{"version":3,"names":["createContext","useContext","ProgressRootContext","useProgressRootContext","context","Error"],"sources":["progress-root-context.ts"],"sourcesContent":["import { type Accessor, createContext, useContext } from \"solid-js\";\n\n/**\n * Task completion status bubbled through the progress tree.\n *\n * - `indeterminate` — the `value` prop is `null`; no measurable progress\n * - `progressing`   — `0 ≤ value < max`\n * - `complete`      — `value === max`\n */\nexport type ProgressStatus = \"indeterminate\" | \"progressing\" | \"complete\";\n\nexport interface ProgressRootState {\n\t/** The current task status. */\n\tstatus: ProgressStatus;\n}\n\n/**\n * The value handed down by `<Progress.Root>` to its children.\n *\n * Every reactive entry is an `Accessor<T>` so that consumers pull the latest\n * value on demand — matching the no-top-level-reactive-reads rule from\n * Solid 2 RFC 01.\n */\nexport interface ProgressRootContextValue {\n\t/** Formatted value string (empty string when `value` is `null`). */\n\tformattedValue: Accessor<string>;\n\t/** The maximum value. */\n\tmax: Accessor<number>;\n\t/** The minimum value. */\n\tmin: Accessor<number>;\n\t/** The current value (`null` = indeterminate). */\n\tvalue: Accessor<number | null>;\n\t/** Current root state — supplies shared state to every part. */\n\tstate: Accessor<ProgressRootState>;\n\t/** Current status — same info as `state().status`, here for convenience. */\n\tstatus: Accessor<ProgressStatus>;\n\t/**\n\t * Register a label id so the root can wire `aria-labelledby`. Called by\n\t * `<Progress.Label>` on mount (passes the id) and on cleanup (passes\n\t * `undefined`). Safe to invoke from inside owned scope — the underlying\n\t * signal opts into `ownedWrite` because it's pure internal plumbing.\n\t */\n\tsetLabelId: (id: string | undefined) => void;\n\t/** Current registered label id (if any). */\n\tlabelId: Accessor<string | undefined>;\n}\n\n/**\n * Progress root context. `createContext<T | null>(null)` + `== null` sentinel\n * — Solid 2's `useContext` throws `ContextNotFoundError` when\n * the default is `undefined`, which would shadow the intended Base UI error\n * message below.\n */\nexport const ProgressRootContext =\n\tcreateContext<ProgressRootContextValue | null>(null);\n\n/**\n * Read the `<Progress.Root>` context. Throws a descriptive error if the\n * caller forgot to wrap their subtree in `<Progress.Root>` — matches Base\n * UI React.\n */\nexport function useProgressRootContext(): ProgressRootContextValue {\n\tconst context = useContext(ProgressRootContext);\n\tif (context == null) {\n\t\tthrow new Error(\n\t\t\t\"Base UI: ProgressRootContext is missing. Progress parts must be placed within <Progress.Root>.\",\n\t\t);\n\t}\n\treturn context;\n}\n"],"mappings":"AAAA,SAAwBA,aAAa,EAAEC,UAAU,QAAQ,UAAU;;AAEnE;AACA;AACA;AACA;AACA;AACA;AACA;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;;AAyBA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,mBAAmB,GAC/BF,aAAa,CAAkC,IAAI,CAAC;;AAErD;AACA;AACA;AACA;AACA;AACA,OAAO,SAASG,sBAAsBA,CAAA,EAA6B;EAClE,MAAMC,OAAO,GAAGH,UAAU,CAACC,mBAAmB,CAAC;EAC/C,IAAIE,OAAO,IAAI,IAAI,EAAE;IACpB,MAAM,IAAIC,KAAK,CACd,gGACD,CAAC;EACF;EACA,OAAOD,OAAO;AACf","ignoreList":[]}