valaxy-theme-hairy 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -9,7 +9,7 @@ const showWaline = computed(() => route.path.includes('/posts/') || fr.value.wal
9
9
  </script>
10
10
 
11
11
  <template>
12
- <div class="HairyBody min-h-50vh relative">
12
+ <div class="HairyBody min-h-49vh relative">
13
13
  <div class="mx-auto breakpoint flex z-1 relative">
14
14
  <div class="relative flex-1 pt-2">
15
15
  <slot />
@@ -0,0 +1,53 @@
1
+ <script lang="ts" setup>
2
+ import { capitalize, computed } from 'vue'
3
+ import { useConfig, useThemeConfig } from 'valaxy'
4
+ import { useI18n } from 'vue-i18n'
5
+
6
+ import pkg from 'valaxy/package.json'
7
+
8
+ const { t } = useI18n()
9
+
10
+ const config = useConfig()
11
+ const themeConfig = useThemeConfig()
12
+
13
+ const year = new Date().getFullYear()
14
+
15
+ const isThisYear = computed(() => {
16
+ return year === themeConfig.value.footer.since
17
+ })
18
+
19
+ const poweredHtml = computed(() => t('footer.powered', [`<a href="${pkg.repository}" target="_blank" rel="noopener">Valaxy</a> v${pkg.version}`]))
20
+ const footerIcon = computed(() => themeConfig.value.footer.icon)
21
+ </script>
22
+
23
+ <template>
24
+ <footer class="va-footer p-4 pb-10" text="center sm" style="color:var(--va-c-text-light)">
25
+ <div v-if="themeConfig.footer.beian?.enable && themeConfig.footer.beian.icp" class="beian" m="y-2">
26
+ <a href="https://beian.miit.gov.cn/" target="_blank" rel="noopener">
27
+ {{ themeConfig.footer.beian.icp }}
28
+ </a>
29
+ </div>
30
+
31
+ <div class="copyright flex justify-center items-center" p="1">
32
+ <span>
33
+ &copy;
34
+ <template v-if="!isThisYear">
35
+ {{ themeConfig.footer.since }} -
36
+ </template>
37
+ {{ year }}
38
+ </span>
39
+
40
+ <a v-if="footerIcon" class="inline-flex animate-pulse ml-2" :href="footerIcon.url" target="_blank" :title="footerIcon.title">
41
+ <div :class="footerIcon.name" />
42
+ </a>
43
+
44
+ <span class="ml-2">{{ config.author.name }}</span>
45
+ </div>
46
+
47
+ <div v-if="themeConfig.footer.powered" class="powered" m="2">
48
+ <span v-html="poweredHtml" /> | <span>{{ t('footer.theme') }} - <a :href="themeConfig.pkg.homepage" :title="`valaxy-theme-${config.theme}`" target="_blank">{{ capitalize(config.theme) }}</a> v{{ themeConfig.pkg.version }}</span>
49
+ </div>
50
+
51
+ <slot />
52
+ </footer>
53
+ </template>
@@ -11,7 +11,7 @@ const { headerRef } = useContext()
11
11
  </script>
12
12
 
13
13
  <template>
14
- <header ref="headerRef" class="HairyHeader relative">
14
+ <header ref="headerRef" class="HairyHeader relative animate__animated animate__fadeIn">
15
15
  <div class="h-30vh lt-md:h-60vh min-h-80 flex-center">
16
16
  <HairyPostTitle v-if="title" class="relative z-2" :title="title" v-bind="$props">
17
17
  <template #description>
@@ -9,7 +9,7 @@ defineProps<{
9
9
  </script>
10
10
 
11
11
  <template>
12
- <div class="HairyLayout">
12
+ <div class="HairyLayout min-h-100vh">
13
13
  <HairyNav />
14
14
  <HairyHeader v-bind="header">
15
15
  <template #description>
@@ -22,8 +22,7 @@ defineProps<{
22
22
  <template v-if="$slots['body-slide']" #slide>
23
23
  <slot name="body-slide" />
24
24
  </template>
25
- </HairyBody>1
26
- <HairyBackToTop />
27
- <HairyMeting />
25
+ </HairyBody>
26
+ <HairyFooter class="z-1 relative" />
28
27
  </div>
29
28
  </template>
@@ -22,4 +22,8 @@ useWaline({
22
22
  --waline-theme-color: var(--hy-c-primary);
23
23
  --waline-active-color: var(--hy-c-primary-dark)
24
24
  }
25
+ .wl-editor {
26
+ padding: 4px;
27
+ width: calc(100% - 1rem - 8px);
28
+ }
25
29
  </style>
@@ -0,0 +1,15 @@
1
+ import * as valaxy_dist_node from 'valaxy/dist/node';
2
+
3
+ interface HairyTheme {
4
+ nav?: NavItem[];
5
+ }
6
+ interface NavItem {
7
+ text: string;
8
+ icon?: string;
9
+ link?: string;
10
+ items?: NavItem[];
11
+ }
12
+
13
+ declare const _default: Promise<valaxy_dist_node.ValaxyThemePlugin | valaxy_dist_node.ThemeConfigFn>;
14
+
15
+ export { HairyTheme, NavItem, _default as default };
package/dist/index.js ADDED
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // node/index.ts
21
+ var node_exports = {};
22
+ __export(node_exports, {
23
+ default: () => node_default
24
+ });
25
+ module.exports = __toCommonJS(node_exports);
26
+ var import_valaxy = require("valaxy");
27
+ var safelist = [
28
+ "i-ri-home-line",
29
+ "i-ri-github-line"
30
+ ];
31
+ var node_default = (0, import_valaxy.defineThemePlugin)(() => {
32
+ return {
33
+ vite: {},
34
+ unocss: {
35
+ safelist
36
+ }
37
+ };
38
+ });
39
+ // Annotate the CommonJS export names for ESM import in node:
40
+ 0 && (module.exports = {});
package/dist/index.mjs ADDED
@@ -0,0 +1,17 @@
1
+ // node/index.ts
2
+ import { defineThemePlugin } from "valaxy";
3
+ var safelist = [
4
+ "i-ri-home-line",
5
+ "i-ri-github-line"
6
+ ];
7
+ var node_default = defineThemePlugin(() => {
8
+ return {
9
+ vite: {},
10
+ unocss: {
11
+ safelist
12
+ }
13
+ };
14
+ });
15
+ export {
16
+ node_default as default
17
+ };
package/index.d.ts CHANGED
@@ -3,6 +3,9 @@ import type { ViteSSGContext } from 'vite-ssg'
3
3
  export interface HairyTheme {
4
4
  nav?: NavItem[];
5
5
  home?: {
6
+ headline?: string
7
+ title?: string
8
+ description?: string
6
9
  images?: string[]
7
10
  }
8
11
  user?: {
@@ -42,6 +45,46 @@ export interface HairyTheme {
42
45
  'storage-name'?: string
43
46
  [key: string]: any
44
47
  }
48
+
49
+ footer: Partial<{
50
+ /**
51
+ * 建站于
52
+ */
53
+ since: number
54
+
55
+ /**
56
+ * Icon between year and copyright info.
57
+ */
58
+ icon: {
59
+ /**
60
+ * icon name, i-xxx
61
+ */
62
+ name: string
63
+ animated: boolean
64
+ color: string
65
+ url: string
66
+ title: string
67
+ }
68
+
69
+ /**
70
+ * Powered by valaxy & valaxy-theme-${name}, default is yun
71
+ */
72
+ powered: boolean
73
+
74
+ /**
75
+ * Chinese Users | 中国用户
76
+ * 备案 ICP
77
+ * 国内用户需要在网站页脚展示备案 ICP 号
78
+ * https://beian.miit.gov.cn/
79
+ */
80
+ beian: {
81
+ enable: boolean
82
+ /**
83
+ * 苏ICP备xxxxxxxx号
84
+ */
85
+ icp: string
86
+ }
87
+ }>
45
88
  }
46
89
  export interface NavItem {
47
90
  text: string;
@@ -0,0 +1,24 @@
1
+ <script lang="ts" setup>
2
+ import { computed } from 'vue'
3
+ import { useRoute } from 'vue-router'
4
+
5
+ const route = useRoute()
6
+ const meta = computed(() => route.meta)
7
+ const type = computed(() => meta.value.type || '')
8
+ console.log(type.value)
9
+ </script>
10
+
11
+ <template>
12
+ <HairyBackToTop />
13
+ <HairyMeting />
14
+ <home v-if="type === 'home'" />
15
+ <post v-if="type === 'post'" />
16
+ <archives v-if="type === 'archives'" />
17
+ <categories v-if="type === 'categories'" />
18
+ <month v-if="type === 'month'" />
19
+ <tag v-if="type === 'tag'" />
20
+ <tags v-if="type === 'tags'" />
21
+ <year v-if="type === 'year'" />
22
+ <default v-if="type === 'default'" />
23
+ </template>
24
+
package/layouts/tag.vue CHANGED
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <HairyLayout :header="{ title: `保护标签'${$route.params.tag}'的标签` }">
2
+ <HairyLayout :header="{ title: `包含标签'${$route.params.tag}'的标签` }">
3
3
  <router-view />
4
4
  </HairyLayout>
5
5
  </template>
@@ -528,4 +528,8 @@
528
528
  transform: scale(0);
529
529
  }
530
530
  }
531
+ }
532
+
533
+ .dark .hy-loading {
534
+ background: var(--hy-c-gray-dark-5);
531
535
  }
@@ -6,6 +6,19 @@ function addonHairy(): ValaxyExtendConfig {
6
6
  if (ctx.route.meta.excerpt)
7
7
  ctx.route.meta.frontmatter.text = removeTags(ctx.route.meta.excerpt)
8
8
  },
9
+ pages: {
10
+ extendRoute(route) {
11
+ // 改用 type, 由 theme 决定使用布局
12
+ if (!route.meta.type && route.meta.layout)
13
+ route.meta.type = route.meta.layout
14
+
15
+ if (!route.meta.type)
16
+ route.meta.type = 'default'
17
+
18
+ // 清除所有 layout, 使用统一入口 hairy.vue
19
+ route.meta.layout = 'hairy'
20
+ },
21
+ },
9
22
  }
10
23
  }
11
24
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "valaxy-theme-hairy",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
4
4
  "packageManager": "pnpm@7.5.0",
5
5
  "author": {
6
6
  "email": "wwu710632@gmail.com",
@@ -27,6 +27,7 @@
27
27
  "@iconify-json/simple-icons": "^1.1.19",
28
28
  "@vueuse/core": "^8.9.4",
29
29
  "@waline/client": "^2.6.1",
30
+ "animate.css": "^4.1.1",
30
31
  "dayjs": "^1.11.4",
31
32
  "defu": "^6.0.0",
32
33
  "element-plus": "^2.2.10",
@@ -34,8 +35,7 @@
34
35
  "markdown-toc": "^1.2.0",
35
36
  "reading-time": "^1.5.0",
36
37
  "swiper": "^8.3.1",
37
- "unoverlay-vue": "0.2.1",
38
- "yaml": "^2.1.1"
38
+ "unoverlay-vue": "0.2.1"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@types/lodash": "^4.14.182",
@@ -0,0 +1,76 @@
1
+ .aplayer.aplayer-fixed .aplayer-list,
2
+ .aplayer .aplayer-info {
3
+ font-family: var(--hy-font-family-seto);
4
+ }
5
+
6
+ .dark {
7
+ .aplayer {
8
+ background: #2B2B2B;
9
+ padding: 6px;
10
+ color: #c2c2c2;
11
+ }
12
+
13
+
14
+
15
+ .aplayer.aplayer-fixed .aplayer-body {
16
+ background-color: #2B2B2B;
17
+ }
18
+
19
+ .aplayer.aplayer-fixed .aplayer-info {
20
+ border: none;
21
+ }
22
+
23
+ .aplayer .aplayer-miniswitcher {
24
+ background: #bebebe;
25
+ }
26
+
27
+ .aplayer.aplayer-fixed .aplayer-list {
28
+ border: none;
29
+ }
30
+
31
+ .aplayer .aplayer-list ol {
32
+ padding-right: 4px;
33
+ }
34
+
35
+ .aplayer .aplayer-list ol li.aplayer-list-light {
36
+ background-color: #404040;
37
+ color: var(--hy-c-primary);
38
+
39
+ .aplayer-list-cur {
40
+ background-color: var(--hy-c-primary) !important;
41
+ }
42
+ }
43
+
44
+ .aplayer .aplayer-list ol li {
45
+ border: none;
46
+
47
+ &:hover {
48
+ background: #373737;
49
+ }
50
+ }
51
+
52
+ .aplayer .aplayer-list ol li:nth-child(2n) {
53
+ background: #2F2F2F;
54
+
55
+ &:hover {
56
+ background: #373737;
57
+ }
58
+ }
59
+
60
+ .aplayer .aplayer-list ol li .aplayer-list-index,
61
+ .aplayer .aplayer-list ol li .aplayer-list-author {
62
+ color: #8C8C8C;
63
+ }
64
+
65
+ .aplayer .aplayer-info .aplayer-controller .aplayer-time .aplayer-icon:hover path {
66
+ fill: #d9d9d9 !important;
67
+ }
68
+
69
+ .aplayer .aplayer-miniswitcher .aplayer-icon:hover path {
70
+ // fill: #c2c2c2;
71
+ }
72
+
73
+ .aplayer-pic {
74
+ // border-radius: 4px;
75
+ }
76
+ }
package/styles/index.scss CHANGED
@@ -2,6 +2,8 @@
2
2
  @import "./markdown.scss";
3
3
  @import "./element-plus/index.scss";
4
4
  @import "./scrollbar.scss";
5
+ @import "./aplayer.scss";
6
+ @import "animate.css";
5
7
 
6
8
  body {
7
9
  font-family: var(--hy-font-family-seto);
@@ -10,6 +12,7 @@ body {
10
12
 
11
13
  #app {
12
14
  @apply transition-none;
15
+ min-height: 100vh;
13
16
  }
14
17
 
15
18
  a {
package/valaxy.config.ts CHANGED
@@ -7,11 +7,13 @@ import addonStatistics from './node/addon-statistics'
7
7
  import addonToc from './node/addon-toc'
8
8
  export default defineTheme<HairyTheme>((options) => {
9
9
  const images = addonImages(options)
10
+ const hairy = addonHairy()
10
11
 
11
12
  return {
12
13
  vite: images.vite,
14
+ pages: hairy.pages,
13
15
  extendMd(ctx) {
14
- addonHairy().extendMd?.(ctx)
16
+ hairy.extendMd?.(ctx)
15
17
  images.extendMd?.(ctx)
16
18
  addonStatistics().extendMd?.(ctx)
17
19
  addonToc().extendMd?.(ctx)