@sugarat/theme 0.1.4 → 0.1.6

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
@@ -117,6 +117,7 @@ declare namespace Theme {
117
117
  avatar: string;
118
118
  }
119
119
  interface BlogConfig {
120
+ blog?: false;
120
121
  pagesData: PageData[];
121
122
  srcDir?: string;
122
123
  author?: string;
@@ -147,6 +148,7 @@ declare namespace Theme {
147
148
 
148
149
  declare function getThemeConfig(cfg?: Partial<Theme.BlogConfig>): {
149
150
  blog: {
151
+ blog?: false | undefined;
150
152
  pagesData: Theme.PageData[];
151
153
  srcDir?: string | undefined;
152
154
  author?: string | undefined;
package/node.js CHANGED
@@ -78,11 +78,18 @@ function getThemeConfig(cfg) {
78
78
  let route = v.replace(".md", "");
79
79
  if (route.startsWith("./")) {
80
80
  route = route.replace(
81
- new RegExp(`^\\.\\/${import_path.default.join(srcDir, "/")}`),
81
+ new RegExp(
82
+ `^\\.\\/${import_path.default.join(srcDir, "/").replace(new RegExp(`\\${import_path.default.sep}`, "g"), "/")}`
83
+ ),
82
84
  ""
83
85
  );
84
86
  } else {
85
- route = route.replace(new RegExp(`^${import_path.default.join(srcDir, "/")}`), "");
87
+ route = route.replace(
88
+ new RegExp(
89
+ `^${import_path.default.join(srcDir, "/").replace(new RegExp(`\\${import_path.default.sep}`, "g"), "/")}`
90
+ ),
91
+ ""
92
+ );
86
93
  }
87
94
  const fileContent = import_fs.default.readFileSync(v, "utf-8");
88
95
  const meta = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sugarat/theme",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "description": "简约风的 Vitepress 博客主题,sugarat vitepress blog theme",
5
5
  "main": "src/index.ts",
6
6
  "exports": {
@@ -38,13 +38,13 @@
38
38
  "gray-matter": "^4.0.3"
39
39
  },
40
40
  "devDependencies": {
41
+ "@element-plus/icons-vue": "^2.0.10",
42
+ "element-plus": "^2.2.28",
41
43
  "sass": "^1.56.1",
42
44
  "tsup": " ^6.5.0",
43
45
  "typescript": "^4.8.2",
44
- "vitepress": "^1.0.0-alpha.33",
45
- "vue": "^3.2.45",
46
- "@element-plus/icons-vue": "^2.0.10",
47
- "element-plus": "^2.2.28"
46
+ "vitepress": "1.0.0-alpha.46",
47
+ "vue": "^3.2.45"
48
48
  },
49
49
  "scripts": {
50
50
  "dev": "vitepress dev demo",
@@ -10,7 +10,9 @@ import BlogImagePreview from './BlogImagePreview.vue'
10
10
  import BlogArticleAnalyze from './BlogArticleAnalyze.vue'
11
11
  import BlogAlert from './BlogAlert.vue'
12
12
  import BlogPopover from './BlogPopover.vue'
13
+ import { useBlogThemeMode } from '../composables/config/blog'
13
14
 
15
+ const isBlogTheme = useBlogThemeMode()
14
16
  const { Layout } = Theme
15
17
  </script>
16
18
 
@@ -35,7 +37,7 @@ const { Layout } = Theme
35
37
  <BlogSearch />
36
38
  </template>
37
39
  <!-- 自定义首页 -->
38
- <template #home-hero-before>
40
+ <template #home-hero-before v-if="isBlogTheme">
39
41
  <div class="home">
40
42
  <div class="header-banner">
41
43
  <BlogHomeBanner />
@@ -46,7 +48,7 @@ const { Layout } = Theme
46
48
  </div>
47
49
  </div>
48
50
  </template>
49
- <template #sidebar-nav-after>
51
+ <template #sidebar-nav-after v-if="isBlogTheme">
50
52
  <BlogSidebar />
51
53
  </template>
52
54
  <!-- 评论 -->
@@ -62,6 +64,12 @@ const { Layout } = Theme
62
64
  max-width: 1126px;
63
65
  }
64
66
 
67
+ @media screen and (min-width: 960px) {
68
+ .home {
69
+ padding-top: var(--vp-nav-height);
70
+ }
71
+ }
72
+
65
73
  .header-banner {
66
74
  width: 100%;
67
75
  padding: 60px 0;
@@ -54,6 +54,9 @@ export function useBlogConfig() {
54
54
  return inject(configSymbol)!.value.blog
55
55
  }
56
56
 
57
+ export function useBlogThemeMode() {
58
+ return inject(configSymbol)!.value.blog.blog ?? true
59
+ }
57
60
  export function useHomeConfig() {
58
61
  return inject(homeConfigSymbol)!
59
62
  }
@@ -128,6 +128,7 @@ export namespace Theme {
128
128
  avatar: string
129
129
  }
130
130
  export interface BlogConfig {
131
+ blog?: false
131
132
  pagesData: PageData[]
132
133
  srcDir?: string
133
134
  author?: string
package/src/node.ts CHANGED
@@ -20,11 +20,22 @@ export function getThemeConfig(cfg?: Partial<Theme.BlogConfig>) {
20
20
  // 去除 srcDir 处理目录名
21
21
  if (route.startsWith('./')) {
22
22
  route = route.replace(
23
- new RegExp(`^\\.\\/${path.join(srcDir, '/')}`),
23
+ new RegExp(
24
+ `^\\.\\/${path
25
+ .join(srcDir, '/')
26
+ .replace(new RegExp(`\\${path.sep}`, 'g'), '/')}`
27
+ ),
24
28
  ''
25
29
  )
26
30
  } else {
27
- route = route.replace(new RegExp(`^${path.join(srcDir, '/')}`), '')
31
+ route = route.replace(
32
+ new RegExp(
33
+ `^${path
34
+ .join(srcDir, '/')
35
+ .replace(new RegExp(`\\${path.sep}`, 'g'), '/')}`
36
+ ),
37
+ ''
38
+ )
28
39
  }
29
40
 
30
41
  const fileContent = fs.readFileSync(v, 'utf-8')
@@ -38,6 +38,15 @@ html[class='dark'] {
38
38
  );
39
39
  }
40
40
 
41
+ @media screen and (min-width: 960px) {
42
+ #VPContent.VPContent{
43
+ padding-top: 0;
44
+ .VPHome{
45
+ min-height: 100vh;
46
+ }
47
+ }
48
+ }
49
+
41
50
  @media screen and (max-width: 959px) {
42
51
  .VPNav {
43
52
  background-color: var(--nav-bgc);