import { type Accessor, createContext, useContext } from "solid-js"; import type { Placement } from "./utils"; export interface PopperContextValue { currentPlacement: Accessor; contentRef: Accessor; setPositionerRef: (el: HTMLElement) => void; setArrowRef: (el: HTMLElement) => void; } export const PopperContext = createContext(); export function usePopperContext() { const context = useContext(PopperContext); if (context === undefined) { throw new Error( "[kobalte]: `usePopperContext` must be used within a `Popper` component", ); } return context; }