@industry-theme/repository-composition-panels 0.2.46 → 0.2.48

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,6 +1,6 @@
1
1
  import React from 'react';
2
- import type { FileTree } from '@principal-ai/repository-abstraction';
3
- import type { GitStatus, GitChangeSelectionStatus, PanelComponentProps } from '../types';
2
+ import type { FileTree, GitStatusWithFiles } from '@principal-ai/repository-abstraction';
3
+ import type { GitChangeSelectionStatus, PanelComponentProps } from '../types';
4
4
  import './GitChangesPanel.css';
5
5
  export type ContextMenuAction = {
6
6
  type: 'copyFullPath';
@@ -17,7 +17,7 @@ export type ContextMenuAction = {
17
17
  };
18
18
  export interface GitChangesPanelProps {
19
19
  /** Git status data with categorized file paths */
20
- gitStatus: GitStatus;
20
+ gitStatus: GitStatusWithFiles;
21
21
  /** Complete file tree structure - git status will be overlaid on this tree */
22
22
  fileTree: FileTree;
23
23
  /** Root path for the repository */
@@ -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,MAAM,sCAAsC,CAAC;AAErE,OAAO,KAAK,EAAE,SAAS,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AACzF,OAAO,uBAAuB,CAAC;AAkB/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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,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,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,CAgWjE,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,KAAK,CAAC,EAiD1C,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAgFzD,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
- import React2, { createContext, useContext, forwardRef, createElement, useCallback, useState, useRef, useEffect, useMemo, memo, useLayoutEffect, useImperativeHandle } from "react";
2
+ import React2, { createContext, useContext, forwardRef, createElement, useRef, useCallback, useState, 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";
@@ -569,10 +569,20 @@ const __iconNode$pM = [
569
569
  ];
570
570
  const X$2 = createLucideIcon$1("x", __iconNode$pM);
571
571
  const EMPTY_GIT_STATUS = {
572
- staged: [],
573
- unstaged: [],
574
- untracked: [],
575
- deleted: []
572
+ repoPath: "",
573
+ branch: "",
574
+ isDirty: false,
575
+ hasUntracked: false,
576
+ hasStaged: false,
577
+ ahead: 0,
578
+ behind: 0,
579
+ watchingEnabled: false,
580
+ stagedFiles: [],
581
+ modifiedFiles: [],
582
+ untrackedFiles: [],
583
+ deletedFiles: [],
584
+ createdFiles: [],
585
+ hash: "empty"
576
586
  };
577
587
  const GitChangesPanelContent = ({
578
588
  gitStatus,
@@ -586,6 +596,22 @@ const GitChangesPanelContent = ({
586
596
  selectedFile
587
597
  }) => {
588
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 };
589
615
  const [contextMenu, setContextMenu] = useState({
590
616
  visible: false,
591
617
  x: 0,
@@ -606,21 +632,21 @@ const GitChangesPanelContent = ({
606
632
  }
607
633
  }, [contextMenu.visible]);
608
634
  useMemo(
609
- () => gitStatus.staged.length > 0 || gitStatus.unstaged.length > 0 || gitStatus.untracked.length > 0 || gitStatus.deleted.length > 0,
610
- [gitStatus.staged.length, gitStatus.unstaged.length, gitStatus.untracked.length, gitStatus.deleted.length]
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]
611
637
  );
612
638
  const getFileStatus = useCallback(
613
639
  (filePath) => {
614
- if (gitStatus.staged.includes(filePath)) {
640
+ if (gitStatus.stagedFiles.includes(filePath)) {
615
641
  return "staged";
616
642
  }
617
- if (gitStatus.deleted.includes(filePath)) {
643
+ if (gitStatus.deletedFiles.includes(filePath)) {
618
644
  return "deleted";
619
645
  }
620
- if (gitStatus.untracked.includes(filePath)) {
646
+ if (gitStatus.untrackedFiles.includes(filePath)) {
621
647
  return "untracked";
622
648
  }
623
- if (gitStatus.unstaged.includes(filePath)) {
649
+ if (gitStatus.modifiedFiles.includes(filePath)) {
624
650
  return "unstaged";
625
651
  }
626
652
  return void 0;
@@ -700,21 +726,21 @@ const GitChangesPanelContent = ({
700
726
  }
701
727
  return expandedPaths;
702
728
  };
703
- const expandedUntracked = expandDirectories(gitStatus.untracked);
729
+ const expandedUntracked = expandDirectories(gitStatus.untrackedFiles);
704
730
  const statusData = [
705
- ...gitStatus.staged.map((filePath) => ({
731
+ ...gitStatus.stagedFiles.map((filePath) => ({
706
732
  filePath,
707
733
  indexStatus: "A",
708
734
  workingTreeStatus: " ",
709
735
  status: "A"
710
736
  })),
711
- ...gitStatus.unstaged.map((filePath) => ({
737
+ ...gitStatus.modifiedFiles.map((filePath) => ({
712
738
  filePath,
713
739
  indexStatus: " ",
714
740
  workingTreeStatus: "M",
715
741
  status: "M"
716
742
  })),
717
- ...gitStatus.deleted.map((filePath) => ({
743
+ ...gitStatus.deletedFiles.map((filePath) => ({
718
744
  filePath,
719
745
  indexStatus: " ",
720
746
  workingTreeStatus: "D",
@@ -926,7 +952,22 @@ const GitChangesPanelPreview = () => {
926
952
  };
927
953
  const GitChangesPanel = ({ context, events }) => {
928
954
  var _a;
929
- const gitSlice = context.getSlice("git");
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
+ const gitSlice = context.getSlice("gitStatusWithFiles");
930
971
  const fileTreeSlice = context.getSlice("fileTree");
931
972
  const gitStatus = (gitSlice == null ? void 0 : gitSlice.data) ?? EMPTY_GIT_STATUS;
932
973
  const fileTree = fileTreeSlice == null ? void 0 : fileTreeSlice.data;