import { Ref } from "vue"; import { CookieParseOptions, CookieSerializeOptions } from "cookie-es"; //#region src/app/composables/cookie.d.ts type _CookieOptions = Omit; interface CookieOptions extends _CookieOptions { decode?(value: string | null | undefined): T; encode?(value: T): string; default?: () => T | Ref; watch?: boolean | 'shallow'; readonly?: boolean; /** * Expiration date for the cookie, or a getter that returns one. * * When a function is provided, it is evaluated on every cookie write * so the expiration can be refreshed when the value is re-set. * The getter should be pure (no side effects). */ expires?: Date | (() => Date | undefined); /** * Refresh cookie expiration even when the value remains unchanged. * * By default, a cookie is only rewritten when its value changes. * When `refresh` is set to `true`, the cookie will be re-written * on every explicit assignment (e.g. `cookie.value = cookie.value`), * extending its expiration even if the value is the same. * * Note: the expiration is not refreshed automatically — you must * assign to `cookie.value` to trigger the refresh. * * Ignored when `readonly` is set. * * @default false */ refresh?: boolean; } interface CookieRef extends Ref {} /** @since 3.0.0 */ declare function useCookie(name: string, _opts?: CookieOptions & { readonly?: false; }): CookieRef; declare function useCookie(name: string, _opts: CookieOptions & { readonly: true; }): Readonly>; /** @since 3.10.0 */ declare function refreshCookie(name: string): void; //#endregion export { CookieOptions, CookieRef, refreshCookie, useCookie };