From 57dc0ba5d1c4fa38450cce9c9a55e36774e11147 Mon Sep 17 00:00:00 2001 From: broisnees Date: Mon, 16 Nov 2026 14:07:33 +0000 Subject: [PATCH] Labs: flat tab bar, one name per database, quiet swap; smaller plan tag - Tab bar: no divider and no dimming between databases. Tabs keep one order across a switch, and an AI chat tab stays in place instead of vanishing while its database is in the background. The clicked tab lights up at once. - Status bar: the database chip is the one in front; the other open databases follow it once each as plain names (it listed the current one twice, with dots). - The switch turns transitions off for two frames, so tab pills, row highlights and chips don't each fade in their own 100ms. - Plan tag (Pro, Trial, Free): a small flat tag at the label's height instead of the big glossy grained pill. --- src/app.css | 45 ++++++++++-------------- src/lib/components/AccountCard.svelte | 2 +- src/lib/components/SettingsDialog.svelte | 2 +- src/lib/components/SharesPage.svelte | 2 +- src/lib/components/StatusBar.svelte | 28 ++++++--------- src/lib/components/StudioShell.svelte | 32 ++++++++++++----- src/lib/components/TabBar.svelte | 8 ++--- 7 files changed, 58 insertions(+), 61 deletions(-) diff --git a/src/app.css b/src/app.css index 9d470c90..802b2728 100644 --- a/src/app.css +++ b/src/app.css @@ -1291,6 +1291,14 @@ select optgroup { /* The OS preference, unless Settings → Appearance has overridden it to "Full". `data-motion` is absent when the setting is "System", so the media query is the only thing deciding then. */ +/* Labs, switching between open databases: the whole screen swaps at once, so + nothing fades or slides for that frame (StudioShell sets it for two frames). + Without it every tab pill, row highlight and chip ran its own 100ms + transition and the swap read as layers flickering in turn. */ +html[data-swapping] :is(*, *::before, *::after) { + transition: none !important; +} + @media (prefers-reduced-motion: reduce) { html:not([data-motion="full"]) :is(*, *::before, *::after) { animation-duration: 0.01ms !important; @@ -1530,36 +1538,21 @@ pre code, linear-gradient(to bottom, transparent 45%, rgb(0 0 0 / 0.24)); } -/* ── Glossy chip ───────────────────────────────────────────────────────────── - A tinted pill in `--chip` (a colour): a lit top edge, a soft fill that darkens - toward the foot, a hairline ring and the same fine grain as the marks. Used - for plan badges (Pro, Trial). */ +/* ── Plan tag ──────────────────────────────────────────────────────────────── + A small flat tag in `--chip` (a colour): a faint tint and a hairline ring, + nothing more. It sits beside a name or a setting label, so it stays at the + text's own height and never reads as a button. Used for plan badges (Pro, + Trial, Free). */ .chip-gloss { --chip: var(--success); - position: relative; - isolation: isolate; - overflow: hidden; display: inline-flex; align-items: center; - border-radius: 9999px; - color: color-mix(in oklch, var(--chip) 88%, var(--foreground)); - background: linear-gradient(to bottom, color-mix(in oklch, var(--chip) 24%, transparent), color-mix(in oklch, var(--chip) 12%, transparent)); - box-shadow: - inset 0 1px 0 color-mix(in oklch, white 22%, transparent), - inset 0 0 0 1px color-mix(in oklch, var(--chip) 40%, transparent), - 0 1px 2px rgb(0 0 0 / 0.18); -} -.chip-gloss::after { - content: ""; - position: absolute; - inset: 0; - z-index: -1; - pointer-events: none; - border-radius: inherit; - opacity: 0.22; - mix-blend-mode: overlay; - background-image: url("data:image/svg+xml;utf8,"); - background-size: 120px 120px; + border-radius: 0.3125rem; + letter-spacing: 0.01em; + line-height: 1; + color: color-mix(in oklch, var(--chip) 85%, var(--foreground)); + background: color-mix(in oklch, var(--chip) 12%, transparent); + box-shadow: inset 0 0 0 1px color-mix(in oklch, var(--chip) 24%, transparent); } .chip-gloss.chip-warning { --chip: var(--warning); } /* ── Glossy key ────────────────────────────────────────────────────────────── diff --git a/src/lib/components/AccountCard.svelte b/src/lib/components/AccountCard.svelte index 3d7443bc..77d43482 100644 --- a/src/lib/components/AccountCard.svelte +++ b/src/lib/components/AccountCard.svelte @@ -45,7 +45,7 @@ {#snippet planPill()}

{label} - {#if badge}{badge.label}{/if} + {#if badge}{badge.label}{/if}

{desc}

diff --git a/src/lib/components/SharesPage.svelte b/src/lib/components/SharesPage.svelte index 9a99635b..87667f06 100644 --- a/src/lib/components/SharesPage.svelte +++ b/src/lib/components/SharesPage.svelte @@ -239,7 +239,7 @@
{:else} - Pro + Pro {/if} {/if} diff --git a/src/lib/components/StatusBar.svelte b/src/lib/components/StatusBar.svelte index 8dac8043..519ffbb7 100644 --- a/src/lib/components/StatusBar.svelte +++ b/src/lib/components/StatusBar.svelte @@ -725,30 +725,24 @@ {/if} - + {#if switchingTo} - {@render sep()} - Opening {switchingTo} + {switchingTo} - {:else if openDatabases.length} - {@render sep()} -
- {#each openDatabases as db (db.key)} + {:else if openDatabases.length > 1} +
+ {#each openDatabases.filter((d) => !d.current) as db (db.key)} {/each} diff --git a/src/lib/components/StudioShell.svelte b/src/lib/components/StudioShell.svelte index 33d7c06f..e4e2ea5a 100644 --- a/src/lib/components/StudioShell.svelte +++ b/src/lib/components/StudioShell.svelte @@ -8627,8 +8627,12 @@ let rowSearch = $state('') async function activateForeignTab(id) { const hit = sessionOfTab(id) if (!hit) return - await handleSwitchDatabase(hit.s.conn, { focusTab: id }) + // The clicked tab lights up now, not when its database is in front. + pressedTab = id + try { await handleSwitchDatabase(hit.s.conn, { focusTab: id }) } finally { pressedTab = '' } } + /** Labs: a tab of another database that was clicked and is being brought forward. */ + let pressedTab = $state('') /** Close a tab of another open database without switching to it. @param {string} id */ function closeForeignTab(id) { @@ -8642,9 +8646,9 @@ let rowSearch = $state('') /** * Labs: one tab bar for every open database. This database's tabs and the - * kept ones, grouped in the order the databases were opened. A group after - * the first starts with a divider; which database a tab belongs to is in its - * tooltip and in the status bar (openDatabases), not on the tab. + * kept ones, in the order the databases were opened, so no tab moves on a + * switch. They look like any other tab: which database one belongs to is in + * its tooltip and in the status bar (openDatabases). */ const barTabs = $derived.by(() => { void sessionsTick @@ -8660,8 +8664,7 @@ let rowSearch = $state('') for (const k of order) { const group = k === here ? own.map((t) => ({ ...t, connLabel: label })) - : (_sessions.get(k)?.tabs ?? []).filter((t) => t.kind !== 'welcome' && t.kind !== 'ai').map((t) => ({ ...t, connLabel: _sessions.get(k)?.label, foreign: true })) - if (group.length && out.length) group[0] = { ...group[0], groupStart: true } + : (_sessions.get(k)?.tabs ?? []).filter((t) => t.kind !== 'welcome' && ($appAiInTab || t.kind !== 'ai')).map((t) => ({ ...t, connLabel: _sessions.get(k)?.label, foreign: true })) out.push(...group) } return out @@ -8805,11 +8808,22 @@ let rowSearch = $state('') _sessions.delete(key) noteSession(key) sessionsTick++ + holdTransitions() await resumeSession(session.conn, session, focusTab) sidebarShowTables() return true } + /** Swap the screen without transitions until two frames after the change (app.css, data-swapping). */ + function holdTransitions() { + const root = document.documentElement + root.setAttribute('data-swapping', '') + clearTimeout(_swapTimer) + _swapTimer = setTimeout(() => requestAnimationFrame(() => requestAnimationFrame(() => root.removeAttribute('data-swapping'))), 0) + } + /** @type {ReturnType | undefined} */ + let _swapTimer + /** * Connect, and when a provider's credentials were revoked or rotated in its * console, mint fresh ones once: the same recovery the connect dialog does. @@ -9976,7 +9990,7 @@ let rowSearch = $state('') {#if tabsInTitle} (tabs.some((t) => t.id === id) ? activateTab(id) : activateForeignTab(id))} onclose={(id) => (tabs.some((t) => t.id === id) ? closeTab(id) : closeForeignTab(id))} oncloseothers={(id) => { if (tabs.some((t) => t.id === id)) closeOtherTabs(id) }} @@ -10337,7 +10351,7 @@ let rowSearch = $state('') {#if tabBarVisible && !tabsInTitle} (tabs.some((t) => t.id === id) ? activateTab(id) : activateForeignTab(id))} onclose={(id) => (tabs.some((t) => t.id === id) ? closeTab(id) : closeForeignTab(id))} oncloseothers={(id) => { if (tabs.some((t) => t.id === id)) closeOtherTabs(id) }} @@ -10360,7 +10374,7 @@ let rowSearch = $state('') databases show their tabs here too. Split, each pane lists its own. --> t.foreign) ? barTabs : group.tabIds.map((id) => tabsById.get(id)).filter(Boolean)} - activeTabId={group.activeTabId} + activeTabId={pressedTab || group.activeTabId} onselect={(id) => (tabs.some((t) => t.id === id) ? void focusTabInGroup(group.id, id) : void activateForeignTab(id))} onclose={(id) => (tabs.some((t) => t.id === id) ? void closeTabInGroup(group.id, id) : closeForeignTab(id))} oncloseothers={(id) => { if (tabs.some((t) => t.id === id)) closeOtherTabs(id) }} diff --git a/src/lib/components/TabBar.svelte b/src/lib/components/TabBar.svelte index 99ae90ac..9cb091ac 100644 --- a/src/lib/components/TabBar.svelte +++ b/src/lib/components/TabBar.svelte @@ -178,10 +178,6 @@ {@const tabIconName = tabIcon(tab)} {@const active = tab.id === activeTabId} - - {#if tab.groupStart} - - {/if} {#snippet child({ props: ctxProps })} @@ -220,8 +216,8 @@ )} onclick={() => { if (_suppressTabClick) { _suppressTabClick = false; return } onselect(tab.id) }} > - - {tabDisplayTitle(tab)} + + {tabDisplayTitle(tab)} {#if tab.pinned}