@industry-theme/repository-composition-panels 0.2.49 → 0.2.50

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":"GitChangesPanel.d.ts","sourceRoot":"","sources":["../../src/panels/GitChangesPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4D,MAAM,OAAO,CAAC;AAIjF,OAAO,KAAK,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAEzF,OAAO,KAAK,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC9E,OAAO,uBAAuB,CAAC;AA4B/B,MAAM,MAAM,iBAAiB,GACzB;IAAE,IAAI,EAAE,cAAc,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACtC;IAAE,IAAI,EAAE,kBAAkB,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC1C;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAClC;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAEzC,MAAM,WAAW,oBAAoB;IACnC,kDAAkD;IAClD,SAAS,EAAE,kBAAkB,CAAC;IAC9B,8EAA8E;IAC9E,QAAQ,EAAE,QAAQ,CAAC;IACnB,mCAAmC;IACnC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,8CAA8C;IAC9C,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,sCAAsC;IACtC,WAAW,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,wBAAwB,KAAK,IAAI,CAAC;IAC5E,uDAAuD;IACvD,mBAAmB,CAAC,EAAE,CAAC,MAAM,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAC1D,mDAAmD;IACnD,YAAY,CAAC,EAAE,MAAM,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AAW,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,wBAAwB,KAAK,IAAI,CAAC;IAC5E,uDAAuD;IACvD,mBAAmB,CAAC,EAAE,CAAC,MAAM,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAC1D,mDAAmD;IACnD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,uCAAuC;IACvC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,mCAAmC;IACnC,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;GAGG;AACH,eAAO,MAAM,sBAAsB,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAgajE,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,KAAK,CAAC,EAiD1C,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAyDzD,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
- import React2, { createContext, useContext, forwardRef, createElement, useRef, useCallback, useState, useEffect, useMemo, memo, useLayoutEffect, useImperativeHandle } from "react";
2
+ import React2, { createContext, useContext, forwardRef, createElement, useCallback, useState, useRef, useEffect, useMemo, memo, useLayoutEffect, useImperativeHandle } from "react";
3
3
  import { createPortal } from "react-dom";
4
4
  import { GitStatusFileTree, calculateTelemetryCoverageStats, TelemetryCoverageFileTree } from "@principal-ade/dynamic-file-tree";
5
5
  import { CanvasConverter } from "@principal-ai/principal-view-core/browser";
@@ -596,22 +596,7 @@ const GitChangesPanelContent = ({
596
596
  selectedFile
597
597
  }) => {
598
598
  const { theme } = useTheme$1();
599
- const renderCountRef = useRef(0);
600
- const prevPropsRef = useRef(null);
601
- renderCountRef.current += 1;
602
- if (prevPropsRef.current) {
603
- const propsChanged = {
604
- gitStatus: prevPropsRef.current.gitStatus !== gitStatus,
605
- fileTree: prevPropsRef.current.fileTree !== fileTree,
606
- rootPath: prevPropsRef.current.rootPath !== rootPath,
607
- isLoading: prevPropsRef.current.isLoading !== isLoading,
608
- onFileClick: prevPropsRef.current.onFileClick !== onFileClick,
609
- onContextMenuAction: prevPropsRef.current.onContextMenuAction !== onContextMenuAction,
610
- selectedFile: prevPropsRef.current.selectedFile !== selectedFile
611
- };
612
- console.log(`[GitChangesPanelContent] Render #${renderCountRef.current}`, propsChanged);
613
- }
614
- prevPropsRef.current = { gitStatus, fileTree, rootPath, isLoading, onFileClick, onContextMenuAction, selectedFile };
599
+ const [searchTerm, setSearchTerm] = useState("");
615
600
  const [contextMenu, setContextMenu] = useState({
616
601
  visible: false,
617
602
  x: 0,
@@ -631,10 +616,6 @@ const GitChangesPanelContent = ({
631
616
  return () => document.removeEventListener("mousedown", handleClickOutside);
632
617
  }
633
618
  }, [contextMenu.visible]);
634
- useMemo(
635
- () => gitStatus.stagedFiles.length > 0 || gitStatus.modifiedFiles.length > 0 || gitStatus.untrackedFiles.length > 0 || gitStatus.deletedFiles.length > 0,
636
- [gitStatus.stagedFiles.length, gitStatus.modifiedFiles.length, gitStatus.untrackedFiles.length, gitStatus.deletedFiles.length]
637
- );
638
619
  const getFileStatus = useCallback(
639
620
  (filePath) => {
640
621
  if (gitStatus.stagedFiles.includes(filePath)) {
@@ -753,8 +734,53 @@ const GitChangesPanelContent = ({
753
734
  status: "??"
754
735
  }))
755
736
  ];
756
- return { tree: fileTree, statusData };
757
- }, [isLoading, fileTree, gitStatus]);
737
+ const filteredStatusData = searchTerm ? statusData.filter(
738
+ (item) => item.filePath.toLowerCase().includes(searchTerm.toLowerCase())
739
+ ) : statusData;
740
+ let filteredTree = fileTree;
741
+ if (searchTerm && fileTree.allFiles) {
742
+ const rootPath2 = fileTree.root.path;
743
+ const matchingPaths = /* @__PURE__ */ new Set();
744
+ filteredStatusData.forEach((item) => {
745
+ const absolutePath = `${rootPath2}/${item.filePath}`;
746
+ matchingPaths.add(absolutePath);
747
+ const parts = item.filePath.split("/");
748
+ for (let i = 1; i < parts.length; i++) {
749
+ const parentPath = `${rootPath2}/${parts.slice(0, i).join("/")}`;
750
+ matchingPaths.add(parentPath);
751
+ }
752
+ });
753
+ matchingPaths.add(rootPath2);
754
+ const filteredAllFiles = fileTree.allFiles.filter((file) => matchingPaths.has(file.path));
755
+ const filteredAllDirectories = fileTree.allDirectories.filter((dir) => matchingPaths.has(dir.path));
756
+ const filterDirectoryTree = (dir) => {
757
+ const filteredChildren = dir.children.filter((child) => matchingPaths.has(child.path)).map((child) => {
758
+ if ("children" in child) {
759
+ return filterDirectoryTree(child);
760
+ }
761
+ return child;
762
+ });
763
+ return {
764
+ ...dir,
765
+ children: filteredChildren,
766
+ fileCount: filteredChildren.filter((child) => !("children" in child)).length
767
+ };
768
+ };
769
+ const filteredRoot = filterDirectoryTree(fileTree.root);
770
+ filteredTree = {
771
+ ...fileTree,
772
+ root: filteredRoot,
773
+ allFiles: filteredAllFiles,
774
+ allDirectories: filteredAllDirectories,
775
+ stats: {
776
+ ...fileTree.stats,
777
+ totalFiles: filteredAllFiles.length,
778
+ totalDirectories: filteredAllDirectories.length
779
+ }
780
+ };
781
+ }
782
+ return { tree: filteredTree, statusData: filteredStatusData };
783
+ }, [isLoading, fileTree, gitStatus, searchTerm]);
758
784
  const renderContent = () => {
759
785
  if (isLoading) {
760
786
  return /* @__PURE__ */ jsx(
@@ -794,7 +820,7 @@ const GitChangesPanelContent = ({
794
820
  transparentBackground: true,
795
821
  horizontalNodePadding: "16px",
796
822
  verticalPadding: "16px",
797
- openByDefault: false,
823
+ openByDefault: !!searchTerm,
798
824
  enableDragAndDrop: false
799
825
  }
800
826
  );
@@ -813,6 +839,45 @@ const GitChangesPanelContent = ({
813
839
  textAlign: "left"
814
840
  };
815
841
  return /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", height: "100%" }, children: [
842
+ /* @__PURE__ */ jsx(
843
+ "div",
844
+ {
845
+ style: {
846
+ padding: "6px 16px",
847
+ borderBottom: `1px solid ${theme.colors.border}`,
848
+ backgroundColor: theme.colors.background,
849
+ height: "40px",
850
+ boxSizing: "border-box"
851
+ },
852
+ children: /* @__PURE__ */ jsx(
853
+ "input",
854
+ {
855
+ type: "text",
856
+ placeholder: "Filter files...",
857
+ value: searchTerm,
858
+ onChange: (e) => setSearchTerm(e.target.value),
859
+ style: {
860
+ width: "100%",
861
+ padding: "4px 10px",
862
+ fontSize: theme.fontSizes[1],
863
+ fontFamily: theme.fonts.body,
864
+ color: theme.colors.text,
865
+ backgroundColor: theme.colors.backgroundSecondary,
866
+ border: `1px solid ${theme.colors.border}`,
867
+ borderRadius: "4px",
868
+ outline: "none",
869
+ boxSizing: "border-box"
870
+ },
871
+ onFocus: (e) => {
872
+ e.target.style.borderColor = theme.colors.primary;
873
+ },
874
+ onBlur: (e) => {
875
+ e.target.style.borderColor = theme.colors.border;
876
+ }
877
+ }
878
+ )
879
+ }
880
+ ),
816
881
  /* @__PURE__ */ jsx("div", { style: { flex: 1, overflow: "auto" }, children: renderContent() }),
817
882
  contextMenu.visible && createPortal(
818
883
  /* @__PURE__ */ jsxs(
@@ -952,21 +1017,6 @@ const GitChangesPanelPreview = () => {
952
1017
  };
953
1018
  const GitChangesPanel = ({ context, events }) => {
954
1019
  var _a;
955
- const renderCountRef = useRef(0);
956
- const prevPropsRef = useRef(null);
957
- renderCountRef.current += 1;
958
- if (prevPropsRef.current) {
959
- const propsChanged = {
960
- context: prevPropsRef.current.context !== context,
961
- events: prevPropsRef.current.events !== events,
962
- // Also check individual context properties
963
- "context.currentScope": prevPropsRef.current.context.currentScope !== context.currentScope,
964
- "context.getSlice": prevPropsRef.current.context.getSlice !== context.getSlice,
965
- "context.slices": prevPropsRef.current.context.slices !== context.slices
966
- };
967
- console.log(`[GitChangesPanel] Render #${renderCountRef.current}`, propsChanged);
968
- }
969
- prevPropsRef.current = { context, events };
970
1020
  const gitSlice = context.getSlice("gitStatusWithFiles");
971
1021
  const fileTreeSlice = context.getSlice("fileTree");
972
1022
  const gitStatus = (gitSlice == null ? void 0 : gitSlice.data) ?? EMPTY_GIT_STATUS;