mirror of
https://github.com/pengzhanbo/vuepress-theme-plume.git
synced 2026-04-23 10:58:13 +08:00
chore: tweak
This commit is contained in:
parent
7882539221
commit
4438447ce3
@ -1,11 +1,10 @@
|
||||
import { resolveRouteFullPath, usePageLang, useRoute } from 'vuepress/client'
|
||||
import { isPlainObject, isString } from 'vuepress/shared'
|
||||
import { useBlogPostData } from '@vuepress-plume/plugin-blog-data/client'
|
||||
import type { NotesSidebarItem } from '@vuepress-plume/plugin-notes-data'
|
||||
import { computed } from 'vue'
|
||||
import type { Ref } from 'vue'
|
||||
import type { NavItemWithLink, PlumeThemeBlogPostItem } from '../../shared/index.js'
|
||||
import type { NavItemWithLink, PlumeThemeBlogPostItem, SidebarItem } from '../../shared/index.js'
|
||||
import { resolveNavLink } from '../utils/index.js'
|
||||
import { useBlogPostData } from './blog-data.js'
|
||||
import { useSidebar } from './sidebar.js'
|
||||
import { useData } from './data.js'
|
||||
|
||||
@ -72,13 +71,13 @@ function resolveFromFrontmatterConfig(conf: unknown): null | false | NavItemWith
|
||||
return false
|
||||
}
|
||||
|
||||
function flatSidebar(sidebar: NotesSidebarItem[], res: NavItemWithLink[] = []): NavItemWithLink[] {
|
||||
function flatSidebar(sidebar: SidebarItem[], res: NavItemWithLink[] = []): NavItemWithLink[] {
|
||||
for (const item of sidebar) {
|
||||
if (item.link)
|
||||
res.push({ link: item.link, text: item.text || item.dir || '' })
|
||||
|
||||
if (Array.isArray(item.items) && item.items.length)
|
||||
flatSidebar(item.items as NotesSidebarItem[], res)
|
||||
flatSidebar(item.items as SidebarItem[], res)
|
||||
}
|
||||
|
||||
return res
|
||||
|
||||
@ -1,15 +1,15 @@
|
||||
import type {
|
||||
NotesDataOptions,
|
||||
NotesItemOptions,
|
||||
} from '@vuepress-plume/plugin-notes-data'
|
||||
NoteItem,
|
||||
NotesOptions,
|
||||
} from '../shared/notes.js'
|
||||
import type { NavItem } from '../shared/index.js'
|
||||
import type { ThemeConfig } from '../shared/theme-data.js'
|
||||
|
||||
export function definePlumeNotesConfig(notes: NotesDataOptions): NotesDataOptions {
|
||||
export function definePlumeNotesConfig(notes: NotesOptions): NotesOptions {
|
||||
return notes
|
||||
}
|
||||
|
||||
export function definePlumeNotesItemConfig(item: NotesItemOptions): NotesItemOptions {
|
||||
export function definePlumeNotesItemConfig(item: NoteItem): NoteItem {
|
||||
return item
|
||||
}
|
||||
|
||||
@ -25,9 +25,9 @@ export function defineNavbar(navbar: NavItem[]): NavItem[] {
|
||||
}
|
||||
|
||||
export type {
|
||||
NotesDataOptions,
|
||||
NotesItemOptions,
|
||||
NotesItemOptions as NotesItem,
|
||||
NotesOptions,
|
||||
NoteItem,
|
||||
NoteItem as NotesItem,
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user