{"version":3,"names":["createContext","useContext","DrawerProviderContext","useDrawerProviderContext","optional","context","Error"],"sources":["drawer-provider-context.ts"],"sourcesContent":["/**\n * Context set by `<Drawer.Provider>` — a global coordinator that tracks\n * which drawers are open and exposes a non-reactive visual-state store\n * consumed by `<Drawer.Indent>` / `<Drawer.IndentBackground>`.\n *\n * 1:1 port of Base UI React's `DrawerProviderContext`.\n */\n\nimport { type Accessor, createContext, useContext } from \"solid-js\";\n\n/**\n * Non-reactive visual-state store. Driven by swipe progress updates; read\n * by `<Drawer.Indent>` to push CSS vars on its element without any Solid\n * reactivity round-trip (matches React's `useSyncExternalStore` model).\n */\nexport interface DrawerVisualState {\n\tswipeProgress: number;\n\tfrontmostHeight: number;\n}\n\nexport interface DrawerVisualStateStore {\n\tgetSnapshot: () => DrawerVisualState;\n\tsubscribe: (listener: () => void) => () => void;\n\tset: (state: Partial<DrawerVisualState>) => void;\n}\n\nexport interface DrawerProviderContextValue {\n\t/** Register/update a drawer's open flag. */\n\tsetDrawerOpen: (drawerId: string, open: boolean) => void;\n\t/** Remove a drawer from the registry. */\n\tremoveDrawer: (drawerId: string) => void;\n\t/** Whether ANY registered drawer is currently open. */\n\tactive: Accessor<boolean>;\n\t/** Visual-state store. */\n\tvisualStateStore: DrawerVisualStateStore;\n}\n\n/**\n * Null-sentinel context. `<Drawer.Provider>` is optional; most\n * drawer parts consult it via `useDrawerProviderContext(true)`.\n */\nexport const DrawerProviderContext =\n\tcreateContext<DrawerProviderContextValue | null>(null);\n\nexport function useDrawerProviderContext(): DrawerProviderContextValue;\nexport function useDrawerProviderContext(\n\toptional: true,\n): DrawerProviderContextValue | null;\nexport function useDrawerProviderContext(\n\toptional?: boolean,\n): DrawerProviderContextValue | null {\n\tconst context = useContext(DrawerProviderContext);\n\tif (context == null && !optional) {\n\t\tthrow new Error(\n\t\t\t\"Base UI: DrawerProviderContext is missing. Use <Drawer.Provider>.\",\n\t\t);\n\t}\n\treturn context;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAAwBA,aAAa,EAAEC,UAAU,QAAQ,UAAU;;AAEnE;AACA;AACA;AACA;AACA;;AAuBA;AACA;AACA;AACA;AACA,OAAO,MAAMC,qBAAqB,GACjCF,aAAa,CAAoC,IAAI,CAAC;AAMvD,OAAO,SAASG,wBAAwBA,CACvCC,QAAkB,EACkB;EACpC,MAAMC,OAAO,GAAGJ,UAAU,CAACC,qBAAqB,CAAC;EACjD,IAAIG,OAAO,IAAI,IAAI,IAAI,CAACD,QAAQ,EAAE;IACjC,MAAM,IAAIE,KAAK,CACd,mEACD,CAAC;EACF;EACA,OAAOD,OAAO;AACf","ignoreList":[]}