chore: tweak

This commit is contained in:
pengzhanbo 2024-07-08 23:34:39 +08:00
parent 7882539221
commit 4438447ce3
2 changed files with 12 additions and 13 deletions

View File

@ -1,11 +1,10 @@
import { resolveRouteFullPath, usePageLang, useRoute } from 'vuepress/client' import { resolveRouteFullPath, usePageLang, useRoute } from 'vuepress/client'
import { isPlainObject, isString } from 'vuepress/shared' 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 { computed } from 'vue'
import type { Ref } 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 { resolveNavLink } from '../utils/index.js'
import { useBlogPostData } from './blog-data.js'
import { useSidebar } from './sidebar.js' import { useSidebar } from './sidebar.js'
import { useData } from './data.js' import { useData } from './data.js'
@ -72,13 +71,13 @@ function resolveFromFrontmatterConfig(conf: unknown): null | false | NavItemWith
return false return false
} }
function flatSidebar(sidebar: NotesSidebarItem[], res: NavItemWithLink[] = []): NavItemWithLink[] { function flatSidebar(sidebar: SidebarItem[], res: NavItemWithLink[] = []): NavItemWithLink[] {
for (const item of sidebar) { for (const item of sidebar) {
if (item.link) if (item.link)
res.push({ link: item.link, text: item.text || item.dir || '' }) res.push({ link: item.link, text: item.text || item.dir || '' })
if (Array.isArray(item.items) && item.items.length) if (Array.isArray(item.items) && item.items.length)
flatSidebar(item.items as NotesSidebarItem[], res) flatSidebar(item.items as SidebarItem[], res)
} }
return res return res

View File

@ -1,15 +1,15 @@
import type { import type {
NotesDataOptions, NoteItem,
NotesItemOptions, NotesOptions,
} from '@vuepress-plume/plugin-notes-data' } from '../shared/notes.js'
import type { NavItem } from '../shared/index.js' import type { NavItem } from '../shared/index.js'
import type { ThemeConfig } from '../shared/theme-data.js' import type { ThemeConfig } from '../shared/theme-data.js'
export function definePlumeNotesConfig(notes: NotesDataOptions): NotesDataOptions { export function definePlumeNotesConfig(notes: NotesOptions): NotesOptions {
return notes return notes
} }
export function definePlumeNotesItemConfig(item: NotesItemOptions): NotesItemOptions { export function definePlumeNotesItemConfig(item: NoteItem): NoteItem {
return item return item
} }
@ -25,9 +25,9 @@ export function defineNavbar(navbar: NavItem[]): NavItem[] {
} }
export type { export type {
NotesDataOptions, NotesOptions,
NotesItemOptions, NoteItem,
NotesItemOptions as NotesItem, NoteItem as NotesItem,
} }
/** /**