import { ContextTrinity } from "../createTrinity/index.mjs"; import { ComputedRef, MaybeRefOrGetter, Ref, ShallowRef, WritableComputedRef } from "vue"; //#region src/composables/createPagination/index.d.ts type PaginationTicket = { type: 'page'; value: number; } | { type: 'ellipsis'; value: string; }; interface PaginationContext { /** Current page (1-indexed, auto-clamped to total pages) */ page: WritableComputedRef; /** Items per page */ itemsPerPage: number; /** Total number of items */ size: number; /** Total number of pages (computed from size / itemsPerPage) */ pages: number; /** Ellipsis character, or false if disabled */ ellipsis: string | false; /** Visible page numbers and ellipsis for rendering */ items: ComputedRef; /** Start index of items on current page (0-indexed) */ pageStart: Readonly>; /** End index of items on current page (exclusive, 0-indexed) */ pageStop: Readonly>; /** Whether current page is the first page */ isFirst: Readonly>; /** Whether current page is the last page */ isLast: Readonly>; /** Go to first page */ first: () => void; /** Go to last page */ last: () => void; /** Go to next page */ next: () => void; /** Go to previous page */ prev: () => void; /** Go to specific page */ select: (value: number) => void; } interface PaginationOptions { /** Initial page or ref for v-model (1-indexed). @default 1 */ page?: number | ShallowRef; /** Items per page. @default 10 */ itemsPerPage?: MaybeRefOrGetter; /** Total number of items. @default 0 */ size?: MaybeRefOrGetter; /** Maximum visible page buttons. @default 7 */ visible?: MaybeRefOrGetter; /** Ellipsis character. @default '...' */ ellipsis?: string | false; } interface PaginationContextOptions extends PaginationOptions { /** Namespace for dependency injection */ namespace?: string; } /** * Creates a pagination instance. * * @param options The options for the pagination instance. * @returns A pagination context with navigation methods. * * @example * ```ts * import { createPagination } from '@vuetify/v0' * * // Basic usage * const pagination = createPagination({ size: 100 }) * pagination.next() * pagination.items.value // [{ type: 'page', value: 1 }, { type: 'page', value: 2 }, ...] * * // With v-model (pass a ref) * const page = ref(1) * const pagination = createPagination({ page, size: 100 }) * // Mutating pagination.page or the passed ref syncs both * ``` */ declare function createPagination(_options?: PaginationOptions): PaginationContext; /** * Creates a pagination context for dependency injection. * * @param options The options including namespace. * @returns A trinity: [usePagination, providePagination, defaultContext] * * @example * ```ts * // With default namespace 'v0:pagination' * const [usePagination, providePaginationContext] = createPaginationContext({ size: 50 }) * * // Or with custom namespace * const [usePagination, providePaginationContext] = createPaginationContext({ * namespace: 'my-pagination', * size: 50, * }) * * // Parent component * providePaginationContext() * * // Child component * const pagination = usePagination() * pagination.next() * ``` */ declare function createPaginationContext(_options?: PaginationContextOptions): ContextTrinity; /** * Returns the current pagination instance from context. * * @param namespace The namespace. @default 'v0:pagination' * @returns The pagination context. * * @example * ```vue * * * * ``` */ declare function usePagination(namespace?: string): PaginationContext; //#endregion export { PaginationContext, PaginationContextOptions, PaginationOptions, PaginationTicket, createPagination, createPaginationContext, usePagination };