Sidebar.svelte 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692
  1. <script lang="ts">
  2. import { toast } from 'svelte-sonner';
  3. import { goto } from '$app/navigation';
  4. import {
  5. user,
  6. chats,
  7. settings,
  8. showSettings,
  9. chatId,
  10. tags,
  11. showSidebar,
  12. mobile,
  13. showArchivedChats,
  14. pinnedChats,
  15. scrollPaginationEnabled,
  16. currentChatPage,
  17. temporaryChatEnabled,
  18. showArtifacts,
  19. showOverview,
  20. showControls
  21. } from '$lib/stores';
  22. import { onMount, getContext, tick, onDestroy } from 'svelte';
  23. const i18n = getContext('i18n');
  24. import { updateUserSettings } from '$lib/apis/users';
  25. import {
  26. deleteChatById,
  27. getChatList,
  28. getChatById,
  29. getChatListByTagName,
  30. updateChatById,
  31. getAllChatTags,
  32. archiveChatById,
  33. cloneChatById,
  34. getChatListBySearchText,
  35. createNewChat,
  36. getPinnedChatList
  37. } from '$lib/apis/chats';
  38. import { WEBUI_BASE_URL } from '$lib/constants';
  39. import ArchivedChatsModal from './Sidebar/ArchivedChatsModal.svelte';
  40. import UserMenu from './Sidebar/UserMenu.svelte';
  41. import ChatItem from './Sidebar/ChatItem.svelte';
  42. import DeleteConfirmDialog from '$lib/components/common/ConfirmDialog.svelte';
  43. import Spinner from '../common/Spinner.svelte';
  44. import Loader from '../common/Loader.svelte';
  45. import FilesOverlay from '../chat/MessageInput/FilesOverlay.svelte';
  46. import AddFilesPlaceholder from '../AddFilesPlaceholder.svelte';
  47. import { select } from 'd3-selection';
  48. import SearchInput from './Sidebar/SearchInput.svelte';
  49. const BREAKPOINT = 768;
  50. let navElement;
  51. let search = '';
  52. let shiftKey = false;
  53. let selectedChatId = null;
  54. let deleteChat = null;
  55. let showDeleteConfirm = false;
  56. let showDropdown = false;
  57. let selectedTagName = null;
  58. // Pagination variables
  59. let chatListLoading = false;
  60. let allChatsLoaded = false;
  61. const initChatList = async () => {
  62. // Reset pagination variables
  63. currentChatPage.set(1);
  64. allChatsLoaded = false;
  65. await chats.set(await getChatList(localStorage.token, $currentChatPage));
  66. // Enable pagination
  67. scrollPaginationEnabled.set(true);
  68. };
  69. const loadMoreChats = async () => {
  70. chatListLoading = true;
  71. currentChatPage.set($currentChatPage + 1);
  72. let newChatList = [];
  73. if (search) {
  74. newChatList = await getChatListBySearchText(localStorage.token, search, $currentChatPage);
  75. } else {
  76. newChatList = await getChatList(localStorage.token, $currentChatPage);
  77. }
  78. // once the bottom of the list has been reached (no results) there is no need to continue querying
  79. allChatsLoaded = newChatList.length === 0;
  80. await chats.set([...($chats ? $chats : []), ...newChatList]);
  81. chatListLoading = false;
  82. };
  83. let searchDebounceTimeout;
  84. const searchDebounceHandler = async () => {
  85. console.log('search', search);
  86. chats.set(null);
  87. selectedTagName = null;
  88. if (searchDebounceTimeout) {
  89. clearTimeout(searchDebounceTimeout);
  90. }
  91. if (search === '') {
  92. await initChatList();
  93. return;
  94. } else {
  95. searchDebounceTimeout = setTimeout(async () => {
  96. currentChatPage.set(1);
  97. await chats.set(await getChatListBySearchText(localStorage.token, search));
  98. }, 1000);
  99. }
  100. };
  101. const deleteChatHandler = async (id) => {
  102. const res = await deleteChatById(localStorage.token, id).catch((error) => {
  103. toast.error(error);
  104. return null;
  105. });
  106. if (res) {
  107. if ($chatId === id) {
  108. await chatId.set('');
  109. await tick();
  110. goto('/');
  111. }
  112. allChatsLoaded = false;
  113. currentChatPage.set(1);
  114. await chats.set(await getChatList(localStorage.token, $currentChatPage));
  115. await pinnedChats.set(await getPinnedChatList(localStorage.token));
  116. }
  117. };
  118. const inputFilesHandler = async (files) => {
  119. console.log(files);
  120. for (const file of files) {
  121. const reader = new FileReader();
  122. reader.onload = async (e) => {
  123. const content = e.target.result;
  124. try {
  125. const items = JSON.parse(content);
  126. for (const item of items) {
  127. if (item.chat) {
  128. await createNewChat(localStorage.token, item.chat);
  129. }
  130. }
  131. } catch {
  132. toast.error($i18n.t(`Invalid file format.`));
  133. }
  134. initChatList();
  135. };
  136. reader.readAsText(file);
  137. }
  138. };
  139. const tagEventHandler = async (type, tagName, chatId) => {
  140. console.log(type, tagName, chatId);
  141. if (type === 'delete') {
  142. if (selectedTagName === tagName) {
  143. if ($tags.map((t) => t.name).includes(tagName)) {
  144. await chats.set(await getChatListByTagName(localStorage.token, tagName));
  145. } else {
  146. selectedTagName = null;
  147. await initChatList();
  148. }
  149. }
  150. }
  151. };
  152. let dragged = false;
  153. const onDragOver = (e) => {
  154. e.preventDefault();
  155. dragged = true;
  156. };
  157. const onDragLeave = () => {
  158. dragged = false;
  159. };
  160. const onDrop = async (e) => {
  161. e.preventDefault();
  162. console.log(e);
  163. if (e.dataTransfer?.files) {
  164. const inputFiles = Array.from(e.dataTransfer?.files);
  165. if (inputFiles && inputFiles.length > 0) {
  166. console.log(inputFiles);
  167. inputFilesHandler(inputFiles);
  168. } else {
  169. toast.error($i18n.t(`File not found.`));
  170. }
  171. }
  172. dragged = false;
  173. };
  174. let touchstart;
  175. let touchend;
  176. function checkDirection() {
  177. const screenWidth = window.innerWidth;
  178. const swipeDistance = Math.abs(touchend.screenX - touchstart.screenX);
  179. if (touchstart.clientX < 40 && swipeDistance >= screenWidth / 8) {
  180. if (touchend.screenX < touchstart.screenX) {
  181. showSidebar.set(false);
  182. }
  183. if (touchend.screenX > touchstart.screenX) {
  184. showSidebar.set(true);
  185. }
  186. }
  187. }
  188. const onTouchStart = (e) => {
  189. touchstart = e.changedTouches[0];
  190. console.log(touchstart.clientX);
  191. };
  192. const onTouchEnd = (e) => {
  193. touchend = e.changedTouches[0];
  194. checkDirection();
  195. };
  196. const onKeyDown = (e) => {
  197. if (e.key === 'Shift') {
  198. shiftKey = true;
  199. }
  200. };
  201. const onKeyUp = (e) => {
  202. if (e.key === 'Shift') {
  203. shiftKey = false;
  204. }
  205. };
  206. const onFocus = () => {};
  207. const onBlur = () => {
  208. shiftKey = false;
  209. selectedChatId = null;
  210. };
  211. onMount(async () => {
  212. mobile.subscribe((e) => {
  213. if ($showSidebar && e) {
  214. showSidebar.set(false);
  215. }
  216. if (!$showSidebar && !e) {
  217. showSidebar.set(true);
  218. }
  219. });
  220. showSidebar.set(!$mobile ? localStorage.sidebar === 'true' : false);
  221. showSidebar.subscribe((value) => {
  222. localStorage.sidebar = value;
  223. });
  224. await pinnedChats.set(await getPinnedChatList(localStorage.token));
  225. await initChatList();
  226. window.addEventListener('keydown', onKeyDown);
  227. window.addEventListener('keyup', onKeyUp);
  228. window.addEventListener('touchstart', onTouchStart);
  229. window.addEventListener('touchend', onTouchEnd);
  230. window.addEventListener('focus', onFocus);
  231. window.addEventListener('blur', onBlur);
  232. const dropZone = document.getElementById('sidebar');
  233. dropZone?.addEventListener('dragover', onDragOver);
  234. dropZone?.addEventListener('drop', onDrop);
  235. dropZone?.addEventListener('dragleave', onDragLeave);
  236. });
  237. onDestroy(() => {
  238. window.removeEventListener('keydown', onKeyDown);
  239. window.removeEventListener('keyup', onKeyUp);
  240. window.removeEventListener('touchstart', onTouchStart);
  241. window.removeEventListener('touchend', onTouchEnd);
  242. window.removeEventListener('focus', onFocus);
  243. window.removeEventListener('blur', onBlur);
  244. const dropZone = document.getElementById('sidebar');
  245. dropZone?.removeEventListener('dragover', onDragOver);
  246. dropZone?.removeEventListener('drop', onDrop);
  247. dropZone?.removeEventListener('dragleave', onDragLeave);
  248. });
  249. </script>
  250. <ArchivedChatsModal
  251. bind:show={$showArchivedChats}
  252. on:change={async () => {
  253. await pinnedChats.set(await getPinnedChatList(localStorage.token));
  254. await chats.set(await getChatList(localStorage.token));
  255. }}
  256. />
  257. <DeleteConfirmDialog
  258. bind:show={showDeleteConfirm}
  259. title={$i18n.t('Delete chat?')}
  260. on:confirm={() => {
  261. deleteChatHandler(deleteChat.id);
  262. }}
  263. >
  264. <div class=" text-sm text-gray-500 flex-1 line-clamp-3">
  265. {$i18n.t('This will delete')} <span class=" font-semibold">{deleteChat.title}</span>.
  266. </div>
  267. </DeleteConfirmDialog>
  268. <!-- svelte-ignore a11y-no-static-element-interactions -->
  269. {#if $showSidebar}
  270. <div
  271. class=" fixed md:hidden z-40 top-0 right-0 left-0 bottom-0 bg-black/60 w-full min-h-screen h-screen flex justify-center overflow-hidden overscroll-contain"
  272. on:mousedown={() => {
  273. showSidebar.set(!$showSidebar);
  274. }}
  275. />
  276. {/if}
  277. <div
  278. bind:this={navElement}
  279. id="sidebar"
  280. class="h-screen max-h-[100dvh] min-h-screen select-none {$showSidebar
  281. ? 'md:relative w-[260px]'
  282. : '-translate-x-[260px] w-[0px]'} bg-gray-50 text-gray-900 dark:bg-gray-950 dark:text-gray-200 text-sm transition fixed z-50 top-0 left-0
  283. "
  284. data-state={$showSidebar}
  285. >
  286. {#if dragged}
  287. <div
  288. class="absolute w-full h-full max-h-full backdrop-blur bg-gray-800/40 flex justify-center z-[999] touch-none pointer-events-none"
  289. >
  290. <div class="m-auto pt-64 flex flex-col justify-center">
  291. <AddFilesPlaceholder
  292. title={$i18n.t('Drop Chat Export')}
  293. content={$i18n.t('Drop a chat export file here to import it.')}
  294. />
  295. </div>
  296. </div>
  297. {/if}
  298. <div
  299. class="py-2.5 my-auto flex flex-col justify-between h-screen max-h-[100dvh] w-[260px] z-50 {$showSidebar
  300. ? ''
  301. : 'invisible'}"
  302. >
  303. <div class="px-2.5 flex justify-between space-x-1 text-gray-600 dark:text-gray-400">
  304. <a
  305. id="sidebar-new-chat-button"
  306. class="flex flex-1 justify-between rounded-xl px-2 h-full hover:bg-gray-100 dark:hover:bg-gray-900 transition"
  307. href="/"
  308. draggable="false"
  309. on:click={async () => {
  310. selectedChatId = null;
  311. await goto('/');
  312. const newChatButton = document.getElementById('new-chat-button');
  313. setTimeout(() => {
  314. newChatButton?.click();
  315. if ($mobile) {
  316. showSidebar.set(false);
  317. }
  318. }, 0);
  319. }}
  320. >
  321. <div class="self-center mx-1.5">
  322. <img
  323. crossorigin="anonymous"
  324. src="{WEBUI_BASE_URL}/static/favicon.png"
  325. class=" size-6 -translate-x-1.5 rounded-full"
  326. alt="logo"
  327. />
  328. </div>
  329. <div class=" self-center font-medium text-sm text-gray-850 dark:text-white font-primary">
  330. {$i18n.t('New Chat')}
  331. </div>
  332. <div class="self-center ml-auto">
  333. <svg
  334. xmlns="http://www.w3.org/2000/svg"
  335. viewBox="0 0 20 20"
  336. fill="currentColor"
  337. class="size-5"
  338. >
  339. <path
  340. d="M5.433 13.917l1.262-3.155A4 4 0 017.58 9.42l6.92-6.918a2.121 2.121 0 013 3l-6.92 6.918c-.383.383-.84.685-1.343.886l-3.154 1.262a.5.5 0 01-.65-.65z"
  341. />
  342. <path
  343. d="M3.5 5.75c0-.69.56-1.25 1.25-1.25H10A.75.75 0 0010 3H4.75A2.75 2.75 0 002 5.75v9.5A2.75 2.75 0 004.75 18h9.5A2.75 2.75 0 0017 15.25V10a.75.75 0 00-1.5 0v5.25c0 .69-.56 1.25-1.25 1.25h-9.5c-.69 0-1.25-.56-1.25-1.25v-9.5z"
  344. />
  345. </svg>
  346. </div>
  347. </a>
  348. <button
  349. class=" cursor-pointer px-2 py-2 flex rounded-xl hover:bg-gray-100 dark:hover:bg-gray-900 transition"
  350. on:click={() => {
  351. showSidebar.set(!$showSidebar);
  352. }}
  353. >
  354. <div class=" m-auto self-center">
  355. <svg
  356. xmlns="http://www.w3.org/2000/svg"
  357. fill="none"
  358. viewBox="0 0 24 24"
  359. stroke-width="2"
  360. stroke="currentColor"
  361. class="size-5"
  362. >
  363. <path
  364. stroke-linecap="round"
  365. stroke-linejoin="round"
  366. d="M3.75 6.75h16.5M3.75 12h16.5m-16.5 5.25H12"
  367. />
  368. </svg>
  369. </div>
  370. </button>
  371. </div>
  372. {#if $user?.role === 'admin'}
  373. <div class="px-2.5 flex justify-center text-gray-800 dark:text-gray-200">
  374. <a
  375. class="flex-grow flex space-x-3 rounded-xl px-2.5 py-2 hover:bg-gray-100 dark:hover:bg-gray-900 transition"
  376. href="/workspace"
  377. on:click={() => {
  378. selectedChatId = null;
  379. chatId.set('');
  380. if ($mobile) {
  381. showSidebar.set(false);
  382. }
  383. }}
  384. draggable="false"
  385. >
  386. <div class="self-center">
  387. <svg
  388. xmlns="http://www.w3.org/2000/svg"
  389. fill="none"
  390. viewBox="0 0 24 24"
  391. stroke-width="2"
  392. stroke="currentColor"
  393. class="size-[1.1rem]"
  394. >
  395. <path
  396. stroke-linecap="round"
  397. stroke-linejoin="round"
  398. d="M13.5 16.875h3.375m0 0h3.375m-3.375 0V13.5m0 3.375v3.375M6 10.5h2.25a2.25 2.25 0 0 0 2.25-2.25V6a2.25 2.25 0 0 0-2.25-2.25H6A2.25 2.25 0 0 0 3.75 6v2.25A2.25 2.25 0 0 0 6 10.5Zm0 9.75h2.25A2.25 2.25 0 0 0 10.5 18v-2.25a2.25 2.25 0 0 0-2.25-2.25H6a2.25 2.25 0 0 0-2.25 2.25V18A2.25 2.25 0 0 0 6 20.25Zm9.75-9.75H18a2.25 2.25 0 0 0 2.25-2.25V6A2.25 2.25 0 0 0 18 3.75h-2.25A2.25 2.25 0 0 0 13.5 6v2.25a2.25 2.25 0 0 0 2.25 2.25Z"
  399. />
  400. </svg>
  401. </div>
  402. <div class="flex self-center">
  403. <div class=" self-center font-medium text-sm font-primary">{$i18n.t('Workspace')}</div>
  404. </div>
  405. </a>
  406. </div>
  407. {/if}
  408. <div
  409. class="relative flex flex-col flex-1 overflow-y-auto {$temporaryChatEnabled
  410. ? 'opacity-20'
  411. : ''}"
  412. >
  413. {#if $temporaryChatEnabled}
  414. <div class="absolute z-40 w-full h-full flex justify-center"></div>
  415. {/if}
  416. <SearchInput
  417. bind:value={search}
  418. on:input={searchDebounceHandler}
  419. placeholder={$i18n.t('Search')}
  420. />
  421. <!-- {#if $tags.length > 0}
  422. <div class="px-3.5 mb-2.5 flex gap-0.5 flex-wrap">
  423. <button
  424. class="px-2.5 py-[1px] text-xs transition {selectedTagName === null
  425. ? 'bg-gray-100 dark:bg-gray-900'
  426. : ' '} rounded-md font-medium"
  427. on:click={async () => {
  428. selectedTagName = null;
  429. await initChatList();
  430. }}
  431. >
  432. {$i18n.t('all')}
  433. </button>
  434. {#each $tags as tag}
  435. <button
  436. class="px-2.5 py-[1px] text-xs transition {selectedTagName === tag.name
  437. ? 'bg-gray-100 dark:bg-gray-900'
  438. : ''} rounded-md font-medium"
  439. on:click={async () => {
  440. selectedTagName = tag.name;
  441. scrollPaginationEnabled.set(false);
  442. let taggedChatList = await getChatListByTagName(localStorage.token, tag.name);
  443. if (taggedChatList.length === 0) {
  444. await tags.set(await getAllChatTags(localStorage.token));
  445. // if the tag we deleted is no longer a valid tag, return to main chat list view
  446. await initChatList();
  447. } else {
  448. await chats.set(taggedChatList);
  449. }
  450. chatListLoading = false;
  451. }}
  452. >
  453. {tag.name}
  454. </button>
  455. {/each}
  456. </div>
  457. {/if} -->
  458. {#if !search && $pinnedChats.length > 0}
  459. <div class="pl-2 pb-2 flex flex-col space-y-1">
  460. <div class="">
  461. <div class="w-full pl-2.5 text-xs text-gray-500 dark:text-gray-500 font-medium pb-1.5">
  462. {$i18n.t('Pinned')}
  463. </div>
  464. {#each $pinnedChats as chat, idx}
  465. <ChatItem
  466. {chat}
  467. {shiftKey}
  468. selected={selectedChatId === chat.id}
  469. on:select={() => {
  470. selectedChatId = chat.id;
  471. }}
  472. on:unselect={() => {
  473. selectedChatId = null;
  474. }}
  475. on:delete={(e) => {
  476. if ((e?.detail ?? '') === 'shift') {
  477. deleteChatHandler(chat.id);
  478. } else {
  479. deleteChat = chat;
  480. showDeleteConfirm = true;
  481. }
  482. }}
  483. on:tag={(e) => {
  484. const { type, name } = e.detail;
  485. tagEventHandler(type, name, chat.id);
  486. }}
  487. />
  488. {/each}
  489. </div>
  490. </div>
  491. {/if}
  492. <div class="pl-2 flex-1 flex flex-col space-y-1 overflow-y-auto scrollbar-hidden">
  493. {#if $chats}
  494. {#each $chats as chat, idx}
  495. {#if idx === 0 || (idx > 0 && chat.time_range !== $chats[idx - 1].time_range)}
  496. <div
  497. class="w-full pl-2.5 text-xs text-gray-500 dark:text-gray-500 font-medium {idx === 0
  498. ? ''
  499. : 'pt-5'} pb-0.5"
  500. >
  501. {$i18n.t(chat.time_range)}
  502. <!-- localisation keys for time_range to be recognized from the i18next parser (so they don't get automatically removed):
  503. {$i18n.t('Today')}
  504. {$i18n.t('Yesterday')}
  505. {$i18n.t('Previous 7 days')}
  506. {$i18n.t('Previous 30 days')}
  507. {$i18n.t('January')}
  508. {$i18n.t('February')}
  509. {$i18n.t('March')}
  510. {$i18n.t('April')}
  511. {$i18n.t('May')}
  512. {$i18n.t('June')}
  513. {$i18n.t('July')}
  514. {$i18n.t('August')}
  515. {$i18n.t('September')}
  516. {$i18n.t('October')}
  517. {$i18n.t('November')}
  518. {$i18n.t('December')}
  519. -->
  520. </div>
  521. {/if}
  522. <ChatItem
  523. {chat}
  524. {shiftKey}
  525. selected={selectedChatId === chat.id}
  526. on:select={() => {
  527. selectedChatId = chat.id;
  528. }}
  529. on:unselect={() => {
  530. selectedChatId = null;
  531. }}
  532. on:delete={(e) => {
  533. if ((e?.detail ?? '') === 'shift') {
  534. deleteChatHandler(chat.id);
  535. } else {
  536. deleteChat = chat;
  537. showDeleteConfirm = true;
  538. }
  539. }}
  540. on:tag={(e) => {
  541. const { type, name } = e.detail;
  542. tagEventHandler(type, name, chat.id);
  543. }}
  544. />
  545. {/each}
  546. {#if $scrollPaginationEnabled && !allChatsLoaded}
  547. <Loader
  548. on:visible={(e) => {
  549. if (!chatListLoading) {
  550. loadMoreChats();
  551. }
  552. }}
  553. >
  554. <div class="w-full flex justify-center py-1 text-xs animate-pulse items-center gap-2">
  555. <Spinner className=" size-4" />
  556. <div class=" ">Loading...</div>
  557. </div>
  558. </Loader>
  559. {/if}
  560. {:else}
  561. <div class="w-full flex justify-center py-1 text-xs animate-pulse items-center gap-2">
  562. <Spinner className=" size-4" />
  563. <div class=" ">Loading...</div>
  564. </div>
  565. {/if}
  566. </div>
  567. </div>
  568. <div class="px-2.5 pb-safe-bottom">
  569. <!-- <hr class=" border-gray-900 mb-1 w-full" /> -->
  570. <div class="flex flex-col font-primary">
  571. {#if $user !== undefined}
  572. <UserMenu
  573. role={$user.role}
  574. on:show={(e) => {
  575. if (e.detail === 'archived-chat') {
  576. showArchivedChats.set(true);
  577. }
  578. }}
  579. >
  580. <button
  581. class=" flex rounded-xl py-3 px-3.5 w-full hover:bg-gray-100 dark:hover:bg-gray-900 transition"
  582. on:click={() => {
  583. showDropdown = !showDropdown;
  584. }}
  585. >
  586. <div class=" self-center mr-3">
  587. <img
  588. src={$user.profile_image_url}
  589. class=" max-w-[30px] object-cover rounded-full"
  590. alt="User profile"
  591. />
  592. </div>
  593. <div class=" self-center font-medium">{$user.name}</div>
  594. </button>
  595. </UserMenu>
  596. {/if}
  597. </div>
  598. </div>
  599. </div>
  600. </div>
  601. <style>
  602. .scrollbar-hidden:active::-webkit-scrollbar-thumb,
  603. .scrollbar-hidden:focus::-webkit-scrollbar-thumb,
  604. .scrollbar-hidden:hover::-webkit-scrollbar-thumb {
  605. visibility: visible;
  606. }
  607. .scrollbar-hidden::-webkit-scrollbar-thumb {
  608. visibility: hidden;
  609. }
  610. </style>