/**
 * Context set by `<Drawer.Provider>` — a global coordinator that tracks
 * which drawers are open and exposes a non-reactive visual-state store
 * consumed by `<Drawer.Indent>` / `<Drawer.IndentBackground>`.
 *
 * 1:1 port of Base UI React's `DrawerProviderContext`.
 */

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

/**
 * Non-reactive visual-state store. Driven by swipe progress updates; read
 * by `<Drawer.Indent>` to push CSS vars on its element without any Solid
 * reactivity round-trip (matches React's `useSyncExternalStore` model).
 */

/**
 * Null-sentinel context. `<Drawer.Provider>` is optional; most
 * drawer parts consult it via `useDrawerProviderContext(true)`.
 */
export const DrawerProviderContext = createContext(null);
export function useDrawerProviderContext(optional) {
  const context = useContext(DrawerProviderContext);
  if (context == null && !optional) {
    throw new Error("Base UI: DrawerProviderContext is missing. Use <Drawer.Provider>.");
  }
  return context;
}
//# sourceMappingURL=drawer-provider-context.jsx.map
