import { ContextTrinity } from "../createTrinity/index.mjs"; import { RegistryContext, RegistryOptions, RegistryTicket } from "../createRegistry/index.mjs"; //#region src/composables/createTimeline/index.d.ts interface TimelineContext extends RegistryContext { /** * Removes the last registered ticket and stores it for redo * * @returns The removed ticket, or undefined if there are no tickets to undo. * * @see https://0.vuetifyjs.com/composables/registration/create-timeline * * @example * ```ts * import { useTimeline } from '@vuetify/v0' * * const timeline = useTimeline() * * timeline.register({ id: 'one' }) * timeline.register({ id: 'two' }) * * console.log(timeline.values()) // [{ id: 'one' }, { id: 'two' }] * * timeline.undo() * console.log(timeline.values()) // [{ id: 'one' }] * ``` */ undo: () => Z | undefined; /** * Restores the last undone ticket * * @returns The restored ticket, or undefined if there are no tickets to redo. * * @see https://0.vuetifyjs.com/composables/registration/create-timeline * * @example * ```ts * import { useTimeline } from '@vuetify/v0' * * const timeline = useTimeline() * * timeline.register({ id: 'one' }) * timeline.register({ id: 'two' }) * * console.log(timeline.values()) // [{ id: 'one' }, { id: 'two' }] * * timeline.undo() * console.log(timeline.values()) // [{ id: 'one' }] * * timeline.redo() * console.log(timeline.values()) // [{ id: 'one' }, { id: 'two' }] * ``` */ redo: () => Z | undefined; } interface TimelineTicket extends RegistryTicket {} interface TimelineOptions extends RegistryOptions { /** * The maximum size of the timeline. * * @default 10 */ size?: number; } interface TimelineContextOptions extends TimelineOptions { namespace?: string; } /** * Creates a new timeline instance. * * @param options The options for the timeline instance. * @template Z The type of the timeline ticket. * @template E The type of the timeline context. * @returns A new timeline instance. * * @see https://0.vuetifyjs.com/composables/registration/create-timeline * * @example * ```ts * import { useTimeline } from '@vuetify/v0' * * const timeline = useTimeline({ size: 3 }) * * timeline.onboard([{ id: 'one' }, { id: 'two' }, { id: 'three' }]) * * console.log(timeline.values()) // [{ id: 'one' }, { id: 'two' }, { id: 'three' }] * * timeline.undo() * console.log(timeline.values()) // [{ id: 'one' }, { id: 'two' }] * * timeline.redo() * console.log(timeline.values()) // [{ id: 'one' }, { id: 'two' }, { id: 'three' }] * ``` */ declare function createTimeline = TimelineContext>(_options?: TimelineOptions): E; /** * Creates a new timeline context. * * @param options The options for the timeline context. * @template Z The type of the timeline ticket. * @template E The type of the timeline context. * @returns A new timeline context. * * @see https://0.vuetifyjs.com/composables/registration/create-timeline * * @example * ```ts * import { createTimelineContext } from '@vuetify/v0' * * // With default namespace 'v0:timeline' * export const [useTimeline, provideTimeline, context] = createTimelineContext({ size: 5 }) * * context.register({ id: 'example' }) * * // In a parent component * provideTimeline() * * // In a child component * const timeline = useTimeline() * * console.log(timeline.values()) // [{ id: 'example' }] * ``` */ declare function createTimelineContext = TimelineContext>(_options?: TimelineContextOptions): ContextTrinity; /** * Returns the current timeline instance. * * @param namespace The namespace for the timeline context. Defaults to `'v0:timeline'`. * @returns The current timeline instance. * * @see https://0.vuetifyjs.com/composables/registration/create-timeline * * @example * ```vue * * ``` */ declare function useTimeline = TimelineContext>(namespace?: string): E; //#endregion export { TimelineContext, TimelineContextOptions, TimelineOptions, TimelineTicket, createTimeline, createTimelineContext, useTimeline };