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        },
103        containerWarning: {
104          cornerRadius: 6,
105          padding: { left: 6, right: 6 },
106          background: backgroundColor(theme, "warning"),
107          border: border(theme, "warning"),
108        },
109        containerError: {
110          cornerRadius: 6,
111          padding: { left: 6, right: 6 },
112          background: backgroundColor(theme, "error"),
113          border: border(theme, "error"),
114        },
115        hover: {
116          iconColorOk: iconColor(theme, "primary"),
117          containerOk: {
118            cornerRadius: 6,
119            padding: { left: 6, right: 6 },
120            background: backgroundColor(theme, 300, "hovered"),
121          },
122          containerWarning: {
123            cornerRadius: 6,
124            padding: { left: 6, right: 6 },
125            background: backgroundColor(theme, "warning", "hovered"),
126            border: border(theme, "warning"),
127          },
128          containerError: {
129            cornerRadius: 6,
130            padding: { left: 6, right: 6 },
131            background: backgroundColor(theme, "error", "hovered"),
132            border: border(theme, "error"),
133          }
134        },
135      },
136      sidebarButtons: {
137        groupLeft: {},
138        groupRight: {},
139        item: {
140          iconSize: 14,
141          padding: { top: 3, bottom: 3, left: 6, right: 6 },
142          cornerRadius: 6,
143          iconColor: iconColor(theme, "secondary"),
144          hover: {
145            iconColor: iconColor(theme, "primary"),
146            background: backgroundColor(theme, 300, "hovered"),
147          },
148          active: {
149            iconColor: iconColor(theme, "active"),
150            background: backgroundColor(theme, 300, "active"),
151          }
152        },
153      },
154    },
155    titlebar: {
156      avatarWidth: 18,
157      height: 32,
158      background: backgroundColor(theme, 100),
159      padding: {
160        left: 80,
161      },
162      title: text(theme, "sans", "primary"),
163      avatar: {
164        cornerRadius: 10,
165        border: {
166          color: "#00000088",
167          width: 1,
168        },
169      },
170      avatarRibbon: {
171        height: 3,
172        width: 12,
173        // TODO: The background for this ideally should be 
174        // set with a token, not hardcoded in rust
175      },
176      border: border(theme, "primary", { bottom: true }),
177      signInPrompt: {
178        border: border(theme, "primary"),
179        cornerRadius: 6,
180        margin: {
181          top: 1,
182          right: 6,
183        },
184        padding: {
185          left: 6,
186          right: 6,
187        },
188        ...text(theme, "sans", "secondary", { size: "xs" }),
189        hover: text(theme, "sans", "active", { size: "xs" }),
190      },
191      offlineIcon: {
192        color: iconColor(theme, "secondary"),
193        width: 16,
194        padding: {
195          right: 4,
196        },
197      },
198      shareIcon: {
199        cornerRadius: 6,
200        margin: { top: 3, bottom: 2 },
201        color: iconColor(theme, "secondary"),
202        hover: {
203          background: backgroundColor(theme, 100, "hovered"),
204          color: iconColor(theme, "secondary"),
205        },
206        active: {
207          background: backgroundColor(theme, 100, "active"),
208          color: iconColor(theme, "active"),
209        },
210        activeHover: {
211          background: backgroundColor(theme, 100, "hovered"),
212          color: iconColor(theme, "active"),
213        }
214      },
215      outdatedWarning: {
216        ...text(theme, "sans", "warning"),
217        size: 13,
218        margin: { right: 6 }
219      },
220    },
221    toolbar: {
222      height: 34,
223      background: backgroundColor(theme, 500),
224      border: border(theme, "secondary", { bottom: true }),
225      itemSpacing: 8,
226      padding: { left: 16, right: 8, top: 4, bottom: 4 },
227    },
228    breadcrumbs: {
229      ...text(theme, "mono", "secondary"),
230      padding: { left: 6 },
231    },
232    disconnectedOverlay: {
233      ...text(theme, "sans", "active"),
234      background: "#000000aa",
235    },
236  };
237}