workspace.ts

  1import Theme from "../themes/theme";
  2import { backgroundColor, border, iconColor, text } from "./components";
  3
  4export default function workspace(theme: Theme) {
  5  const tab = {
  6    height: 32,
  7    background: backgroundColor(theme, 300),
  8    iconClose: iconColor(theme, "muted"),
  9    iconCloseActive: iconColor(theme, "active"),
 10    iconConflict: iconColor(theme, "warning"),
 11    iconDirty: iconColor(theme, "info"),
 12    iconWidth: 8,
 13    spacing: 8,
 14    text: text(theme, "sans", "secondary", { size: "sm" }),
 15    border: border(theme, "primary", {
 16      left: true,
 17      bottom: true,
 18      overlay: true,
 19    }),
 20    padding: {
 21      left: 8,
 22      right: 8,
 23    },
 24  };
 25
 26  const activeTab = {
 27    ...tab,
 28    background: backgroundColor(theme, 500),
 29    text: text(theme, "sans", "active", { size: "sm" }),
 30    border: {
 31      ...tab.border,
 32      bottom: false,
 33    },
 34  };
 35
 36  return {
 37    background: backgroundColor(theme, 300),
 38    leaderBorderOpacity: 0.7,
 39    leaderBorderWidth: 2.0,
 40    tab,
 41    activeTab,
 42    modal: {
 43      margin: {
 44        bottom: 52,
 45        top: 52,
 46      },
 47      cursor: "Arrow"
 48    },
 49    sidebarResizeHandle: {
 50      background: border(theme, "primary").color,
 51      padding: {
 52        left: 1,
 53      },
 54    },
 55    paneDivider: {
 56      color: border(theme, "secondary").color,
 57      width: 1,
 58    },
 59    statusBar: {
 60      height: 30,
 61      itemSpacing: 8,
 62      padding: {
 63        top: 1,
 64        bottom: 1,
 65        left: 6,
 66        right: 6,
 67      },
 68      border: border(theme, "primary", { top: true, overlay: true }),
 69      cursorPosition: text(theme, "sans", "muted"),
 70      autoUpdateProgressMessage: text(theme, "sans", "muted"),
 71      autoUpdateDoneMessage: text(theme, "sans", "muted"),
 72      lspStatus: {
 73        iconSpacing: 4,
 74        iconWidth: 14,
 75        height: 18,
 76        cornerRadius: 6,
 77        padding: { left: 6, right: 6 },
 78        message: text(theme, "sans", "muted"),
 79        iconColor: iconColor(theme, "muted"),
 80        hover: {
 81          message: text(theme, "sans", "primary"),
 82          iconColor: iconColor(theme, "primary"),
 83          background: backgroundColor(theme, 300, "hovered"),
 84        }
 85      },
 86      diagnosticMessage: {
 87        ...text(theme, "sans", "muted"),
 88        hover: text(theme, "sans", "secondary"),
 89      },
 90      diagnosticSummary: {
 91        height: 16,
 92        iconWidth: 14,
 93        iconSpacing: 2,
 94        summarySpacing: 6,
 95        text: text(theme, "sans", "primary", { size: "sm" }),
 96        iconColorOk: iconColor(theme, "secondary"),
 97        iconColorWarning: iconColor(theme, "warning"),
 98        iconColorError: iconColor(theme, "error"),
 99        containerOk: {
100          cornerRadius: 6,
101          padding: { left: 6, right: 6 },
102          background: backgroundColor(theme, 300, "hovered"),
103        },
104        containerWarning: {
105          cornerRadius: 6,
106          padding: { left: 6, right: 6 },
107          background: backgroundColor(theme, "warning"),
108          border: border(theme, "warning"),
109        },
110        containerError: {
111          cornerRadius: 6,
112          padding: { left: 6, right: 6 },
113          background: backgroundColor(theme, "error"),
114          border: border(theme, "error"),
115        },
116        hover: {
117          iconColorOk: iconColor(theme, "primary"),
118          containerOk: {
119            cornerRadius: 6,
120            padding: { left: 6, right: 6 },
121            background: backgroundColor(theme, 300, "hovered"),
122          },
123          containerWarning: {
124            cornerRadius: 6,
125            padding: { left: 6, right: 6 },
126            background: backgroundColor(theme, "warning", "hovered"),
127            border: border(theme, "warning"),
128          },
129          containerError: {
130            cornerRadius: 6,
131            padding: { left: 6, right: 6 },
132            background: backgroundColor(theme, "error", "hovered"),
133            border: border(theme, "error"),
134          }
135        },
136      },
137      sidebarButtons: {
138        groupLeft: {},
139        groupRight: {},
140        item: {
141          iconSize: 14,
142          padding: { top: 3, bottom: 3, left: 6, right: 6 },
143          cornerRadius: 6,
144          iconColor: iconColor(theme, "secondary"),
145          hover: {
146            iconColor: iconColor(theme, "primary"),
147            background: backgroundColor(theme, 300, "hovered"),
148          },
149          active: {
150            iconColor: iconColor(theme, "active"),
151            background: backgroundColor(theme, 300, "active"),
152          }
153        },
154      },
155    },
156    titlebar: {
157      avatarWidth: 18,
158      height: 32,
159      background: backgroundColor(theme, 100),
160      padding: {
161        left: 80,
162      },
163      title: text(theme, "sans", "primary"),
164      avatar: {
165        cornerRadius: 10,
166        border: {
167          color: "#00000088",
168          width: 1,
169        },
170      },
171      avatarRibbon: {
172        height: 3,
173        width: 12,
174        // TODO: The background for this ideally should be 
175        // set with a token, not hardcoded in rust
176      },
177      border: border(theme, "primary", { bottom: true }),
178      signInPrompt: {
179        border: border(theme, "primary"),
180        cornerRadius: 6,
181        margin: {
182          top: 1,
183          right: 6,
184        },
185        padding: {
186          left: 6,
187          right: 6,
188        },
189        ...text(theme, "sans", "secondary", { size: "xs" }),
190        hover: text(theme, "sans", "active", { size: "xs" }),
191      },
192      offlineIcon: {
193        color: iconColor(theme, "secondary"),
194        width: 16,
195        padding: {
196          right: 4,
197        },
198      },
199      shareIcon: {
200        cornerRadius: 6,
201        margin: { top: 3, bottom: 2 },
202        color: iconColor(theme, "secondary"),
203        hover: {
204          background: backgroundColor(theme, 100, "hovered"),
205          color: iconColor(theme, "secondary"),
206        },
207        active: {
208          background: backgroundColor(theme, 100, "active"),
209          color: iconColor(theme, "active"),
210        },
211        activeHover: {
212          background: backgroundColor(theme, 100, "hovered"),
213          color: iconColor(theme, "active"),
214        }
215      },
216      outdatedWarning: {
217        ...text(theme, "sans", "warning"),
218        size: 13,
219        margin: { right: 6 }
220      },
221    },
222    toolbar: {
223      height: 34,
224      background: backgroundColor(theme, 500),
225      border: border(theme, "secondary", { bottom: true }),
226      itemSpacing: 8,
227      padding: { left: 16, right: 8, top: 4, bottom: 4 },
228    },
229    breadcrumbs: {
230      ...text(theme, "mono", "secondary"),
231      padding: { left: 6 },
232    },
233    disconnectedOverlay: {
234      ...text(theme, "sans", "active"),
235      background: "#000000aa",
236    },
237  };
238}