import { createContext, useContext } from "solid-js"; export interface ScrollAreaScrollbarContextValue { orientation: "horizontal" | "vertical"; } /** * `createContext(null)` + `== null` sentinel — * Solid 2's `useContext` throws `ContextNotFoundError` when the default is * `undefined`, which would shadow the intended Base UI error message below. */ export const ScrollAreaScrollbarContext = createContext(null); export function useScrollAreaScrollbarContext(): ScrollAreaScrollbarContextValue { const context = useContext(ScrollAreaScrollbarContext); if (context == null) { throw new Error( "Base UI: ScrollAreaScrollbarContext is missing. ScrollAreaScrollbar parts must be placed within .", ); } return context; }