@industry-theme/file-city-panel 0.2.73 → 0.2.75

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.
@@ -1 +1 @@
1
- {"version":3,"file":"CodeCityPanel.d.ts","sourceRoot":"","sources":["../../src/panels/CodeCityPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4D,MAAM,OAAO,CAAC;AA8BjF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAgBpD;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,KAAK,CAAC;QACX,GAAG,EAAE,MAAM,CAAC;QACZ,QAAQ,EAAE,MAAM,CAAC;QACjB,MAAM,EAAE,OAAO,GAAG,SAAS,GAAG,UAAU,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,GAAG,WAAW,CAAC;QAC1F,SAAS,EAAE,MAAM,CAAC;QAClB,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC,CAAC;IACH,aAAa,EAAE;QACb,KAAK,EAAE,MAAM,EAAE,CAAC;QAChB,QAAQ,EAAE,MAAM,EAAE,CAAC;QACnB,OAAO,EAAE,MAAM,EAAE,CAAC;QAClB,OAAO,EAAE;YAAE,QAAQ,EAAE,MAAM,CAAC;YAAC,iBAAiB,CAAC,EAAE,MAAM,CAAA;SAAE,EAAE,CAAC;KAC7D,CAAC;IACF,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,aAAa,EAAE;QACb,KAAK,EAAE,MAAM,EAAE,CAAC;QAChB,QAAQ,EAAE,MAAM,EAAE,CAAC;QACnB,OAAO,EAAE,MAAM,EAAE,CAAC;QAClB,OAAO,EAAE,MAAM,EAAE,CAAC;KACnB,CAAC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E,MAAM,CAAC;YAAC,iBAAiB,CAAC,EAAE,MAAM,CAAA;SAAE,EAAE,CAAC;KAC7D,CAAC;IACF,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,aAAa,EAAE;QACb,KAAK,EAAE,MAAM,EAAE,CAAC;QAChB,QAAQ,EAAE,MAAM,EAAE,CAAC;QACnB,OAAO,EAAE,MAAM,EAAE,CAAC;QAClB,OAAO,EAAE,MAAM,EAAE,CAAC;KACnB,CAAC;IACF,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,KAAK,CAAC,EAAE;QACN,KAAK,EAAE,MAAM,CAAC;QACd,SAAS,EAAE,MAAM,CAAC;QAClB,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;CACH;AAGD,YAAY,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AAmCpF;;GAEG;AACH,QAAA,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAmiEvD,CAAC;AAEF;;;GAGG;AACH,OAAO,EAAE,oBAAoB,EAAE,CAAC;AAEhC;;;;;;;;;;GAUG;AACH,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAEvD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,oBAAoB,EAAE,KAAK,CAAC,EA8BxC,CAAC"}
@@ -53219,17 +53219,14 @@ function validateTour(tour) {
53219
53219
  stepIds.add(step.id);
53220
53220
  });
53221
53221
  }
53222
- if (tour.audience !== void 0) {
53223
- const validAudiences = ["beginner", "intermediate", "advanced"];
53224
- if (!validAudiences.includes(tour.audience)) {
53225
- errors.push(
53226
- new TourValidationError(
53227
- `Invalid 'audience' - must be one of: ${validAudiences.join(", ")}`,
53228
- "audience",
53229
- tour.audience
53230
- )
53231
- );
53232
- }
53222
+ if (tour.audience !== void 0 && typeof tour.audience !== "string") {
53223
+ errors.push(
53224
+ new TourValidationError(
53225
+ `Invalid 'audience' - must be a string`,
53226
+ "audience",
53227
+ tour.audience
53228
+ )
53229
+ );
53233
53230
  }
53234
53231
  return errors;
53235
53232
  }
@@ -53264,27 +53261,14 @@ function parseTour(jsonString) {
53264
53261
  };
53265
53262
  }
53266
53263
  }
53267
- function findTourInFileTree(fileTree) {
53264
+ function findTourFilePathInFileTree(fileTree) {
53268
53265
  const tourFiles = fileTree.allFiles.filter((file) => {
53269
- const normalizedPath = file.path.startsWith("./") ? file.path.slice(2) : file.path;
53270
- return normalizedPath.endsWith(".tour.json") && !normalizedPath.includes("/");
53266
+ const path = file.path;
53267
+ return path.endsWith(".tour.json") && !path.includes("/");
53271
53268
  });
53272
53269
  tourFiles.sort((a, b) => a.path.localeCompare(b.path));
53273
53270
  const tourFile = tourFiles[0];
53274
- if (tourFile && tourFile.content) {
53275
- return tourFile.content;
53276
- }
53277
- return null;
53278
- }
53279
- function loadTourFromFileTree(fileTree) {
53280
- const tourContent = findTourInFileTree(fileTree);
53281
- if (!tourContent) {
53282
- return {
53283
- success: false,
53284
- errors: [new TourValidationError("No *.tour.json file found in repository root")]
53285
- };
53286
- }
53287
- return parseTour(tourContent);
53271
+ return tourFile ? tourFile.path : null;
53288
53272
  }
53289
53273
  const GIT_STATUS_COLORS = {
53290
53274
  staged: "#22c55e",
@@ -53311,7 +53295,7 @@ const CodeCityPanelContent = ({
53311
53295
  actions: _actions,
53312
53296
  events
53313
53297
  }) => {
53314
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C;
53298
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D;
53315
53299
  const { theme: theme2 } = useTheme();
53316
53300
  const [cityData, setCityData] = useState(null);
53317
53301
  const [hoverInfo, setHoverInfo] = useState(null);
@@ -53397,24 +53381,44 @@ const CodeCityPanelContent = ({
53397
53381
  }
53398
53382
  }, [currentRepoPath]);
53399
53383
  useEffect(() => {
53400
- if (!(fileTreeSlice == null ? void 0 : fileTreeSlice.data)) {
53384
+ var _a2;
53385
+ if (!(fileTreeSlice == null ? void 0 : fileTreeSlice.data) || !((_a2 = context.currentScope.repository) == null ? void 0 : _a2.path)) {
53401
53386
  setTourData(null);
53402
53387
  return;
53403
53388
  }
53404
- const tourResult = loadTourFromFileTree(fileTreeSlice.data);
53405
- if (tourResult.success && tourResult.tour) {
53406
- console.log("[Tour] Found and parsed tour.json:", tourResult.tour.title);
53407
- setTourData(tourResult.tour);
53408
- } else {
53409
- if (tourResult.errors && tourResult.errors.length > 0) {
53410
- const hasTourFile = tourResult.errors.some((e) => !e.message.includes("No tour.json file found"));
53411
- if (hasTourFile) {
53412
- console.warn("[Tour] Tour validation failed:", tourResult.errors.map((e) => e.message).join(", "));
53389
+ const loadTour = async () => {
53390
+ var _a3;
53391
+ const tourFilePath = findTourFilePathInFileTree(fileTreeSlice.data);
53392
+ if (!tourFilePath) {
53393
+ setTourData(null);
53394
+ return;
53395
+ }
53396
+ if (!((_a3 = context.adapters) == null ? void 0 : _a3.readFile)) {
53397
+ console.warn("[Tour] No readFile adapter available - cannot load tour file");
53398
+ setTourData(null);
53399
+ return;
53400
+ }
53401
+ const repoPath = context.currentScope.repository.path;
53402
+ const fullPath = `${repoPath}/${tourFilePath}`;
53403
+ try {
53404
+ const tourContent = await context.adapters.readFile(fullPath);
53405
+ const tourResult = parseTour(tourContent);
53406
+ if (tourResult.success && tourResult.tour) {
53407
+ console.log("[Tour] Found and parsed tour file:", tourResult.tour.title, `(${tourFilePath})`);
53408
+ setTourData(tourResult.tour);
53409
+ } else {
53410
+ if (tourResult.errors && tourResult.errors.length > 0) {
53411
+ console.warn("[Tour] Tour validation failed:", tourResult.errors.map((e) => e.message).join(", "));
53412
+ }
53413
+ setTourData(null);
53413
53414
  }
53415
+ } catch (error) {
53416
+ console.warn("[Tour] Failed to read tour file:", error instanceof Error ? error.message : "Unknown error");
53417
+ setTourData(null);
53414
53418
  }
53415
- setTourData(null);
53416
- }
53417
- }, [fileTreeSlice == null ? void 0 : fileTreeSlice.data]);
53419
+ };
53420
+ loadTour();
53421
+ }, [fileTreeSlice == null ? void 0 : fileTreeSlice.data, (_e = context.currentScope.repository) == null ? void 0 : _e.path, context.adapters]);
53418
53422
  const [prFilesVersion, setPrFilesVersion] = useState(0);
53419
53423
  const [commitFilesVersion, setCommitFilesVersion] = useState(0);
53420
53424
  useEffect(() => {
@@ -53543,7 +53547,7 @@ const CodeCityPanelContent = ({
53543
53547
  default:
53544
53548
  return null;
53545
53549
  }
53546
- }, [(_e = hoverInfo == null ? void 0 : hoverInfo.hoveredBuilding) == null ? void 0 : _e.path, colorMode, qualityData]);
53550
+ }, [(_f = hoverInfo == null ? void 0 : hoverInfo.hoveredBuilding) == null ? void 0 : _f.path, colorMode, qualityData]);
53547
53551
  const computedTreeStats = useMemo(() => {
53548
53552
  var _a2, _b2, _c2;
53549
53553
  if (!cityData) {
@@ -53760,7 +53764,7 @@ const CodeCityPanelContent = ({
53760
53764
  }
53761
53765
  }
53762
53766
  return layers;
53763
- }, [cityData, (_f = prFilesSlice == null ? void 0 : prFilesSlice.data) == null ? void 0 : _f.filesByStatus, prFilesVersion]);
53767
+ }, [cityData, (_g = prFilesSlice == null ? void 0 : prFilesSlice.data) == null ? void 0 : _g.filesByStatus, prFilesVersion]);
53764
53768
  const commitFilesLayers = useMemo(() => {
53765
53769
  var _a2;
53766
53770
  if (!cityData || !cityData.buildings || !((_a2 = commitFilesSlice == null ? void 0 : commitFilesSlice.data) == null ? void 0 : _a2.filesByStatus)) {
@@ -53838,7 +53842,7 @@ const CodeCityPanelContent = ({
53838
53842
  }
53839
53843
  }
53840
53844
  return layers;
53841
- }, [cityData, (_g = commitFilesSlice == null ? void 0 : commitFilesSlice.data) == null ? void 0 : _g.filesByStatus, commitFilesVersion]);
53845
+ }, [cityData, (_h = commitFilesSlice == null ? void 0 : commitFilesSlice.data) == null ? void 0 : _h.filesByStatus, commitFilesVersion]);
53842
53846
  const storyboardLayers = useMemo(() => {
53843
53847
  if (!cityData || !cityData.buildings || !(storyboardContextSlice == null ? void 0 : storyboardContextSlice.data)) {
53844
53848
  return [];
@@ -53939,7 +53943,7 @@ const CodeCityPanelContent = ({
53939
53943
  if (!((_a2 = prFilesSlice == null ? void 0 : prFilesSlice.data) == null ? void 0 : _a2.filesByStatus)) return 0;
53940
53944
  const { added, modified, removed, renamed } = prFilesSlice.data.filesByStatus;
53941
53945
  return added.length + modified.length + removed.length + renamed.length;
53942
- }, [(_h = prFilesSlice == null ? void 0 : prFilesSlice.data) == null ? void 0 : _h.filesByStatus]);
53946
+ }, [(_i = prFilesSlice == null ? void 0 : prFilesSlice.data) == null ? void 0 : _i.filesByStatus]);
53943
53947
  const legendAgentLayers = useMemo(() => {
53944
53948
  const agentLayers = highlightLayers.filter(
53945
53949
  (layer) => layer.id.startsWith("event-highlight")
@@ -54203,7 +54207,7 @@ const CodeCityPanelContent = ({
54203
54207
  } finally {
54204
54208
  setLoading(false);
54205
54209
  }
54206
- }, [fileTreeSlice == null ? void 0 : fileTreeSlice.data, fileTreeSlice == null ? void 0 : fileTreeSlice.loading, (_i = context.currentScope.repository) == null ? void 0 : _i.path]);
54210
+ }, [fileTreeSlice == null ? void 0 : fileTreeSlice.data, fileTreeSlice == null ? void 0 : fileTreeSlice.loading, (_j = context.currentScope.repository) == null ? void 0 : _j.path]);
54207
54211
  const handleFileClick = useCallback(
54208
54212
  (filePath, type) => {
54209
54213
  if (type === "file") {
@@ -54713,7 +54717,7 @@ const CodeCityPanelContent = ({
54713
54717
  textOverflow: "ellipsis",
54714
54718
  whiteSpace: "nowrap"
54715
54719
  },
54716
- children: ((_j = hoverInfo.fileTooltip) == null ? void 0 : _j.text) || ((_l = (_k = hoverInfo.hoveredDistrict) == null ? void 0 : _k.path) == null ? void 0 : _l.split("/").pop()) || ((_m = hoverInfo.hoveredDistrict) == null ? void 0 : _m.path) || "Unknown"
54720
+ children: ((_k = hoverInfo.fileTooltip) == null ? void 0 : _k.text) || ((_m = (_l = hoverInfo.hoveredDistrict) == null ? void 0 : _l.path) == null ? void 0 : _m.split("/").pop()) || ((_n = hoverInfo.hoveredDistrict) == null ? void 0 : _n.path) || "Unknown"
54717
54721
  }
54718
54722
  ),
54719
54723
  /* @__PURE__ */ jsx(
@@ -54727,7 +54731,7 @@ const CodeCityPanelContent = ({
54727
54731
  textOverflow: "ellipsis",
54728
54732
  whiteSpace: "nowrap"
54729
54733
  },
54730
- children: ((_n = hoverInfo.hoveredBuilding) == null ? void 0 : _n.path) || ((_o = hoverInfo.hoveredDistrict) == null ? void 0 : _o.path) || "/"
54734
+ children: ((_o = hoverInfo.hoveredBuilding) == null ? void 0 : _o.path) || ((_p = hoverInfo.hoveredDistrict) == null ? void 0 : _p.path) || "/"
54731
54735
  }
54732
54736
  )
54733
54737
  ]
@@ -54959,14 +54963,14 @@ const CodeCityPanelContent = ({
54959
54963
  {
54960
54964
  fileTypes: [],
54961
54965
  gitStatus: gitSlice == null ? void 0 : gitSlice.data,
54962
- prFiles: (_p = prFilesSlice == null ? void 0 : prFilesSlice.data) == null ? void 0 : _p.filesByStatus,
54963
- prFileStats: (_q = prFilesSlice == null ? void 0 : prFilesSlice.data) == null ? void 0 : _q.files,
54964
- prNumber: (_r = prFilesSlice == null ? void 0 : prFilesSlice.data) == null ? void 0 : _r.pullNumber,
54965
- commitFiles: (_s = commitFilesSlice == null ? void 0 : commitFilesSlice.data) == null ? void 0 : _s.filesByStatus,
54966
- commitHash: (_t = commitFilesSlice == null ? void 0 : commitFilesSlice.data) == null ? void 0 : _t.commitHash,
54967
- commitStats: (_u = commitFilesSlice == null ? void 0 : commitFilesSlice.data) == null ? void 0 : _u.stats,
54966
+ prFiles: (_q = prFilesSlice == null ? void 0 : prFilesSlice.data) == null ? void 0 : _q.filesByStatus,
54967
+ prFileStats: (_r = prFilesSlice == null ? void 0 : prFilesSlice.data) == null ? void 0 : _r.files,
54968
+ prNumber: (_s = prFilesSlice == null ? void 0 : prFilesSlice.data) == null ? void 0 : _s.pullNumber,
54969
+ commitFiles: (_t = commitFilesSlice == null ? void 0 : commitFilesSlice.data) == null ? void 0 : _t.filesByStatus,
54970
+ commitHash: (_u = commitFilesSlice == null ? void 0 : commitFilesSlice.data) == null ? void 0 : _u.commitHash,
54971
+ commitStats: (_v = commitFilesSlice == null ? void 0 : commitFilesSlice.data) == null ? void 0 : _v.stats,
54968
54972
  fileTree: fileTreeSlice == null ? void 0 : fileTreeSlice.data,
54969
- rootPath: (_v = context.currentScope.repository) == null ? void 0 : _v.path,
54973
+ rootPath: (_w = context.currentScope.repository) == null ? void 0 : _w.path,
54970
54974
  onGitFileClick: handleLegendFileClick,
54971
54975
  onGitNodeHover: handleGitNodeHover,
54972
54976
  onPrFileClick: handleLegendFileClick,
@@ -54989,14 +54993,14 @@ const CodeCityPanelContent = ({
54989
54993
  {
54990
54994
  fileTypes: legendFileTypes,
54991
54995
  gitStatus: gitSlice == null ? void 0 : gitSlice.data,
54992
- prFiles: (_w = prFilesSlice == null ? void 0 : prFilesSlice.data) == null ? void 0 : _w.filesByStatus,
54993
- prFileStats: (_x = prFilesSlice == null ? void 0 : prFilesSlice.data) == null ? void 0 : _x.files,
54994
- prNumber: (_y = prFilesSlice == null ? void 0 : prFilesSlice.data) == null ? void 0 : _y.pullNumber,
54995
- commitFiles: (_z = commitFilesSlice == null ? void 0 : commitFilesSlice.data) == null ? void 0 : _z.filesByStatus,
54996
- commitHash: (_A = commitFilesSlice == null ? void 0 : commitFilesSlice.data) == null ? void 0 : _A.commitHash,
54997
- commitStats: (_B = commitFilesSlice == null ? void 0 : commitFilesSlice.data) == null ? void 0 : _B.stats,
54996
+ prFiles: (_x = prFilesSlice == null ? void 0 : prFilesSlice.data) == null ? void 0 : _x.filesByStatus,
54997
+ prFileStats: (_y = prFilesSlice == null ? void 0 : prFilesSlice.data) == null ? void 0 : _y.files,
54998
+ prNumber: (_z = prFilesSlice == null ? void 0 : prFilesSlice.data) == null ? void 0 : _z.pullNumber,
54999
+ commitFiles: (_A = commitFilesSlice == null ? void 0 : commitFilesSlice.data) == null ? void 0 : _A.filesByStatus,
55000
+ commitHash: (_B = commitFilesSlice == null ? void 0 : commitFilesSlice.data) == null ? void 0 : _B.commitHash,
55001
+ commitStats: (_C = commitFilesSlice == null ? void 0 : commitFilesSlice.data) == null ? void 0 : _C.stats,
54998
55002
  fileTree: fileTreeSlice == null ? void 0 : fileTreeSlice.data,
54999
- rootPath: (_C = context.currentScope.repository) == null ? void 0 : _C.path,
55003
+ rootPath: (_D = context.currentScope.repository) == null ? void 0 : _D.path,
55000
55004
  agentLayers: legendAgentLayers,
55001
55005
  qualityMetrics: legendQualityMetrics,
55002
55006
  colorMode,