@cere/cere-design-system 0.0.33 → 0.0.35

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/index.mjs CHANGED
@@ -9470,6 +9470,20 @@ var CodeEditorTabs = ({
9470
9470
  }
9471
9471
  }
9472
9472
  ),
9473
+ tab.syncStatus && /* @__PURE__ */ jsx98(
9474
+ Box31,
9475
+ {
9476
+ component: "span",
9477
+ sx: {
9478
+ fontSize: "0.6rem",
9479
+ fontWeight: 700,
9480
+ lineHeight: 1,
9481
+ color: tab.syncStatus === "new" ? "success.main" : "warning.main",
9482
+ flexShrink: 0
9483
+ },
9484
+ children: tab.syncStatus === "new" ? "N" : "M"
9485
+ }
9486
+ ),
9473
9487
  /* @__PURE__ */ jsx98(Tooltip8, { title: tab.path, enterDelay: 600, children: /* @__PURE__ */ jsx98(
9474
9488
  Typography27,
9475
9489
  {
@@ -9521,6 +9535,20 @@ import InsertDriveFileOutlinedIcon from "@mui/icons-material/InsertDriveFileOutl
9521
9535
  import ExpandMoreIcon4 from "@mui/icons-material/ExpandMore";
9522
9536
  import ChevronRightIcon4 from "@mui/icons-material/ChevronRight";
9523
9537
  import { jsx as jsx99, jsxs as jsxs51 } from "react/jsx-runtime";
9538
+ var STATUS_CONFIG = {
9539
+ new: { label: "N", color: "success.main" },
9540
+ modified: { label: "M", color: "warning.main" },
9541
+ deleted: { label: "D", color: "error.main" }
9542
+ };
9543
+ function computeFolderStatus(node) {
9544
+ if (node.status) return node.status;
9545
+ if (node.type !== "folder" || !node.children) return void 0;
9546
+ const childStatuses = node.children.map((c) => c.type === "folder" ? computeFolderStatus(c) : c.status).filter((s) => !!s);
9547
+ if (childStatuses.length === 0) return void 0;
9548
+ if (childStatuses.includes("new")) return "new";
9549
+ if (childStatuses.includes("modified")) return "modified";
9550
+ return "deleted";
9551
+ }
9524
9552
  var CodeEditorFileTree = ({
9525
9553
  tree,
9526
9554
  selectedPath,
@@ -9613,7 +9641,28 @@ var CodeEditorFileTree = ({
9613
9641
  }
9614
9642
  }
9615
9643
  }
9616
- )
9644
+ ),
9645
+ (() => {
9646
+ const effectiveStatus = isFolder ? computeFolderStatus(node) : node.status;
9647
+ if (!effectiveStatus) return null;
9648
+ const cfg = STATUS_CONFIG[effectiveStatus];
9649
+ return /* @__PURE__ */ jsx99(
9650
+ Box32,
9651
+ {
9652
+ component: "span",
9653
+ sx: {
9654
+ ml: "auto",
9655
+ pl: 0.5,
9656
+ fontSize: "0.65rem",
9657
+ fontWeight: 700,
9658
+ lineHeight: 1,
9659
+ color: cfg.color,
9660
+ flexShrink: 0
9661
+ },
9662
+ children: cfg.label
9663
+ }
9664
+ );
9665
+ })()
9617
9666
  ]
9618
9667
  }
9619
9668
  ),
@@ -9832,10 +9881,61 @@ var StatusBarItemElement = ({ item }) => {
9832
9881
  return inner;
9833
9882
  };
9834
9883
 
9835
- // src/components/third-party/CodeEditorWorkspace/CodeEditorWorkspace.tsx
9836
- import React16 from "react";
9884
+ // src/components/third-party/CodeEditorWorkspace/CodeEditorWelcomeScreen.tsx
9837
9885
  import { Box as Box34 } from "@mui/material";
9838
9886
  import { jsx as jsx101, jsxs as jsxs53 } from "react/jsx-runtime";
9887
+ var CodeEditorWelcomeScreen = ({
9888
+ logo,
9889
+ children,
9890
+ containerProps
9891
+ }) => {
9892
+ const defaultLogo = /* @__PURE__ */ jsx101(
9893
+ CereIcon,
9894
+ {
9895
+ sx: {
9896
+ fontSize: 80,
9897
+ color: "text.disabled",
9898
+ opacity: 0.4
9899
+ }
9900
+ }
9901
+ );
9902
+ return /* @__PURE__ */ jsxs53(
9903
+ Box34,
9904
+ {
9905
+ sx: {
9906
+ flex: 1,
9907
+ display: "flex",
9908
+ flexDirection: "column",
9909
+ alignItems: "center",
9910
+ justifyContent: "center",
9911
+ gap: 3,
9912
+ p: 4,
9913
+ userSelect: "none"
9914
+ },
9915
+ ...containerProps,
9916
+ children: [
9917
+ logo !== void 0 ? logo : defaultLogo,
9918
+ children && /* @__PURE__ */ jsx101(
9919
+ Box34,
9920
+ {
9921
+ sx: {
9922
+ display: "flex",
9923
+ flexDirection: "column",
9924
+ alignItems: "center",
9925
+ gap: 1
9926
+ },
9927
+ children
9928
+ }
9929
+ )
9930
+ ]
9931
+ }
9932
+ );
9933
+ };
9934
+
9935
+ // src/components/third-party/CodeEditorWorkspace/CodeEditorWorkspace.tsx
9936
+ import React16 from "react";
9937
+ import { Box as Box35 } from "@mui/material";
9938
+ import { jsx as jsx102, jsxs as jsxs54 } from "react/jsx-runtime";
9839
9939
  var CodeEditorWorkspace = ({
9840
9940
  files,
9841
9941
  initialOpenPaths,
@@ -9853,6 +9953,9 @@ var CodeEditorWorkspace = ({
9853
9953
  renderFileTree,
9854
9954
  renderEditor,
9855
9955
  renderStatusBar,
9956
+ renderWelcomeScreen,
9957
+ welcomeScreen,
9958
+ welcomeScreenProps,
9856
9959
  gitInfo,
9857
9960
  showStatusBar = true,
9858
9961
  statusBarItems,
@@ -9897,7 +10000,7 @@ var CodeEditorWorkspace = ({
9897
10000
  onTabSelect: workspace.setActiveFile,
9898
10001
  onTabClose: workspace.closeFile
9899
10002
  };
9900
- const tabsElement = showTabs ? renderTabs ? renderTabs({ ...tabsProps, workspace }) : /* @__PURE__ */ jsx101(CodeEditorTabs, { ...tabsProps }) : null;
10003
+ const tabsElement = showTabs ? renderTabs ? renderTabs({ ...tabsProps, workspace }) : /* @__PURE__ */ jsx102(CodeEditorTabs, { ...tabsProps }) : null;
9901
10004
  const fileTreeProps = {
9902
10005
  tree: fileTree ?? [],
9903
10006
  selectedPath: workspace.activeFilePath,
@@ -9905,7 +10008,7 @@ var CodeEditorWorkspace = ({
9905
10008
  defaultExpandedPaths,
9906
10009
  width: fileTreeWidth
9907
10010
  };
9908
- const fileTreeElement = hasFileTree ? renderFileTree ? renderFileTree({ ...fileTreeProps, workspace }) : /* @__PURE__ */ jsx101(CodeEditorFileTree, { ...fileTreeProps }) : null;
10011
+ const fileTreeElement = hasFileTree ? renderFileTree ? renderFileTree({ ...fileTreeProps, workspace }) : /* @__PURE__ */ jsx102(CodeEditorFileTree, { ...fileTreeProps }) : null;
9909
10012
  const statusBarProps = {
9910
10013
  gitInfo,
9911
10014
  language: workspace.activeFile?.language,
@@ -9913,8 +10016,9 @@ var CodeEditorWorkspace = ({
9913
10016
  items: statusBarItems,
9914
10017
  onBranchClick
9915
10018
  };
9916
- const statusBarElement = showStatusBar ? renderStatusBar ? renderStatusBar({ ...statusBarProps, workspace }) : /* @__PURE__ */ jsx101(CodeEditorStatusBar, { ...statusBarProps }) : null;
9917
- const editorElement = renderEditor ? renderEditor(workspace) : workspace.activeFile ? /* @__PURE__ */ jsx101(
10019
+ const statusBarElement = showStatusBar ? renderStatusBar ? renderStatusBar({ ...statusBarProps, workspace }) : /* @__PURE__ */ jsx102(CodeEditorStatusBar, { ...statusBarProps }) : null;
10020
+ const welcomeElement = renderWelcomeScreen ? renderWelcomeScreen(workspace) : welcomeScreen !== void 0 ? welcomeScreen : /* @__PURE__ */ jsx102(CodeEditorWelcomeScreen, { ...welcomeScreenProps });
10021
+ const editorElement = renderEditor ? renderEditor(workspace) : workspace.activeFile ? /* @__PURE__ */ jsx102(
9918
10022
  CodeEditor,
9919
10023
  {
9920
10024
  value: workspace.activeFile.value,
@@ -9932,22 +10036,9 @@ var CodeEditorWorkspace = ({
9932
10036
  height: "100%",
9933
10037
  ...editorProps
9934
10038
  }
9935
- ) : /* @__PURE__ */ jsx101(
9936
- Box34,
9937
- {
9938
- sx: {
9939
- flex: 1,
9940
- display: "flex",
9941
- alignItems: "center",
9942
- justifyContent: "center",
9943
- color: "text.secondary",
9944
- fontSize: "0.875rem"
9945
- },
9946
- children: "Open a file to start editing"
9947
- }
9948
- );
9949
- return /* @__PURE__ */ jsxs53(
9950
- Box34,
10039
+ ) : welcomeElement;
10040
+ return /* @__PURE__ */ jsxs54(
10041
+ Box35,
9951
10042
  {
9952
10043
  sx: {
9953
10044
  display: "flex",
@@ -9961,9 +10052,9 @@ var CodeEditorWorkspace = ({
9961
10052
  ...containerProps,
9962
10053
  children: [
9963
10054
  fileTreeElement,
9964
- /* @__PURE__ */ jsxs53(Box34, { sx: { flex: 1, display: "flex", flexDirection: "column", minWidth: 0, overflow: "hidden" }, children: [
10055
+ /* @__PURE__ */ jsxs54(Box35, { sx: { flex: 1, display: "flex", flexDirection: "column", minWidth: 0, overflow: "hidden" }, children: [
9965
10056
  tabsElement,
9966
- /* @__PURE__ */ jsx101(Box34, { sx: { flex: 1, overflow: "hidden" }, children: editorElement }),
10057
+ /* @__PURE__ */ jsx102(Box35, { sx: { flex: 1, overflow: "hidden" }, children: editorElement }),
9967
10058
  statusBarElement
9968
10059
  ] })
9969
10060
  ]
@@ -10004,6 +10095,7 @@ export {
10004
10095
  CodeEditorFileTree,
10005
10096
  CodeEditorStatusBar,
10006
10097
  CodeEditorTabs,
10098
+ CodeEditorWelcomeScreen,
10007
10099
  CodeEditorWorkspace,
10008
10100
  Collapse,
10009
10101
  ConnectionLineType2 as ConnectionLineType,