@sugarat/theme 0.2.25 → 0.2.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/node.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { DefaultTheme, UserConfig } from 'vitepress';
|
|
|
2
2
|
import { ElButton } from 'element-plus';
|
|
3
3
|
import { RSSOptions } from 'vitepress-plugin-rss';
|
|
4
4
|
import { Repo, Mapping } from '@giscus/vue';
|
|
5
|
+
import { Options } from 'oh-my-live2d';
|
|
5
6
|
export { tabsMarkdownPlugin } from 'vitepress-plugin-tabs';
|
|
6
7
|
|
|
7
8
|
type RSSPluginOptions = RSSOptions;
|
|
@@ -384,6 +385,11 @@ declare namespace Theme {
|
|
|
384
385
|
* @default true
|
|
385
386
|
*/
|
|
386
387
|
backToTop?: boolean | BackToTop;
|
|
388
|
+
/**
|
|
389
|
+
* oh-my-live2d 的 loadOml2d 方法的配置选项
|
|
390
|
+
* 详见 https://oml2d.com/options/Options.html
|
|
391
|
+
*/
|
|
392
|
+
oml2d?: Options;
|
|
387
393
|
}
|
|
388
394
|
interface BackToTop {
|
|
389
395
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sugarat/theme",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.26",
|
|
4
4
|
"description": "简约风的 Vitepress 博客主题,sugarat vitepress blog theme",
|
|
5
5
|
"author": "sugar",
|
|
6
6
|
"license": "MIT",
|
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
"gray-matter": "^4.0.3",
|
|
43
43
|
"markdown-it-task-checkbox": "^1.0.6",
|
|
44
44
|
"mermaid": "^10.2.4",
|
|
45
|
+
"oh-my-live2d": "^0.9.0",
|
|
45
46
|
"swiper": "^11.0.5",
|
|
46
47
|
"vitepress-markdown-timeline": "^1.2.1",
|
|
47
48
|
"vitepress-plugin-mermaid": "2.0.13",
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import Theme from 'vitepress/theme'
|
|
3
3
|
import { useData } from 'vitepress'
|
|
4
4
|
import { computed } from 'vue'
|
|
5
|
+
import { useOml2d } from '../hooks/useOml2d'
|
|
5
6
|
import { useBlogThemeMode } from '../composables/config/blog'
|
|
6
7
|
import BlogHomeInfo from './BlogHomeInfo.vue'
|
|
7
8
|
import BlogHomeBanner from './BlogHomeBanner.vue'
|
|
@@ -22,6 +23,9 @@ const { frontmatter } = useData()
|
|
|
22
23
|
const layout = computed(() => frontmatter.value.layout)
|
|
23
24
|
const isBlogTheme = useBlogThemeMode()
|
|
24
25
|
const { Layout } = Theme
|
|
26
|
+
|
|
27
|
+
// oh-my-live2d 扩展
|
|
28
|
+
useOml2d()
|
|
25
29
|
</script>
|
|
26
30
|
|
|
27
31
|
<template>
|
|
@@ -76,7 +76,6 @@ export function withConfigProvider(App: Component) {
|
|
|
76
76
|
}
|
|
77
77
|
})
|
|
78
78
|
}
|
|
79
|
-
|
|
80
79
|
export function useDocMetaInsertSelector() {
|
|
81
80
|
const blogConfig = useConfig()
|
|
82
81
|
const { frontmatter } = useData()
|
|
@@ -98,6 +97,12 @@ export function useConfig() {
|
|
|
98
97
|
export function useBlogConfig() {
|
|
99
98
|
return inject(configSymbol)!.value.blog!
|
|
100
99
|
}
|
|
100
|
+
/**
|
|
101
|
+
* 获取 oh-my-live2d的配置选项
|
|
102
|
+
*/
|
|
103
|
+
export function useOml2dOptions() {
|
|
104
|
+
return inject(configSymbol)!.value.blog?.oml2d
|
|
105
|
+
}
|
|
101
106
|
|
|
102
107
|
export function useBlogThemeMode() {
|
|
103
108
|
return inject(configSymbol)!.value?.blog?.blog ?? true
|
|
@@ -3,6 +3,7 @@ import type { ElButton } from 'element-plus'
|
|
|
3
3
|
import type { DefaultTheme } from 'vitepress'
|
|
4
4
|
import type { RSSOptions } from 'vitepress-plugin-rss'
|
|
5
5
|
import type { Mapping, Repo } from '@giscus/vue'
|
|
6
|
+
import type { Options as Oml2dOptions } from 'oh-my-live2d'
|
|
6
7
|
|
|
7
8
|
type RSSPluginOptions = RSSOptions
|
|
8
9
|
|
|
@@ -416,6 +417,12 @@ export namespace Theme {
|
|
|
416
417
|
* @default true
|
|
417
418
|
*/
|
|
418
419
|
backToTop?: boolean | BackToTop
|
|
420
|
+
|
|
421
|
+
/**
|
|
422
|
+
* oh-my-live2d 的 loadOml2d 方法的配置选项
|
|
423
|
+
* 详见 https://oml2d.com/options/Options.html
|
|
424
|
+
*/
|
|
425
|
+
oml2d?: Oml2dOptions
|
|
419
426
|
}
|
|
420
427
|
|
|
421
428
|
export interface BackToTop {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { onMounted } from 'vue'
|
|
2
|
+
import { useOml2dOptions } from '../composables/config/blog'
|
|
3
|
+
|
|
4
|
+
export function useOml2d() {
|
|
5
|
+
const oml2dOptions = useOml2dOptions()
|
|
6
|
+
onMounted(async () => {
|
|
7
|
+
if (oml2dOptions) {
|
|
8
|
+
const { loadOml2d } = await import('oh-my-live2d')
|
|
9
|
+
loadOml2d(oml2dOptions)
|
|
10
|
+
}
|
|
11
|
+
})
|
|
12
|
+
}
|