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

/** `side` values reported by floating-ui's `placement.split('-')[0]`. */

/** `align` values mapped from floating-ui's placement suffix. */

/**
 * Shared positioning state produced by the positioner and consumed by the
 * arrow + popup for their own reactive `side` / `align` data-attrs and for
 * the arrow's absolute-position styles.
 *
 * Mirrors Base UI React's `PopoverPositionerContext`.
 */

export const PopoverPositionerContext = createContext(null);

/**
 * Read the current `<Popover.Positioner>` context. Throws unless the
 * consumer is rendered inside a positioner.
 */
export function usePopoverPositionerContext() {
  const context = useContext(PopoverPositionerContext);
  if (context == null) {
    throw new Error("Base UI: PopoverPositionerContext is missing. Popover.Arrow and Popover.Popup must be placed inside <Popover.Positioner>.");
  }
  return context;
}
//# sourceMappingURL=popover-positioner-context.jsx.map
