{"version":3,"names":["createContext","useContext","NOOP_TOOLBAR_ROOT_CONTEXT","disabled","orientation","present","ToolbarRootContext","useToolbarRootContext","optional","context","Error"],"sources":["toolbar-root-context.ts"],"sourcesContent":["import { type Accessor, createContext, useContext } from \"solid-js\";\nimport type { Orientation } from \"../internals/types\";\n\n/**\n * Per-item metadata carried alongside a `<Toolbar.Button>` or `<Toolbar.Link>`\n * registration. `focusableWhenDisabled` is the only field — it drives the\n * `disabledIndices` projection on the composite root so arrow navigation can\n * skip items that cannot take focus.\n */\nexport interface ToolbarRootItemMetadata {\n\tfocusableWhenDisabled: boolean;\n}\n\n/**\n * Value handed down by `<Toolbar.Root>` to descendant parts.\n *\n * Solid 2 adaptations from Base UI React's `ToolbarRootContext`:\n *\n * - Reactive slots are `Accessor<T>` so children pull on demand without\n *   tripping the top-level-reactive-read rule.\n * - `present` is `true` only when provided by a real `<Toolbar.Root>`.\n *   Parts branch on it — `<Toolbar.Separator>` tolerates being rendered\n *   outside, and `<Toolbar.Button>` / `<Toolbar.Link>` throw (matching React).\n *\n * Note: React's `setItemMap` does NOT appear here. Each item already reports\n * its metadata via `useCompositeListItem({ metadata })`; the root captures the\n * sorted map from `<CompositeList onMapChange>` and derives `disabledIndices`\n * directly. See the header comment in `toolbar-root.tsx`.\n */\nexport interface ToolbarRootContextValue {\n\t/** Whether the whole toolbar ignores user interaction. */\n\tdisabled: Accessor<boolean>;\n\t/** Navigation orientation. */\n\torientation: Accessor<Orientation>;\n\t/** Marker — `true` when provided by a real `<Toolbar.Root>`. */\n\treadonly present: boolean;\n}\n\n/**\n * No-op sentinel used when parts are rendered outside a `<Toolbar.Root>`.\n * Children branch on `.present` to decide whether to throw.\n */\nexport const NOOP_TOOLBAR_ROOT_CONTEXT: ToolbarRootContextValue = {\n\tdisabled: () => false,\n\torientation: () => \"horizontal\",\n\tpresent: false,\n};\n\nexport const ToolbarRootContext = createContext<ToolbarRootContextValue>(\n\tNOOP_TOOLBAR_ROOT_CONTEXT,\n);\n\nexport function useToolbarRootContext(optional: true): ToolbarRootContextValue;\nexport function useToolbarRootContext(\n\toptional?: false,\n): ToolbarRootContextValue;\nexport function useToolbarRootContext(\n\toptional = false,\n): ToolbarRootContextValue {\n\tconst context = useContext(ToolbarRootContext);\n\tif (!context.present && !optional) {\n\t\tthrow new Error(\n\t\t\t\"Base UI: ToolbarRootContext is missing. Toolbar parts must be placed within <Toolbar.Root>.\",\n\t\t);\n\t}\n\treturn context;\n}\n"],"mappings":"AAAA,SAAwBA,aAAa,EAAEC,UAAU,QAAQ,UAAU;;AAGnE;AACA;AACA;AACA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAUA;AACA;AACA;AACA;AACA,OAAO,MAAMC,yBAAkD,GAAG;EACjEC,QAAQ,EAAEA,CAAA,KAAM,KAAK;EACrBC,WAAW,EAAEA,CAAA,KAAM,YAAY;EAC/BC,OAAO,EAAE;AACV,CAAC;AAED,OAAO,MAAMC,kBAAkB,GAAGN,aAAa,CAC9CE,yBACD,CAAC;AAMD,OAAO,SAASK,qBAAqBA,CACpCC,QAAQ,GAAG,KAAK,EACU;EAC1B,MAAMC,OAAO,GAAGR,UAAU,CAACK,kBAAkB,CAAC;EAC9C,IAAI,CAACG,OAAO,CAACJ,OAAO,IAAI,CAACG,QAAQ,EAAE;IAClC,MAAM,IAAIE,KAAK,CACd,6FACD,CAAC;EACF;EACA,OAAOD,OAAO;AACf","ignoreList":[]}