import type { Readable, Subscriber, Unsubscriber } from "svelte/store"; import type { BreakpointSize } from "./breakpoints"; /** * Creates a readable store that returns the current breakpoint size. * It also provides functions for creating derived stores used to do comparisons. */ export function breakpointObserver(): { subscribe: ( this: void, run: Subscriber, invalidate?: (value?: BreakpointSize | undefined) => void, ) => Unsubscriber; /** * Returns a store readable store that returns whether the current * breakpoint is smaller than size. * @param size - Size to compare against. */ smallerThan: (size: BreakpointSize) => Readable; /** * Returns a store readable store that returns whether the current * breakpoint is larger than size. * @param size - Size to compare against. */ largerThan: (size: BreakpointSize) => Readable; }; export default breakpointObserver;