valaxy 0.7.7 → 0.7.8
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/components/ValaxyRightSidebar.vue +1 -1
- package/client/components/ValaxyToc.vue +1 -1
- package/client/composables/category.ts +1 -1
- package/client/composables/comments/twikoo.ts +25 -1
- package/client/composables/comments/waline.ts +32 -23
- package/client/composables/common.ts +1 -1
- package/client/composables/outline.ts +1 -1
- package/client/composables/post.ts +1 -1
- package/client/composables/tag.ts +1 -1
- package/client/composables/widgets/aplayer.ts +10 -5
- package/client/config.ts +1 -1
- package/client/modules/valaxy.ts +1 -1
- package/client/utils/cdn.ts +1 -0
- package/client/utils/index.ts +1 -0
- package/client/utils/time.ts +1 -1
- package/dist/chunk-2QVEQP3K.js +1 -0
- package/dist/chunk-4FKSRP5I.mjs +0 -0
- package/dist/{chunk-HP2UOVSL.mjs → chunk-EIYDDCHI.mjs} +91 -91
- package/dist/{chunk-BTP4CLJN.js → chunk-EYC2AAUG.js} +91 -91
- package/dist/chunk-IMWNMHRD.mjs +0 -0
- package/dist/chunk-KP3MIFG6.js +1 -0
- package/dist/client/index.d.ts +227 -0
- package/dist/client/index.js +1 -0
- package/dist/client/index.mjs +1 -0
- package/dist/{index-df14d281.d.ts → index-328992a1.d.ts} +12 -2
- package/dist/node/cli.js +10 -10
- package/dist/node/cli.mjs +10 -10
- package/dist/node/index.d.ts +4 -6
- package/dist/node/index.js +1 -1
- package/dist/node/index.mjs +1 -1
- package/dist/types/index.d.ts +1 -2
- package/dist/types/index.js +1 -1
- package/dist/types/index.mjs +1 -0
- package/index.d.ts +1 -1
- package/package.json +7 -6
- package/client/shims.d.ts +0 -42
|
@@ -5,7 +5,7 @@ import { onMounted, ref, watch } from 'vue'
|
|
|
5
5
|
import { useI18n } from 'vue-i18n'
|
|
6
6
|
import { useRoute } from 'vue-router'
|
|
7
7
|
|
|
8
|
-
import type { Header } from '
|
|
8
|
+
import type { Header } from 'valaxy/types'
|
|
9
9
|
import { useActiveSidebarLinks } from '~/composables'
|
|
10
10
|
import { useConfig } from '~/config'
|
|
11
11
|
|
|
@@ -1,8 +1,32 @@
|
|
|
1
1
|
import { isClient, useScriptTag } from '@vueuse/core'
|
|
2
|
+
import { useConfig } from 'valaxy'
|
|
3
|
+
import { computed } from 'vue'
|
|
2
4
|
import { useI18n } from 'vue-i18n'
|
|
3
5
|
import { useRoute } from 'vue-router'
|
|
4
6
|
|
|
7
|
+
declare global {
|
|
8
|
+
interface Window {
|
|
9
|
+
// extend the window
|
|
10
|
+
twikoo: {
|
|
11
|
+
init: (options: {
|
|
12
|
+
envId: string
|
|
13
|
+
el: string
|
|
14
|
+
} | any) => any
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* A simple, safe, free comment system.
|
|
21
|
+
* @public
|
|
22
|
+
* @see https://github.com/imaegoo/twikoo
|
|
23
|
+
* @see https://twikoo.js.org/
|
|
24
|
+
* @param options
|
|
25
|
+
*/
|
|
5
26
|
export function useTwikoo(options: {} = {}) {
|
|
27
|
+
const config = useConfig()
|
|
28
|
+
const cdnPrefix = computed(() => config.value.cdn.prefix)
|
|
29
|
+
|
|
6
30
|
const route = useRoute()
|
|
7
31
|
const { locale } = useI18n()
|
|
8
32
|
|
|
@@ -25,7 +49,7 @@ export function useTwikoo(options: {} = {}) {
|
|
|
25
49
|
}
|
|
26
50
|
|
|
27
51
|
// 直接使用 CDN
|
|
28
|
-
useScriptTag(
|
|
52
|
+
useScriptTag(`${cdnPrefix.value}twikoo@1.5.1/dist/twikoo.all.min.js`, () => {
|
|
29
53
|
initTwikoo(options)
|
|
30
54
|
})
|
|
31
55
|
}
|
|
@@ -1,21 +1,34 @@
|
|
|
1
|
-
import { isClient
|
|
2
|
-
import {
|
|
3
|
-
import { onUnmounted, watch } from 'vue'
|
|
1
|
+
import { isClient } from '@vueuse/core'
|
|
2
|
+
import { onMounted, onUnmounted, watch } from 'vue'
|
|
4
3
|
import { useI18n } from 'vue-i18n'
|
|
5
4
|
import { useRoute } from 'vue-router'
|
|
6
5
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
import type { WalineInitOptions, WalineInstance } from '@waline/client'
|
|
7
|
+
|
|
8
|
+
import '@waline/client/dist/waline.css'
|
|
9
|
+
import { cdnPrefix } from '../../utils'
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* A Simple, Safe Comment System.
|
|
13
|
+
* @public
|
|
14
|
+
* @see https://github.com/walinejs/waline
|
|
15
|
+
* @see https://waline.js.org/
|
|
16
|
+
* @param options
|
|
17
|
+
* @returns
|
|
18
|
+
*/
|
|
19
|
+
export function useWaline(options: {} = {}, cdn = cdnPrefix) {
|
|
20
|
+
if (!isClient)
|
|
21
|
+
return
|
|
13
22
|
|
|
14
23
|
const route = useRoute()
|
|
15
24
|
|
|
16
25
|
const { locale } = useI18n()
|
|
17
26
|
|
|
18
|
-
let waline:
|
|
27
|
+
let waline: WalineInstance | null | undefined
|
|
28
|
+
|
|
29
|
+
onMounted(() => {
|
|
30
|
+
initWaline(options)
|
|
31
|
+
})
|
|
19
32
|
|
|
20
33
|
/**
|
|
21
34
|
* init waline
|
|
@@ -23,28 +36,24 @@ export function useWaline(options: {} = {}) {
|
|
|
23
36
|
* @returns
|
|
24
37
|
*/
|
|
25
38
|
function initWaline(options: {} = {}) {
|
|
26
|
-
|
|
27
|
-
return
|
|
28
|
-
|
|
29
|
-
const defaultOptions = {
|
|
39
|
+
const defaultOptions: WalineInitOptions = {
|
|
30
40
|
el: '.comment #waline',
|
|
41
|
+
serverURL: '',
|
|
31
42
|
lang: locale.value,
|
|
32
43
|
dark: 'html.dark',
|
|
33
44
|
emoji: [
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
45
|
+
`${cdn}@waline/emojis/bilibili/`,
|
|
46
|
+
`${cdn}@waline/emojis/qq/`,
|
|
47
|
+
`${cdn}@waline/emojis/weibo/`,
|
|
37
48
|
],
|
|
38
49
|
path: route.path,
|
|
39
50
|
}
|
|
40
51
|
const walineOptions = Object.assign(defaultOptions, options)
|
|
41
|
-
return window.Waline.init(walineOptions)
|
|
42
|
-
}
|
|
43
52
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
53
|
+
import('@waline/client').then(({ init }) => {
|
|
54
|
+
waline = init(walineOptions)
|
|
55
|
+
})
|
|
56
|
+
}
|
|
48
57
|
|
|
49
58
|
watch(() => route.path, (path) => {
|
|
50
59
|
if (!waline)
|
|
@@ -2,7 +2,7 @@ import { useRoute } from 'vue-router'
|
|
|
2
2
|
import { computed } from 'vue'
|
|
3
3
|
import { isClient } from '@vueuse/core'
|
|
4
4
|
|
|
5
|
-
import type { Post } from '
|
|
5
|
+
import type { Post } from 'valaxy/types'
|
|
6
6
|
import { useConfig } from '../config'
|
|
7
7
|
|
|
8
8
|
export function useFrontmatter() {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Ref } from 'vue'
|
|
2
2
|
import { onMounted, onUnmounted, onUpdated } from 'vue'
|
|
3
|
-
import type { Header } from '
|
|
3
|
+
import type { Header } from 'valaxy/types'
|
|
4
4
|
import { throttleAndDebounce } from '~/utils'
|
|
5
5
|
|
|
6
6
|
interface HeaderWithChildren extends Header {
|
|
@@ -2,8 +2,8 @@ import type { Ref } from 'vue'
|
|
|
2
2
|
import { computed } from 'vue'
|
|
3
3
|
import { useRoute, useRouter } from 'vue-router'
|
|
4
4
|
import { useI18n } from 'vue-i18n'
|
|
5
|
+
import type { Post } from 'valaxy/types'
|
|
5
6
|
import { sortByDate } from '../utils'
|
|
6
|
-
import type { Post } from '../../types'
|
|
7
7
|
|
|
8
8
|
export const usePostTitle = (post: Ref<Post>) => {
|
|
9
9
|
const { locale } = useI18n()
|
|
@@ -1,23 +1,28 @@
|
|
|
1
1
|
import { useScriptTag } from '@vueuse/core'
|
|
2
2
|
import { useHead } from '@vueuse/head'
|
|
3
|
+
import { useConfig } from 'valaxy'
|
|
4
|
+
import { computed } from 'vue'
|
|
3
5
|
|
|
4
6
|
/**
|
|
5
7
|
* use MetingJS and Aplayer
|
|
6
|
-
* https://github.com/MoePlayer/APlayer
|
|
7
|
-
* https://github.com/metowolf/MetingJS
|
|
8
|
+
* @see https://github.com/MoePlayer/APlayer
|
|
9
|
+
* @see https://github.com/metowolf/MetingJS
|
|
8
10
|
*/
|
|
9
11
|
export function useAplayer() {
|
|
12
|
+
const config = useConfig()
|
|
13
|
+
const cdnPrefix = computed(() => config.value.cdn.prefix)
|
|
14
|
+
|
|
10
15
|
useHead({
|
|
11
16
|
link: [
|
|
12
17
|
{
|
|
13
18
|
rel: 'stylesheet',
|
|
14
|
-
href:
|
|
19
|
+
href: `${cdnPrefix.value}aplayer/dist/APlayer.min.css`,
|
|
15
20
|
},
|
|
16
21
|
],
|
|
17
22
|
})
|
|
18
23
|
|
|
19
24
|
// load meting after aplayer
|
|
20
|
-
useScriptTag(
|
|
21
|
-
useScriptTag(
|
|
25
|
+
useScriptTag(`${cdnPrefix.value}aplayer/dist/APlayer.min.js`, () => {
|
|
26
|
+
useScriptTag(`${cdnPrefix.value}meting@2/dist/Meting.min.js`)
|
|
22
27
|
})
|
|
23
28
|
}
|
package/client/config.ts
CHANGED
|
@@ -5,7 +5,7 @@ import valaxyContext from '/@valaxyjs/context'
|
|
|
5
5
|
import type { ComputedRef, InjectionKey, Ref } from 'vue'
|
|
6
6
|
import { computed, inject, readonly, shallowRef } from 'vue'
|
|
7
7
|
// import type { RouteMeta } from 'vue-router'
|
|
8
|
-
import type { PageData, ValaxyConfig } from '
|
|
8
|
+
import type { PageData, ValaxyConfig } from 'valaxy/types'
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* parse valaxy config
|
package/client/modules/valaxy.ts
CHANGED
|
@@ -11,7 +11,7 @@ import { createI18n } from 'vue-i18n'
|
|
|
11
11
|
import { useStorage } from '@vueuse/core'
|
|
12
12
|
|
|
13
13
|
import type { Router } from 'vue-router'
|
|
14
|
-
import type { PageDataPayload } from '
|
|
14
|
+
import type { PageDataPayload } from 'valaxy/types'
|
|
15
15
|
import { initConfig, valaxyConfigSymbol } from '../config'
|
|
16
16
|
import { ensureSuffix } from '@antfu/utils'
|
|
17
17
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const cdnPrefix = 'https://npm.elemecdn.com/'
|
package/client/utils/index.ts
CHANGED
package/client/utils/time.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
File without changes
|