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 +17 -9
- package/client/composables/widgets/aplayer.ts +1 -1
- package/client/composables/widgets/codepen.ts +1 -1
- package/client/locales/en.yml +3 -0
- package/client/locales/zh-CN.yml +3 -0
- package/client/modules/schemaOrg.ts +1 -1
- package/client/styles/common/code.scss +35 -0
- package/client/styles/components/custom-block.scss +0 -1
- package/client/styles/third/katex.scss +6 -0
- package/client/utils/index.ts +1 -0
- package/client/utils/router.ts +39 -0
- package/dist/chunk-43XYAG2L.cjs +129 -0
- package/dist/chunk-4TR5DCV6.mjs +130 -0
- package/dist/{config-9f7e02a4.d.ts → config-29a16f62.d.ts} +9 -1
- package/dist/node/cli.cjs +1 -1
- package/dist/node/cli.mjs +1 -1
- package/dist/node/index.cjs +1 -1
- package/dist/node/index.d.cts +1 -1
- package/dist/node/index.d.ts +1 -1
- package/dist/node/index.mjs +1 -1
- package/dist/types/index.d.cts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/package.json +6 -4
- package/types/config.ts +9 -1
- package/types/default-theme.d.ts +1 -0
- package/dist/chunk-EXQ7FCH2.cjs +0 -128
- package/dist/chunk-SXINH4FB.mjs +0 -129
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 '@
|
|
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 '@
|
|
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
|
|
85
|
+
// https://unhead.unjs.io/guide/guides/identity.html
|
|
78
86
|
// Personal Website or Blog
|
|
79
87
|
definePerson({
|
|
80
|
-
name:
|
|
81
|
-
url: siteUrl,
|
|
82
|
-
image:
|
|
83
|
-
sameAs:
|
|
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
|
}),
|
package/client/locales/en.yml
CHANGED
package/client/locales/zh-CN.yml
CHANGED
|
@@ -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('@
|
|
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
|
+
}
|
package/client/utils/index.ts
CHANGED
|
@@ -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
|
+
}
|