valaxy 0.4.0 → 0.6.1
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/README.md +0 -4
- package/{src/client → client}/App.vue +0 -0
- package/{src/client/composables/search/index.ts → client/app/data.ts} +0 -0
- package/{src/client → client}/components/AppLink.vue +0 -0
- package/client/components/PostCard.vue +84 -0
- package/{src/client → client}/components/PostList.vue +0 -0
- package/{src/client → client}/components/README.md +0 -0
- package/{src/client → client}/components/ValaxyBg.vue +0 -0
- package/{src/client → client}/components/ValaxyCopyright.vue +0 -0
- package/{src/client → client}/components/ValaxyFooter.vue +1 -1
- package/{src/client → client}/components/ValaxyHamburger.vue +0 -0
- package/client/components/ValaxyMd.vue +74 -0
- package/{src/client → client}/components/ValaxyOverlay.vue +0 -0
- package/{src/client → client}/components/ValaxyPagination.vue +0 -0
- package/{src/client → client}/components/ValaxyRightSidebar.vue +0 -0
- package/{src/client → client}/components/ValaxySidebar.vue +0 -0
- package/{src/client → client}/components/ValaxyToc.vue +3 -3
- package/{src/client → client}/composables/category.ts +0 -0
- package/{src/client → client}/composables/comments/index.ts +0 -0
- package/{src/client → client}/composables/comments/twikoo.ts +0 -0
- package/{src/client → client}/composables/comments/waline.ts +0 -0
- package/{src/client → client}/composables/common.ts +0 -0
- package/client/composables/copy-code.ts +92 -0
- package/{src/client → client}/composables/dark.ts +0 -0
- package/client/composables/features/index.ts +0 -0
- package/{src/client → client}/composables/helper.ts +0 -0
- package/{src/client → client}/composables/index.ts +1 -1
- package/{src/client → client}/composables/layout.ts +0 -0
- package/client/composables/outline.ts +168 -0
- package/{src/client → client}/composables/post.ts +0 -0
- package/client/composables/search/index.ts +0 -0
- package/{src/client → client}/composables/sidebar.ts +46 -1
- package/{src/client → client}/composables/tag.ts +0 -0
- package/{src/client → client}/composables/widgets/aplayer.ts +0 -0
- package/{src/client → client}/composables/widgets/backToTop.ts +0 -0
- package/{src/client → client}/composables/widgets/codepen.ts +0 -0
- package/{src/client → client}/composables/widgets/index.ts +0 -0
- package/client/config.ts +75 -0
- package/{src/client → client}/index.html +0 -0
- package/{src/client → client}/index.ts +0 -0
- package/{src/client → client}/layouts/404.vue +0 -0
- package/{src/client → client}/layouts/README.md +0 -0
- package/{src/client → client}/locales/README.md +0 -0
- package/{src/client → client}/locales/en.yml +1 -0
- package/{src/client → client}/locales/zh-CN.yml +4 -3
- package/{src/client → client}/main.ts +4 -1
- package/{src/client → client}/modules/README.md +0 -0
- package/{src/client → client}/modules/nprogress.ts +0 -0
- package/{src/client → client}/modules/pinia.ts +0 -0
- package/{src/client → client}/modules/valaxy.ts +19 -7
- package/{src/client → client}/pages/README.md +0 -0
- package/{src/client → client}/pages/[...all].vue +0 -0
- package/{src/client → client}/pages/hi/[name].vue +0 -0
- package/{src/client → client}/pages/index.vue +0 -0
- package/{src/client → client}/pages/page/[page].vue +0 -0
- package/{src/client → client}/shims.d.ts +7 -1
- package/{src/client → client}/stores/app.ts +0 -0
- package/{src/client → client}/stores/user.ts +0 -0
- package/{src/client → client}/styles/common/button.scss +0 -0
- package/client/styles/common/code.scss +231 -0
- package/{src/client → client}/styles/common/custom-blocks.scss +0 -0
- package/{src/client → client}/styles/common/hamburger.scss +0 -0
- package/{src/client → client}/styles/common/markdown.scss +0 -2
- package/client/styles/common/scrollbar.scss +28 -0
- package/{src/client → client}/styles/common/sidebar.scss +0 -0
- package/{src/client → client}/styles/common/transition.scss +0 -0
- package/client/styles/css-vars.scss +62 -0
- package/{src/client → client}/styles/global/helper.scss +0 -0
- package/{src/client → client}/styles/global/i18n.scss +0 -0
- package/{src/client → client}/styles/global/index.scss +0 -0
- package/{src/client → client}/styles/global/nprogress.scss +0 -0
- package/{src/client → client}/styles/global/reset.scss +0 -0
- package/{src/client → client}/styles/index.scss +0 -0
- package/{src/client → client}/styles/mixins/config.scss +0 -0
- package/{src/client → client}/styles/mixins/index.scss +0 -0
- package/{src/client → client}/styles/mixins/size.scss +0 -0
- package/{src/client → client}/styles/mixins/variable.scss +0 -0
- package/{src/client → client}/styles/palette.scss +21 -2
- package/client/styles/third/katex.scss +3 -0
- package/client/styles/vars.scss +41 -0
- package/{src/client → client}/styles/widgets/banner.scss +0 -0
- package/{src/client → client}/types.ts +0 -0
- package/{src/client → client}/utils/helper.ts +22 -0
- package/{src/client → client}/utils/index.ts +0 -0
- package/client/utils/sidebar.ts +26 -0
- package/{src/client → client}/utils/time.ts +0 -0
- package/config/index.ts +18 -0
- package/dist/chunk-EAN2KU6W.mjs +1 -0
- package/dist/chunk-HMUGSKPK.mjs +40 -0
- package/dist/chunk-U5OMNIOK.js +1 -0
- package/dist/chunk-ZHHNO5RK.js +40 -0
- package/dist/{config-de04677b.d.ts → config-112ac884.d.ts} +37 -14
- package/dist/index.d.ts +65 -111
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/node/cli.js +7 -11
- package/dist/node/cli.mjs +7 -11
- package/dist/node/index.d.ts +3 -2
- package/dist/node/index.js +1 -1
- package/dist/node/index.mjs +1 -1
- package/{src/index.ts → index.ts} +1 -0
- package/{src/node → node}/build.ts +0 -0
- package/{src/node → node}/cli.ts +3 -2
- package/node/config.ts +156 -0
- package/{src/node → node}/index.ts +0 -0
- package/{src/node → node}/markdown/check.ts +0 -0
- package/node/markdown/highlight.ts +38 -0
- package/{src/node → node}/markdown/index.ts +30 -16
- package/{src/node → node}/markdown/markdown-it/container.ts +0 -0
- package/{src/node → node}/markdown/markdown-it/headings.ts +0 -0
- package/{src/node → node}/markdown/markdown-it/highlightLines.ts +1 -1
- package/{src/node → node}/markdown/markdown-it/katex.ts +0 -0
- package/{src/node → node}/markdown/markdown-it/parseHeader.ts +0 -0
- package/node/markdown/markdownToVue.ts +274 -0
- package/{src/node → node}/markdown/slugify.ts +0 -0
- package/{src/node → node}/options.ts +18 -2
- package/{src/node → node}/plugins/extendConfig.ts +5 -3
- package/node/plugins/index.ts +224 -0
- package/{src/node → node}/plugins/preset.ts +8 -8
- package/{src/node → node}/plugins/unocss.ts +0 -0
- package/{src/node → node}/plugins/valaxy.ts +0 -0
- package/{src/node → node}/rss.ts +1 -1
- package/{src/node → node}/server.ts +0 -0
- package/{src/node → node}/shims.d.ts +0 -5
- package/{src/node → node}/utils/cli.ts +1 -1
- package/node/utils/getGitTimestamp.ts +13 -0
- package/node/utils/index.ts +59 -0
- package/node/utils/net.ts +20 -0
- package/{src/node → node}/vite.ts +5 -1
- package/package.json +32 -13
- package/shared/index.ts +1 -0
- package/tsup.config.ts +7 -4
- package/{src/types → types}/config.ts +31 -108
- package/types/data.ts +31 -0
- package/{src/types → types}/index.ts +1 -0
- package/{src/types → types}/posts.ts +6 -1
- package/dist/chunk-6LIOFBAA.mjs +0 -1
- package/dist/chunk-HRARZPSA.js +0 -83
- package/dist/chunk-N6HD5SHF.mjs +0 -83
- package/dist/chunk-V3BMKLEW.js +0 -1
- package/src/client/components/PostCard.vue +0 -68
- package/src/client/components/ValaxyMd.vue +0 -71
- package/src/client/composables/features/index.ts +0 -1
- package/src/client/composables/features/katex.ts +0 -15
- package/src/client/composables/search/algolia.ts +0 -115
- package/src/client/config.ts +0 -51
- package/src/client/styles/common/code.scss +0 -207
- package/src/client/styles/common/scrollbar.scss +0 -34
- package/src/client/styles/css-vars.scss +0 -39
- package/src/client/styles/vars.scss +0 -27
- package/src/node/config.ts +0 -52
- package/src/node/markdown/highlight.ts +0 -50
- package/src/node/plugins/index.ts +0 -120
- package/src/node/plugins/markdown.ts +0 -57
- package/src/node/utils/index.ts +0 -26
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import { useI18n } from 'vue-i18n'
|
|
3
|
-
import type { Post } from '../../types'
|
|
4
|
-
import { usePostProperty } from '~/composables'
|
|
5
|
-
|
|
6
|
-
const props = defineProps<{
|
|
7
|
-
post: Post
|
|
8
|
-
}>()
|
|
9
|
-
|
|
10
|
-
const { t } = useI18n()
|
|
11
|
-
|
|
12
|
-
const { icon, styles } = usePostProperty(props.post.type)
|
|
13
|
-
</script>
|
|
14
|
-
|
|
15
|
-
<template>
|
|
16
|
-
<YunCard m="y-4 auto" class="post-card" :style="styles">
|
|
17
|
-
<AppLink
|
|
18
|
-
class="post-title-link"
|
|
19
|
-
:to="post.path || ''"
|
|
20
|
-
m="t-3"
|
|
21
|
-
>
|
|
22
|
-
<div class="flex justify-center items-center title text-2xl" font="serif black">
|
|
23
|
-
<div v-if="post.type" class="inline-flex" m="r-1" :class="icon" />{{ post.title }}
|
|
24
|
-
</div>
|
|
25
|
-
</AppLink>
|
|
26
|
-
|
|
27
|
-
<YunPostMeta :frontmatter="post" />
|
|
28
|
-
|
|
29
|
-
<div v-if="post.excerpt" class="markdown-body" text="left" w="full" p="x-6 lt-sm:4" v-html="post.excerpt" />
|
|
30
|
-
<div m="b-5" />
|
|
31
|
-
|
|
32
|
-
<a
|
|
33
|
-
v-if="post.url"
|
|
34
|
-
:href="post.url"
|
|
35
|
-
class="post-link-btn shadow hover:shadow-md"
|
|
36
|
-
rounded
|
|
37
|
-
target="_blank"
|
|
38
|
-
m="b-4"
|
|
39
|
-
>
|
|
40
|
-
{{ t('post.view_link') }}
|
|
41
|
-
</a>
|
|
42
|
-
|
|
43
|
-
<div v-if="post.categories || post.tags" w="full" class="yun-card-actions flex justify-between" border="t" text="sm">
|
|
44
|
-
<div class="inline-flex">
|
|
45
|
-
<router-link
|
|
46
|
-
v-if="post.categories"
|
|
47
|
-
:to="{
|
|
48
|
-
path: '/categories/',
|
|
49
|
-
query: { category: Array.isArray(post.categories) ? post.categories[post.categories.length - 1] : post.categories },
|
|
50
|
-
}"
|
|
51
|
-
class="post-categories inline-flex justify-center items-center" m="l-2"
|
|
52
|
-
>
|
|
53
|
-
<div m="x-1" i-ri-folder-2-line />
|
|
54
|
-
{{ Array.isArray(post.categories) ? post.categories.join(' > ') : post.categories }}
|
|
55
|
-
</router-link>
|
|
56
|
-
</div>
|
|
57
|
-
|
|
58
|
-
<div class="post-tags inline-flex" m="r-2">
|
|
59
|
-
<template v-if="post.tags">
|
|
60
|
-
<router-link v-for="tag, i in post.tags" :key="i" :to="{ path: '/tags/', query: { tag } }" m="x-1" class="post-tag inline-flex justify-center items-center">
|
|
61
|
-
<div m="r-1" i-ri-price-tag-3-line />
|
|
62
|
-
{{ tag }}
|
|
63
|
-
</router-link>
|
|
64
|
-
</template>
|
|
65
|
-
</div>
|
|
66
|
-
</div>
|
|
67
|
-
</YunCard>
|
|
68
|
-
</template>
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import type { Post } from 'valaxy'
|
|
3
|
-
import { onMounted, ref } from 'vue'
|
|
4
|
-
import { useI18n } from 'vue-i18n'
|
|
5
|
-
import { useAplayer, useCodePen, useKatex } from '~/composables'
|
|
6
|
-
import { wrapTable } from '~/utils'
|
|
7
|
-
|
|
8
|
-
const props = defineProps<{
|
|
9
|
-
frontmatter: Post
|
|
10
|
-
excerpt?: string
|
|
11
|
-
}>()
|
|
12
|
-
|
|
13
|
-
const { t } = useI18n()
|
|
14
|
-
|
|
15
|
-
const content = ref()
|
|
16
|
-
function updateDom() {
|
|
17
|
-
wrapTable(content.value)
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
onMounted(() => {
|
|
21
|
-
updateDom()
|
|
22
|
-
})
|
|
23
|
-
|
|
24
|
-
// features
|
|
25
|
-
if (props.frontmatter.katex)
|
|
26
|
-
useKatex()
|
|
27
|
-
|
|
28
|
-
// widgets
|
|
29
|
-
if (props.frontmatter.aplayer)
|
|
30
|
-
useAplayer()
|
|
31
|
-
|
|
32
|
-
if (props.frontmatter.codepen)
|
|
33
|
-
useCodePen()
|
|
34
|
-
</script>
|
|
35
|
-
|
|
36
|
-
<template>
|
|
37
|
-
<article v-if="$slots.default" :class="frontmatter.markdown !== false && 'markdown-body'">
|
|
38
|
-
<slot ref="content" @vnode-updated="updateDom" />
|
|
39
|
-
|
|
40
|
-
<div text="center">
|
|
41
|
-
<a
|
|
42
|
-
v-if="frontmatter.url"
|
|
43
|
-
:href="frontmatter.url"
|
|
44
|
-
class="post-link-btn shadow hover:shadow-md"
|
|
45
|
-
rounded
|
|
46
|
-
target="_blank"
|
|
47
|
-
m="b-4"
|
|
48
|
-
>
|
|
49
|
-
{{ t('post.view_link') }}
|
|
50
|
-
</a>
|
|
51
|
-
</div>
|
|
52
|
-
|
|
53
|
-
<slot v-if="typeof frontmatter.end !== 'undefined'" name="end">
|
|
54
|
-
<div m="y-4" class="end flex justify-center items-center">
|
|
55
|
-
<hr class="line inline-flex" w="full" m="!y-2">
|
|
56
|
-
<span p="x-4" font="serif bold" class="whitespace-nowrap">
|
|
57
|
-
{{ frontmatter.end ? 'Q.E.D.' : 'To Be Continued.' }}
|
|
58
|
-
</span>
|
|
59
|
-
<hr class="line inline-flex" w="full" m="!y-2">
|
|
60
|
-
</div>
|
|
61
|
-
</slot>
|
|
62
|
-
</article>
|
|
63
|
-
</template>
|
|
64
|
-
|
|
65
|
-
<style lang="scss">
|
|
66
|
-
.end {
|
|
67
|
-
.line {
|
|
68
|
-
height: 1px;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
</style>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './katex'
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
import { isClient, useScriptTag } from '@vueuse/core'
|
|
2
|
-
import { useI18n } from 'vue-i18n'
|
|
3
|
-
import { useRoute } from 'vue-router'
|
|
4
|
-
|
|
5
|
-
const algoliasearchUrl = 'https://cdn.jsdelivr.net/npm/algoliasearch@4/dist/algoliasearch-lite.umd.js'
|
|
6
|
-
const instantsearchUrl = 'https://cdn.jsdelivr.net/npm/instantsearch.js@4/dist/instantsearch.production.min.js'
|
|
7
|
-
|
|
8
|
-
export function useAlgoliaSearch(config: {
|
|
9
|
-
appId: string
|
|
10
|
-
apiKey: string
|
|
11
|
-
indexName: string
|
|
12
|
-
hits: {
|
|
13
|
-
per_page: number
|
|
14
|
-
}
|
|
15
|
-
}) {
|
|
16
|
-
if (!isClient)
|
|
17
|
-
return
|
|
18
|
-
|
|
19
|
-
const route = useRoute()
|
|
20
|
-
const { t } = useI18n()
|
|
21
|
-
|
|
22
|
-
useScriptTag(algoliasearchUrl, () => {
|
|
23
|
-
useScriptTag(instantsearchUrl, () => {
|
|
24
|
-
const algoliaSettings = config
|
|
25
|
-
const { indexName, appId, apiKey } = algoliaSettings
|
|
26
|
-
|
|
27
|
-
const search = window.instantsearch({
|
|
28
|
-
indexName,
|
|
29
|
-
searchClient: window.algoliasearch(appId, apiKey),
|
|
30
|
-
searchFunction: (helper: { search: () => void }) => {
|
|
31
|
-
const searchInput = document.querySelector('.search-input') as HTMLInputElement
|
|
32
|
-
if (searchInput.value)
|
|
33
|
-
helper.search()
|
|
34
|
-
},
|
|
35
|
-
})
|
|
36
|
-
|
|
37
|
-
// Registering Widgets
|
|
38
|
-
search.addWidgets([
|
|
39
|
-
window.instantsearch.widgets.configure({
|
|
40
|
-
hitsPerPage: algoliaSettings.hits.per_page || 8,
|
|
41
|
-
}),
|
|
42
|
-
|
|
43
|
-
window.instantsearch.widgets.searchBox({
|
|
44
|
-
container: '.search-input-container',
|
|
45
|
-
placeholder: t('search.placeholder'),
|
|
46
|
-
// Hide default icons of algolia search
|
|
47
|
-
showReset: false,
|
|
48
|
-
showSubmit: false,
|
|
49
|
-
showLoadingIndicator: false,
|
|
50
|
-
cssClasses: {
|
|
51
|
-
input: 'search-input',
|
|
52
|
-
},
|
|
53
|
-
}),
|
|
54
|
-
|
|
55
|
-
window.instantsearch.widgets.stats({
|
|
56
|
-
container: '#algolia-stats',
|
|
57
|
-
templates: {
|
|
58
|
-
text: (data: any) => {
|
|
59
|
-
const stats = t('search.hits_time', {
|
|
60
|
-
hits: data.nbHits,
|
|
61
|
-
time: data.processingTimeMS,
|
|
62
|
-
})
|
|
63
|
-
return `<span>${stats}</span>
|
|
64
|
-
<a href="https://www.algolia.com/" target="_blank" class="algolia-powered">
|
|
65
|
-
<img src="https://simpleicons.org/icons/algolia.svg" alt="Algolia">
|
|
66
|
-
</a>
|
|
67
|
-
`
|
|
68
|
-
},
|
|
69
|
-
},
|
|
70
|
-
}),
|
|
71
|
-
|
|
72
|
-
window.instantsearch.widgets.hits({
|
|
73
|
-
container: '#algolia-hits',
|
|
74
|
-
templates: {
|
|
75
|
-
item: (data: any) => {
|
|
76
|
-
const link = data.permalink ? data.permalink : route.path
|
|
77
|
-
return `<a href="${link}" class="algolia-hit-item-link">
|
|
78
|
-
${data._highlightResult.title.value}
|
|
79
|
-
<small>${data._highlightResult.slug.value}</small>
|
|
80
|
-
</a>`
|
|
81
|
-
},
|
|
82
|
-
empty: (data: any) => {
|
|
83
|
-
return `<div id="algolia-hits-empty">${t('search.empty', data.query)}</div>`
|
|
84
|
-
},
|
|
85
|
-
},
|
|
86
|
-
cssClasses: {
|
|
87
|
-
item: 'algolia-hit-item',
|
|
88
|
-
},
|
|
89
|
-
}),
|
|
90
|
-
|
|
91
|
-
window.instantsearch.widgets.pagination({
|
|
92
|
-
container: '#algolia-pagination',
|
|
93
|
-
scrollTo: false,
|
|
94
|
-
showFirst: false,
|
|
95
|
-
showLast: false,
|
|
96
|
-
templates: {
|
|
97
|
-
first: '<div i-ri-arrow-left-line></div>',
|
|
98
|
-
last: '<div i-ri-arrow-right-line></div>',
|
|
99
|
-
previous: '<div i-ri-arrow-left-s-line></div>',
|
|
100
|
-
next: '<div i-ri-arrow-right-s-line></div>',
|
|
101
|
-
},
|
|
102
|
-
cssClasses: {
|
|
103
|
-
root: 'pagination',
|
|
104
|
-
item: 'page-number',
|
|
105
|
-
link: 'page-number',
|
|
106
|
-
selectedItem: 'active',
|
|
107
|
-
disabledItem: 'disabled-item',
|
|
108
|
-
},
|
|
109
|
-
}),
|
|
110
|
-
])
|
|
111
|
-
|
|
112
|
-
search.start()
|
|
113
|
-
})
|
|
114
|
-
})
|
|
115
|
-
}
|
package/src/client/config.ts
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
// @ts-expect-error virtual module @valaxyjs/config
|
|
2
|
-
import valaxyConfig from '@valaxyjs/config'
|
|
3
|
-
import type { ComputedRef, InjectionKey } from 'vue'
|
|
4
|
-
import { computed, inject, readonly, shallowRef } from 'vue'
|
|
5
|
-
import type { ThemeConfig } from '../../../valaxy-theme-yun'
|
|
6
|
-
import type { ValaxyConfig } from '../types'
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* parse valaxy config
|
|
10
|
-
* @param data
|
|
11
|
-
* @returns
|
|
12
|
-
*/
|
|
13
|
-
function parse(data: string): ValaxyConfig {
|
|
14
|
-
const parsed = JSON.parse(data)
|
|
15
|
-
return (import.meta.env.DEV ? readonly(parsed) : parsed) as ValaxyConfig
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export const valaxyConfigSymbol: InjectionKey<ComputedRef<ValaxyConfig<ThemeConfig>>> = Symbol('valaxy:config')
|
|
19
|
-
export const valaxyConfigRef = shallowRef<ValaxyConfig>(parse(valaxyConfig))
|
|
20
|
-
|
|
21
|
-
// hmr
|
|
22
|
-
if (import.meta.hot) {
|
|
23
|
-
// /@valaxyjs/config must be static string
|
|
24
|
-
import.meta.hot.accept('/@valaxyjs/config', (m) => {
|
|
25
|
-
valaxyConfigRef.value = parse(m.default)
|
|
26
|
-
})
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export function initConfig() {
|
|
30
|
-
return computed(() => valaxyConfigRef.value)
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/*
|
|
34
|
-
* get Config
|
|
35
|
-
* @returns
|
|
36
|
-
*/
|
|
37
|
-
export function useConfig() {
|
|
38
|
-
const config = inject(valaxyConfigSymbol)
|
|
39
|
-
if (!config)
|
|
40
|
-
throw new Error('[Valaxy] config not properly injected in qpp')
|
|
41
|
-
return config!
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* getThemeConfig
|
|
46
|
-
* @returns
|
|
47
|
-
*/
|
|
48
|
-
export function useThemeConfig() {
|
|
49
|
-
const config = useConfig()
|
|
50
|
-
return computed(() => config!.value.themeConfig)
|
|
51
|
-
}
|
|
@@ -1,207 +0,0 @@
|
|
|
1
|
-
@use "~/styles/mixins" as *;
|
|
2
|
-
|
|
3
|
-
/* https://github.com/antfu/prism-theme-vars */
|
|
4
|
-
@use "prism-theme-vars/base.css" as *;
|
|
5
|
-
|
|
6
|
-
@include mobile {
|
|
7
|
-
.markdown-body {
|
|
8
|
-
div[class*="language-"] {
|
|
9
|
-
margin: 0 -1rem;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
.markdown-body {
|
|
15
|
-
div[class*="language-"] {
|
|
16
|
-
position: relative;
|
|
17
|
-
padding: 0;
|
|
18
|
-
background-color: var(--smc-code-bg-color);
|
|
19
|
-
|
|
20
|
-
pre {
|
|
21
|
-
position: relative;
|
|
22
|
-
padding: 1rem;
|
|
23
|
-
z-index: 1;
|
|
24
|
-
background: none;
|
|
25
|
-
|
|
26
|
-
// expand
|
|
27
|
-
code {
|
|
28
|
-
display: block;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/* Line highlighting */
|
|
35
|
-
|
|
36
|
-
.highlight-lines {
|
|
37
|
-
position: absolute;
|
|
38
|
-
top: 0;
|
|
39
|
-
bottom: 0;
|
|
40
|
-
left: 0;
|
|
41
|
-
padding: 1rem 0;
|
|
42
|
-
width: 100%;
|
|
43
|
-
line-height: var(--prism-line-height);
|
|
44
|
-
user-select: none;
|
|
45
|
-
overflow: hidden;
|
|
46
|
-
|
|
47
|
-
.highlighted {
|
|
48
|
-
background-color: rgba(0, 0, 0, 0.08);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
.dark {
|
|
53
|
-
.highlight-lines {
|
|
54
|
-
.highlighted {
|
|
55
|
-
background-color: rgba(0, 0, 0, 0.4);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
.markdown-body {
|
|
61
|
-
code {
|
|
62
|
-
color: var(--prism-foreground) !important;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// prism
|
|
67
|
-
html:not(.dark) {
|
|
68
|
-
// text
|
|
69
|
-
--prism-foreground: #224466;
|
|
70
|
-
|
|
71
|
-
--prism-background: #f8f8f8;
|
|
72
|
-
--prism-comment: #758575;
|
|
73
|
-
--prism-namespace: #444444;
|
|
74
|
-
--prism-string: #bc8671;
|
|
75
|
-
--prism-punctuation: #80817d;
|
|
76
|
-
--prism-literal: #36acaa;
|
|
77
|
-
--prism-keyword: #248459;
|
|
78
|
-
--prism-function: #0088bb;
|
|
79
|
-
--prism-deleted: #9a050f;
|
|
80
|
-
--prism-class: #2b91af;
|
|
81
|
-
--prism-builtin: #800000;
|
|
82
|
-
--prism-property: #ce9178;
|
|
83
|
-
--prism-regex: #ad502b;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
html.dark {
|
|
87
|
-
--prism-foreground: #a6accd;
|
|
88
|
-
|
|
89
|
-
--prism-background: #242424;
|
|
90
|
-
--prism-namespace: #aaaaaa;
|
|
91
|
-
--prism-comment: #758575;
|
|
92
|
-
--prism-namespace: #444444;
|
|
93
|
-
--prism-string: #c3e88d;
|
|
94
|
-
--prism-punctuation: #a6accd;
|
|
95
|
-
--prism-literal: #36acaa;
|
|
96
|
-
--prism-keyword: #89ddff;
|
|
97
|
-
--prism-function: #82aaff;
|
|
98
|
-
--prism-deleted: #9a050f;
|
|
99
|
-
--prism-class: #4ec9b0;
|
|
100
|
-
--prism-builtin: #d16969;
|
|
101
|
-
--prism-property: #c792ea;
|
|
102
|
-
--prism-regex: #ad502b;
|
|
103
|
-
--prism-selector: #c3e88d;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
/* Language marker */
|
|
107
|
-
// @use 'prism-theme-vars/marker.css' as *; * not div
|
|
108
|
-
div[class*="language-"]:before {
|
|
109
|
-
position: absolute;
|
|
110
|
-
top: 0.6em;
|
|
111
|
-
right: 1em;
|
|
112
|
-
z-index: 2;
|
|
113
|
-
font-size: 0.8rem;
|
|
114
|
-
color: #888;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
div[class~="language-html"]:before,
|
|
118
|
-
div[class~="language-markup"]:before {
|
|
119
|
-
content: "html";
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
div[class~="language-md"]:before,
|
|
123
|
-
div[class~="language-markdown"]:before {
|
|
124
|
-
content: "md";
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
div[class~="language-css"]:before {
|
|
128
|
-
content: "css";
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
div[class~="language-sass"]:before {
|
|
132
|
-
content: "sass";
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
div[class~="language-scss"]:before {
|
|
136
|
-
content: "scss";
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
div[class~="language-less"]:before {
|
|
140
|
-
content: "less";
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
div[class~="language-stylus"]:before {
|
|
144
|
-
content: "styl";
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
div[class~="language-js"]:before,
|
|
148
|
-
div[class~="language-javascript"]:before {
|
|
149
|
-
content: "js";
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
div[class~="language-ts"]:before,
|
|
153
|
-
div[class~="language-typescript"]:before {
|
|
154
|
-
content: "ts";
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
div[class~="language-json"]:before {
|
|
158
|
-
content: "json";
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
div[class~="language-rb"]:before,
|
|
162
|
-
div[class~="language-ruby"]:before {
|
|
163
|
-
content: "rb";
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
div[class~="language-py"]:before,
|
|
167
|
-
div[class~="language-python"]:before {
|
|
168
|
-
content: "py";
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
div[class~="language-sh"]:before,
|
|
172
|
-
div[class~="language-bash"]:before {
|
|
173
|
-
content: "sh";
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
div[class~="language-php"]:before {
|
|
177
|
-
content: "php";
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
div[class~="language-go"]:before {
|
|
181
|
-
content: "go";
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
div[class~="language-rust"]:before {
|
|
185
|
-
content: "rust";
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
div[class~="language-java"]:before {
|
|
189
|
-
content: "java";
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
div[class~="language-c"]:before {
|
|
193
|
-
content: "c";
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
div[class~="language-yml"]:before,
|
|
197
|
-
div[class~="language-yaml"]:before {
|
|
198
|
-
content: "yaml";
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
div[class~="language-dockerfile"]:before {
|
|
202
|
-
content: "dockerfile";
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
div[class~="language-vue"]:before {
|
|
206
|
-
content: "vue";
|
|
207
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
@use '~/styles/mixins' as *;
|
|
2
|
-
|
|
3
|
-
.no-scroll {
|
|
4
|
-
position: fixed;
|
|
5
|
-
overflow-y: scroll;
|
|
6
|
-
width: 100%;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
::-webkit-scrollbar {
|
|
10
|
-
width: 8px;
|
|
11
|
-
height: 8px;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
::-webkit-scrollbar-track {
|
|
15
|
-
border-radius: 2px;
|
|
16
|
-
background-color: rgba(255, 255, 255, 0.1);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
::-webkit-scrollbar-thumb {
|
|
20
|
-
border-radius: 2px;
|
|
21
|
-
background-color: rgba(get-css-var('c', 'primary', 'rgb'), 0.3);
|
|
22
|
-
|
|
23
|
-
&:window-inactive {
|
|
24
|
-
background-color: rgba(get-css-var('c', 'primary', 'rgb'), 0.3);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
&:hover {
|
|
28
|
-
background-color: rgba(get-css-var('c', 'primary', 'rgb'), 0.7);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
&:active {
|
|
32
|
-
background-color: rgba(get-css-var('c', 'primary', 'rgb'), 0.9);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
@use "sass:map";
|
|
2
|
-
@use "./mixins" as *;
|
|
3
|
-
@use "./vars" as *;
|
|
4
|
-
|
|
5
|
-
$c-primary: #0078E7 !default;
|
|
6
|
-
|
|
7
|
-
@use "./palette" with (
|
|
8
|
-
$colors: (
|
|
9
|
-
'primary': $c-primary,
|
|
10
|
-
)
|
|
11
|
-
);
|
|
12
|
-
|
|
13
|
-
// common
|
|
14
|
-
:root {
|
|
15
|
-
@include set-css-var-from-map($common);
|
|
16
|
-
@include set-css-var-from-map($border, 'border');
|
|
17
|
-
@include set-css-var-from-map($font, 'font');
|
|
18
|
-
@include set-css-var-from-map($transition, 'transition');
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
// colors
|
|
22
|
-
:root {
|
|
23
|
-
// palette different with colors
|
|
24
|
-
@include set-css-var-from-map(palette.$palette, 'c');
|
|
25
|
-
// primary
|
|
26
|
-
@include set-css-var-from-map(palette.$colors, 'c');
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// light
|
|
30
|
-
:root {
|
|
31
|
-
color-scheme: light;
|
|
32
|
-
@include set-css-var-from-map(palette.$light);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
// dark
|
|
36
|
-
html.dark {
|
|
37
|
-
color-scheme: dark;
|
|
38
|
-
@include set-css-var-from-map(palette.$dark);
|
|
39
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
@use "sass:map";
|
|
2
|
-
|
|
3
|
-
$common: () !default;
|
|
4
|
-
$common: map.merge((
|
|
5
|
-
'sidebar-width-mobile': 320px,
|
|
6
|
-
), $common);
|
|
7
|
-
|
|
8
|
-
$border: () !default;
|
|
9
|
-
$border: map.merge((
|
|
10
|
-
'width': 1px
|
|
11
|
-
), $border);
|
|
12
|
-
|
|
13
|
-
$font: () !default;
|
|
14
|
-
$font: map.merge((
|
|
15
|
-
'sans': 'Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif',
|
|
16
|
-
'mono': 'Menlo, Monaco, Consolas, "Courier New", monospace',
|
|
17
|
-
'serif': "'Songti SC', 'Noto Serif SC', STZhongsong, STKaiti, KaiTi, Roboto, serif",
|
|
18
|
-
'serif-weight': 900,
|
|
19
|
-
), $font);
|
|
20
|
-
|
|
21
|
-
$transition: () !default;
|
|
22
|
-
$transition: map.merge((
|
|
23
|
-
'duration-fast': 0.2s,
|
|
24
|
-
'duration': 0.4s,
|
|
25
|
-
'duration-slow': 0.6s,
|
|
26
|
-
'': all var(--va-transition-duration-fast) ease-in-out
|
|
27
|
-
), $transition);
|
package/src/node/config.ts
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
// import { loadConfig } from 'c12'
|
|
2
|
-
import fs from 'fs'
|
|
3
|
-
import { loadConfig } from 'unconfig'
|
|
4
|
-
import defu from 'defu'
|
|
5
|
-
import type { ValaxyConfig } from '../types'
|
|
6
|
-
import { defaultValaxyConfig } from '../types'
|
|
7
|
-
import type { ValaxyEntryOptions } from './options'
|
|
8
|
-
|
|
9
|
-
// for user config
|
|
10
|
-
export async function resolveConfig(options: ValaxyEntryOptions = {}) {
|
|
11
|
-
// c12 merge array twice, so i deprecated it
|
|
12
|
-
// const { config, configFile } = await loadConfig<ValaxyConfig>({
|
|
13
|
-
// name: 'valaxy',
|
|
14
|
-
// defaults: defaultValaxyConfig,
|
|
15
|
-
// })
|
|
16
|
-
|
|
17
|
-
const { config: userConfig, sources } = await loadConfig<ValaxyConfig>({
|
|
18
|
-
sources: [
|
|
19
|
-
{
|
|
20
|
-
files: 'valaxy.config',
|
|
21
|
-
extensions: ['ts', 'js', 'mjs', 'cjs', 'json'],
|
|
22
|
-
},
|
|
23
|
-
],
|
|
24
|
-
merge: false,
|
|
25
|
-
})
|
|
26
|
-
const configFile = sources[0]
|
|
27
|
-
const config = defu(userConfig, defaultValaxyConfig)
|
|
28
|
-
|
|
29
|
-
const theme = options.theme || config.theme || 'yun'
|
|
30
|
-
|
|
31
|
-
try {
|
|
32
|
-
const { defaultThemeConfig } = await import(`valaxy-theme-${theme}`)
|
|
33
|
-
config.themeConfig = defu(config.themeConfig, defaultThemeConfig)
|
|
34
|
-
}
|
|
35
|
-
catch (e) {
|
|
36
|
-
console.error(`valaxy-theme-${theme} doesn't have default config`)
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
try {
|
|
40
|
-
const pkg = fs.readFileSync(require.resolve(`valaxy-theme-${theme}/package.json`), 'utf-8')
|
|
41
|
-
config.themeConfig.pkg = JSON.parse(pkg)
|
|
42
|
-
}
|
|
43
|
-
catch (e) {
|
|
44
|
-
console.error(`valaxy-theme-${theme} doesn't have package.json`)
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
return {
|
|
48
|
-
config,
|
|
49
|
-
configFile,
|
|
50
|
-
theme,
|
|
51
|
-
}
|
|
52
|
-
}
|