valaxy 0.15.4 → 0.15.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/client/App.vue CHANGED
@@ -1,6 +1,6 @@
1
1
  <script setup lang="ts">
2
2
  import { computed, onBeforeMount } from 'vue'
3
- import { useHead, useSeoMeta } from '@vueuse/head'
3
+ import { useHead, useSeoMeta } from '@unhead/vue'
4
4
 
5
5
  // @ts-expect-error virtual module
6
6
  import ValaxyUserApp from '/@valaxyjs/UserAppVue'
@@ -9,7 +9,7 @@ import ValaxyUserApp from '/@valaxyjs/UserAppVue'
9
9
  import ValaxyThemeApp from '/@valaxyjs/ThemeAppVue'
10
10
  import pkg from 'valaxy/package.json'
11
11
  import { useI18n } from 'vue-i18n'
12
- import { definePerson, defineWebPage, defineWebSite, useSchemaOrg } from '@vueuse/schema-org'
12
+ import { definePerson, defineWebPage, defineWebSite, useSchemaOrg } from '@unhead/schema-org'
13
13
  import dayjs from 'dayjs'
14
14
  import ValaxyAddons from './components/ValaxyAddons.vue'
15
15
  import { isDark, useFrontmatter } from './composables'
@@ -55,6 +55,12 @@ useHead({
55
55
  content: `Valaxy ${pkg.version}`,
56
56
  },
57
57
  ],
58
+
59
+ templateParams: {
60
+ schemaOrg: {
61
+ host: siteConfig.value.url,
62
+ },
63
+ },
58
64
  })
59
65
 
60
66
  // seo
@@ -65,25 +71,27 @@ const description = computed(() => fm.value.excerpt || fm.value.description || s
65
71
  useSeoMeta({
66
72
  description,
67
73
  ogDescription: description,
68
- ogLocale: computed(() => fm.value.lang || siteConfig.value.lang),
74
+ ogLocale: computed(() => locale.value || fm.value.lang || siteConfig.value.lang || 'en'),
75
+ ogLocaleAlternate: computed(() => siteConfig.value.languages.filter(l => l !== locale.value)),
69
76
  ogSiteName: computed(() => siteConfig.value.title),
70
77
  ogTitle: computed(() => fm.value.title || siteConfig.value.title),
71
78
  ogImage: computed(() => fm.value.ogImage || fm.value.cover || siteConfig.value.favicon),
79
+ ogType: 'website',
72
80
  ogUrl: siteUrl,
73
81
  })
74
82
 
75
83
  // for SEO
76
84
  useSchemaOrg([
77
- // https://unhead-schema-org.harlanzw.com//guide/guides/identity.html
85
+ // https://unhead.unjs.io/guide/guides/identity.html
78
86
  // Personal Website or Blog
79
87
  definePerson({
80
- name: computed(() => siteConfig.value.author.name),
81
- url: siteUrl,
82
- image: computed(() => siteConfig.value.author.avatar),
83
- sameAs: computed(() => siteConfig.value.social.map(s => s.link)),
88
+ name: siteConfig.value.author.name,
89
+ url: siteUrl.value,
90
+ image: siteConfig.value.author.avatar,
91
+ sameAs: siteConfig.value.social.map(s => s.link),
84
92
  }),
85
93
  defineWebSite({
86
- name: title,
94
+ name: title.value,
87
95
  datePublished: computed(() => fm.value.date),
88
96
  dateModified: computed(() => fm.value.updated),
89
97
  }),
@@ -1,5 +1,5 @@
1
1
  import { useScriptTag } from '@vueuse/core'
2
- import { useHead } from '@vueuse/head'
2
+ import { useHead } from '@unhead/vue'
3
3
  import { computed } from 'vue'
4
4
  import { useSiteConfig } from '../..'
5
5
 
@@ -1,4 +1,4 @@
1
- import { useHead } from '@vueuse/head'
1
+ import { useHead } from '@unhead/vue'
2
2
 
3
3
  /**
4
4
  * @deprecated
@@ -107,3 +107,6 @@ time:
107
107
  hour: 1 Hour | {count} Hours
108
108
  minute: 1 Minute | {count} Minutes
109
109
  second: 1 Second | {count} Seconds
110
+
111
+ tooltip:
112
+ last_updated: Last updated
@@ -106,3 +106,6 @@ time:
106
106
  hour: 1 小时 | {count} 小时
107
107
  minute: 1 分 | {count} 分
108
108
  second: 1 秒 | {count} 秒
109
+
110
+ tooltip:
111
+ last_updated: 最后更新于
@@ -9,7 +9,7 @@ export const install: UserModule = async ({ head, isClient, router }) => {
9
9
 
10
10
  const valaxyConfig = initValaxyConfig()
11
11
 
12
- const { SchemaOrgUnheadPlugin } = await import('@vueuse/schema-org')
12
+ const { SchemaOrgUnheadPlugin } = await import('@unhead/schema-org')
13
13
  head?.use(SchemaOrgUnheadPlugin({
14
14
  // config
15
15
  host: valaxyConfig.value.siteConfig.url || 'https://valaxy.site',
@@ -190,3 +190,38 @@ html:not(.dark) .vp-code-dark {
190
190
  opacity: 0;
191
191
  }
192
192
  }
193
+
194
+ // diff
195
+ .markdown-body {
196
+ [class*='language-'] code .diff {
197
+ transition: background-color 0.5s;
198
+ margin: 0 -24px;
199
+ padding: 0 24px;
200
+ width: calc(100% + 2 * 24px);
201
+ display: inline-block;
202
+ }
203
+
204
+ [class*='language-'] code .diff::before {
205
+ position: absolute;
206
+ left: 10px;
207
+ }
208
+
209
+ [class*='language-'] code .diff.remove {
210
+ background-color: var(--va-code-line-diff-remove-color);
211
+ opacity: 0.7;
212
+ }
213
+
214
+ [class*='language-'] code .diff.remove::before {
215
+ content: '-';
216
+ color: var(--va-code-line-diff-remove-symbol-color);
217
+ }
218
+
219
+ [class*='language-'] code .diff.add {
220
+ background-color: var(--va-code-line-diff-add-color);
221
+ }
222
+
223
+ [class*='language-'] code .diff.add::before {
224
+ content: '+';
225
+ color: var(--va-code-line-diff-add-symbol-color);
226
+ }
227
+ }
@@ -170,7 +170,6 @@
170
170
  .custom-block a {
171
171
  color: inherit;
172
172
  font-weight: 600;
173
- // text-decoration: underline;
174
173
  text-underline-offset: 2px;
175
174
  transition: opacity 0.25s;
176
175
  }
@@ -1,3 +1,9 @@
1
+ .katex-display {
2
+ overflow-x: auto;
3
+ overflow-y: visible;
4
+ padding: 8px 0;
5
+ }
6
+
1
7
  .katex-display > .katex > .katex-html > .tag {
2
8
  right: 2px;
3
9
  }
@@ -4,3 +4,4 @@ export * from './time'
4
4
  export * from './wrap'
5
5
  export * from './types'
6
6
  export * from './content'
7
+ export * from './router'
@@ -0,0 +1,39 @@
1
+ export interface ScrollToOptions {
2
+ smooth: boolean
3
+ targetPadding: number
4
+ }
5
+
6
+ export function scrollTo(el: HTMLElement, hash: string, options: Partial<ScrollToOptions> = {
7
+ smooth: true,
8
+ targetPadding: -64,
9
+ }) {
10
+ let target: Element | null = null
11
+ try {
12
+ target = el.classList.contains('header-anchor')
13
+ ? el
14
+ : ((decodeURIComponent(hash) && document.querySelector(decodeURIComponent(hash))) || null)
15
+ }
16
+ catch (e) {
17
+ console.warn(e)
18
+ }
19
+
20
+ if (target) {
21
+ const targetPadding = options?.targetPadding || -64
22
+ const targetTop
23
+ = window.scrollY
24
+ + (target as HTMLElement).getBoundingClientRect().top
25
+ + targetPadding
26
+
27
+ // only smooth scroll if distance is smaller than screen height.
28
+ if (!options.smooth || Math.abs(targetTop - window.scrollY) > window.innerHeight) {
29
+ window.scrollTo(0, targetTop)
30
+ }
31
+ else {
32
+ window.scrollTo({
33
+ // left: 0,
34
+ top: targetTop,
35
+ behavior: 'smooth',
36
+ })
37
+ }
38
+ }
39
+ }