workspace.ts

  1import Theme from "../themes/theme";
  2import { backgroundColor, border, iconColor, text } from "./components";
  3
  4export default function workspace(theme: Theme) {
  5  const signInPrompt = {
  6    ...text(theme, "sans", "secondary", { size: "xs" }),
  7    border: border(theme, "primary"),
  8    cornerRadius: 6,
  9    margin: {
 10      top: 1,
 11      right: 6,
 12    },
 13    padding: {
 14      left: 6,
 15      right: 6,
 16    },
 17  };
 18
 19  const tab = {
 20    height: 32,
 21    background: backgroundColor(theme, 300),
 22    iconClose: iconColor(theme, "muted"),
 23    iconCloseActive: iconColor(theme, "active"),
 24    iconConflict: iconColor(theme, "warning"),
 25    iconDirty: iconColor(theme, "info"),
 26    iconWidth: 8,
 27    spacing: 8,
 28    text: text(theme, "sans", "secondary", { size: "sm" }),
 29    border: border(theme, "primary", {
 30      left: true,
 31      bottom: true,
 32      overlay: true,
 33    }),
 34    padding: {
 35      left: 8,
 36      right: 8,
 37    },
 38  };
 39
 40  const activeTab = {
 41    ...tab,
 42    background: backgroundColor(theme, 500),
 43    text: text(theme, "sans", "active", { size: "sm" }),
 44    border: {
 45      ...tab.border,
 46      bottom: false,
 47    },
 48  };
 49
 50  const sidebarItem = {
 51    height: 32,
 52    iconColor: iconColor(theme, "secondary"),
 53    iconSize: 18,
 54  };
 55  const sidebar = {
 56    width: 30,
 57    background: backgroundColor(theme, 300),
 58    border: border(theme, "primary", { right: true }),
 59    item: sidebarItem,
 60    activeItem: {
 61      ...sidebarItem,
 62      iconColor: iconColor(theme, "active"),
 63    },
 64    resizeHandle: {
 65      background: border(theme, "primary").color,
 66      padding: {
 67        left: 1,
 68      },
 69    },
 70  };
 71
 72  return {
 73    background: backgroundColor(theme, 300),
 74    leaderBorderOpacity: 0.7,
 75    leaderBorderWidth: 2.0,
 76    tab,
 77    activeTab,
 78    leftSidebar: {
 79      ...sidebar,
 80      border: border(theme, "primary", { right: true }),
 81    },
 82    rightSidebar: {
 83      ...sidebar,
 84      border: border(theme, "primary", { left: true }),
 85    },
 86    paneDivider: {
 87      color: border(theme, "secondary").color,
 88      width: 1,
 89    },
 90    status_bar: {
 91      height: 24,
 92      itemSpacing: 8,
 93      padding: {
 94        left: 6,
 95        right: 6,
 96      },
 97      border: border(theme, "primary", { top: true, overlay: true }),
 98      cursorPosition: text(theme, "sans", "muted"),
 99      diagnosticMessage: text(theme, "sans", "muted"),
100      lspMessage: text(theme, "sans", "muted"),
101    },
102    titlebar: {
103      avatarWidth: 18,
104      height: 32,
105      background: backgroundColor(theme, 100),
106      shareIconColor: iconColor(theme, "secondary"),
107      shareIconActiveColor: iconColor(theme, "feature"),
108      title: text(theme, "sans", "primary"),
109      avatar: {
110        cornerRadius: 10,
111        border: {
112          color: "#00000088",
113          width: 1,
114        },
115      },
116      avatarRibbon: {
117        height: 3,
118        width: 12,
119        // TODO: The background for this ideally should be 
120        // set with a token, not hardcoded in rust
121      },
122      border: border(theme, "primary", { bottom: true }),
123      signInPrompt,
124      hoveredSignInPrompt: {
125        ...signInPrompt,
126        ...text(theme, "sans", "active", { size: "xs" }),
127      },
128      offlineIcon: {
129        color: iconColor(theme, "secondary"),
130        width: 16,
131        padding: {
132          right: 4,
133        },
134      },
135      outdatedWarning: {
136        ...text(theme, "sans", "warning"),
137        size: 13,
138      },
139    },
140    toolbar: {
141      height: 34,
142      background: backgroundColor(theme, 500),
143      border: border(theme, "secondary", { bottom: true }),
144      itemSpacing: 8,
145      padding: { left: 16, right: 8, top: 4, bottom: 4 },
146    },
147    breadcrumbs: {
148      ...text(theme, "mono", "secondary"),
149      padding: { left: 6 },
150    },
151    disconnectedOverlay: {
152      ...text(theme, "sans", "active"),
153      background: "#000000aa",
154    },
155  };
156}