valaxy-theme-yun 0.5.0 → 0.6.2

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.
@@ -0,0 +1,72 @@
1
+ <script lang="ts" setup>
2
+ import type { PageData, Post } from 'valaxy'
3
+ import { useConfig, usePostProperty, usePostTitle } from 'valaxy'
4
+ import { computed } from 'vue'
5
+
6
+ const props = defineProps<{
7
+ frontmatter: Post
8
+ data?: PageData
9
+ }>()
10
+ const config = useConfig()
11
+
12
+ const { styles, icon, color } = usePostProperty(props.frontmatter.type)
13
+ const title = usePostTitle(computed(() => props.frontmatter))
14
+ </script>
15
+
16
+ <template>
17
+ <main class="yun-main lt-md:ml-0" flex="~">
18
+ <div w="full" flex="~">
19
+ <slot name="main">
20
+ <div class="content" flex="~ col grow" w="full" p="l-4 lt-md:0">
21
+ <YunCard :cover="frontmatter.cover" m="0" class="relative" :style="styles">
22
+ <slot name="main-header">
23
+ <YunPageHeader :title="title" :icon="frontmatter.icon || icon" :color="frontmatter.color || color" :cover="frontmatter.cover" />
24
+ </slot>
25
+ <slot name="main-header-after" />
26
+
27
+ <div p="x-4 b-8" class="sm:px-6 lg:px-12 xl:px-16" w="full">
28
+ <slot name="main-content" />
29
+ <ValaxyMd :frontmatter="frontmatter">
30
+ <slot name="main-content-md" />
31
+ <slot />
32
+ </ValaxyMd>
33
+ </div>
34
+ </YunCard>
35
+
36
+ <slot name="main-content-after" />
37
+
38
+ <slot name="main-nav">
39
+ <YunPostNav v-if="frontmatter.nav !== false" />
40
+ </slot>
41
+
42
+ <slot v-if="frontmatter.comment !== false" name="comment">
43
+ <YunCard w="full" p="4" class="comment sm:p-6 lg:px-12 xl:px-16" :class="frontmatter.nav === false ? 'mt-4' : 0">
44
+ <YunWaline v-if="config.comment.waline.enable" />
45
+ <YunTwikoo v-if="config.comment.twikoo.enable" />
46
+ </YunCard>
47
+ </slot>
48
+
49
+ <ValaxyFooter>
50
+ <slot name="footer" />
51
+ </ValaxyFooter>
52
+ </div>
53
+ </slot>
54
+
55
+ <slot name="aside">
56
+ <YunAside :frontmatter="frontmatter" :data="data">
57
+ <slot name="aside-custom" />
58
+ </YunAside>
59
+ </slot>
60
+ </div>
61
+ </main>
62
+ </template>
63
+
64
+ <style lang="scss">
65
+ @use '~/styles/mixins' as *;
66
+ @include xl {
67
+ .content{
68
+ // 8px scrollbar width
69
+ max-width: calc(100vw - 2 * var(--va-sidebar-width-mobile) - 1rem - 8px);
70
+ }
71
+ }
72
+ </style>
@@ -4,7 +4,7 @@ import docsearch from '@docsearch/js'
4
4
  import type { DocSearchHit } from '@docsearch/react/dist/esm/types'
5
5
  import { onMounted } from 'vue'
6
6
  import type { AlgoliaSearchOptions } from 'valaxy'
7
- import { useConfig } from 'valaxy/client'
7
+ import { useConfig } from 'valaxy'
8
8
  import { useRoute, useRouter } from 'vue-router'
9
9
 
10
10
  const router = useRouter()
@@ -87,7 +87,7 @@ function initialize(userOptions: AlgoliaSearchOptions) {
87
87
  if (route.path !== relativeHit)
88
88
  event.preventDefault()
89
89
 
90
- router.go(relativeHit)
90
+ router.push(relativeHit)
91
91
  },
92
92
  children,
93
93
  },
@@ -142,6 +142,9 @@ function getRelativePath(absoluteUrl: string) {
142
142
  .dark .DocSearch {
143
143
  --docsearch-modal-shadow: none;
144
144
  --docsearch-footer-shadow: none;
145
+ --docsearch-logo-color: var(--va-c-text-2);
146
+ --docsearch-hit-background: var(--va-c-bg-mute);
147
+ --docsearch-hit-color: var(--va-c-text-2);
145
148
  --docsearch-hit-shadow: none;
146
149
  }
147
150
 
@@ -0,0 +1,81 @@
1
+ <script lang="ts" setup>
2
+ import { useI18n } from 'vue-i18n'
3
+ import type { PageData, Post } from 'valaxy'
4
+ import { useAppStore } from 'valaxy/client/stores/app'
5
+
6
+ defineProps<{ frontmatter: Post; data: PageData }>()
7
+ const { t } = useI18n()
8
+ const app = useAppStore()
9
+ </script>
10
+
11
+ <template>
12
+ <button
13
+ class="xl:hidden toc-btn shadow fixed yun-icon-btn z-350"
14
+ opacity="75" right="2" bottom="19"
15
+ @click="app.toggleRightSidebar()"
16
+ >
17
+ <div i-ri-file-list-line />
18
+ </button>
19
+
20
+ <ValaxyOverlay :show="app.isRightSidebarOpen" @click="app.toggleRightSidebar()" />
21
+
22
+ <!-- -->
23
+ <aside class="va-card aside" :class="app.isRightSidebarOpen && 'open'" m="l-4" text="center">
24
+ <div class="aside-container" flex="~ col">
25
+ <h2 v-if="frontmatter.toc !== false" m="t-6 b-2" font="serif black">
26
+ {{ t('sidebar.toc') }}
27
+ </h2>
28
+
29
+ <YunToc v-if="frontmatter.toc !== false" :headers="data.headers || []" />
30
+
31
+ <div class="flex-grow" />
32
+
33
+ <div v-if="$slots.default" class="custom-container">
34
+ <slot />
35
+ </div>
36
+ </div>
37
+ </aside>
38
+ </template>
39
+
40
+ <style lang="scss">
41
+ @use '~/styles/mixins' as *;
42
+
43
+ .aside {
44
+ position: fixed;
45
+ right: 0;
46
+ top: 0;
47
+ bottom: 0;
48
+
49
+ min-width: var(--va-sidebar-width-mobile);
50
+
51
+ transform: translateX(100%);
52
+
53
+ transition: box-shadow var(--va-transition-duration),
54
+ background-color var(--va-transition-duration), opacity 0.25s,
55
+ transform var(--va-transition-duration) cubic-bezier(0.19, 1, 0.22, 1);
56
+
57
+ &.open {
58
+ right: 0;
59
+ display: block;
60
+ z-index: 10;
61
+ transform: translateX(0);
62
+ }
63
+
64
+ &-container {
65
+ position: sticky;
66
+ top: 0;
67
+ height: 100vh;
68
+ }
69
+ }
70
+
71
+ @include xl {
72
+ .aside {
73
+ transform: translateX(0);
74
+ }
75
+ }
76
+
77
+ .toc-btn {
78
+ color: var(--va-c-primary);
79
+ background-color: white;
80
+ }
81
+ </style>
@@ -6,7 +6,7 @@
6
6
  */
7
7
 
8
8
  import { CSSProperties, computed } from 'vue'
9
- import { useThemeConfig } from 'valaxy/client'
9
+ import { useThemeConfig } from 'valaxy'
10
10
  import { random } from '~/utils'
11
11
  const themeConfig = useThemeConfig()
12
12
 
@@ -1,5 +1,11 @@
1
+ <script lang="ts" setup>
2
+ defineProps<{ cover?: string }>()
3
+ </script>
4
+
1
5
  <template>
2
6
  <div class="yun-card">
7
+ <img v-if="cover" class="object-cover select-none" h="64 md:sm" w="full" :src="cover">
8
+
3
9
  <div v-if="$slots.header" class="yun-card-header">
4
10
  <header>
5
11
  <slot name="header" />
@@ -1,5 +1,5 @@
1
1
  <script lang="ts" setup>
2
- import type { Categories } from 'valaxy/client'
2
+ import type { Categories } from 'valaxy'
3
3
  import { ref } from 'vue'
4
4
 
5
5
  const props = withDefaults(defineProps<{
@@ -1,8 +1,7 @@
1
1
  <script lang="ts" setup>
2
2
  import { ref } from 'vue'
3
- import type { Post } from 'valaxy'
4
- import type { Category } from 'valaxy/client'
5
- import { isParentCategory } from 'valaxy/client'
3
+ import type { Category, Post } from 'valaxy'
4
+ import { isParentCategory } from 'valaxy'
6
5
  import { useI18n } from 'vue-i18n'
7
6
 
8
7
  const props = withDefaults(defineProps<{
@@ -1,5 +1,5 @@
1
1
  <script lang="ts" setup>
2
- import { useConfig } from 'valaxy/client'
2
+ import { useConfig } from 'valaxy'
3
3
  import { useRouter } from 'vue-router'
4
4
 
5
5
  const config = useConfig()
@@ -7,7 +7,7 @@ defineProps<{
7
7
  </script>
8
8
 
9
9
  <template>
10
- <header class="post-header">
10
+ <header class="post-header" m="t-4">
11
11
  <h1 class="post-title" p="2" text="2xl center" font="serif black" :style="`color:${color}`">
12
12
  <div v-if="icon" class="icon" m="r-1" inline-flex :class="icon" />
13
13
  <span>{{ title }}</span>
@@ -1,7 +1,7 @@
1
1
  <script lang="ts" setup>
2
2
  import { computed, ref, watch } from 'vue'
3
3
  import type { Post } from 'valaxy'
4
- import { formatDate, sortByDate } from 'valaxy/client'
4
+ import { formatDate, sortByDate } from 'valaxy'
5
5
  import { useI18n } from 'vue-i18n'
6
6
 
7
7
  const props = defineProps<{
@@ -1,7 +1,7 @@
1
1
  <script lang="ts" setup>
2
2
  import type { Post } from 'valaxy'
3
3
  import { useI18n } from 'vue-i18n'
4
- import { formatDate } from 'valaxy/client'
4
+ import { formatDate } from 'valaxy'
5
5
 
6
6
  defineProps<{
7
7
  frontmatter: Post
@@ -1,6 +1,6 @@
1
1
  <script lang="ts" setup>
2
2
  import { onMounted, ref } from 'vue'
3
- import { useThemeConfig } from 'valaxy/client'
3
+ import { useThemeConfig } from 'valaxy'
4
4
 
5
5
  const themeConfig = useThemeConfig()
6
6
 
@@ -1,5 +1,5 @@
1
1
  <script lang="ts" setup>
2
- import { useThemeConfig } from 'valaxy/client'
2
+ import { useThemeConfig } from 'valaxy'
3
3
  const themeConfig = useThemeConfig()
4
4
  </script>
5
5
 
@@ -1,5 +1,5 @@
1
1
  <script lang="ts" setup>
2
- import { useCategory, usePostList, useTag, useThemeConfig } from 'valaxy/client'
2
+ import { useCategory, usePostList, useTag, useThemeConfig } from 'valaxy'
3
3
  import { useI18n } from 'vue-i18n'
4
4
 
5
5
  const { t } = useI18n()
@@ -1,5 +1,5 @@
1
1
  <script lang="ts" setup>
2
- import { useConfig } from 'valaxy/client'
2
+ import { useConfig } from 'valaxy'
3
3
 
4
4
  const config = useConfig()
5
5
  </script>
@@ -1,5 +1,5 @@
1
1
  <script lang="ts" setup>
2
- import { useConfig } from 'valaxy/client'
2
+ import { useConfig } from 'valaxy'
3
3
  import { ref } from 'vue'
4
4
  import { useI18n } from 'vue-i18n'
5
5
  const { t } = useI18n()
@@ -0,0 +1,135 @@
1
+ <script setup lang="ts">
2
+ import { computed, ref } from 'vue'
3
+ import { useI18n } from 'vue-i18n'
4
+ import type { Header } from 'valaxy'
5
+ import { useThemeConfig } from 'valaxy'
6
+ import { useFrontmatter } from '~/composables'
7
+ import {
8
+ resolveHeaders,
9
+ useActiveAnchor,
10
+ } from '~/composables/outline'
11
+
12
+ const props = defineProps<{ headers: Header[] }>()
13
+
14
+ const frontmatter = useFrontmatter()
15
+ const themeConfig = useThemeConfig()
16
+
17
+ const { locale } = useI18n()
18
+ const container = ref()
19
+ const marker = ref()
20
+
21
+ useActiveAnchor(container, marker)
22
+
23
+ const resolvedHeaders = computed(() => {
24
+ return resolveHeaders(props.headers || [])
25
+ })
26
+
27
+ function handleClick({ target: el }: Event) {
28
+ const id = `#${(el as HTMLAnchorElement).href!.split('#')[1]}`
29
+ const heading = document.querySelector(decodeURIComponent(id)) as HTMLAnchorElement
30
+ heading?.focus()
31
+ }
32
+ </script>
33
+
34
+ <template>
35
+ <div v-show="headers.length" ref="container">
36
+ <div class="content">
37
+ <div class="outline-title">
38
+ {{ themeConfig.outlineTitle || 'On this page' }}
39
+ </div>
40
+
41
+ <div ref="marker" class="outline-marker" />
42
+
43
+ <nav aria-labelledby="doc-outline-aria-label">
44
+ <span id="doc-outline-aria-label" class="visually-hidden">
45
+ Table of Contents for current page
46
+ </span>
47
+
48
+ <ul class="va-toc relative z-1">
49
+ <li
50
+ v-for="{ text, link, children, hidden, lang } in resolvedHeaders"
51
+ v-show="!hidden"
52
+ :key="link"
53
+ class="va-toc-item"
54
+ :lang="lang || locale"
55
+ >
56
+ <a class="outline-link" :href="link" @click="handleClick">
57
+ {{ text }}
58
+ </a>
59
+ <ul v-if="children && frontmatter.outline === 'deep'">
60
+ <li v-for="item in children" v-show="!item.hidden" :key="item.link" :lang="lang || locale">
61
+ <a class="outline-link" p="l-3" :href="link" @click="handleClick">
62
+ {{ item.text }}
63
+ </a>
64
+ </li>
65
+ </ul>
66
+ </li>
67
+ </ul>
68
+ </nav>
69
+ </div>
70
+ </div>
71
+ </template>
72
+
73
+ <style lang="scss" scoped>
74
+ .va-toc {
75
+ text-align: left;
76
+
77
+ .va-toc-item {
78
+ color: var(--va-c-text-light);
79
+ }
80
+ }
81
+
82
+ .content {
83
+ position: relative;
84
+ padding-left: 16px;
85
+ font-size: 14px;
86
+ text-align: left;
87
+ }
88
+
89
+ .outline-marker {
90
+ position: absolute;
91
+ top: 32px;
92
+ left: -2px;
93
+ z-index: 0;
94
+ opacity: 0;
95
+ width: 4px;
96
+ height: 18px;
97
+ background-color: var(--va-c-brand);
98
+ transition: top 0.25s cubic-bezier(0, 1, 0.5, 1), background-color 0.5s, opacity 0.25s;
99
+ border-top-right-radius: 2px;
100
+ border-bottom-right-radius: 2px;
101
+ }
102
+
103
+ .outline-title {
104
+ letter-spacing: 0.4px;
105
+ line-height: 28px;
106
+ font-size: 14px;
107
+ font-weight: 600;
108
+ }
109
+
110
+ .outline-link {
111
+ display: block;
112
+ line-height: 28px;
113
+ color: var(--va-c-text-2);
114
+ white-space: nowrap;
115
+ overflow: hidden;
116
+ text-overflow: ellipsis;
117
+ transition: color 0.5s;
118
+ }
119
+
120
+ .outline-link:hover,
121
+ .outline-link.active {
122
+ color: var(--va-c-brand);
123
+ transition: color 0.25s;
124
+ }
125
+
126
+ .visually-hidden {
127
+ position: absolute;
128
+ width: 1px;
129
+ height: 1px;
130
+ white-space: nowrap;
131
+ clip: rect(0 0 0 0);
132
+ clip-path: inset(50%);
133
+ overflow: hidden;
134
+ }
135
+ </style>
@@ -1,5 +1,5 @@
1
1
  <script lang="ts" setup>
2
- import { useConfig, useTwikoo } from 'valaxy/client'
2
+ import { useConfig, useTwikoo } from 'valaxy'
3
3
 
4
4
  const config = useConfig()
5
5
  useTwikoo(config.value.comment.twikoo)
@@ -1,5 +1,5 @@
1
1
  <script lang="ts" setup>
2
- import { useConfig, useWaline } from 'valaxy/client'
2
+ import { useConfig, useWaline } from 'valaxy'
3
3
 
4
4
  const config = useConfig()
5
5
  useWaline(config.value.comment.waline)
package/config/index.ts CHANGED
@@ -2,12 +2,19 @@ export const anonymousImage = 'https://cdn.jsdelivr.net/gh/YunYouJun/cdn/img/ava
2
2
 
3
3
  export namespace YunTheme {
4
4
  export type Config = ThemeConfig
5
+ export type Sidebar = any
5
6
  }
6
7
 
7
8
  /**
8
9
  * Theme Config
9
10
  */
10
11
  export interface ThemeConfig {
12
+ /**
13
+ * toc title
14
+ * @default 'On this page'
15
+ */
16
+ outlineTitle: string
17
+
11
18
  // for unocss
12
19
  safelist: string[]
13
20
  colors: {
@@ -56,6 +63,8 @@ export interface ThemeConfig {
56
63
  color: string
57
64
  }[]
58
65
 
66
+ sidebar: YunTheme.Sidebar
67
+
59
68
  /**
60
69
  * footer
61
70
  */
@@ -125,6 +134,7 @@ export type ThemeUserConfig = Partial<ThemeConfig>
125
134
  * Default Config
126
135
  */
127
136
  export const defaultThemeConfig: ThemeConfig = {
137
+ outlineTitle: 'On this page',
128
138
  safelist: ['i-ri-clipboard-line'],
129
139
  colors: {
130
140
  primary: '#0078E7',
@@ -151,6 +161,7 @@ export const defaultThemeConfig: ThemeConfig = {
151
161
 
152
162
  pages: [],
153
163
 
164
+ sidebar: null,
154
165
  footer: {
155
166
  since: 2022,
156
167
  icon: {
package/dist/index.d.ts CHANGED
@@ -3,11 +3,17 @@ import { Plugin } from 'vite';
3
3
  declare const anonymousImage = "https://cdn.jsdelivr.net/gh/YunYouJun/cdn/img/avatar/none.jpg";
4
4
  declare namespace YunTheme {
5
5
  type Config = ThemeConfig;
6
+ type Sidebar = any;
6
7
  }
7
8
  /**
8
9
  * Theme Config
9
10
  */
10
11
  interface ThemeConfig {
12
+ /**
13
+ * toc title
14
+ * @default 'On this page'
15
+ */
16
+ outlineTitle: string;
11
17
  safelist: string[];
12
18
  colors: {
13
19
  /**
@@ -50,6 +56,7 @@ interface ThemeConfig {
50
56
  icon: string;
51
57
  color: string;
52
58
  }[];
59
+ sidebar: YunTheme.Sidebar;
53
60
  /**
54
61
  * footer
55
62
  */
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var f="https://cdn.jsdelivr.net/gh/YunYouJun/cdn/img/avatar/none.jpg",n= exports.defaultThemeConfig ={safelist:["i-ri-clipboard-line"],colors:{primary:"#0078E7"},banner:{enable:!0,title:"\u4E91\u6E38\u541B\u7684\u5C0F\u7AD9"},bg_image:{enable:!0,url:"https://cdn.jsdelivr.net/gh/YunYouJun/cdn/img/bg/stars-timing-0-blur-30px.jpg",dark:"https://cdn.jsdelivr.net/gh/YunYouJun/cdn/img/bg/galaxy.jpg"},say:{enable:!0,api:"https://el-bot-api.vercel.app/api/words/young",hitokoto:{enable:!1,api:"https://v1.hitokoto.cn"}},pages:[],footer:{since:2022,icon:{name:"i-ri-cloud-line",animated:!0,color:"var(--va-c-primary)",url:"https://sponsors.yunyoujun.cn",title:"Sponsor YunYouJun"},powered:!0,beian:{enable:!1,icp:""}},types:{link:{color:"var(--va-c-primary)",icon:"i-ri-external-link-line"},bilibili:{color:"#FF8EB3",icon:"i-ri-bilibili-line"},douban:{color:"#007722",icon:"i-ri-douban-line"},github:{color:"var(--va-c-text)",icon:"i-ri-github-line"},"netease-cloud-music":{color:"#C10D0C",icon:"i-ri-netease-cloud-music-line"},notion:{color:"var(--va-c-text)",icon:"i-simple-icons-notion"},twitter:{color:"#1da1f2",icon:"i-ri-twitter-line"},wechat:{color:"#1AAD19",icon:"i-ri-wechat-2-line"},weibo:{color:"#E6162D",icon:"i-ri-weibo-line"},yuque:{color:"#25b864",icon:"i-ant-design-yuque-outlined"},zhihu:{color:"#0084FF",icon:"i-ri-zhihu-line"}},menu:{custom:{title:"button.about",icon:"i-ri-clipboard-line",url:"/about"}}};n.safelist=n.safelist.concat(m(n));function m(i){var t,r,a,l,s,c,u,p;let e=[],o=i.types;if(o)for(let g in o)e.push(o[g].icon);return(r=(t=i.footer)==null?void 0:t.icon)!=null&&r.name&&e.push((l=(a=i.footer)==null?void 0:a.icon)==null?void 0:l.name),(c=(s=i.menu)==null?void 0:s.custom)!=null&&c.icon&&e.push((p=(u=i.menu)==null?void 0:u.custom)==null?void 0:p.icon),e}function b(i=n){return{name:"valaxy-theme-yun",enforce:"pre",config(){var e;return{css:{preprocessorOptions:{scss:{additionalData:`$c-primary: ${((e=i.colors)==null?void 0:e.primary)||"#0078E7"} !default;`}}}}}}}var y=b;exports.anonymousImage = f; exports.default = y; exports.defaultThemeConfig = n; exports.generateSafelist = m; exports.yunPlugin = b;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var f="https://cdn.jsdelivr.net/gh/YunYouJun/cdn/img/avatar/none.jpg",n= exports.defaultThemeConfig ={outlineTitle:"On this page",safelist:["i-ri-clipboard-line"],colors:{primary:"#0078E7"},banner:{enable:!0,title:"\u4E91\u6E38\u541B\u7684\u5C0F\u7AD9"},bg_image:{enable:!0,url:"https://cdn.jsdelivr.net/gh/YunYouJun/cdn/img/bg/stars-timing-0-blur-30px.jpg",dark:"https://cdn.jsdelivr.net/gh/YunYouJun/cdn/img/bg/galaxy.jpg"},say:{enable:!0,api:"https://el-bot-api.vercel.app/api/words/young",hitokoto:{enable:!1,api:"https://v1.hitokoto.cn"}},pages:[],sidebar:null,footer:{since:2022,icon:{name:"i-ri-cloud-line",animated:!0,color:"var(--va-c-primary)",url:"https://sponsors.yunyoujun.cn",title:"Sponsor YunYouJun"},powered:!0,beian:{enable:!1,icp:""}},types:{link:{color:"var(--va-c-primary)",icon:"i-ri-external-link-line"},bilibili:{color:"#FF8EB3",icon:"i-ri-bilibili-line"},douban:{color:"#007722",icon:"i-ri-douban-line"},github:{color:"var(--va-c-text)",icon:"i-ri-github-line"},"netease-cloud-music":{color:"#C10D0C",icon:"i-ri-netease-cloud-music-line"},notion:{color:"var(--va-c-text)",icon:"i-simple-icons-notion"},twitter:{color:"#1da1f2",icon:"i-ri-twitter-line"},wechat:{color:"#1AAD19",icon:"i-ri-wechat-2-line"},weibo:{color:"#E6162D",icon:"i-ri-weibo-line"},yuque:{color:"#25b864",icon:"i-ant-design-yuque-outlined"},zhihu:{color:"#0084FF",icon:"i-ri-zhihu-line"}},menu:{custom:{title:"button.about",icon:"i-ri-clipboard-line",url:"/about"}}};n.safelist=n.safelist.concat(m(n));function m(e){var t,r,a,l,s,c,u,p;let i=[],o=e.types;if(o)for(let g in o)i.push(o[g].icon);return(r=(t=e.footer)==null?void 0:t.icon)!=null&&r.name&&i.push((l=(a=e.footer)==null?void 0:a.icon)==null?void 0:l.name),(c=(s=e.menu)==null?void 0:s.custom)!=null&&c.icon&&i.push((p=(u=e.menu)==null?void 0:u.custom)==null?void 0:p.icon),i}function b(e=n){return{name:"valaxy-theme-yun",enforce:"pre",config(){var i;return{css:{preprocessorOptions:{scss:{additionalData:`$c-primary: ${((i=e.colors)==null?void 0:i.primary)||"#0078E7"} !default;`}}}}}}}var y=b;exports.anonymousImage = f; exports.default = y; exports.defaultThemeConfig = n; exports.generateSafelist = m; exports.yunPlugin = b;
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- var f="https://cdn.jsdelivr.net/gh/YunYouJun/cdn/img/avatar/none.jpg",n={safelist:["i-ri-clipboard-line"],colors:{primary:"#0078E7"},banner:{enable:!0,title:"\u4E91\u6E38\u541B\u7684\u5C0F\u7AD9"},bg_image:{enable:!0,url:"https://cdn.jsdelivr.net/gh/YunYouJun/cdn/img/bg/stars-timing-0-blur-30px.jpg",dark:"https://cdn.jsdelivr.net/gh/YunYouJun/cdn/img/bg/galaxy.jpg"},say:{enable:!0,api:"https://el-bot-api.vercel.app/api/words/young",hitokoto:{enable:!1,api:"https://v1.hitokoto.cn"}},pages:[],footer:{since:2022,icon:{name:"i-ri-cloud-line",animated:!0,color:"var(--va-c-primary)",url:"https://sponsors.yunyoujun.cn",title:"Sponsor YunYouJun"},powered:!0,beian:{enable:!1,icp:""}},types:{link:{color:"var(--va-c-primary)",icon:"i-ri-external-link-line"},bilibili:{color:"#FF8EB3",icon:"i-ri-bilibili-line"},douban:{color:"#007722",icon:"i-ri-douban-line"},github:{color:"var(--va-c-text)",icon:"i-ri-github-line"},"netease-cloud-music":{color:"#C10D0C",icon:"i-ri-netease-cloud-music-line"},notion:{color:"var(--va-c-text)",icon:"i-simple-icons-notion"},twitter:{color:"#1da1f2",icon:"i-ri-twitter-line"},wechat:{color:"#1AAD19",icon:"i-ri-wechat-2-line"},weibo:{color:"#E6162D",icon:"i-ri-weibo-line"},yuque:{color:"#25b864",icon:"i-ant-design-yuque-outlined"},zhihu:{color:"#0084FF",icon:"i-ri-zhihu-line"}},menu:{custom:{title:"button.about",icon:"i-ri-clipboard-line",url:"/about"}}};n.safelist=n.safelist.concat(m(n));function m(i){var t,r,a,l,s,c,u,p;let e=[],o=i.types;if(o)for(let g in o)e.push(o[g].icon);return(r=(t=i.footer)==null?void 0:t.icon)!=null&&r.name&&e.push((l=(a=i.footer)==null?void 0:a.icon)==null?void 0:l.name),(c=(s=i.menu)==null?void 0:s.custom)!=null&&c.icon&&e.push((p=(u=i.menu)==null?void 0:u.custom)==null?void 0:p.icon),e}function b(i=n){return{name:"valaxy-theme-yun",enforce:"pre",config(){var e;return{css:{preprocessorOptions:{scss:{additionalData:`$c-primary: ${((e=i.colors)==null?void 0:e.primary)||"#0078E7"} !default;`}}}}}}}var y=b;export{f as anonymousImage,y as default,n as defaultThemeConfig,m as generateSafelist,b as yunPlugin};
1
+ var f="https://cdn.jsdelivr.net/gh/YunYouJun/cdn/img/avatar/none.jpg",n={outlineTitle:"On this page",safelist:["i-ri-clipboard-line"],colors:{primary:"#0078E7"},banner:{enable:!0,title:"\u4E91\u6E38\u541B\u7684\u5C0F\u7AD9"},bg_image:{enable:!0,url:"https://cdn.jsdelivr.net/gh/YunYouJun/cdn/img/bg/stars-timing-0-blur-30px.jpg",dark:"https://cdn.jsdelivr.net/gh/YunYouJun/cdn/img/bg/galaxy.jpg"},say:{enable:!0,api:"https://el-bot-api.vercel.app/api/words/young",hitokoto:{enable:!1,api:"https://v1.hitokoto.cn"}},pages:[],sidebar:null,footer:{since:2022,icon:{name:"i-ri-cloud-line",animated:!0,color:"var(--va-c-primary)",url:"https://sponsors.yunyoujun.cn",title:"Sponsor YunYouJun"},powered:!0,beian:{enable:!1,icp:""}},types:{link:{color:"var(--va-c-primary)",icon:"i-ri-external-link-line"},bilibili:{color:"#FF8EB3",icon:"i-ri-bilibili-line"},douban:{color:"#007722",icon:"i-ri-douban-line"},github:{color:"var(--va-c-text)",icon:"i-ri-github-line"},"netease-cloud-music":{color:"#C10D0C",icon:"i-ri-netease-cloud-music-line"},notion:{color:"var(--va-c-text)",icon:"i-simple-icons-notion"},twitter:{color:"#1da1f2",icon:"i-ri-twitter-line"},wechat:{color:"#1AAD19",icon:"i-ri-wechat-2-line"},weibo:{color:"#E6162D",icon:"i-ri-weibo-line"},yuque:{color:"#25b864",icon:"i-ant-design-yuque-outlined"},zhihu:{color:"#0084FF",icon:"i-ri-zhihu-line"}},menu:{custom:{title:"button.about",icon:"i-ri-clipboard-line",url:"/about"}}};n.safelist=n.safelist.concat(m(n));function m(e){var t,r,a,l,s,c,u,p;let i=[],o=e.types;if(o)for(let g in o)i.push(o[g].icon);return(r=(t=e.footer)==null?void 0:t.icon)!=null&&r.name&&i.push((l=(a=e.footer)==null?void 0:a.icon)==null?void 0:l.name),(c=(s=e.menu)==null?void 0:s.custom)!=null&&c.icon&&i.push((p=(u=e.menu)==null?void 0:u.custom)==null?void 0:p.icon),i}function b(e=n){return{name:"valaxy-theme-yun",enforce:"pre",config(){var i;return{css:{preprocessorOptions:{scss:{additionalData:`$c-primary: ${((i=e.colors)==null?void 0:i.primary)||"#0078E7"} !default;`}}}}}}}var y=b;export{f as anonymousImage,y as default,n as defaultThemeConfig,m as generateSafelist,b as yunPlugin};
package/layouts/404.vue CHANGED
@@ -7,7 +7,7 @@ const { t } = useI18n()
7
7
  </script>
8
8
 
9
9
  <template>
10
- <YunBase>
10
+ <Base>
11
11
  <template #content>
12
12
  <div text="center">
13
13
  <div text-4xl>
@@ -21,5 +21,5 @@ const { t } = useI18n()
21
21
  </div>
22
22
  </div>
23
23
  </template>
24
- </YunBase>
24
+ </Base>
25
25
  </template>
@@ -1,5 +1,5 @@
1
1
  <script lang="ts" setup>
2
- import { useFrontmatter, usePostList, usePostTitle } from 'valaxy/client'
2
+ import { useFrontmatter, usePostList, usePostTitle } from 'valaxy'
3
3
  import { useI18n } from 'vue-i18n'
4
4
 
5
5
  const { t } = useI18n()
@@ -11,13 +11,13 @@ const title = usePostTitle(frontmatter)
11
11
  </script>
12
12
 
13
13
  <template>
14
- <YunBase>
15
- <template #header>
14
+ <Base>
15
+ <template #main-header>
16
16
  <YunPageHeader :title="title || t('menu.archives')" :icon="frontmatter.icon || 'i-ri-archive-line'" :color="frontmatter.color" />
17
17
  </template>
18
- <template #content>
18
+ <template #main-content>
19
19
  <router-view />
20
20
  <YunPostCollapse :posts="postList" />
21
21
  </template>
22
- </YunBase>
22
+ </Base>
23
23
  </template>
package/layouts/base.vue CHANGED
@@ -1,14 +1,14 @@
1
1
  <script lang="ts" setup>
2
- import { useConfig, useFrontmatter, usePostProperty, usePostTitle } from 'valaxy/client'
3
- const frontmatter = useFrontmatter()
2
+ import { useConfig } from 'valaxy'
4
3
 
5
4
  const config = useConfig()
6
-
7
- const { styles, icon, color } = usePostProperty(frontmatter.value.type)
8
- const title = usePostTitle(frontmatter)
9
5
  </script>
10
6
 
11
7
  <template>
8
+ <slot name="bg">
9
+ <ValaxyBg v-if="config.themeConfig.bg_image.enable" />
10
+ </slot>
11
+
12
12
  <ValaxySidebar>
13
13
  <slot name="sidebar">
14
14
  <YunSidebar v-if="$slots['sidebar-child']">
@@ -18,56 +18,34 @@ const title = usePostTitle(frontmatter)
18
18
  </slot>
19
19
  </ValaxySidebar>
20
20
 
21
- <main class="yun-main flex lt-md:ml-0">
22
- <div flex="~ 1 col" w="full" p="l-4 lt-md:0" class="content">
23
- <YunCard m="0" p="4" class="relative sm:p-6 lg:px-12 xl:px-16" :style="styles">
24
- <slot name="header">
25
- <YunPageHeader :title="title" :icon="frontmatter.icon || icon" :color="frontmatter.color || color" :cover="frontmatter.cover" />
26
- </slot>
27
- <template #content>
28
- <slot name="content">
29
- <router-view />
30
- </slot>
31
- </template>
32
- </YunCard>
33
-
34
- <slot :frontmatter="frontmatter" />
35
-
36
- <slot name="nav">
37
- <YunPostNav v-if="frontmatter.nav !== false" />
38
- </slot>
39
-
40
- <slot v-if="frontmatter.comment !== false" name="comment">
41
- <YunCard w="full" p="4" class="comment sm:p-6 lg:px-12 xl:px-16" :class="frontmatter.nav === false ? 'mt-4' : 0">
42
- <YunWaline v-if="config.comment.waline.enable" />
43
- <YunTwikoo v-if="config.comment.twikoo.enable" />
44
- </YunCard>
45
- </slot>
46
-
47
- <ValaxyFooter>
21
+ <router-view v-slot="{ Component }">
22
+ <component :is="Component">
23
+ <template #main-header>
24
+ <slot name="main-header" />
25
+ </template>
26
+
27
+ <template #main-header-after>
28
+ <slot name="main-header-after" />
29
+ </template>
30
+ <template #main>
31
+ <slot name="main" />
32
+ </template>
33
+ <template #main-content>
34
+ <slot name="main-content" />
35
+ </template>
36
+ <template #main-content-after>
37
+ <slot name="main-content-after" />
38
+ </template>
39
+ <template #aside-custom>
40
+ <slot name="aside-custom" />
41
+ </template>
42
+ <template #footer>
48
43
  <slot name="footer" />
49
- </ValaxyFooter>
50
- </div>
51
-
52
- <slot name="right-sidebar">
53
- <ValaxyRightSidebar :frontmatter="frontmatter">
54
- <template #custom>
55
- <slot name="right-custom" />
56
- </template>
57
- </ValaxyRightSidebar>
58
- </slot>
59
- </main>
44
+ </template>
45
+ </component>
46
+ </router-view>
60
47
 
61
48
  <YunSearch v-if="config.search.enable" />
62
49
  <YunBackToTop />
63
50
  </template>
64
51
 
65
- <style lang="scss">
66
- @use '~/styles/mixins' as *;
67
- @include xl {
68
- .content{
69
- // 8px scrollbar width
70
- max-width: calc(100vw - 2 * var(--va-sidebar-width-mobile) - 1rem - 8px);
71
- }
72
- }
73
- </style>
@@ -1,6 +1,6 @@
1
1
  <script lang="ts" setup>
2
2
  import { computed, ref } from 'vue'
3
- import { useCategory, useFrontmatter, useInvisibleElement, usePostList, usePostTitle } from 'valaxy/client'
3
+ import { useCategory, useFrontmatter, useInvisibleElement, usePostList, usePostTitle } from 'valaxy'
4
4
  import { useI18n } from 'vue-i18n'
5
5
  import { useRoute, useRouter } from 'vue-router'
6
6
 
@@ -46,15 +46,15 @@ const title = usePostTitle(frontmatter)
46
46
  </script>
47
47
 
48
48
  <template>
49
- <YunBase>
50
- <template #header>
49
+ <Base>
50
+ <template #main-header>
51
51
  <YunPageHeader
52
52
  :title="title || t('menu.categories')"
53
53
  :icon="frontmatter.icon || 'i-ri-folder-2-line'"
54
54
  :color="frontmatter.color"
55
55
  />
56
56
  </template>
57
- <template #content>
57
+ <template #main-content>
58
58
  <div text="center" class="yun-text-light" p="2">
59
59
  {{ t('counter.categories', categories.children!.size) }}
60
60
  </div>
@@ -62,9 +62,11 @@ const title = usePostTitle(frontmatter)
62
62
  <router-view />
63
63
  </template>
64
64
 
65
- <YunCard v-if="curCategory" ref="collapse" m="t-4" w="full">
66
- <YunPageHeader m="t-4" :title="curCategory === 'Uncategorized' ? t('category.uncategorized') : curCategory" icon="i-ri-folder-open-line" />
67
- <YunPostCollapse w="full" m="b-4" p="x-20 lt-sm:x-5" :posts="posts" />
68
- </YunCard>
69
- </YunBase>
65
+ <template #main-content-after>
66
+ <YunCard v-if="curCategory" ref="collapse" m="t-4" w="full">
67
+ <YunPageHeader :title="curCategory === 'Uncategorized' ? t('category.uncategorized') : curCategory" icon="i-ri-folder-open-line" />
68
+ <YunPostCollapse w="full" m="b-4" p="x-20 lt-sm:x-5" :posts="posts" />
69
+ </YunCard>
70
+ </template>
71
+ </Base>
70
72
  </template>
@@ -1,7 +1,7 @@
1
1
  <template>
2
- <YunBase>
2
+ <Base>
3
3
  <template #content>
4
4
  <router-view />
5
5
  </template>
6
- </YunBase>
6
+ </Base>
7
7
  </template>
package/layouts/home.vue CHANGED
@@ -1,5 +1,5 @@
1
1
  <script lang="ts" setup>
2
- import { useConfig } from 'valaxy/client'
2
+ import { useConfig } from 'valaxy'
3
3
  import { useLayout } from '~/composables'
4
4
 
5
5
  import { useAppStore } from '~/stores/app'
package/layouts/post.vue CHANGED
@@ -1,6 +1,6 @@
1
1
  <script lang="ts" setup>
2
2
  import { computed } from 'vue'
3
- import { useConfig, useFrontmatter, useFullUrl } from 'valaxy/client'
3
+ import { useConfig, useFrontmatter, useFullUrl } from 'valaxy'
4
4
 
5
5
  const config = useConfig()
6
6
  const frontmatter = useFrontmatter()
@@ -15,20 +15,18 @@ const showSponsor = computed(() => {
15
15
  </script>
16
16
 
17
17
  <template>
18
- <YunBase>
19
- <template #content>
20
- <main text="left" m="auto" p="t-0 b-2">
21
- <slot name="header">
22
- <YunPostMeta :frontmatter="frontmatter" />
23
- </slot>
24
- <router-view v-slot="{ Component }">
25
- <Transition appear>
26
- <component :is="Component" />
27
- </Transition>
28
- </router-view>
29
- <YunSponsor v-if="showSponsor" />
30
- <ValaxyCopyright v-if="frontmatter.copyright || config.license.enabled" :url="url" m="y-4" />
31
- </main>
18
+ <Base>
19
+ <template #main-header-after>
20
+ <YunPostMeta :frontmatter="frontmatter" />
32
21
  </template>
33
- </YunBase>
22
+
23
+ <template #main>
24
+ <YunSponsor v-if="showSponsor" />
25
+ <ValaxyCopyright v-if="frontmatter.copyright || config.license.enabled" :url="url" m="y-4" />
26
+ </template>
27
+
28
+ <template #aside-custom>
29
+ <slot name="aside-custom" />
30
+ </template>
31
+ </Base>
34
32
  </template>
package/layouts/tags.vue CHANGED
@@ -1,5 +1,5 @@
1
1
  <script lang="ts" setup>
2
- import { useFrontmatter, useInvisibleElement, usePostList, usePostTitle, useTags, useThemeConfig } from 'valaxy/client'
2
+ import { useFrontmatter, useInvisibleElement, usePostList, usePostTitle, useTags, useThemeConfig } from 'valaxy'
3
3
  import { useI18n } from 'vue-i18n'
4
4
  import { computed, ref } from 'vue'
5
5
  import { useRoute, useRouter } from 'vue-router'
@@ -48,15 +48,15 @@ const title = usePostTitle(frontmatter)
48
48
  </script>
49
49
 
50
50
  <template>
51
- <YunBase>
52
- <template #header>
51
+ <Base>
52
+ <template #main-header>
53
53
  <YunPageHeader
54
54
  :title="title || t('menu.tags')"
55
55
  :icon="frontmatter.icon || 'i-ri-tag-line'"
56
56
  :color="frontmatter.color"
57
57
  />
58
58
  </template>
59
- <template #content>
59
+ <template #main-content>
60
60
  <div class="yun-text-light" text="center" p="2">
61
61
  {{ t('counter.tags', Array.from(tags).length) }}
62
62
  </div>
@@ -70,11 +70,13 @@ const title = usePostTitle(frontmatter)
70
70
  <router-view />
71
71
  </template>
72
72
 
73
- <YunCard v-if="curTag" ref="collapse" m="t-4" w="full">
74
- <YunPageHeader m="t-4" :title="curTag" icon="i-ri-hashtag" />
75
- <YunPostCollapse w="full" m="b-4" p="x-20 lt-sm:x-5" :posts="posts" />
76
- </YunCard>
77
- </YunBase>
73
+ <template #main-content-after>
74
+ <YunCard v-if="curTag" ref="collapse" m="t-4" w="full">
75
+ <YunPageHeader :title="curTag" icon="i-ri-hashtag" />
76
+ <YunPostCollapse w="full" m="b-4" p="x-20 lt-sm:x-5" :posts="posts" />
77
+ </YunCard>
78
+ </template>
79
+ </Base>
78
80
  </template>
79
81
 
80
82
  <style lang="scss">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "valaxy-theme-yun",
3
- "version": "0.5.0",
3
+ "version": "0.6.2",
4
4
  "author": {
5
5
  "email": "me@yunyoujun.cn",
6
6
  "name": "YunYouJun",
@@ -15,10 +15,10 @@
15
15
  "types": "dist/index.d.ts",
16
16
  "dependencies": {
17
17
  "@iconify-json/ant-design": "^1.1.2",
18
- "@iconify-json/simple-icons": "^1.1.15"
18
+ "@iconify-json/simple-icons": "^1.1.16"
19
19
  },
20
20
  "devDependencies": {
21
- "valaxy": "0.5.0"
21
+ "valaxy": "0.6.2"
22
22
  },
23
23
  "scripts": {
24
24
  "build": "tsup",
@@ -4,4 +4,5 @@
4
4
  .yun-main {
5
5
  padding-left: var(--va-sidebar-width-mobile);
6
6
  transition: padding-left var(--va-transition-duration);
7
+ box-sizing: border-box;
7
8
  }
@@ -11,6 +11,9 @@ html.dark {
11
11
  }
12
12
 
13
13
  .markdown-body {
14
+ word-wrap: break-word;
15
+ word-break: break-all;
16
+
14
17
  h1,
15
18
  h2,
16
19
  h3,
@@ -1,32 +0,0 @@
1
- <script setup lang="ts">
2
- // export layouts/base.vue as components
3
- import { useThemeConfig } from 'valaxy/client'
4
- import Base from '../layouts/base.vue'
5
-
6
- const themeConfig = useThemeConfig()
7
- </script>
8
-
9
- <template>
10
- <ValaxyBg v-if="themeConfig.bg_image.enable" />
11
-
12
- <Base>
13
- <template #sidebar>
14
- <slot name="sidebar" />
15
- </template>
16
- <template #content>
17
- <slot name="content" />
18
- </template>
19
- <template #nav>
20
- <slot name="nav" />
21
- </template>
22
- <template #comment>
23
- <slot name="comment" />
24
- </template>
25
- <template #footer>
26
- <slot name="footer" />
27
- </template>
28
- <template #right-sidebar>
29
- <slot name="right-sidebar" />
30
- </template>
31
- </Base>
32
- </template>