char-fork/llama.cpp
git clone https://git.t4t.associates/char-fork/llama.cpp
92d1bb0c9
char/aliceai-t5-moe
1/** 2* Scroll container binding and navigation guard for the ChatScreen. 3* 4* Binds the `AutoScrollController` to `document.documentElement`, exposes 5* the container for programmatic scrolling, and flags an `isNavigating` 6* window during route changes so the controller can reset without its 7* scroll handler seeing spurious events from layout shifts. 8*/ 9 10import type { AutoScrollController } from './use-auto-scroll.svelte' ; 11import { afterNavigate , beforeNavigate } from '$app/navigation' ; 12 13export function useChatScreenScroll ( autoScroll :AutoScrollController ) { 14let chatScrollContainer :HTMLElement | undefined = $state (); 15let isNavigating = $state ( false ); 16 17function handleScroll ( event :UIEvent ) { 18// Ignore scroll events caused by navigation layout changes or by our own 19// programmatic scrolls so they don't accidentally disable auto-scroll. 20if ( isNavigating || ! event . isTrusted ) return ; 21 22autoScroll . handleScroll (); 23} 24 25beforeNavigate (() => { 26isNavigating = true ; 27autoScroll . resetScrollState (); 28}); 29 30afterNavigate (() => { 31setTimeout (() => { 32isNavigating = false ; 33autoScroll . resetScrollState (); 34}, 10 ); 35}); 36 37$effect (() => { 38chatScrollContainer = document . documentElement ; 39autoScroll . setContainer ( chatScrollContainer ); 40}); 41 42return { 43get chatScrollContainer () { 44return chatScrollContainer ; 45}, 46 handleScroll 47}; 48}