index.css 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481
  1. /**
  2. * Normally we'd import tailwind with the following:
  3. *
  4. * @import "tailwindcss";
  5. *
  6. * However, we need to customize the preflight styles since the extension's
  7. * current UI assumes there's no CSS resetting or normalization.
  8. *
  9. * We're excluding tailwind's default preflight and importing our own, which
  10. * is based on the original:
  11. * https://github.com/tailwindlabs/tailwindcss/blob/main/packages/tailwindcss/preflight.css
  12. *
  13. * Reference: https://tailwindcss.com/docs/preflight
  14. */
  15. @layer theme, base, components, utilities;
  16. @import "tailwindcss/theme.css" layer(theme);
  17. @import "./preflight.css" layer(base);
  18. @import "tailwindcss/utilities.css" layer(utilities);
  19. @import "katex/dist/katex.min.css";
  20. @plugin "tailwindcss-animate";
  21. @theme {
  22. --font-display: var(--vscode-font-family);
  23. --text-xs: calc(var(--vscode-font-size) * 0.85);
  24. --text-sm: calc(var(--vscode-font-size) * 0.9);
  25. --text-base: var(--vscode-font-size);
  26. --text-lg: calc(var(--vscode-font-size) * 1.1);
  27. --color-background: var(--background);
  28. --color-foreground: var(--foreground);
  29. --color-card: var(--card);
  30. --color-card-foreground: var(--card-foreground);
  31. --color-popover: var(--popover);
  32. --color-popover-foreground: var(--popover-foreground);
  33. --color-primary: var(--primary);
  34. --color-primary-foreground: var(--primary-foreground);
  35. --color-secondary: var(--secondary);
  36. --color-secondary-foreground: var(--secondary-foreground);
  37. --color-muted: var(--muted);
  38. --color-muted-foreground: var(--muted-foreground);
  39. --color-accent: var(--accent);
  40. --color-accent-foreground: var(--accent-foreground);
  41. --color-destructive: var(--destructive);
  42. --color-destructive-foreground: var(--destructive-foreground);
  43. --color-border: var(--border);
  44. --color-input: var(--input);
  45. --color-ring: var(--ring);
  46. --color-chart-1: var(--chart-1);
  47. --color-chart-2: var(--chart-2);
  48. --color-chart-3: var(--chart-3);
  49. --color-chart-4: var(--chart-4);
  50. --color-chart-5: var(--chart-5);
  51. --radius-lg: var(--radius);
  52. --radius-md: calc(var(--radius) - 2px);
  53. --radius-sm: calc(var(--radius) - 4px);
  54. /**
  55. * Allow VSCode colors to be used with Tailwind.
  56. */
  57. --color-vscode-foreground: var(--vscode-foreground);
  58. --color-vscode-editor-foreground: var(--vscode-editor-foreground);
  59. --color-vscode-editor-background: var(--vscode-editor-background);
  60. --color-vscode-editorGroup-border: var(--vscode-editorGroup-border);
  61. --color-vscode-editorWarning-foreground: var(--vscode-editorWarning-foreground);
  62. --color-vscode-editorWarning-background: var(--vscode-editorWarning-background);
  63. --color-vscode-button-foreground: var(--vscode-button-foreground);
  64. --color-vscode-button-background: var(--vscode-button-background);
  65. --color-vscode-button-secondaryForeground: var(--vscode-button-secondaryForeground);
  66. --color-vscode-button-secondaryBackground: var(--vscode-button-secondaryBackground);
  67. --color-vscode-dropdown-foreground: var(--vscode-dropdown-foreground);
  68. --color-vscode-dropdown-background: var(--vscode-dropdown-background);
  69. --color-vscode-dropdown-border: var(--vscode-dropdown-border);
  70. --color-vscode-input-foreground: var(--vscode-input-foreground);
  71. --color-vscode-input-background: var(--vscode-input-background);
  72. --color-vscode-input-border: var(
  73. --vscode-input-border,
  74. transparent
  75. ); /* Some themes don't have a border color, so we can fallback to transparent */
  76. --color-vscode-focusBorder: var(--vscode-focusBorder);
  77. --color-vscode-badge-foreground: var(--vscode-badge-foreground);
  78. --color-vscode-badge-background: var(--vscode-badge-background);
  79. --color-vscode-notifications-foreground: var(--vscode-notifications-foreground);
  80. --color-vscode-notifications-background: var(--vscode-notifications-background);
  81. --color-vscode-notifications-border: var(--vscode-notifications-border);
  82. --color-vscode-descriptionForeground: var(--vscode-descriptionForeground);
  83. --color-vscode-errorForeground: var(--vscode-errorForeground);
  84. --color-vscode-list-hoverForeground: var(--vscode-list-hoverForeground);
  85. --color-vscode-list-hoverBackground: var(--vscode-list-hoverBackground);
  86. --color-vscode-list-focusBackground: var(--vscode-list-focusBackground);
  87. --color-vscode-list-activeSelectionBackground: var(--vscode-list-activeSelectionBackground);
  88. --color-vscode-list-activeSelectionForeground: var(--vscode-list-activeSelectionForeground);
  89. --color-vscode-toolbar-hoverBackground: var(--vscode-toolbar-hoverBackground);
  90. --color-vscode-panel-border: var(--vscode-panel-border);
  91. --color-vscode-sideBar-foreground: var(--vscode-sideBar-foreground);
  92. --color-vscode-sideBar-background: var(--vscode-sideBar-background);
  93. --color-vscode-sideBar-border: var(--vscode-sideBar-border);
  94. --color-vscode-sideBarSectionHeader-foreground: var(--vscode-sideBarSectionHeader-foreground);
  95. --color-vscode-sideBarSectionHeader-background: var(--vscode-sideBarSectionHeader-background);
  96. --color-vscode-sideBarSectionHeader-border: var(--vscode-sideBarSectionHeader-border);
  97. --color-vscode-titleBar-activeForeground: var(--vscode-titleBar-activeForeground);
  98. --color-vscode-titleBar-inactiveForeground: var(--vscode-titleBar-inactiveForeground);
  99. --color-vscode-charts-green: var(--vscode-charts-green);
  100. --color-vscode-charts-yellow: var(--vscode-charts-yellow);
  101. --color-vscode-inputValidation-infoForeground: var(--vscode-inputValidation-infoForeground);
  102. --color-vscode-inputValidation-infoBackground: var(--vscode-inputValidation-infoBackground);
  103. --color-vscode-inputValidation-infoBorder: var(--vscode-inputValidation-infoBorder);
  104. --color-vscode-widget-border: var(--vscode-widget-border);
  105. --color-vscode-textLink-foreground: var(--vscode-textLink-foreground);
  106. --color-vscode-textCodeBlock-background: var(--vscode-textCodeBlock-background);
  107. --color-vscode-button-hoverBackground: var(--vscode-button-hoverBackground);
  108. }
  109. @layer base {
  110. :root {
  111. --background: var(--vscode-editor-background);
  112. --foreground: var(--vscode-editor-foreground);
  113. --card: var(--vscode-editor-background);
  114. --card-foreground: var(--vscode-editor-foreground);
  115. --popover: var(--vscode-menu-background, var(--vscode-editor-background));
  116. --popover-foreground: var(--vscode-menu-foreground, var(--vscode-editor-foreground));
  117. --primary: var(--vscode-button-background);
  118. --primary-foreground: var(--vscode-button-foreground);
  119. --secondary: var(--vscode-button-secondaryBackground);
  120. --secondary-foreground: var(--vscode-button-secondaryForeground);
  121. --muted: var(--vscode-disabledForeground);
  122. --muted-foreground: var(--vscode-descriptionForeground);
  123. --accent: var(--vscode-list-hoverBackground);
  124. --accent-foreground: var(--vscode-list-hoverForeground);
  125. --destructive: var(--vscode-errorForeground);
  126. --destructive-foreground: var(--vscode-button-foreground);
  127. --border: var(--vscode-input-border, transparent); /* --border gets theme value or transparent fallback */
  128. --input: var(--vscode-input-background);
  129. --ring: var(--vscode-input-border);
  130. --chart-1: var(--vscode-charts-red);
  131. --chart-2: var(--vscode-charts-blue);
  132. --chart-3: var(--vscode-charts-yellow);
  133. --chart-4: var(--vscode-charts-orange);
  134. --chart-5: var(--vscode-charts-green);
  135. --radius: 0.5rem;
  136. }
  137. /* Higher specififty than VSCode's theme and root. */
  138. /* Used for baseline theme overrides, but avoid using for styling. */
  139. body {
  140. --vscode-input-border: var(--border);
  141. }
  142. }
  143. @layer components {
  144. /* Border Styles */
  145. .border,
  146. .border-r,
  147. .border-l,
  148. .border-t,
  149. .border-b,
  150. .border-x,
  151. .border-y {
  152. border-color: var(--border);
  153. }
  154. /* Code Block Styles */
  155. pre,
  156. code {
  157. background-color: var(--vscode-textCodeBlock-background);
  158. }
  159. /* Search result highlighting */
  160. .history-item-highlight {
  161. @apply underline;
  162. }
  163. }
  164. /* Form Element Focus States */
  165. textarea:focus {
  166. outline: 1.5px solid var(--vscode-focusBorder, #007fd4);
  167. }
  168. .focus\:outline-0 {
  169. outline: 0 !important; /* Allow tailwind to override the `textarea:focus` rule */
  170. }
  171. /**
  172. * Use vscode native scrollbar styles
  173. * https://github.com/gitkraken/vscode-gitlens/blob/b1d71d4844523e8b2ef16f9e007068e91f46fd88/src/webviews/apps/home/home.scss
  174. */
  175. html {
  176. height: 100%;
  177. -webkit-font-smoothing: antialiased;
  178. -moz-osx-font-smoothing: grayscale;
  179. }
  180. body {
  181. margin: 0;
  182. line-height: 1.25;
  183. }
  184. body.scrollable,
  185. .scrollable,
  186. body.code-block-scrollable,
  187. .code-block-scrollable {
  188. border-color: transparent;
  189. transition: border-color 0.7s linear;
  190. }
  191. body:hover.scrollable,
  192. body:hover .scrollable,
  193. body:focus-within.scrollable,
  194. body:focus-within .scrollable,
  195. body:hover.code-block-scrollable,
  196. body:hover .code-block-scrollable,
  197. body:focus-within.code-block-scrollable,
  198. body:focus-within .code-block-scrollable {
  199. border-color: var(--vscode-scrollbarSlider-background);
  200. transition: none;
  201. }
  202. .scrollable::-webkit-scrollbar-corner {
  203. background-color: transparent !important;
  204. }
  205. .scrollable::-webkit-scrollbar-thumb {
  206. background-color: transparent;
  207. border-color: inherit;
  208. border-right-style: inset;
  209. border-right-width: calc(100vw + 100vh);
  210. border-radius: unset !important;
  211. }
  212. .scrollable::-webkit-scrollbar-thumb:hover {
  213. border-color: var(--vscode-scrollbarSlider-hoverBackground);
  214. }
  215. .scrollable::-webkit-scrollbar-thumb:active {
  216. border-color: var(--vscode-scrollbarSlider-activeBackground);
  217. }
  218. /**
  219. * Fix VSCode ignoring webkit scrollbar modifiers
  220. * https://github.com/microsoft/vscode/issues/213045
  221. */
  222. @supports selector(::-webkit-scrollbar) {
  223. html {
  224. scrollbar-color: unset;
  225. }
  226. }
  227. /**
  228. * The above scrollbar styling uses some transparent background color magic to accomplish its animation. However this doesn't play nicely with SyntaxHighlighter, so we need to set a background color for the code blocks' horizontal scrollbar. This actually has the unintended consequence of always showing the scrollbar which I prefer since it makes it more obvious that there is more content to scroll to.
  229. */
  230. .code-block-scrollable::-webkit-scrollbar-track {
  231. background: transparent;
  232. }
  233. .code-block-scrollable::-webkit-scrollbar-thumb {
  234. background-color: var(--vscode-scrollbarSlider-background);
  235. border-radius: 5px;
  236. border: 2px solid transparent;
  237. background-clip: content-box;
  238. }
  239. .code-block-scrollable::-webkit-scrollbar-thumb:hover {
  240. background-color: var(--vscode-scrollbarSlider-hoverBackground);
  241. }
  242. .code-block-scrollable::-webkit-scrollbar-thumb:active {
  243. background-color: var(--vscode-scrollbarSlider-activeBackground);
  244. }
  245. .code-block-scrollable::-webkit-scrollbar-corner {
  246. background-color: transparent;
  247. }
  248. /**
  249. * Add a way to hide scrollbars.
  250. */
  251. .scrollbar-hide {
  252. -ms-overflow-style: none; /* IE and Edge */
  253. scrollbar-width: none; /* Firefox */
  254. }
  255. .scrollbar-hide::-webkit-scrollbar {
  256. display: none; /* Chrome, Safari and Opera */
  257. }
  258. /**
  259. * Dropdown label
  260. * https://github.com/microsoft/vscode-webview-ui-toolkit/tree/main/src/dropdown#with-label
  261. */
  262. .dropdown-container {
  263. box-sizing: border-box;
  264. display: flex;
  265. flex-flow: column nowrap;
  266. align-items: flex-start;
  267. justify-content: flex-start;
  268. }
  269. .dropdown-container label {
  270. display: block;
  271. color: var(--vscode-foreground);
  272. cursor: pointer;
  273. font-size: var(--vscode-font-size);
  274. line-height: normal;
  275. margin-bottom: 2px;
  276. }
  277. /* Fix dropdown double scrollbar overflow */
  278. #api-provider > div > ul {
  279. overflow: unset;
  280. }
  281. /* Fix scrollbar in dropdown */
  282. vscode-dropdown::part(listbox) {
  283. border-color: var(--vscode-scrollbarSlider-background);
  284. transition: none;
  285. scrollbar-color: var(--vscode-scrollbarSlider-background) transparent;
  286. }
  287. /* Faded icon buttons in textfields */
  288. .input-icon-button {
  289. cursor: pointer;
  290. opacity: 0.65;
  291. }
  292. .input-icon-button:hover {
  293. opacity: 1;
  294. }
  295. .input-icon-button.disabled {
  296. cursor: not-allowed;
  297. opacity: 0.4;
  298. }
  299. .input-icon-button.disabled:hover {
  300. opacity: 0.4;
  301. }
  302. /* Context mentions */
  303. .mention-context-textarea-highlight {
  304. background-color: color-mix(in srgb, var(--vscode-badge-foreground) 30%, transparent);
  305. border-radius: 3px;
  306. box-shadow: 0 0 0 0.5px color-mix(in srgb, var(--vscode-badge-foreground) 30%, transparent);
  307. color: transparent;
  308. }
  309. .mention-context-highlight {
  310. background-color: color-mix(in srgb, var(--vscode-badge-foreground) 30%, transparent);
  311. border-radius: 3px;
  312. }
  313. .mention-context-highlight-with-shadow {
  314. background-color: color-mix(in srgb, var(--vscode-badge-foreground) 30%, transparent);
  315. border-radius: 3px;
  316. box-shadow: 0 0 0 0.5px color-mix(in srgb, var(--vscode-badge-foreground) 30%, transparent);
  317. }
  318. /**
  319. * vscrui Overrides / Hacks
  320. */
  321. .vscrui-checkbox__listbox > ul {
  322. max-height: unset !important;
  323. }
  324. .vscrui-checkbox svg {
  325. min-width: 16px;
  326. min-height: 16px;
  327. }
  328. /**
  329. * @shadcn/ui Overrides / Hacks
  330. */
  331. input[cmdk-input]:focus {
  332. outline: none;
  333. }
  334. /**
  335. * Markdown
  336. */
  337. .custom-markdown > pre {
  338. background-color: transparent !important;
  339. }
  340. /*
  341. * Use geometric precision for codicons to avoid blurriness
  342. */
  343. .codicon[class*="codicon-"] {
  344. text-rendering: geometricPrecision !important;
  345. }
  346. /**
  347. * Custom animations for UI elements
  348. */
  349. @keyframes slide-in-right {
  350. from {
  351. transform: translateX(100%);
  352. }
  353. to {
  354. transform: translateX(0);
  355. }
  356. }
  357. .animate-slide-in-right {
  358. animation: slide-in-right 0.3s ease-out;
  359. }
  360. @keyframes fade-in {
  361. from {
  362. opacity: 0;
  363. }
  364. to {
  365. opacity: 1;
  366. }
  367. }
  368. .animate-fade-in {
  369. animation: fade-in 0.2s ease-out;
  370. }
  371. @keyframes pulse {
  372. 0%,
  373. 100% {
  374. opacity: 1;
  375. }
  376. 50% {
  377. opacity: 0.7;
  378. }
  379. }
  380. .animate-pulse {
  381. animation: pulse 1.5s ease-in-out infinite;
  382. }
  383. /* Transition utilities */
  384. .transition-all {
  385. transition-property: all;
  386. transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  387. transition-duration: 150ms;
  388. }
  389. .transition-colors {
  390. transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;
  391. transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  392. transition-duration: 150ms;
  393. }