// lib/scrollBus.ts export interface ScrollBusState { current: number; velocity: number; progress: number; /** Banner/footer-geometry camera progress (original sP global, 0..1). */ sP: number; } export const scrollBus: ScrollBusState = { current: 0, velocity: 0, progress: 0, sP: 0, }; /** * Lightweight pub/sub so DOM components (hyper-space section stages) can * read `scrollBus.current` reactively via useSyncExternalStore — the * original reads it through `useLenisScrollTop` (module 35231). */ const scrollListeners = new Set<() => void>(); export function subscribeScroll(cb: () => void): () => void { scrollListeners.add(cb); return () => { scrollListeners.delete(cb); }; } export function notifyScroll() { for (const cb of scrollListeners) cb(); }