UNPKG

@aedart/vuepress-utils

Version:

A few utilities for Vuepress.

228 lines (222 loc) 5.67 kB
/** * @aedart/vuepress-utils * * BSD-3-Clause, Copyright (c) 2023-present Alin Eugen Deac <aedart@gmail.com>. */ import { NavbarLinkOptions, NavGroup, SidebarObjectOptions, SidebarArrayOptions, NavbarGroupOptions, SidebarOptions } from '@vuepress/theme-default'; /** * Pages Collection */ interface PagesCollection { /** * Set the name of this collection * * @param {string} name E.g. "v2.x" */ set name(name: string); /** * Get the name of this collection * * @returns {string} E.g. "v2.x" */ get name(): string; /** * Set this collection's relative path inside an archive * * @param {string} path E.g. "/v2x" */ set path(path: string); /** * get this collection's relative path inside an archive * * @returns {string} E.g. "/v2x" */ get path(): string; /** * Returns the full path of this collection * * Method depends on {@link Archive.path}. * * @returns {string} E.g. "/archive/v2x" */ get fullPath(): string; /** * Set the archive that this collection belongs to * * @param {Archive | null} archive */ set archive(archive: Archive | null); /** * Get the archive that this collection belongs to * * @returns {Archive} */ get archive(): Archive | null; /** * Returns a "navigation link" representation of this collection * * @returns {NavbarLinkOptions | NavGroup<NavbarLinkOptions>} */ asNavigationItem(): NavbarLinkOptions | NavGroup<NavbarLinkOptions>; /** * Returns a "sidebar configuration object" representation of this collection * * @returns {SidebarObjectOptions} */ asSidebarObject(): SidebarObjectOptions; /** * Returns sidebar configuration (all pages in this collection) * * @returns {SidebarArrayOptions} */ sidebar(): SidebarArrayOptions; } /** * Archive */ interface Archive { /** * Set the name of this archive * * @param {string} name E.g. "Archive" */ set name(name: string); /** * Get the name of this archive * * @returns {string} E.g. "Archive" */ get name(): string; /** * Set this archive's path * * @param {string} path E.g. "/archive" */ set path(path: string); /** * get this archive's path * * @returns {string} E.g. "/archive" */ get path(): string; /** * Set the pages collection to be marked as "current" * * @param {PagesCollection} collection */ set current(collection: PagesCollection); /** * Get the pages collection that is marked as "current" * * @returns {PagesCollection} */ get current(): PagesCollection; /** * Set the pages collection to be marked as "next" * * @param {PagesCollection} collection */ set next(collection: PagesCollection); /** * Get the pages collection that is marked as "next" * * @returns {PagesCollection} */ get next(): PagesCollection; /** * Set the collections in this archive * * @param {PagesCollection[]} pageCollections */ set collections(pageCollections: PagesCollection[]); /** * Get the collections in this archive * * @returns {PagesCollection[]} */ get collections(): PagesCollection[]; /** * Set the navigation label for the "current" collection * * @param {string} name */ set currentLabel(name: string); /** * Get the navigation label for the "current" collection * * @returns {string} */ get currentLabel(): string; /** * Set the navigation label for the "next" collection * * @param {string} name */ set nextLabel(name: string); /** * Get the navigation label for the "next" collection * * @returns {string} */ get nextLabel(): string; /** * Set the relative path for the "current" collection, * in this archive * * @param {string} path E.g. "/current" */ set currentPath(path: string); /** * Get the relative path for the "current" collection, * in this archive * * @returns {string} E.g. "/current" */ get currentPath(): string; /** * Get the full path of the "current" collection * * @returns {string} E.g. "/archive/current" */ get currentFullPath(): string; /** * Set the relative path for the "next" collection, * in this archive * * @param {string} path E.g. "/next" */ set nextPath(path: string); /** * Get the relative path for the "current" collection, * in this archive * * @returns {string} E.g. "/next" */ get nextPath(): string; /** * Get the full path of the "current" collection * * @returns {string} E.g. "/archive/next" */ get nextFullPath(): string; /** * Returns a navigation "bar item" or "group" representation of this archive * * @returns {NavbarGroupOptions | NavbarLinkOptions} */ asNavigationItem(): NavbarGroupOptions | NavbarLinkOptions; /** * Returns sidebar configuration (all collections' pages) * * @returns {SidebarOptions} */ sidebarConfiguration(): SidebarOptions; } /** * Contracts identifier * * @type {typeof VUEPRESS_UTILS_CONTRACTS} */ declare const VUEPRESS_UTILS_CONTRACTS: unique symbol; //# sourceMappingURL=index.d.ts.map export { type Archive, type PagesCollection, VUEPRESS_UTILS_CONTRACTS };