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

/**
 * Task completion status bubbled through the progress tree.
 *
 * - `indeterminate` — the `value` prop is `null`; no measurable progress
 * - `progressing`   — `0 ≤ value < max`
 * - `complete`      — `value === max`
 */

/**
 * The value handed down by `<Progress.Root>` to its children.
 *
 * Every reactive entry is an `Accessor<T>` so that consumers pull the latest
 * value on demand — matching the no-top-level-reactive-reads rule from
 * Solid 2 RFC 01.
 */

/**
 * Progress 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 ProgressRootContext = createContext(null);

/**
 * Read the `<Progress.Root>` context. Throws a descriptive error if the
 * caller forgot to wrap their subtree in `<Progress.Root>` — matches Base
 * UI React.
 */
export function useProgressRootContext() {
  const context = useContext(ProgressRootContext);
  if (context == null) {
    throw new Error("Base UI: ProgressRootContext is missing. Progress parts must be placed within <Progress.Root>.");
  }
  return context;
}
//# sourceMappingURL=progress-root-context.jsx.map
