valaxy 0.7.7 → 0.8.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.
Files changed (47) hide show
  1. package/README.md +4 -0
  2. package/client/README.md +3 -0
  3. package/client/components/ValaxyCopyright.vue +1 -1
  4. package/client/components/ValaxyMd.vue +2 -4
  5. package/client/components/ValaxyOverlay.vue +2 -2
  6. package/client/components/ValaxySidebar.vue +1 -2
  7. package/client/composables/comments/twikoo.ts +25 -1
  8. package/client/composables/comments/waline.ts +33 -23
  9. package/client/composables/{copy-code.ts → features/copy-code.ts} +0 -0
  10. package/client/composables/features/index.ts +1 -0
  11. package/client/composables/index.ts +2 -1
  12. package/client/composables/outline.ts +1 -1
  13. package/client/composables/post.ts +1 -1
  14. package/client/composables/widgets/aplayer.ts +10 -5
  15. package/client/config.ts +4 -1
  16. package/client/index.ts +2 -0
  17. package/client/modules/nprogress.ts +1 -1
  18. package/client/modules/pinia.ts +1 -1
  19. package/client/modules/valaxy.ts +1 -1
  20. package/client/scaffolds/post.md +6 -0
  21. package/client/styles/common/code.scss +1 -1
  22. package/client/styles/common/scrollbar.scss +1 -1
  23. package/client/{types.ts → types/index.ts} +0 -0
  24. package/client/utils/cdn.ts +1 -0
  25. package/client/utils/index.ts +1 -0
  26. package/dist/{chunk-HP2UOVSL.mjs → chunk-ER6SQ4ZW.mjs} +204 -204
  27. package/dist/{chunk-BTP4CLJN.js → chunk-VGABMGJA.js} +203 -203
  28. package/dist/config-60c840d8.d.ts +202 -0
  29. package/dist/node/cli.js +11 -11
  30. package/dist/node/cli.mjs +11 -11
  31. package/dist/node/index.d.ts +140 -15
  32. package/dist/node/index.js +1 -1
  33. package/dist/node/index.mjs +1 -1
  34. package/dist/types/index.d.ts +154 -10
  35. package/index.d.ts +1 -1
  36. package/package.json +14 -8
  37. package/types/config.ts +218 -0
  38. package/types/data.ts +31 -0
  39. package/types/index.ts +3 -0
  40. package/types/posts.ts +133 -0
  41. package/client/app/data.ts +0 -0
  42. package/client/components/ValaxyRightSidebar.vue +0 -73
  43. package/client/components/ValaxyToc.vue +0 -140
  44. package/client/modules/README.md +0 -11
  45. package/client/pages/README.md +0 -20
  46. package/client/shims.d.ts +0 -42
  47. package/dist/index-df14d281.d.ts +0 -462
package/types/posts.ts ADDED
@@ -0,0 +1,133 @@
1
+ export interface Post extends Record<string, any> {
2
+ /**
3
+ * Path of post
4
+ * route.path
5
+ * @description 路径
6
+ */
7
+ path?: string
8
+ /**
9
+ * Title
10
+ * @description 文章标题
11
+ */
12
+ title?: string
13
+ date?: string | number | Date
14
+ /**
15
+ * Updated Time
16
+ */
17
+ updated?: string | number | Date
18
+ lang?: string
19
+ /**
20
+ * TODO
21
+ * Read Time
22
+ * @description 阅读时长
23
+ */
24
+ duration?: string
25
+ /**
26
+ * post card type, can be bilibili/yuque/...
27
+ */
28
+ type?: string
29
+ /**
30
+ * override url, and jump directly
31
+ */
32
+ url?: string
33
+ /**
34
+ * @description 摘要
35
+ */
36
+ excerpt?: string
37
+ /**
38
+ * @description Author
39
+ * @description:zh-CN 作者
40
+ */
41
+ author?: string
42
+
43
+ /**
44
+ * Display sponsor info
45
+ * @description 是否开启赞助
46
+ */
47
+ sponsor?: boolean
48
+ /**
49
+ * Copyright
50
+ * @description 是否显示文章底部版权信息
51
+ */
52
+ copyright?: boolean
53
+
54
+ /**
55
+ * Category
56
+ * @description 分类,若为数组,则按顺序代表多层文件夹
57
+ */
58
+ categories?: string | string[]
59
+ /**
60
+ * Tags
61
+ * @description 标签,可以有多个
62
+ */
63
+ tags?: string[]
64
+
65
+ /**
66
+ * display prev next
67
+ * @description 是否显示前一篇、后一篇导航
68
+ */
69
+ nav?: boolean
70
+
71
+ /**
72
+ * display right sidebar
73
+ * @description 是否显示右侧侧边栏
74
+ */
75
+ aside?: boolean
76
+
77
+ /**
78
+ * icon before title
79
+ */
80
+ icon?: string
81
+ /**
82
+ * title color
83
+ */
84
+ color?: string
85
+ /**
86
+ * display comment
87
+ */
88
+ comment?: boolean
89
+ /**
90
+ * post is end
91
+ * @description 是否完结,将在末尾添加衬线字体 Q.E.D.
92
+ */
93
+ end?: boolean
94
+
95
+ /**
96
+ * use aplayer
97
+ */
98
+ aplayer?: boolean
99
+ /**
100
+ * use katex
101
+ */
102
+ katex?: boolean
103
+ /**
104
+ * use codepen
105
+ */
106
+ codepen?: boolean
107
+
108
+ /**
109
+ * 置顶
110
+ */
111
+ top?: number
112
+
113
+ /**
114
+ * display toc
115
+ * @description 是否显示目录
116
+ */
117
+ toc?: boolean
118
+ /**
119
+ * is draft
120
+ * @description 是否为草稿
121
+ */
122
+ draft?: boolean
123
+ /**
124
+ * cover
125
+ * @description 封面图片
126
+ */
127
+ cover?: string
128
+ /**
129
+ * enable markdown-body class
130
+ * @description 是否启用默认的 markdown 样式
131
+ */
132
+ markdown?: boolean
133
+ }
File without changes
@@ -1,73 +0,0 @@
1
- <script lang="ts" setup>
2
- import { useI18n } from 'vue-i18n'
3
- import type { Post } from '../../types'
4
- import { useAppStore } from '~/stores/app'
5
- defineProps<{ frontmatter: Post }>()
6
- const { t } = useI18n()
7
-
8
- const app = useAppStore()
9
- </script>
10
-
11
- <template>
12
- <button
13
- class="xl:hidden toc-btn shadow fixed yun-icon-btn z-350"
14
- opacity="75" right="2" bottom="19"
15
- @click="app.toggleRightSidebar()"
16
- >
17
- <div i-ri-file-list-line />
18
- </button>
19
-
20
- <ValaxyOverlay :show="app.isRightSidebarOpen" @click="app.toggleRightSidebar()" />
21
-
22
- <aside class="right-sidebar fixed va-card" :class="app.isRightSidebarOpen && 'open'" m="l-4" text="center">
23
- <h2 v-if="frontmatter.toc !== false" m="t-6 b-2" font="serif black">
24
- {{ t('sidebar.toc') }}
25
- </h2>
26
-
27
- <div class="right-sidebar-container">
28
- <ValaxyToc v-if="frontmatter.toc !== false" />
29
-
30
- <div v-if="$slots.custom" class="custom-container">
31
- <slot name="custom" />
32
- </div>
33
- </div>
34
- </aside>
35
- </template>
36
-
37
- <style lang="scss">
38
- @use '~/styles/mixins' as *;
39
-
40
- @include xl {
41
- .right-sidebar {
42
- transform: translateX(0) !important;
43
- }
44
- }
45
-
46
- .right-sidebar {
47
- width: var(--va-sidebar-width-mobile);
48
-
49
- position: fixed;
50
- top: 0;
51
- bottom: 0;
52
- right: 0;
53
-
54
- transform: translateX(100%);
55
-
56
- transition: box-shadow var(--va-transition-duration),
57
- background-color var(--va-transition-duration), opacity 0.25s,
58
- transform var(--va-transition-duration) cubic-bezier(0.19, 1, 0.22, 1);
59
-
60
- &.open {
61
- z-index: 10;
62
- transform: translateX(0);
63
- }
64
- }
65
- .right-sidebar-container {
66
- top: 1rem;
67
- }
68
-
69
- .toc-btn {
70
- color: var(--va-c-primary);
71
- background-color: white;
72
- }
73
- </style>
@@ -1,140 +0,0 @@
1
- <script lang="ts" setup>
2
- // this is a runtime toc
3
- // prebuild toc see composables/outline.ts
4
- import { onMounted, ref, watch } from 'vue'
5
- import { useI18n } from 'vue-i18n'
6
- import { useRoute } from 'vue-router'
7
-
8
- import type { Header } from '../../types'
9
- import { useActiveSidebarLinks } from '~/composables'
10
- import { useConfig } from '~/config'
11
-
12
- const container = ref()
13
- const marker = ref()
14
- useActiveSidebarLinks(container, marker)
15
-
16
- function getStylesByLevel(level: number) {
17
- return {
18
- // fontSize: `${(6 - level) * 0.1 + 0.7}rem`,
19
- paddingLeft: `${level * 1 - 1}rem`,
20
- }
21
- }
22
-
23
- const { locale } = useI18n()
24
-
25
- const config = useConfig()
26
-
27
- function useHeaders() {
28
- const headers = ref<Header[]>([])
29
- const route = useRoute()
30
-
31
- function generateHeaders() {
32
- headers.value = []
33
-
34
- const content = document.querySelector('.markdown-body')
35
- const levels = config.value.markdownIt.toc!.includeLevel!.map(level => `h${level}`)
36
-
37
- content?.querySelectorAll(levels as any).forEach((header) => {
38
- headers.value.push({
39
- level: header.tagName.toLowerCase().replace('h', ''),
40
- title: header.textContent.replace('#', ''),
41
- slug: header.id,
42
- lang: header.lang || locale.value,
43
- })
44
- })
45
- }
46
-
47
- watch(() => route.path, () => {
48
- generateHeaders()
49
- })
50
-
51
- onMounted(() => {
52
- generateHeaders()
53
- })
54
-
55
- return {
56
- headers,
57
- generateHeaders,
58
- }
59
- }
60
-
61
- const { headers, generateHeaders } = useHeaders()
62
-
63
- if (import.meta.hot) {
64
- import.meta.hot.on('valaxy:md-update', () => {
65
- setTimeout(() => {
66
- generateHeaders()
67
- // 400ms transition
68
- }, 600)
69
- })
70
- }
71
- </script>
72
-
73
- <template>
74
- <div v-if="headers" ref="container">
75
- <div ref="marker" class="outline-marker" />
76
- <ul class="va-toc" p="l-4">
77
- <li v-for="header, i in headers" :key="i" :lang="header.lang || locale" class="va-toc-item" :style="getStylesByLevel(header.level)">
78
- <a class="toc-link-item" :href="`#${header.slug}`">{{ header.title }}</a>
79
- </li>
80
- </ul>
81
- </div>
82
- </template>
83
-
84
- <style lang="scss">
85
- .outline-marker {
86
- opacity: 0;
87
- position: absolute;
88
- background-color: var(--va-c-primary);
89
- border-radius: 4px;
90
- width: 4px;
91
- height: 20px;
92
- top: 32px;
93
- left: 20px;
94
- z-index: 0;
95
- transition: top 0.25s cubic-bezier(0, 1, 0.5, 1), opacity 0.25s,
96
- background-color 0.5s;
97
- }
98
-
99
- .va-toc {
100
- top: 10px;
101
- width: var(--yun-sidebar-width-mobile);
102
-
103
- background-color: var(--va-c-bg-light);
104
-
105
- font-size: 1rem;
106
- font-family: var(--va-font-serif);
107
- font-weight: 900;
108
- line-height: 1.6;
109
-
110
- text-align: left;
111
-
112
- a {
113
- display: block;
114
- color: var(--c-toc-link);
115
- transition: color var(--va-transition-duration);
116
-
117
- overflow: hidden;
118
- white-space: nowrap;
119
- text-overflow: ellipsis;
120
-
121
- font-weight: 900;
122
-
123
- &:hover {
124
- color: var(--va-c-text);
125
- }
126
- }
127
-
128
- .toc-link-item {
129
- color: var(--va-c-text-light);
130
-
131
- &:hover {
132
- color: var(--va-c-text);
133
- }
134
-
135
- &.active {
136
- color: var(--va-c-primary);
137
- }
138
- }
139
- }
140
- </style>
@@ -1,11 +0,0 @@
1
- ## Modules
2
-
3
- A custom user module system. Place a `.ts` file with the following template, it will be installed automatically.
4
-
5
- ```ts
6
- import type { UserModule } from '~/types'
7
-
8
- export const install: UserModule = ({ app, router, isClient }) => {
9
- // do something
10
- }
11
- ```
@@ -1,20 +0,0 @@
1
- # File-based Routing
2
-
3
- Routes will be auto-generated for Vue files in this dir with the same file structure.
4
- Check out [`vite-plugin-pages`](https://github.com/hannoeru/vite-plugin-pages) for more details.
5
-
6
- ## Path Aliasing
7
-
8
- `~/` is aliased to `./src/` folder.
9
-
10
- For example, instead of having
11
-
12
- ```ts
13
- import { isDark } from '../../../../composables'
14
- ```
15
-
16
- now, you can use
17
-
18
- ```ts
19
- import { isDark } from '~/composables'
20
- ```
package/client/shims.d.ts DELETED
@@ -1,42 +0,0 @@
1
- import 'vue-router'
2
-
3
- import type { Post } from 'valaxy'
4
- import type { Header } from '../node/markdown'
5
-
6
- // markdowns can be treat as Vue components
7
- declare module '*.md' {
8
- import type { DefineComponent } from 'vue'
9
- const component: DefineComponent<{}, {}, any>
10
- export default component
11
- }
12
-
13
- declare module '*.vue' {
14
- import type { DefineComponent } from 'vue'
15
- const component: DefineComponent<{}, {}, any>
16
- export default component
17
- }
18
-
19
- // vite hmr data
20
- declare module '/@valaxyjs/config' {
21
- // import type { ValaxyConfig } from 'valaxy'
22
- const config: string
23
- export default config
24
- }
25
-
26
- declare module '/@valaxyjs/context' {
27
- const ctx: string
28
- export default ctx
29
- }
30
-
31
- declare module '/@valaxyjs/locales' {
32
- const messages: {}
33
- export default messages
34
- }
35
-
36
- declare module 'vue-router' {
37
- interface RouteMeta {
38
- headers: Header[]
39
- frontmatter: Post
40
- }
41
- }
42
-