import { ContextTrinity } from "../createTrinity/index.mjs"; import { DateAdapter } from "./adapters/adapter.mjs"; import { PlainDateAdapter as V0PlainDateAdapter } from "./adapters/plain.mjs"; import "./adapters/index.mjs"; import { ComputedRef, ObjectPlugin } from "vue"; //#region src/composables/useDate/index.d.ts interface DateContext { /** The date adapter instance */ adapter: DateAdapter; /** Current locale (reactive, synced with useLocale if available) */ locale: ComputedRef; /** First day of week, derived from locale or explicit override */ firstDayOfWeek: ComputedRef; } /** Options for date composables */ interface DateOptions { /** * Date adapter instance. Omit it to use `V0PlainDateAdapter`. * Pass `V0DateAdapter` for Temporal. An adapter you pass is not replaced. * * @example * ```ts * import { createDate } from '@vuetify/v0' * import { V0DateAdapter } from '@vuetify/v0/date' * * createDate() * createDate({ adapter: new V0DateAdapter() }) * ``` */ adapter?: DateAdapter; /** Locale for formatting (defaults to useLocale's selected locale or 'en-US') */ locale?: string; /** Short locale codes mapped to full Intl locale strings (e.g., { en: 'en-US' }) */ locales?: Record; /** First day of week override. 0=Sun, 1=Mon, ... 6=Sat. Derived from locale if not set. */ firstDayOfWeek?: number; } /** Context options with namespace */ interface DateContextOptions extends DateOptions { namespace?: string; } /** Plugin options */ interface DatePluginOptions extends DateContextOptions { /** When true, this plugin appears in the Vue DevTools v0 inspector. @default false */ devtools?: boolean; } /** * Creates a new date context. * * @param options Adapter and locale configuration. * @template Z The date type used by the adapter. * @template E The date context type. * @returns A date context. * * @see https://0.vuetifyjs.com/composables/plugins/use-date * * @example * ```ts * import { createDate } from '@vuetify/v0' * import { V0DateAdapter } from '@vuetify/v0/date' * * const { adapter } = createDate() * adapter.toISO(adapter.date()!) * * // Temporal, unchanged * const temporal = createDate({ adapter: new V0DateAdapter() }) * ``` */ declare function createDate(options: DateOptions & { adapter: DateAdapter; }): DateContext; declare function createDate(options?: DateOptions): DateContext; /** * Creates a new date context trinity. * * @param options Adapter, locale, and namespace configuration. * @template Z The date type used by the adapter. * @template E The date context type. * @returns A trinity [useContext, provideContext, defaultContext]. * * @see https://0.vuetifyjs.com/composables/plugins/use-date * * @example * ```ts * import { createDateContext } from '@vuetify/v0' * import { V0DateAdapter } from '@vuetify/v0/date' * * const [useAppDate, provideAppDate] = createDateContext({ * adapter: new V0DateAdapter(), * namespace: 'app:date', * }) * ``` */ declare function createDateContext = DateContext>(_options?: DateContextOptions): ContextTrinity; /** * Creates a new date plugin. * * @param options Adapter, locale, and namespace configuration. * @template Z The date type used by the adapter. * @template E The date context type. * @returns A Vue plugin. * * @see https://0.vuetifyjs.com/composables/plugins/use-date * * @example * ```ts * import { createApp } from 'vue' * import { createDatePlugin } from '@vuetify/v0' * import { V0DateAdapter } from '@vuetify/v0/date' * import App from './App.vue' * * const app = createApp(App) * * app.use(createDatePlugin()) * app.use(createDatePlugin({ adapter: new V0DateAdapter(), locale: 'de-DE' })) * ``` */ declare function createDatePlugin(options: DatePluginOptions & { adapter: DateAdapter; }): ObjectPlugin; declare function createDatePlugin(options?: DatePluginOptions): ObjectPlugin; /** * Returns the current date context. * * Inside a component with no plugin, returns a `V0PlainDateAdapter` context. * Outside a component, throws. A plugin you installed is used as-is. * * @param namespace The namespace to look up (defaults to 'v0:date'). * @template Z The date type used by the adapter. * @template E The date context type. * @returns The current date context. * @throws If called outside a Vue component. * * @see https://0.vuetifyjs.com/composables/plugins/use-date * * @example * ```ts * import { createApp } from 'vue' * import { createDatePlugin } from '@vuetify/v0' * import { V0DateAdapter } from '@vuetify/v0/date' * import App from './App.vue' * * const app = createApp(App) * app.use(createDatePlugin({ adapter: new V0DateAdapter() })) * ``` * * @example * ```vue * * ``` */ declare function useDate = DateContext>(namespace?: string): E; //#endregion export { DateAdapter, DateContext, DateContextOptions, DateOptions, DatePluginOptions, V0PlainDateAdapter as PlainDateAdapter, V0PlainDateAdapter, createDate, createDateContext, createDatePlugin, useDate };