diff --git a/tools/ui/src/lib/components/app/models/ModelsManager/ModelsManager.svelte b/tools/ui/src/lib/components/app/models/ModelsManager/ModelsManager.svelte index 5aaab7a3d9..7502744d50 100644 --- a/tools/ui/src/lib/components/app/models/ModelsManager/ModelsManager.svelte +++ b/tools/ui/src/lib/components/app/models/ModelsManager/ModelsManager.svelte @@ -256,6 +256,31 @@ /** How long the panel takes to fade out before it swaps to another model. */ const SWAP_FADE_MS = 150; + /** How long the calls to action take to leave the toolbar, matching their collapse. */ + const CTA_LEAVE_MS = 200; + /** How long the panel takes to slide out before the calls to action come back. */ + const PANE_LEAVE_MS = 150; + + // The calls to action leave first, then the panel takes the space they gave up. + // Closing runs the same order backwards. + let ctasVisible = $state(true); + let paneOpen = $state(false); + + $effect(() => { + if (selected !== null) { + untrack(() => (ctasVisible = false)); + + const timer = setTimeout(() => untrack(() => (paneOpen = true)), CTA_LEAVE_MS); + + return () => clearTimeout(timer); + } + + untrack(() => (paneOpen = false)); + + const timer = setTimeout(() => untrack(() => (ctasVisible = true)), PANE_LEAVE_MS); + + return () => clearTimeout(timer); + }); async function toggleLoad(option: ModelOption): Promise { if (modelsStore.isModelLoaded(option.model)) { @@ -295,12 +320,12 @@ {#snippet toolbarEndRegion()} - - + +
{@render toolbarEnd?.()}
@@ -324,12 +349,12 @@ /> -
+
{#if shownOption} {#key shownId}