import type { Accessor } from "solid-js"; import type { ScrollAreaRootState } from "../root/scroll-area-root-context.ts"; import { ScrollAreaRootDataAttributes } from "../root/scroll-area-root-data-attributes.ts"; /** * Reactive `data-*` getter bag shared by ``, * ``, ``, and the scrollbar parts. * Each key is a live getter reading through the supplied `state` accessor โ€” * safe to spread into `mergeRootProps` without losing reactivity. * * Mirrors `scrollAreaStateAttributesMapping` (see `../root/state-attributes-mapping.ts`): * `cornerHidden` is intentionally not projected. `data-scrolling` is omitted * because the legacy mapping never included it (the root state shape carries * the field but the mapping skipped it under the default projection rule that * `false` โ‡’ no attr โ€” present here for completeness so that `true` projects). * * Established as part of ยง1 wave 3 alongside `numberFieldDataAttrs` and * `sliderDataAttrs`. */ export function scrollAreaDataAttrs( state: Accessor, ): Record { return { get [ScrollAreaRootDataAttributes.hasOverflowX](): "" | undefined { return state().hasOverflowX ? "" : undefined; }, get [ScrollAreaRootDataAttributes.hasOverflowY](): "" | undefined { return state().hasOverflowY ? "" : undefined; }, get [ScrollAreaRootDataAttributes.overflowXStart](): "" | undefined { return state().overflowXStart ? "" : undefined; }, get [ScrollAreaRootDataAttributes.overflowXEnd](): "" | undefined { return state().overflowXEnd ? "" : undefined; }, get [ScrollAreaRootDataAttributes.overflowYStart](): "" | undefined { return state().overflowYStart ? "" : undefined; }, get [ScrollAreaRootDataAttributes.overflowYEnd](): "" | undefined { return state().overflowYEnd ? "" : undefined; }, }; }