valaxy 0.8.1 → 0.9.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.
- package/client/App.vue +4 -0
- package/client/composables/comments/index.ts +2 -1
- package/client/composables/common.ts +11 -2
- package/client/composables/post.ts +1 -1
- package/client/composables/sidebar.ts +36 -1
- package/client/config.ts +11 -6
- package/client/index.html +4 -10
- package/client/setups.ts +0 -6
- package/client/styles/common/markdown.scss +0 -4
- package/client/styles/global/i18n.scss +4 -2
- package/client/styles/global/index.scss +0 -1
- package/client/styles/index.scss +0 -6
- package/client/styles/palette.scss +5 -1
- package/client/utils/helper.ts +2 -0
- package/client/vite.config.ts +3 -0
- package/dist/chunk-B2L4QLCB.mjs +1 -0
- package/dist/chunk-KRHFRLOW.js +1 -0
- package/dist/{chunk-ER6SQ4ZW.mjs → chunk-LHTMHTJP.mjs} +128 -114
- package/dist/{chunk-VGABMGJA.js → chunk-V4YNXOMI.js} +127 -113
- package/dist/{config-60c840d8.d.ts → config-1d2e9ebd.d.ts} +13 -1
- package/dist/node/cli.js +8 -8
- package/dist/node/cli.mjs +8 -8
- package/dist/node/index.d.ts +29 -7
- package/dist/node/index.js +1 -1
- package/dist/node/index.mjs +1 -1
- package/dist/types/index.d.ts +7 -2
- package/dist/types/index.js +1 -1
- package/dist/types/index.mjs +1 -0
- package/package.json +7 -8
- package/types/config.ts +13 -1
- package/types/index.ts +1 -0
- package/types/setups.ts +8 -0
- package/client/styles/common/button.scss +0 -27
package/client/App.vue
CHANGED
|
@@ -8,6 +8,10 @@ import { isDark } from './composables'
|
|
|
8
8
|
// they will be rendered correctly in the html results with vite-ssg
|
|
9
9
|
import { useConfig } from './config'
|
|
10
10
|
|
|
11
|
+
// <link rel="apple-touch-icon" href="/pwa-192x192.png">
|
|
12
|
+
// <link rel="mask-icon" href="/safari-pinned-tab.svg" color="#00aba9">
|
|
13
|
+
// <meta name="msapplication-TileColor" content = "#00aba9" >
|
|
14
|
+
|
|
11
15
|
const config = useConfig()
|
|
12
16
|
useHead({
|
|
13
17
|
title: config.value.title,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useRoute } from 'vue-router'
|
|
2
|
-
import { computed } from 'vue'
|
|
2
|
+
import { computed, inject } from 'vue'
|
|
3
3
|
import { isClient } from '@vueuse/core'
|
|
4
4
|
|
|
5
|
-
import type { Post } from '../../types'
|
|
5
|
+
import type { PageData, Post } from '../../types'
|
|
6
6
|
import { useConfig } from '../config'
|
|
7
7
|
|
|
8
8
|
export function useFrontmatter() {
|
|
@@ -12,6 +12,15 @@ export function useFrontmatter() {
|
|
|
12
12
|
return frontmatter
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
+
/**
|
|
16
|
+
* inject pageData
|
|
17
|
+
* @returns
|
|
18
|
+
*/
|
|
19
|
+
export function useData(): PageData {
|
|
20
|
+
const value = inject<PageData>('pageData', {} as any)
|
|
21
|
+
return value
|
|
22
|
+
}
|
|
23
|
+
|
|
15
24
|
/**
|
|
16
25
|
* get full url
|
|
17
26
|
*/
|
|
@@ -48,7 +48,7 @@ export function usePostList(params: {
|
|
|
48
48
|
*/
|
|
49
49
|
export function usePageList() {
|
|
50
50
|
const router = useRouter()
|
|
51
|
-
return computed(() => {
|
|
51
|
+
return computed<Post[]>(() => {
|
|
52
52
|
const routes = router.getRoutes()
|
|
53
53
|
.map((i) => {
|
|
54
54
|
return Object.assign({ path: i.path, excerpt: i.meta.excerpt }, i.meta.frontmatter)
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { useFrontmatter } from 'valaxy'
|
|
1
2
|
import type { Ref } from 'vue'
|
|
2
|
-
import { onMounted, onUnmounted } from 'vue'
|
|
3
|
+
import { computed, onMounted, onUnmounted, ref } from 'vue'
|
|
3
4
|
|
|
4
5
|
export function useActiveSidebarLinks(container: Ref<HTMLElement>, marker: Ref<HTMLElement>) {
|
|
5
6
|
const onScroll = throttleAndDebounce(setActiveLink, 200)
|
|
@@ -111,3 +112,37 @@ function throttleAndDebounce(fn: () => void, delay: number): () => void {
|
|
|
111
112
|
}
|
|
112
113
|
}
|
|
113
114
|
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* helper for sidebar
|
|
118
|
+
*/
|
|
119
|
+
export function useSidebar() {
|
|
120
|
+
const isOpen = ref(false)
|
|
121
|
+
const fm = useFrontmatter()
|
|
122
|
+
const hasSidebar = computed(() => {
|
|
123
|
+
return (
|
|
124
|
+
fm.value.sidebar !== false
|
|
125
|
+
&& fm.value.layout !== 'home'
|
|
126
|
+
)
|
|
127
|
+
})
|
|
128
|
+
|
|
129
|
+
function open() {
|
|
130
|
+
isOpen.value = true
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function close() {
|
|
134
|
+
isOpen.value = false
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function toggle() {
|
|
138
|
+
isOpen.value ? close() : open()
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
return {
|
|
142
|
+
isOpen,
|
|
143
|
+
hasSidebar,
|
|
144
|
+
open,
|
|
145
|
+
close,
|
|
146
|
+
toggle,
|
|
147
|
+
}
|
|
148
|
+
}
|
package/client/config.ts
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
import valaxyConfig from '/@valaxyjs/config'
|
|
3
3
|
// @ts-expect-error virtual module @valaxyjs/context
|
|
4
4
|
import valaxyContext from '/@valaxyjs/context'
|
|
5
|
-
import type { ComputedRef, InjectionKey
|
|
5
|
+
import type { ComputedRef, InjectionKey } from 'vue'
|
|
6
6
|
import { computed, inject, readonly, shallowRef } from 'vue'
|
|
7
7
|
// import type { RouteMeta } from 'vue-router'
|
|
8
8
|
// fix build caused by pnpm
|
|
9
9
|
// This is likely not portable. A type annotation is necessary.
|
|
10
10
|
// https://github.com/microsoft/TypeScript/issues/42873
|
|
11
|
-
import type {
|
|
11
|
+
import type { ValaxyConfig } from 'valaxy/types'
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* parse valaxy config
|
|
@@ -28,7 +28,6 @@ export const valaxyConfigSymbol: InjectionKey<ComputedRef<ValaxyConfig>> = Symbo
|
|
|
28
28
|
export const valaxyConfigRef = shallowRef<ValaxyConfig>(parse<ValaxyConfig>(valaxyConfig))
|
|
29
29
|
|
|
30
30
|
export const valaxyContextRef = shallowRef<ValaxyContext>(parse<ValaxyContext>(valaxyContext))
|
|
31
|
-
// export const valaxyDataRef = shallowRef<PageData>(parse(valaxyConfig))
|
|
32
31
|
|
|
33
32
|
// hmr
|
|
34
33
|
if (import.meta.hot) {
|
|
@@ -63,7 +62,13 @@ export function useConfig<ThemeConfig = any>() {
|
|
|
63
62
|
return config!
|
|
64
63
|
}
|
|
65
64
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
65
|
+
/**
|
|
66
|
+
* You can use like this: import { useThemeConfig } from 'valaxy-theme-xxx'
|
|
67
|
+
* if you want to: import { useThemeConfig } from 'valaxy'
|
|
68
|
+
* you need pass themeConfig by yourself
|
|
69
|
+
* @returns
|
|
70
|
+
*/
|
|
71
|
+
export function useThemeConfig<T = Record<string, any>>() {
|
|
72
|
+
const config = useConfig<T>()
|
|
73
|
+
return computed(() => config!.value.themeConfig)
|
|
69
74
|
}
|
package/client/index.html
CHANGED
|
@@ -4,25 +4,19 @@
|
|
|
4
4
|
<head>
|
|
5
5
|
<meta charset="UTF-8">
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
7
|
-
<link rel="apple-touch-icon" href="/pwa-192x192.png">
|
|
8
|
-
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#00aba9">
|
|
9
|
-
<meta name="msapplication-TileColor" content="#00aba9">
|
|
10
|
-
<meta name="theme-color" content="#ffffff">
|
|
11
7
|
<script>
|
|
12
8
|
(function () {
|
|
13
|
-
const prefersDark = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches
|
|
14
|
-
const setting = localStorage.getItem('vueuse-color-scheme') || 'auto'
|
|
15
|
-
if (setting === 'dark' || (prefersDark && setting !== 'light'))
|
|
16
|
-
document.documentElement.classList.toggle('dark', true)
|
|
17
9
|
const locale = localStorage.getItem('valaxy-locale') || 'en'
|
|
18
10
|
document.documentElement.setAttribute('lang', locale)
|
|
19
11
|
})()
|
|
20
12
|
</script>
|
|
13
|
+
<!-- head -->
|
|
21
14
|
</head>
|
|
22
15
|
|
|
23
|
-
<body
|
|
16
|
+
<body>
|
|
24
17
|
<div id="app"></div>
|
|
25
|
-
<script type="module" src="
|
|
18
|
+
<script type="module" src="__ENTRY__"></script>
|
|
19
|
+
<!-- body -->
|
|
26
20
|
</body>
|
|
27
21
|
|
|
28
22
|
</html>
|
package/client/setups.ts
CHANGED
|
@@ -1,16 +1,10 @@
|
|
|
1
1
|
import type { ViteSSGContext } from 'vite-ssg'
|
|
2
2
|
import type { Awaitable } from '@antfu/utils'
|
|
3
|
-
import type { VitePluginConfig as UnoCssConfig } from 'unocss/vite'
|
|
4
3
|
|
|
5
4
|
type AppContext = ViteSSGContext
|
|
6
5
|
|
|
7
6
|
export type AppSetup = (ctx: AppContext) => Awaitable<void>
|
|
8
|
-
export type UnoSetup = () => Awaitable<Partial<UnoCssConfig> | undefined>
|
|
9
7
|
|
|
10
8
|
export function defineAppSetup(fn: AppSetup) {
|
|
11
9
|
return fn
|
|
12
10
|
}
|
|
13
|
-
|
|
14
|
-
export function defineUnoSetup(fn: UnoSetup) {
|
|
15
|
-
return fn
|
|
16
|
-
}
|
|
@@ -8,7 +8,8 @@ html[lang] {
|
|
|
8
8
|
h4[lang],
|
|
9
9
|
h5[lang],
|
|
10
10
|
h6[lang],
|
|
11
|
-
div[lang]
|
|
11
|
+
div[lang],
|
|
12
|
+
span[lang] {
|
|
12
13
|
display: none;
|
|
13
14
|
}
|
|
14
15
|
}
|
|
@@ -32,7 +33,8 @@ html[lang] {
|
|
|
32
33
|
h4[lang="#{$lang}"],
|
|
33
34
|
h5[lang="#{$lang}"],
|
|
34
35
|
h6[lang="#{$lang}"],
|
|
35
|
-
div[lang="#{$lang}"]
|
|
36
|
+
div[lang="#{$lang}"],
|
|
37
|
+
span[lang="#{$lang}"] {
|
|
36
38
|
display: block;
|
|
37
39
|
}
|
|
38
40
|
}
|
package/client/styles/index.scss
CHANGED
|
@@ -10,7 +10,6 @@ $c-primary: #0078e7 !default;
|
|
|
10
10
|
@use "./global/nprogress.scss" as *;
|
|
11
11
|
|
|
12
12
|
// common
|
|
13
|
-
@use "./common/button.scss" as *;
|
|
14
13
|
@use "./common/code.scss" as *;
|
|
15
14
|
@use "./common/custom-blocks.scss" as *;
|
|
16
15
|
@use "./common/hamburger.scss" as *;
|
|
@@ -24,8 +23,3 @@ $c-primary: #0078e7 !default;
|
|
|
24
23
|
|
|
25
24
|
// markdown
|
|
26
25
|
@use "./common/markdown.scss";
|
|
27
|
-
@forward "star-markdown-css/src/scss/theme/yun.scss" with (
|
|
28
|
-
$colors: (
|
|
29
|
-
"primary": $c-primary,
|
|
30
|
-
)
|
|
31
|
-
);
|
|
@@ -53,6 +53,8 @@ $light: map.merge(
|
|
|
53
53
|
"c-bg": white,
|
|
54
54
|
"c-bg-light": white,
|
|
55
55
|
"c-bg-dark": #fafafa,
|
|
56
|
+
|
|
57
|
+
"c-bg-soft": white,
|
|
56
58
|
"c-bg-alt": #f9f9f9,
|
|
57
59
|
"c-bg-mute": #f1f1f1,
|
|
58
60
|
|
|
@@ -81,8 +83,10 @@ $dark: map.merge(
|
|
|
81
83
|
"c-bg": #1a1a1a,
|
|
82
84
|
"c-bg-light": #1d1e1f,
|
|
83
85
|
"c-bg-dark": #1a1a1a,
|
|
84
|
-
|
|
86
|
+
|
|
87
|
+
"c-bg-soft": #1d1e1f,
|
|
85
88
|
"c-bg-mute": #2f2f2f,
|
|
89
|
+
"c-bg-alt": #1a1a1a,
|
|
86
90
|
|
|
87
91
|
"c-text": #f2f2f2,
|
|
88
92
|
"c-text-light": #ddd,
|
package/client/utils/helper.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var g=Object.create;var f=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var j=Object.getPrototypeOf,k=Object.prototype.hasOwnProperty;var m=(a=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(a,{get:(b,c)=>(typeof require!="undefined"?require:b)[c]}):a)(function(a){if(typeof require!="undefined")return require.apply(this,arguments);throw new Error('Dynamic require of "'+a+'" is not supported')});var n=(a,b)=>()=>(b||a((b={exports:{}}).exports,b),b.exports);var l=(a,b,c,e)=>{if(b&&typeof b=="object"||typeof b=="function")for(let d of i(b))!k.call(a,d)&&d!==c&&f(a,d,{get:()=>b[d],enumerable:!(e=h(b,d))||e.enumerable});return a};var o=(a,b,c)=>(c=a!=null?g(j(a)):{},l(b||!a||!a.__esModule?f(c,"default",{value:a,enumerable:!0}):c,a));export{m as a,n as b,o as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var g=Object.create;var f=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var j=Object.getPrototypeOf,k=Object.prototype.hasOwnProperty;var m=(a=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(a,{get:(b,c)=>(typeof require!="undefined"?require:b)[c]}):a)(function(a){if(typeof require!="undefined")return require.apply(this,arguments);throw new Error('Dynamic require of "'+a+'" is not supported')});var n=(a,b)=>()=>(b||a((b={exports:{}}).exports,b),b.exports);var l=(a,b,c,e)=>{if(b&&typeof b=="object"||typeof b=="function")for(let d of i(b))!k.call(a,d)&&d!==c&&f(a,d,{get:()=>b[d],enumerable:!(e=h(b,d))||e.enumerable});return a};var o=(a,b,c)=>(c=a!=null?g(j(a)):{},l(b||!a||!a.__esModule?f(c,"default",{value:a,enumerable:!0}):c,a));exports.a = m; exports.b = n; exports.c = o;
|