UNPKG

@aedart/vuepress-utils

Version:

A few utilities for Vuepress.

92 lines (84 loc) 2.92 kB
/** * @aedart/vuepress-utils * * BSD-3-Clause, Copyright (c) 2023-present Alin Eugen Deac <aedart@gmail.com>. */ import { Archive } from '@aedart/vuepress-utils/contracts'; import { PageDataRef } from '@vuepress/client'; import { ComputedRef } from 'vue'; /** * Prefix given path * * @param {string} prefix * @param {string} path * * @returns {string} */ declare function prefixPath(prefix: string, path: string): string; /** * Determine if "current" pages collection is being viewed * * @param {import('@vuepress/client').PageDataRef} page * @param {Archive} archive * * @returns {boolean} */ declare function isViewingCurrent(page: PageDataRef, archive: Archive): boolean; /** * Returns a computed property that determines if "current" pages collection is being viewed * * @param {import('@vuepress/client').PageDataRef} page * @param {Archive} archive * * @returns {import('vue').ComputedRef<boolean>} */ declare function isViewingCurrentRef(page: PageDataRef, archive: Archive): ComputedRef<boolean>; /** * Determine if "next" pages collection is being viewed * * @param {import('@vuepress/client').PageDataRef} page * @param {Archive} archive * * @returns {boolean} */ declare function isViewingNext(page: PageDataRef, archive: Archive): boolean; /** * Returns a computed property that determines if "next" pages collection is being viewed * * @param {import('@vuepress/client').PageDataRef} page * @param {Archive} archive * * @returns {import('vue').ComputedRef<boolean>} */ declare function isViewingNextRef(page: PageDataRef, archive: Archive): ComputedRef<boolean>; /** * Determine if neither "current" nor "next" pages collection are being viewed * * @param {import('@vuepress/client').PageDataRef} page * @param {Archive} archive * @param {string[]} [exclude=[ '/' ]] Paths to exclude from result * * @returns {boolean} */ declare function isViewingOther(page: PageDataRef, archive: Archive, exclude?: string[]): boolean; /** * Returns a computed property that determines if neither "current" nor "next" pages * collection are being viewed * * @param {import('@vuepress/client').PageDataRef} page * @param {Archive} archive * @param {string[]} [exclude=[ '/' ]] Paths to exclude from result * * @returns {import('vue').ComputedRef<boolean>} */ declare function isViewingOtherRef(page: PageDataRef, archive: Archive, exclude?: string[]): ComputedRef<boolean>; /** * Resolves the base URL of vuepress site, based on {@link process.env.NODE_ENV} * * @param {string} path * @param {string} [productionEnv='production'] Name of a production environment * * @returns {"/" | `/${string}/`} '/' when not in production */ declare function baseURL(path: string, productionEnv?: string): '/' | `/${string}/`; export { baseURL, isViewingCurrent, isViewingCurrentRef, isViewingNext, isViewingNextRef, isViewingOther, isViewingOtherRef, prefixPath };