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.
Files changed (155) hide show
  1. package/README.md +0 -4
  2. package/{src/client → client}/App.vue +0 -0
  3. package/{src/client/composables/search/index.ts → client/app/data.ts} +0 -0
  4. package/{src/client → client}/components/AppLink.vue +0 -0
  5. package/client/components/PostCard.vue +84 -0
  6. package/{src/client → client}/components/PostList.vue +0 -0
  7. package/{src/client → client}/components/README.md +0 -0
  8. package/{src/client → client}/components/ValaxyBg.vue +0 -0
  9. package/{src/client → client}/components/ValaxyCopyright.vue +0 -0
  10. package/{src/client → client}/components/ValaxyFooter.vue +1 -1
  11. package/{src/client → client}/components/ValaxyHamburger.vue +0 -0
  12. package/client/components/ValaxyMd.vue +74 -0
  13. package/{src/client → client}/components/ValaxyOverlay.vue +0 -0
  14. package/{src/client → client}/components/ValaxyPagination.vue +0 -0
  15. package/{src/client → client}/components/ValaxyRightSidebar.vue +0 -0
  16. package/{src/client → client}/components/ValaxySidebar.vue +0 -0
  17. package/{src/client → client}/components/ValaxyToc.vue +3 -3
  18. package/{src/client → client}/composables/category.ts +0 -0
  19. package/{src/client → client}/composables/comments/index.ts +0 -0
  20. package/{src/client → client}/composables/comments/twikoo.ts +0 -0
  21. package/{src/client → client}/composables/comments/waline.ts +0 -0
  22. package/{src/client → client}/composables/common.ts +0 -0
  23. package/client/composables/copy-code.ts +92 -0
  24. package/{src/client → client}/composables/dark.ts +0 -0
  25. package/client/composables/features/index.ts +0 -0
  26. package/{src/client → client}/composables/helper.ts +0 -0
  27. package/{src/client → client}/composables/index.ts +1 -1
  28. package/{src/client → client}/composables/layout.ts +0 -0
  29. package/client/composables/outline.ts +168 -0
  30. package/{src/client → client}/composables/post.ts +0 -0
  31. package/client/composables/search/index.ts +0 -0
  32. package/{src/client → client}/composables/sidebar.ts +46 -1
  33. package/{src/client → client}/composables/tag.ts +0 -0
  34. package/{src/client → client}/composables/widgets/aplayer.ts +0 -0
  35. package/{src/client → client}/composables/widgets/backToTop.ts +0 -0
  36. package/{src/client → client}/composables/widgets/codepen.ts +0 -0
  37. package/{src/client → client}/composables/widgets/index.ts +0 -0
  38. package/client/config.ts +75 -0
  39. package/{src/client → client}/index.html +0 -0
  40. package/{src/client → client}/index.ts +0 -0
  41. package/{src/client → client}/layouts/404.vue +0 -0
  42. package/{src/client → client}/layouts/README.md +0 -0
  43. package/{src/client → client}/locales/README.md +0 -0
  44. package/{src/client → client}/locales/en.yml +1 -0
  45. package/{src/client → client}/locales/zh-CN.yml +4 -3
  46. package/{src/client → client}/main.ts +4 -1
  47. package/{src/client → client}/modules/README.md +0 -0
  48. package/{src/client → client}/modules/nprogress.ts +0 -0
  49. package/{src/client → client}/modules/pinia.ts +0 -0
  50. package/{src/client → client}/modules/valaxy.ts +19 -7
  51. package/{src/client → client}/pages/README.md +0 -0
  52. package/{src/client → client}/pages/[...all].vue +0 -0
  53. package/{src/client → client}/pages/hi/[name].vue +0 -0
  54. package/{src/client → client}/pages/index.vue +0 -0
  55. package/{src/client → client}/pages/page/[page].vue +0 -0
  56. package/{src/client → client}/shims.d.ts +7 -1
  57. package/{src/client → client}/stores/app.ts +0 -0
  58. package/{src/client → client}/stores/user.ts +0 -0
  59. package/{src/client → client}/styles/common/button.scss +0 -0
  60. package/client/styles/common/code.scss +231 -0
  61. package/{src/client → client}/styles/common/custom-blocks.scss +0 -0
  62. package/{src/client → client}/styles/common/hamburger.scss +0 -0
  63. package/{src/client → client}/styles/common/markdown.scss +0 -2
  64. package/client/styles/common/scrollbar.scss +28 -0
  65. package/{src/client → client}/styles/common/sidebar.scss +0 -0
  66. package/{src/client → client}/styles/common/transition.scss +0 -0
  67. package/client/styles/css-vars.scss +62 -0
  68. package/{src/client → client}/styles/global/helper.scss +0 -0
  69. package/{src/client → client}/styles/global/i18n.scss +0 -0
  70. package/{src/client → client}/styles/global/index.scss +0 -0
  71. package/{src/client → client}/styles/global/nprogress.scss +0 -0
  72. package/{src/client → client}/styles/global/reset.scss +0 -0
  73. package/{src/client → client}/styles/index.scss +0 -0
  74. package/{src/client → client}/styles/mixins/config.scss +0 -0
  75. package/{src/client → client}/styles/mixins/index.scss +0 -0
  76. package/{src/client → client}/styles/mixins/size.scss +0 -0
  77. package/{src/client → client}/styles/mixins/variable.scss +0 -0
  78. package/{src/client → client}/styles/palette.scss +21 -2
  79. package/client/styles/third/katex.scss +3 -0
  80. package/client/styles/vars.scss +41 -0
  81. package/{src/client → client}/styles/widgets/banner.scss +0 -0
  82. package/{src/client → client}/types.ts +0 -0
  83. package/{src/client → client}/utils/helper.ts +22 -0
  84. package/{src/client → client}/utils/index.ts +0 -0
  85. package/client/utils/sidebar.ts +26 -0
  86. package/{src/client → client}/utils/time.ts +0 -0
  87. package/config/index.ts +18 -0
  88. package/dist/chunk-EAN2KU6W.mjs +1 -0
  89. package/dist/chunk-HMUGSKPK.mjs +40 -0
  90. package/dist/chunk-U5OMNIOK.js +1 -0
  91. package/dist/chunk-ZHHNO5RK.js +40 -0
  92. package/dist/{config-de04677b.d.ts → config-112ac884.d.ts} +37 -14
  93. package/dist/index.d.ts +65 -111
  94. package/dist/index.js +1 -1
  95. package/dist/index.mjs +1 -1
  96. package/dist/node/cli.js +7 -11
  97. package/dist/node/cli.mjs +7 -11
  98. package/dist/node/index.d.ts +3 -2
  99. package/dist/node/index.js +1 -1
  100. package/dist/node/index.mjs +1 -1
  101. package/{src/index.ts → index.ts} +1 -0
  102. package/{src/node → node}/build.ts +0 -0
  103. package/{src/node → node}/cli.ts +3 -2
  104. package/node/config.ts +156 -0
  105. package/{src/node → node}/index.ts +0 -0
  106. package/{src/node → node}/markdown/check.ts +0 -0
  107. package/node/markdown/highlight.ts +38 -0
  108. package/{src/node → node}/markdown/index.ts +30 -16
  109. package/{src/node → node}/markdown/markdown-it/container.ts +0 -0
  110. package/{src/node → node}/markdown/markdown-it/headings.ts +0 -0
  111. package/{src/node → node}/markdown/markdown-it/highlightLines.ts +1 -1
  112. package/{src/node → node}/markdown/markdown-it/katex.ts +0 -0
  113. package/{src/node → node}/markdown/markdown-it/parseHeader.ts +0 -0
  114. package/node/markdown/markdownToVue.ts +274 -0
  115. package/{src/node → node}/markdown/slugify.ts +0 -0
  116. package/{src/node → node}/options.ts +18 -2
  117. package/{src/node → node}/plugins/extendConfig.ts +5 -3
  118. package/node/plugins/index.ts +224 -0
  119. package/{src/node → node}/plugins/preset.ts +8 -8
  120. package/{src/node → node}/plugins/unocss.ts +0 -0
  121. package/{src/node → node}/plugins/valaxy.ts +0 -0
  122. package/{src/node → node}/rss.ts +1 -1
  123. package/{src/node → node}/server.ts +0 -0
  124. package/{src/node → node}/shims.d.ts +0 -5
  125. package/{src/node → node}/utils/cli.ts +1 -1
  126. package/node/utils/getGitTimestamp.ts +13 -0
  127. package/node/utils/index.ts +59 -0
  128. package/node/utils/net.ts +20 -0
  129. package/{src/node → node}/vite.ts +5 -1
  130. package/package.json +32 -13
  131. package/shared/index.ts +1 -0
  132. package/tsup.config.ts +7 -4
  133. package/{src/types → types}/config.ts +31 -108
  134. package/types/data.ts +31 -0
  135. package/{src/types → types}/index.ts +1 -0
  136. package/{src/types → types}/posts.ts +6 -1
  137. package/dist/chunk-6LIOFBAA.mjs +0 -1
  138. package/dist/chunk-HRARZPSA.js +0 -83
  139. package/dist/chunk-N6HD5SHF.mjs +0 -83
  140. package/dist/chunk-V3BMKLEW.js +0 -1
  141. package/src/client/components/PostCard.vue +0 -68
  142. package/src/client/components/ValaxyMd.vue +0 -71
  143. package/src/client/composables/features/index.ts +0 -1
  144. package/src/client/composables/features/katex.ts +0 -15
  145. package/src/client/composables/search/algolia.ts +0 -115
  146. package/src/client/config.ts +0 -51
  147. package/src/client/styles/common/code.scss +0 -207
  148. package/src/client/styles/common/scrollbar.scss +0 -34
  149. package/src/client/styles/css-vars.scss +0 -39
  150. package/src/client/styles/vars.scss +0 -27
  151. package/src/node/config.ts +0 -52
  152. package/src/node/markdown/highlight.ts +0 -50
  153. package/src/node/plugins/index.ts +0 -120
  154. package/src/node/plugins/markdown.ts +0 -57
  155. package/src/node/utils/index.ts +0 -26
@@ -43,6 +43,7 @@ post:
43
43
  related_posts: Related Posts
44
44
  view_link: View Link
45
45
  read_more: READ MORE
46
+ cover: Cover
46
47
  copyright:
47
48
  author: Post author
48
49
  link: Post link
@@ -43,6 +43,7 @@ post:
43
43
  related_posts: 相关文章
44
44
  view_link: 查看链接
45
45
  read_more: 阅读更多
46
+ cover: 封面
46
47
  copyright:
47
48
  author: 本文作者
48
49
  link: 本文链接
@@ -59,9 +60,9 @@ footer:
59
60
  total_visitors: 总访客量
60
61
 
61
62
  counter:
62
- archives: 暂无日志 | 共计 {count} 篇日志
63
- categories: 暂无分类 | 共计 {count} 个分类
64
- tags: 暂无标签 | 共计 {count} 个标签
63
+ archives: 暂无日志 | 共计 1 篇日志 | 共计 {count} 篇日志
64
+ categories: 暂无分类 | 共计 1 个分类 | 共计 {count} 个分类
65
+ tags: 暂无标签 | 共计 1 个标签 | 共计 {count} 个标签
65
66
  albums:
66
67
  zero: 暂无相册
67
68
  one: 共计 1 个相册
@@ -18,7 +18,10 @@ export const createApp = ViteSSG(
18
18
  {
19
19
  routes,
20
20
  base: import.meta.env.BASE_URL,
21
- scrollBehavior() { return { top: 0 } },
21
+ scrollBehavior(to, from) {
22
+ if (to.path !== from.path)
23
+ return { top: 0 }
24
+ },
22
25
  },
23
26
  (ctx) => {
24
27
  // install all modules under `modules/`
File without changes
File without changes
File without changes
@@ -10,7 +10,10 @@ import { createI18n } from 'vue-i18n'
10
10
 
11
11
  import { useStorage } from '@vueuse/core'
12
12
 
13
+ import type { Router } from 'vue-router'
14
+ import type { PageDataPayload } from '../../types'
13
15
  import { initConfig, valaxyConfigSymbol } from '../config'
16
+ import { ensureSuffix } from '@antfu/utils'
14
17
 
15
18
  import type { UserModule } from '~/types'
16
19
 
@@ -33,10 +36,11 @@ import messages from '/@valaxyjs/locales'
33
36
  // import zh from '../../../../../demo/yun/locales/zh-CN.yml'
34
37
  // import en from '../../../../../demo/yun/locales/en.yml'
35
38
 
36
- function shouldHotReload(payload: any): boolean {
39
+ function shouldHotReload(payload: PageDataPayload): boolean {
37
40
  const payloadPath = payload.path.replace(/(\bindex)?\.md$/, '')
38
41
  const locationPath = location.pathname.replace(/(\bindex)?\.html$/, '')
39
- return payloadPath === locationPath
42
+ // console.log(payloadPath, locationPath)
43
+ return ensureSuffix('/', payloadPath) === ensureSuffix('/', locationPath)
40
44
  }
41
45
 
42
46
  export const install: UserModule = ({ app, router }) => {
@@ -54,11 +58,19 @@ export const install: UserModule = ({ app, router }) => {
54
58
  })
55
59
  app.use(i18n)
56
60
 
57
- // for dev
58
- if (__DEV__) {
59
- import.meta.hot!.on('valaxy:pageHeaders', (payload) => {
60
- if (shouldHotReload(payload))
61
- router.currentRoute.value.meta.headers = payload.pageHeaders
61
+ router.isReady().then(() => {
62
+ handleHMR(router)
63
+ })
64
+ }
65
+
66
+ function handleHMR(router: Router): void {
67
+ // update route.data on HMR updates of active page
68
+ if (import.meta.hot) {
69
+ import.meta.hot!.on('valaxy:pageData', (payload: PageDataPayload) => {
70
+ if (shouldHotReload(payload)) {
71
+ // console.log(payload.pageData.headers)
72
+ Object.assign(router.currentRoute.value.meta, payload.pageData)
73
+ }
62
74
  })
63
75
  }
64
76
  }
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -3,7 +3,7 @@ import 'vue-router'
3
3
  import type { Post } from 'valaxy'
4
4
  import type { Header } from '../node/markdown'
5
5
 
6
- // with vite-plugin-md, markdowns can be treat as Vue components
6
+ // markdowns can be treat as Vue components
7
7
  declare module '*.md' {
8
8
  import type { DefineComponent } from 'vue'
9
9
  const component: DefineComponent<{}, {}, any>
@@ -23,6 +23,11 @@ declare module '@valaxyjs/config' {
23
23
  export default config
24
24
  }
25
25
 
26
+ declare module '@valaxyjs/context' {
27
+ const ctx: string
28
+ export default ctx
29
+ }
30
+
26
31
  declare module '/@valaxyjs/locales' {
27
32
  const messages: {}
28
33
  export default messages
@@ -34,3 +39,4 @@ declare module 'vue-router' {
34
39
  frontmatter: Post
35
40
  }
36
41
  }
42
+
File without changes
File without changes
File without changes
@@ -0,0 +1,231 @@
1
+ @use "~/styles/mixins" as *;
2
+
3
+ @include mobile {
4
+ .markdown-body {
5
+ div[class*="language-"] {
6
+ margin: 0 -1rem;
7
+ }
8
+ }
9
+ }
10
+
11
+ @media (min-width: 640px) {
12
+ .markdown-body div[class*="language-"] {
13
+ border-radius: 6px;
14
+ margin: 16px 0;
15
+ }
16
+ }
17
+
18
+ @media (max-width: 639px) {
19
+ .markdown-body li div[class*="language-"] {
20
+ border-radius: 6px 0 0 6px;
21
+ }
22
+ }
23
+
24
+ .markdown-body {
25
+ div[class*="language-"] {
26
+ position: relative;
27
+ background-color: var(--va-code-block-bg);
28
+
29
+ code {
30
+ padding: 0 24px;
31
+ line-height: var(--va-code-line-height);
32
+ font-size: var(--va-code-font-size);
33
+ color: var(--va-code-block-color);
34
+ transition: color 0.5s;
35
+ width: fit-content;
36
+ }
37
+
38
+ pre {
39
+ position: relative;
40
+ z-index: 1;
41
+ margin: 0;
42
+ padding: 1rem 0;
43
+ background: transparent;
44
+ overflow-x: auto;
45
+
46
+ // expand
47
+ code {
48
+ display: block;
49
+ }
50
+ }
51
+ }
52
+ }
53
+
54
+ // marker
55
+ .markdown-body {
56
+ .highlight-lines {
57
+ position: absolute;
58
+ top: 0;
59
+ bottom: 0;
60
+ left: 0;
61
+ padding: 16px 0;
62
+ width: 100%;
63
+ line-height: var(--va-code-line-height);
64
+ font-family: var(--va-font-mono);
65
+ font-size: var(--va-code-font-size);
66
+ user-select: none;
67
+ overflow: hidden;
68
+
69
+ .highlighted {
70
+ background-color: var(--va-code-line-highlight-color);
71
+ transition: background-color 0.5s;
72
+ }
73
+ }
74
+
75
+ [class*="language-"] > span.copy {
76
+ position: absolute;
77
+ top: 8px;
78
+ right: 8px;
79
+ z-index: 2;
80
+ display: block;
81
+ justify-content: center;
82
+ align-items: center;
83
+ border-radius: 4px;
84
+ width: 40px;
85
+ height: 40px;
86
+ background-color: var(--va-code-block-bg);
87
+ opacity: 0;
88
+ cursor: pointer;
89
+ background-image: var(--va-icon-copy);
90
+ background-position: 50%;
91
+ background-size: 20px;
92
+ background-repeat: no-repeat;
93
+ transition: opacity 0.25s;
94
+ }
95
+
96
+ [class*="language-"]:hover > span.copy {
97
+ opacity: 1;
98
+ }
99
+
100
+ [class*="language-"] > span.copy:hover {
101
+ background-color: var(--va-code-copy-code-hover-bg);
102
+ }
103
+
104
+ [class*="language-"] > span.copy.copied,
105
+ [class*="language-"] > span.copy:hover.copied {
106
+ border-radius: 0 4px 4px 0;
107
+ background-color: var(--va-code-copy-code-hover-bg);
108
+ background-image: var(--va-icon-copied);
109
+ }
110
+
111
+ [class*="language-"] > span.copy.copied::before,
112
+ [class*="language-"] > span.copy:hover.copied::before {
113
+ position: relative;
114
+ left: -65px;
115
+ display: block;
116
+ border-radius: 4px 0 0 4px;
117
+ padding-top: 8px;
118
+ width: 64px;
119
+ height: 40px;
120
+ text-align: center;
121
+ font-size: 12px;
122
+ font-weight: 500;
123
+ color: var(--va-code-copy-code-active-text);
124
+ background-color: var(--va-code-copy-code-hover-bg);
125
+ white-space: nowrap;
126
+ content: "Copied";
127
+ }
128
+
129
+ [class*="language-"]:before {
130
+ position: absolute;
131
+ top: 6px;
132
+ right: 12px;
133
+ z-index: 2;
134
+ font-size: 12px;
135
+ font-weight: 500;
136
+ color: var(--va-c-text-dark-3);
137
+ transition: color 0.5s, opacity 0.5s;
138
+ }
139
+
140
+ [class*="language-"]:hover:before {
141
+ opacity: 0;
142
+ }
143
+
144
+ [class~="language-c"]:before {
145
+ content: "c";
146
+ }
147
+ [class~="language-css"]:before {
148
+ content: "css";
149
+ }
150
+ [class~="language-go"]:before {
151
+ content: "go";
152
+ }
153
+ [class~="language-html"]:before {
154
+ content: "html";
155
+ }
156
+ [class~="language-java"]:before {
157
+ content: "java";
158
+ }
159
+ [class~="language-javascript"]:before {
160
+ content: "js";
161
+ }
162
+ [class~="language-js"]:before {
163
+ content: "js";
164
+ }
165
+ [class~="language-json"]:before {
166
+ content: "json";
167
+ }
168
+ [class~="language-jsx"]:before {
169
+ content: "jsx";
170
+ }
171
+ [class~="language-less"]:before {
172
+ content: "less";
173
+ }
174
+ [class~="language-markdown"]:before {
175
+ content: "md";
176
+ }
177
+ [class~="language-md"]:before {
178
+ content: "md";
179
+ }
180
+ [class~="language-php"]:before {
181
+ content: "php";
182
+ }
183
+ [class~="language-python"]:before {
184
+ content: "py";
185
+ }
186
+ [class~="language-py"]:before {
187
+ content: "py";
188
+ }
189
+ [class~="language-rb"]:before {
190
+ content: "rb";
191
+ }
192
+ [class~="language-ruby"]:before {
193
+ content: "rb";
194
+ }
195
+ [class~="language-rust"]:before {
196
+ content: "rust";
197
+ }
198
+ [class~="language-sass"]:before {
199
+ content: "sass";
200
+ }
201
+ [class~="language-scss"]:before {
202
+ content: "scss";
203
+ }
204
+ [class~="language-sh"]:before {
205
+ content: "sh";
206
+ }
207
+ [class~="language-bash"]:before {
208
+ content: "sh";
209
+ }
210
+ [class~="language-stylus"]:before {
211
+ content: "styl";
212
+ }
213
+ [class~="language-vue-html"]:before {
214
+ content: "template";
215
+ }
216
+ [class~="language-typescript"]:before {
217
+ content: "ts";
218
+ }
219
+ [class~="language-ts"]:before {
220
+ content: "ts";
221
+ }
222
+ [class~="language-tsx"]:before {
223
+ content: "tsx";
224
+ }
225
+ [class~="language-vue"]:before {
226
+ content: "vue";
227
+ }
228
+ [class~="language-yaml"]:before {
229
+ content: "yaml";
230
+ }
231
+ }
@@ -1,8 +1,6 @@
1
1
  @use "sass:map";
2
2
 
3
3
  .markdown-body {
4
- --prism-font-family: var(--va-font-mono);
5
-
6
4
  --smc-font-family: var(--va-font-sans);
7
5
 
8
6
  video {
@@ -0,0 +1,28 @@
1
+ @use "~/styles/mixins" as *;
2
+
3
+ ::-webkit-scrollbar {
4
+ width: 8px;
5
+ height: 8px;
6
+ }
7
+
8
+ ::-webkit-scrollbar-track {
9
+ border-radius: 2px;
10
+ background-color: rgba(255, 255, 255, 0.1);
11
+ }
12
+
13
+ ::-webkit-scrollbar-thumb {
14
+ border-radius: 2px;
15
+ background-color: rgba(122, 122, 122, 0.3);
16
+
17
+ &:window-inactive {
18
+ background-color: rgba(122, 122, 122, 0.3);
19
+ }
20
+
21
+ &:hover {
22
+ background-color: rgba(get-css-var("c", "primary", "rgb"), 0.7);
23
+ }
24
+
25
+ &:active {
26
+ background-color: rgba(get-css-var("c", "primary", "rgb"), 0.9);
27
+ }
28
+ }
@@ -0,0 +1,62 @@
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
+ // code
36
+ :root {
37
+ --va-code-line-height: 1.7;
38
+ --va-code-font-size: 0.875em;
39
+
40
+ --va-code-block-color: var(--va-c-text-dark-1);
41
+ --va-code-block-bg: #282c34;
42
+
43
+ --va-code-line-highlight-color: rgba(0, 0, 0, 0.5);
44
+ --va-code-line-number-color: var(--va-c-text-dark-3);
45
+
46
+ --va-code-copy-code-hover-bg: rgba(255, 255, 255, 0.05);
47
+ --va-code-copy-code-active-text: var(--va-c-text-dark-2);
48
+ }
49
+
50
+ // dark
51
+ html.dark {
52
+ color-scheme: dark;
53
+ @include set-css-var-from-map(palette.$dark);
54
+ }
55
+
56
+ /**
57
+ * Icons
58
+ * -------------------------------------------------------------------------- */
59
+ :root {
60
+ --va-icon-copy: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' height='20' width='20' stroke='rgba(128,128,128,1)' stroke-width='2' class='h-6 w-6' viewBox='0 0 24 24'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M9 5H7a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-2M9 5a2 2 0 0 0 2 2h2a2 2 0 0 0 2-2M9 5a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2'/%3E%3C/svg%3E");
61
+ --va-icon-copied: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' height='20' width='20' stroke='rgba(128,128,128,1)' stroke-width='2' class='h-6 w-6' viewBox='0 0 24 24'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M9 5H7a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-2M9 5a2 2 0 0 0 2 2h2a2 2 0 0 0 2-2M9 5a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2m-6 9 2 2 4-4'/%3E%3C/svg%3E");
62
+ }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -11,6 +11,15 @@ $palette: map.merge(
11
11
  "gray": #8e8e8e,
12
12
  "danger": #db2828,
13
13
  "warning": #f2711c,
14
+
15
+ "text-light-1": #213547,
16
+ "text-light-2": rgba(60, 60, 60, 0.7),
17
+ "text-light-3": rgba(60, 60, 60, 0.33),
18
+ "text-light-4": rgba(60, 60, 60, 0.18),
19
+ "text-dark-1": rgba(255, 255, 255, 0.87),
20
+ "text-dark-2": rgba(235, 235, 235, 0.6),
21
+ "text-dark-3": rgba(235, 235, 235, 0.38),
22
+ "text-dark-4": rgba(235, 235, 235, 0.18),
14
23
  ),
15
24
  $palette
16
25
  );
@@ -37,13 +46,19 @@ $colors: map.merge(
37
46
  $light: () !default;
38
47
  $light: map.merge(
39
48
  (
49
+ "c-brand": $c-primary,
50
+
40
51
  "border-color": #222,
41
52
 
42
53
  "c-bg": white,
43
54
  "c-bg-light": white,
44
55
  "c-bg-dark": #fafafa,
56
+ "c-bg-alt": #f9f9f9,
57
+ "c-bg-mute": #f1f1f1,
58
+
45
59
  "c-text": #333,
46
60
  "c-text-light": #555,
61
+ "c-text-lighter": #666,
47
62
  "c-text-dark": #111,
48
63
 
49
64
  "c-primary-rgb": #{red($c-primary),
@@ -53,6 +68,7 @@ $light: map.merge(
53
68
  blue($c-primary)},
54
69
 
55
70
  "c-link": get-css-var("c-primary-dark"),
71
+ "c-divider": rgba(60, 60, 60, 0.2),
56
72
  ),
57
73
  $light
58
74
  );
@@ -65,12 +81,15 @@ $dark: map.merge(
65
81
  "c-bg": #1a1a1a,
66
82
  "c-bg-light": #1d1e1f,
67
83
  "c-bg-dark": #1a1a1a,
84
+ "c-bg-alt": #1a1a1a,
85
+ "c-bg-mute": #2f2f2f,
68
86
 
69
87
  "c-text": #f2f2f2,
70
- "c-text-light": #eee,
71
- "c-text-lighter": #ddd,
88
+ "c-text-light": #ddd,
89
+ "c-text-lighter": #eee,
72
90
  "c-text-dark": rgba(#ebebeb, 0.8),
73
91
  "c-link": map.get($colors, "primary-light"),
92
+ "code-block-bg": #151515,
74
93
  ),
75
94
  $dark
76
95
  );
@@ -0,0 +1,3 @@
1
+ .katex-display > .katex > .katex-html > .tag {
2
+ right: 2px;
3
+ }
@@ -0,0 +1,41 @@
1
+ @use "sass:map";
2
+
3
+ $common: () !default;
4
+ $common: map.merge(
5
+ (
6
+ "sidebar-width-mobile": 320px,
7
+ ),
8
+ $common
9
+ );
10
+
11
+ $border: () !default;
12
+ $border: map.merge(
13
+ (
14
+ "width": 1px,
15
+ ),
16
+ $border
17
+ );
18
+
19
+ $font: () !default;
20
+ $font: map.merge(
21
+ (
22
+ "sans":
23
+ 'Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif',
24
+ "mono": 'Menlo, Monaco, Consolas, "Courier New", monospace',
25
+ "serif":
26
+ "'Songti SC', 'Noto Serif SC', STZhongsong, STKaiti, KaiTi, Roboto, serif",
27
+ "serif-weight": 900,
28
+ ),
29
+ $font
30
+ );
31
+
32
+ $transition: () !default;
33
+ $transition: map.merge(
34
+ (
35
+ "duration-fast": 0.2s,
36
+ "duration": 0.4s,
37
+ "duration-slow": 0.6s,
38
+ "": all var(--va-transition-duration-fast) ease-in-out,
39
+ ),
40
+ $transition
41
+ );
File without changes
@@ -28,3 +28,25 @@ export const wrapTable = (container: HTMLElement | Document = document) => {
28
28
  wrap(el, 'table-container')
29
29
  })
30
30
  }
31
+
32
+ export function throttleAndDebounce(fn: () => void, delay: number): () => void {
33
+ let timeout: number
34
+ let called = false
35
+
36
+ return () => {
37
+ if (timeout)
38
+ clearTimeout(timeout)
39
+
40
+ if (!called) {
41
+ fn()
42
+ called = true
43
+ setTimeout(() => {
44
+ called = false
45
+ }, delay)
46
+ }
47
+ else {
48
+ // @ts-expect-error browser setTimeout
49
+ timeout = setTimeout(fn, delay)
50
+ }
51
+ }
52
+ }
File without changes
@@ -0,0 +1,26 @@
1
+ import type { YunTheme } from 'valaxy-theme-yun'
2
+ import { ensurePrefix } from '@antfu/utils'
3
+
4
+ /**
5
+ * Get the `Sidebar` from sidebar option. This method will ensure to get correct
6
+ * sidebar config from `MultiSideBarConfig` with various path combinations such
7
+ * as matching `guide/` and `/guide/`. If no matching config was found, it will
8
+ * return empty array.
9
+ */
10
+ export function getSidebar(
11
+ sidebar: YunTheme.Sidebar,
12
+ path: string,
13
+ ) {
14
+ if (Array.isArray(sidebar))
15
+ return sidebar
16
+
17
+ path = ensurePrefix('/', path)
18
+
19
+ for (const dir in sidebar) {
20
+ // make sure the multi sidebar key starts with slash too
21
+ if (path.startsWith(ensurePrefix('/', dir)))
22
+ return sidebar[dir]
23
+ }
24
+
25
+ return []
26
+ }