import { createContext, useContext } from "solid-js";

/**
 * x/y pixel pair — used for scroll positions and corner measurements.
 */

/**
 * width/height pixel pair — used for thumb and corner measurements.
 */

/**
 * Overflow-edge flags. Each flag indicates whether the scroll offset on the
 * corresponding side exceeds the configured threshold.
 */

/**
 * Scrollbar visibility. A scrollbar is hidden when the content doesn't
 * overflow along its axis; the corner is hidden when either scrollbar is
 * hidden.
 */

/**
 * Normalized overflow-edge threshold (all four sides, pixels). Consumers
 * pass either a number or a partial object to `<ScrollArea.Root>`; the root
 * component normalizes it into this shape before publishing to context.
 */

/**
 * Shared root state projected onto the root, viewport, content and
 * scrollbar parts. Mirrors Base UI React's `ScrollAreaRootState`.
 */

/**
 * Mutable ref container — mirrors React's `RefObject<T | null>` so the
 * scroll-area port reads 1:1 against the React source.
 */

/**
 * Value published by `<ScrollArea.Root>` to its descendants.
 *
 * Every reactive field is an `Accessor<T>` so subscribers stay narrow. Setters
 * are plain functions that write into the root's signals. Element refs are
 * mutable containers rather than accessors — the ref targets don't need to
 * trigger re-renders (their imperative reads happen inside event handlers
 * and layout effects).
 */

/**
 * Root context. `createContext<T | null>(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 ScrollAreaRootContext = createContext(null);

/**
 * Read the `<ScrollArea.Root>` context. Throws when used outside a root.
 */
export function useScrollAreaRootContext() {
  const context = useContext(ScrollAreaRootContext);
  if (context == null) {
    throw new Error("Base UI: ScrollAreaRootContext is missing. ScrollArea parts must be placed within <ScrollArea.Root>.");
  }
  return context;
}
//# sourceMappingURL=scroll-area-root-context.jsx.map
