// Shared context for cross-pane focus state and projectId plumbing. // // `focusBlockId` drives diagram selection / chip hover styling. The richer // term/finding/etc detail navigation now lives in the column-stack // (openPanesStore), so this context is intentionally minimal. "use client"; import { createContext, useContext, useMemo, useState, type ReactNode } from "react"; interface PaneContextValue { projectId: string; focusBlockId: string | null; setFocusBlockId: (id: string | null) => void; } const Ctx = createContext(null); interface ProviderProps { projectId: string; children: ReactNode; } export function EditorPaneContextProvider({ projectId, children }: ProviderProps) { const [focusBlockId, setFocusBlockId] = useState(null); const value = useMemo( () => ({ projectId, focusBlockId, setFocusBlockId }), [projectId, focusBlockId] ); return {children}; } export function useEditorPaneContext(): PaneContextValue { const ctx = useContext(Ctx); if (!ctx) throw new Error("useEditorPaneContext must be inside "); return ctx; }