@scrolia/vanilla
Version:
A headless scrollbar component
32 lines • 1.15 kB
TypeScript
import { CompleteOptions } from "../@types/options.js";
import { Context } from "atomico/types/context";
import * as Atom from "atomico";
/** Options for the `ScrollCore` context. */
type ScrollCoreOptions = CompleteOptions;
/** States for the `ScrollCore` context. */
type ScrollCoreStates = {
hvTrack: boolean;
setHvTrack: Atom.SetState<boolean>;
hvThumb: boolean;
setHvThumb: Atom.SetState<boolean>;
total: Atom.Ref<number>;
view: Atom.Ref<number>;
viewOffset: Atom.Ref<number>;
scrollbarLength: number;
setScrollbarLength: Atom.SetState<number>;
scrollbarOffset: number;
setScrollbarOffset: Atom.SetState<number>;
};
/** Core for internal logic. */
type ScrollCore = {
options: ScrollCoreOptions;
contentRef: Atom.Ref<HTMLElement | null>;
x: ScrollCoreStates;
y: ScrollCoreStates;
};
/** `ScrollCore` context. */
declare const ScrollCoreContext: Context<ScrollCore | null>;
/** Hook for using the `ScrollCore` context. */
declare const useScrollCore: () => ScrollCore;
export { type ScrollCore, ScrollCoreContext, type ScrollCoreOptions, type ScrollCoreStates, useScrollCore };
//# sourceMappingURL=scrollcore.d.ts.map