@sugarat/theme 0.2.26 → 0.2.27

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.js CHANGED
@@ -456,6 +456,8 @@ function patchVPThemeConfig(cfg, vpThemeConfig = {}) {
456
456
  vpThemeConfig.sidebar = patchDefaultThemeSideBar(cfg)?.sidebar;
457
457
  return vpThemeConfig;
458
458
  }
459
+ function checkConfig(cfg) {
460
+ }
459
461
 
460
462
  // src/utils/node/vitePlugins.ts
461
463
  var import_node_path3 = __toESM(require("path"));
@@ -562,6 +564,7 @@ function coverImgTransform() {
562
564
 
563
565
  // src/node.ts
564
566
  function getThemeConfig(cfg) {
567
+ checkConfig(cfg);
565
568
  const pagesData = getArticles(cfg);
566
569
  const extraVPConfig = {};
567
570
  const vitePlugins = getVitePlugins(cfg);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sugarat/theme",
3
- "version": "0.2.26",
3
+ "version": "0.2.27",
4
4
  "description": "简约风的 Vitepress 博客主题,sugarat vitepress blog theme",
5
5
  "author": "sugar",
6
6
  "license": "MIT",
@@ -42,7 +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
+ "oh-my-live2d": "^0.10.0",
46
46
  "swiper": "^11.0.5",
47
47
  "vitepress-markdown-timeline": "^1.2.1",
48
48
  "vitepress-plugin-mermaid": "2.0.13",
@@ -1,12 +1,77 @@
1
1
  import { onMounted } from 'vue'
2
+ import type { Options } from 'oh-my-live2d'
2
3
  import { useOml2dOptions } from '../composables/config/blog'
3
4
 
5
+ const defaultModelOptions: any = {
6
+ scale: 0.08,
7
+ position: [-30, 0],
8
+ stageStyle: {
9
+ width: 220
10
+ },
11
+ mobilePosition: [-10, 0],
12
+ mobileScale: 0.05,
13
+ mobileStageStyle: {
14
+ width: 150
15
+ },
16
+ }
17
+ const defaultOptions: Options = {
18
+ tips: {
19
+ copyTips: {
20
+ duration: 2000,
21
+ message: ['复制成功,感谢您的支持!'],
22
+ },
23
+ style: {
24
+ top: '-50px',
25
+ fontSize: '14px',
26
+ padding: '10px',
27
+ width: '200px'
28
+ },
29
+ mobileStyle: {
30
+ top: '-80px',
31
+ left: '80px',
32
+ fontSize: '14px',
33
+ padding: '4px 10px',
34
+ width: '110px'
35
+ }
36
+ }
37
+ }
4
38
  export function useOml2d() {
5
39
  const oml2dOptions = useOml2dOptions()
6
40
  onMounted(async () => {
7
41
  if (oml2dOptions) {
8
42
  const { loadOml2d } = await import('oh-my-live2d')
9
- loadOml2d(oml2dOptions)
43
+ loadOml2d({
44
+ ...defaultOptions,
45
+ ...oml2dOptions,
46
+ models: oml2dOptions?.models?.map(model => ({
47
+ ...defaultModelOptions,
48
+ ...model,
49
+ stageStyle: {
50
+ ...defaultModelOptions.stageStyle,
51
+ ...model.stageStyle
52
+ },
53
+ mobileStageStyle: {
54
+ ...defaultModelOptions.mobileStageStyle,
55
+ ...model.mobileStageStyle
56
+ }
57
+ })),
58
+ tips: {
59
+ ...defaultOptions.tips,
60
+ ...oml2dOptions.tips,
61
+ style: {
62
+ ...defaultOptions?.tips?.style,
63
+ ...oml2dOptions?.tips?.style
64
+ },
65
+ mobileStyle: {
66
+ ...defaultOptions?.tips?.mobileStyle,
67
+ ...oml2dOptions?.tips?.mobileStyle
68
+ },
69
+ copyTips: {
70
+ ...defaultOptions?.tips?.copyTips,
71
+ ...oml2dOptions?.tips?.copyTips
72
+ }
73
+ }
74
+ })
10
75
  }
11
76
  })
12
77
  }
package/src/node.ts CHANGED
@@ -6,7 +6,7 @@ import {
6
6
  patchOptimizeDeps,
7
7
  registerMdPlugins,
8
8
  } from './utils/node/mdPlugins'
9
- import { getArticles, patchVPThemeConfig } from './utils/node/theme'
9
+ import { checkConfig, getArticles, patchVPThemeConfig } from './utils/node/theme'
10
10
  import { getVitePlugins, registerVitePlugins } from './utils/node/vitePlugins'
11
11
 
12
12
  /**
@@ -14,6 +14,9 @@ import { getVitePlugins, registerVitePlugins } from './utils/node/vitePlugins'
14
14
  * @param cfg 主题配置
15
15
  */
16
16
  export function getThemeConfig(cfg?: Partial<Theme.BlogConfig>) {
17
+ // 配置校验
18
+ checkConfig(cfg)
19
+
17
20
  // 文章数据
18
21
  const pagesData = getArticles(cfg)
19
22
  const extraVPConfig: any = {}
@@ -137,3 +137,7 @@ export function patchVPThemeConfig(
137
137
 
138
138
  return vpThemeConfig
139
139
  }
140
+
141
+ export function checkConfig(cfg?: Partial<Theme.BlogConfig>) {
142
+ // TODO:保留
143
+ }