valaxy 0.10.3 → 0.11.0

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/bin/valaxy.cjs ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env node
2
+ 'use strict'
3
+
4
+ const { run } = require('../dist/node/cli.cjs')
5
+
6
+ function main() {
7
+ run()
8
+ }
9
+
10
+ main()
package/bin/valaxy.mjs ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env node
2
+ 'use strict'
3
+
4
+ import { run } from '../dist/node/cli.mjs'
5
+
6
+ function main() {
7
+ run()
8
+ }
9
+
10
+ main()
@@ -0,0 +1,19 @@
1
+ <script lang="ts" setup>
2
+ import type { PageData, Post } from '../../types'
3
+
4
+ defineProps<{
5
+ frontmatter: Post
6
+ data?: PageData
7
+ }>()
8
+ </script>
9
+
10
+ <template>
11
+ <main>
12
+ <slot name="main-content">
13
+ <ValaxyMd :frontmatter="frontmatter">
14
+ <slot name="main-content-md" />
15
+ <slot />
16
+ </ValaxyMd>
17
+ </slot>
18
+ </main>
19
+ </template>
@@ -1,3 +1 @@
1
1
  export * from './twikoo'
2
- // import on demand
3
- // export * from './waline'
@@ -1,7 +1,10 @@
1
1
  import { computed } from 'vue'
2
2
  import { useRoute } from 'vue-router'
3
3
 
4
- export function useLayout(layout: string) {
4
+ export function useLayout(layout?: string) {
5
5
  const route = useRoute()
6
- return computed(() => route.meta.layout === layout)
6
+ if (layout)
7
+ return computed(() => route.meta.layout === layout)
8
+ else
9
+ return computed(() => route.meta.layout)
7
10
  }
@@ -1,6 +1,7 @@
1
1
  import type { Ref } from 'vue'
2
2
  import { computed, onMounted, onUnmounted, ref } from 'vue'
3
- import { useFrontmatter } from '..'
3
+ import { useFrontmatter } from './common'
4
+ import { useLayout } from './layout'
4
5
 
5
6
  export function useActiveSidebarLinks(container: Ref<HTMLElement>, marker: Ref<HTMLElement>) {
6
7
  const onScroll = throttleAndDebounce(setActiveLink, 200)
@@ -119,10 +120,12 @@ function throttleAndDebounce(fn: () => void, delay: number): () => void {
119
120
  export function useSidebar() {
120
121
  const isOpen = ref(false)
121
122
  const fm = useFrontmatter()
123
+ const layout = useLayout()
122
124
  const hasSidebar = computed(() => {
123
125
  return (
124
126
  fm.value.sidebar !== false
125
- && fm.value.layout !== 'home'
127
+ && layout.value !== 'home'
128
+ && layout.value !== 'post'
126
129
  )
127
130
  })
128
131
 
package/client/config.ts CHANGED
@@ -33,12 +33,12 @@ export const valaxyContextRef = shallowRef<ValaxyContext>(parse<ValaxyContext>(v
33
33
  if (import.meta.hot) {
34
34
  // /@valaxyjs/site must be static string
35
35
  import.meta.hot.accept('/@valaxyjs/site', (m) => {
36
- valaxySiteConfigRef.value = parse<ValaxySiteConfig>(m.default)
36
+ valaxySiteConfigRef.value = parse<ValaxySiteConfig>(m?.default)
37
37
  })
38
38
 
39
39
  // context
40
40
  import.meta.hot.accept('/@valaxyjs/context', (m) => {
41
- valaxyContextRef.value = parse<ValaxyContext>(m.default)
41
+ valaxyContextRef.value = parse<ValaxyContext>(m?.default)
42
42
  })
43
43
  }
44
44
 
@@ -1 +1 @@
1
- export const cdnPrefix = 'https://npm.elemecdn.com/'
1
+ export const cdnPrefix = 'https://unpkg.com/'