import type { JSX } from "@solidjs/web"; import { type MaybeAccessor } from "../../internals/maybe-accessor.js"; import { type ScrollAreaRootContextValue } from "./scroll-area-root-context.js"; /** Raw consumer shape for the overflow-edge threshold. */ export type OverflowEdgeThresholdInput = number | Partial<{ xStart: number; xEnd: number; yStart: number; yEnd: number; }> | undefined; /** * Options for {@link createScrollArea}. Every reactive input is * `MaybeAccessor`. */ export interface CreateScrollAreaOptions { /** * Threshold in pixels that must be exceeded before the overflow-edge * attributes are applied. Accepts a number (applied to all four edges) or * a partial per-edge object. * @default 0 */ overflowEdgeThreshold?: MaybeAccessor; } /** Shape of attributes emitted by `c.root()`. */ export interface ScrollAreaRootSlotProps { role: "presentation"; style: JSX.CSSProperties; onPointerEnter: (event: PointerEvent) => void; onPointerMove: (event: PointerEvent) => void; onPointerLeave: () => void; } /** * Public API returned by {@link createScrollArea}. A superset of * {@link ScrollAreaRootContextValue} — the api object IS the value published * to descendants via the root context, so `` / * `` / `` keep reading it unchanged. * * On top of the context fields it adds the `root()` slot factory, a * `bindRoot` ref setter, a `Provider`, and the observability surface. * * **Inherently DOM-coupled.** Unlike `createSwitch`/`createCollapsible`, this * primitive owns no consumer logical state — its accessors reflect DOM * measurement (thumb/corner sizes, per-axis overflow) populated by the * viewport's `ResizeObserver` + scroll handler and the scrollbar/thumb drag * math. Bound to no elements it reports all-default (everything hidden, sizes * 0). It exists for parity / observability and to consolidate the root's * state machinery in one place, not as a standalone headless engine. */ export interface ScrollAreaApi extends ScrollAreaRootContextValue { /** * Root slot — getter-bag for the presentation `
` (role, pointer * hover handlers, corner-size CSS-var style). Does NOT include `ref` or * `children`; bind the element via {@link bindRoot} and wrap descendants * in {@link Provider} (or render ``). */ root: (userProps?: U) => ScrollAreaRootSlotProps & (U extends object ? U : object); /** Plain setter that binds the live root `
` (writes `rootRef`). */ bindRoot: (el: HTMLDivElement | null) => void; /** * Directive form — a `ref` callback that spreads the root slot bag onto * the element AND binds it. For consumers owning the root element's prop * surface directly. */ rootRefDirective: () => (el: HTMLDivElement | null) => void; /** Context provider. Wrap a subtree to expose the api to descendants. */ Provider: (props: { children: JSX.Element; }) => JSX.Element; } /** * Solid 2.0-native scroll-area primitive. Owns the root's reactive state * (hover / scrolling / measured-scrollbar flags, thumb & corner sizes, * per-axis hidden state, overflow-edge flags), the element refs every part * reads, and the shared pointer/scroll handlers. The viewport's measurement * pipeline and the scrollbar/thumb drag math compose against the refs and * setters exposed here. * * Must be called in an owner scope (component body or `createRoot`) — it * allocates timeouts that install cleanups. */ export declare function createScrollArea(options?: CreateScrollAreaOptions): ScrollAreaApi; //# sourceMappingURL=create-scroll-area.d.ts.map