refactor(theme): update basic

This commit is contained in:
pengzhanbo 2023-02-10 04:39:46 +08:00
parent 1689b9c691
commit 8120ad3e65
8 changed files with 23 additions and 6 deletions

View File

@ -1,7 +1,7 @@
import { usePreferredDark, useStorage } from '@vueuse/core'
import { computed, inject, onMounted, onUnmounted, provide, watch } from 'vue'
import type { InjectionKey, WritableComputedRef } from 'vue'
import { useThemeLocaleData } from './useThemeData.js'
import { useThemeLocaleData } from './themeData.js'
export type DarkModeRef = WritableComputedRef<boolean>

View File

@ -1,4 +1,4 @@
export * from './useDarkMode.js'
export * from './darkMode.js'
export * from './useScrollPromise.js'
export * from './useThemeData.js'
export * from './themeData.js'
export * from './useResolveRouteWithRedirect.js'

View File

@ -0,0 +1 @@
export * from '../shared/index.js'

View File

@ -3,3 +3,5 @@ declare module '*.vue' {
const comp: ComponentOptions
export default comp
}
declare const __VUEPRESS_DEV__: string

View File

@ -1,6 +1,7 @@
import { createRequire } from 'node:module'
import type { AutoFrontmatterOptions } from '@vuepress-plume/vuepress-plugin-auto-frontmatter'
import type { App } from '@vuepress/core'
import { format } from 'date-fns'
import type { PlumeThemeLocaleOptions } from '../shared/index.js'
export default function (
@ -21,13 +22,21 @@ export default function (
{
include: '*',
formatter: {
title(title: string) {
if (title) return title
return title
},
author(author: string) {
if (author) return author
return pkg.author || ''
return localeOption.avatar?.name || pkg.author || ''
},
createTime(formatTime: string, data, { createTime }) {
createTime(formatTime: string, _, { createTime }) {
if (formatTime) return formatTime
return createTime
return format(new Date(createTime), 'yyyy/MM/dd hh:mm:ss')
},
permalink(permalink: string, _, { filepath }) {
if (permalink) return permalink
return permalink
},
},
},

View File

@ -0,0 +1,4 @@
export type PlumeThemeImage =
| string
| { src: string; alt?: string }
| { dark: string; light: string; alt?: string }

View File

@ -1,3 +1,4 @@
export * from './base.js'
export * from './frontmatter.js'
export * from './note.js'
export * from './options/index.js'