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

/**
 * The opaque identifier a consumer attaches to a `<Tabs.Tab>` + the matching
 * `<Tabs.Panel>`. `null` disables selection entirely (no panel visible).
 * Matches React Base UI's `TabsTab.Value` (which is also `any | null`).
 */

/**
 * Direction of the most recent activation. `"none"` on first render / when
 * the source or destination tab is missing from the live DOM map.
 */

/** Reason attached to `onValueChange` details. */

/**
 * Change-event details passed to `onValueChange`. Extends the standard Base UI
 * details bag with `activationDirection` so consumers can drive directional
 * animations from their own handler.
 */

/**
 * Metadata stored per `<Tabs.Tab>` in the composite map. `id` is the tab's
 * DOM id — used to wire `aria-labelledby` on the matching panel. `value` is
 * what the consumer passed via `props.value`.
 */

/** Metadata stored per `<Tabs.Panel>` in the composite panel list. */

/**
 * State of `<Tabs.Root>` projected to `data-*` attrs + the `class` /
 * `style` / `render` callback surfaces.
 */

/**
 * Context shared by every `<Tabs.*>` part. Accessors mirror React Base UI's
 * `TabsRootContext` but every slot that's reactive is exposed as an
 * `Accessor<T>` so descendants stay live without a memo ping-pong.
 */

const NOOP = () => {};
export const NOOP_TABS_ROOT_CONTEXT = {
  value: () => undefined,
  onValueChange: NOOP,
  orientation: () => "horizontal",
  tabActivationDirection: () => "none",
  getTabElementBySelectedValue: () => null,
  getTabIdByPanelValue: () => undefined,
  getTabPanelIdByValue: () => undefined,
  registerMountedTabPanel: NOOP,
  unregisterMountedTabPanel: NOOP,
  setTabMap: NOOP,
  present: false
};
export const TabsRootContext = createContext(NOOP_TABS_ROOT_CONTEXT);

/**
 * Read the `<Tabs.Root>` context. Throws when no root ancestor is present —
 * every tabs part requires a root.
 */
export function useTabsRootContext() {
  const context = useContext(TabsRootContext);
  if (!context.present) {
    throw new Error("Base UI: TabsRootContext is missing. Tabs parts must be placed within <Tabs.Root>.");
  }
  return context;
}
//# sourceMappingURL=tabs-root-context.jsx.map
