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

/**
 * Root context shared across every `<NumberField.*>` part. Every reactive
 * entry is exposed as an `Accessor<T>` so descendants can subscribe to the
 * pieces they care about without rereading the entire bag.
 *
 * Non-reactive slots (`inputRef`, `valueRef`, `hasPendingCommitRef`) are
 * plain mutable records — shared between root / input / buttons so each
 * part can read the latest committed state synchronously from event
 * handlers.
 */

/**
 * `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 NumberFieldRootContext = createContext(null);
export function useNumberFieldRootContext() {
  const context = useContext(NumberFieldRootContext);
  if (context == null) {
    throw new Error("Base UI: NumberFieldRootContext is missing. NumberField parts must be placed within <NumberField.Root>.");
  }
  return context;
}
//# sourceMappingURL=number-field-root-context.jsx.map
