mirror of
https://github.com/pengzhanbo/vuepress-theme-plume.git
synced 2026-04-23 10:58:13 +08:00
refactor(theme): update basic
This commit is contained in:
parent
1689b9c691
commit
8120ad3e65
@ -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>
|
||||
|
||||
@ -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'
|
||||
|
||||
@ -0,0 +1 @@
|
||||
export * from '../shared/index.js'
|
||||
2
packages/theme/src/client/shim.d.ts
vendored
2
packages/theme/src/client/shim.d.ts
vendored
@ -3,3 +3,5 @@ declare module '*.vue' {
|
||||
const comp: ComponentOptions
|
||||
export default comp
|
||||
}
|
||||
|
||||
declare const __VUEPRESS_DEV__: string
|
||||
|
||||
@ -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
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
4
packages/theme/src/shared/base.ts
Normal file
4
packages/theme/src/shared/base.ts
Normal file
@ -0,0 +1,4 @@
|
||||
export type PlumeThemeImage =
|
||||
| string
|
||||
| { src: string; alt?: string }
|
||||
| { dark: string; light: string; alt?: string }
|
||||
@ -1,3 +1,4 @@
|
||||
export * from './base.js'
|
||||
export * from './frontmatter.js'
|
||||
export * from './note.js'
|
||||
export * from './options/index.js'
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user