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

/**
 * Reasons a tooltip's open state can change. Mirrors Base UI React's
 * `TooltipRoot.ChangeEventReason` union.
 */

/**
 * Public projected state — surfaces via `data-*` attrs on the root and
 * downstream parts.
 */

/**
 * `instant` is the string flag that Base UI emits as `data-instant` on the
 * popup / arrow / positioner to disable CSS transitions for specific
 * programmatic transitions (delay-group swap, focus, dismiss).
 */

/**
 * Context shape shared between `<Tooltip.Root>` and every tooltip sub-part.
 * Every reactive field is an `Accessor<T>` so consumers don't need to guard
 * against top-level reactive reads.
 */

/**
 * Solid 2's `useContext` throws `ContextNotFoundError` when the resolved
 * value is `undefined`, so the "no provider" sentinel is `null` here — the
 * helper below turns that into the Base UI error.
 */
export const TooltipRootContext = createContext(null);

/**
 * Read the current `<Tooltip.Root>` context. Throws if used outside a root —
 * matches Base UI React's behavior.
 */
export function useTooltipRootContext() {
  const context = useContext(TooltipRootContext);
  if (context === null) {
    throw new Error("Base UI: TooltipRootContext is missing. Tooltip parts must be placed within <Tooltip.Root>.");
  }
  return context;
}
//# sourceMappingURL=tooltip-root-context.jsx.map
