valaxy 0.15.11 → 0.15.13
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/components/ValaxyMd.vue +2 -1
- package/client/composables/dark.ts +2 -0
- package/client/composables/features/collapse-code.ts +42 -0
- package/client/composables/features/index.ts +1 -0
- package/client/composables/widgets/aplayer.ts +1 -0
- package/client/styles/common/code.scss +30 -0
- package/client/styles/common/transition.scss +0 -22
- package/client/styles/common/view-transition.css +21 -0
- package/client/styles/css-vars.scss +1 -0
- package/dist/chunk-NGNRXFVT.mjs +133 -0
- package/dist/chunk-QEB6E2RZ.cjs +132 -0
- package/dist/{config-e5704a2c.d.ts → config-21f067f9.d.ts} +24 -2
- package/dist/node/cli/index.cjs +1 -1
- package/dist/node/cli/index.mjs +1 -1
- package/dist/node/index.cjs +1 -1
- package/dist/node/index.d.cts +2 -2
- package/dist/node/index.d.ts +2 -2
- package/dist/node/index.mjs +1 -1
- package/dist/types/index.cjs +1 -1
- package/dist/types/index.d.cts +3 -4
- package/dist/types/index.d.ts +3 -4
- package/dist/types/index.mjs +1 -1
- package/package.json +5 -6
- package/types/config.ts +9 -1
- package/types/{default-theme.d.ts → default-theme.ts} +2 -1
- package/types/index.ts +2 -1
- package/types/posts.ts +10 -0
- package/dist/chunk-3EJGKTUH.mjs +0 -130
- package/dist/chunk-RDNVTVQ5.cjs +0 -129
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
import { onMounted, onUpdated, ref } from 'vue'
|
|
3
3
|
import { useI18n } from 'vue-i18n'
|
|
4
|
-
import { onContentUpdated, runContentUpdated, useAplayer, useCodePen, useCopyCode, useMediumZoom, wrapTable } from 'valaxy'
|
|
4
|
+
import { onContentUpdated, runContentUpdated, useAplayer, useCodePen, useCollapseCode, useCopyCode, useMediumZoom, wrapTable } from 'valaxy'
|
|
5
5
|
import type { Post } from 'valaxy'
|
|
6
6
|
import { useVanillaLazyLoad } from '../composables/features/vanilla-lazyload'
|
|
7
7
|
import { useCodeGroups } from '../composables/codeGroups'
|
|
@@ -35,6 +35,7 @@ if (props.frontmatter.codepen)
|
|
|
35
35
|
|
|
36
36
|
useCopyCode()
|
|
37
37
|
useCodeGroups()
|
|
38
|
+
useCollapseCode()
|
|
38
39
|
|
|
39
40
|
if (typeof props.frontmatter.medium_zoom === 'undefined' || props.frontmatter.medium_zoom)
|
|
40
41
|
useMediumZoom()
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { isClient } from '@vueuse/core'
|
|
2
|
+
import { onMounted } from 'vue'
|
|
3
|
+
import { useFrontmatter, useSiteConfig } from 'valaxy'
|
|
4
|
+
|
|
5
|
+
export function useCollapseCode() {
|
|
6
|
+
const config = useSiteConfig()
|
|
7
|
+
const frontmatter = useFrontmatter()
|
|
8
|
+
|
|
9
|
+
if (isClient) {
|
|
10
|
+
window.addEventListener('click', (e) => {
|
|
11
|
+
const el = e.target as HTMLElement
|
|
12
|
+
if (el.matches('[class*="language-"] > button.collapse')) {
|
|
13
|
+
const parent = el.parentElement
|
|
14
|
+
parent?.removeAttribute('style')
|
|
15
|
+
parent?.classList.remove('folded')
|
|
16
|
+
}
|
|
17
|
+
})
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// determine whether to add folded class name
|
|
21
|
+
onMounted(() => {
|
|
22
|
+
const els = document.querySelectorAll('div[class*="language-"]')
|
|
23
|
+
const siteConfigLimit = config.value.codeHeightLimit
|
|
24
|
+
const frontmatterLimit = frontmatter.value.codeHeightLimit
|
|
25
|
+
let codeHeightLimit: number
|
|
26
|
+
|
|
27
|
+
if (typeof frontmatterLimit !== 'number' || frontmatterLimit <= 0) {
|
|
28
|
+
if (siteConfigLimit === undefined || siteConfigLimit <= 0)
|
|
29
|
+
return
|
|
30
|
+
else
|
|
31
|
+
codeHeightLimit = siteConfigLimit
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
codeHeightLimit = frontmatterLimit
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
for (const el of Array.from(els)) {
|
|
38
|
+
if (el.scrollHeight > codeHeightLimit)
|
|
39
|
+
el.classList.add('folded')
|
|
40
|
+
}
|
|
41
|
+
})
|
|
42
|
+
}
|
|
@@ -38,6 +38,7 @@ html:not(.dark) .vp-code-dark {
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
div[class*="language-"] {
|
|
41
|
+
overflow-y: hidden;
|
|
41
42
|
position: relative;
|
|
42
43
|
background-color: var(--va-code-block-bg);
|
|
43
44
|
overflow-x: auto;
|
|
@@ -220,4 +221,33 @@ html:not(.dark) .vp-code-dark {
|
|
|
220
221
|
content: '+';
|
|
221
222
|
color: var(--va-code-line-diff-add-symbol-color);
|
|
222
223
|
}
|
|
224
|
+
|
|
225
|
+
// collapse
|
|
226
|
+
[class*='language-'] > button.collapse {
|
|
227
|
+
display: none;
|
|
228
|
+
position: absolute;
|
|
229
|
+
z-index: 10;
|
|
230
|
+
bottom: 0;
|
|
231
|
+
left: 0;
|
|
232
|
+
width: 100%;
|
|
233
|
+
height: 24px;
|
|
234
|
+
opacity: 1;
|
|
235
|
+
cursor: pointer;
|
|
236
|
+
background-image: linear-gradient(-180deg,rgba(0,0,0,0) 0%,var(--va-c-bg-dark) 100%);
|
|
237
|
+
|
|
238
|
+
&::before {
|
|
239
|
+
display: block;
|
|
240
|
+
content: '';
|
|
241
|
+
width: 100%;
|
|
242
|
+
height: 100%;
|
|
243
|
+
background-image: var(--va-icon-collapse);
|
|
244
|
+
background-position: 50%;
|
|
245
|
+
background-size: 16px;
|
|
246
|
+
background-repeat: no-repeat;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
[class*='language-'].folded > button.collapse {
|
|
251
|
+
display: block;
|
|
252
|
+
}
|
|
223
253
|
}
|
|
@@ -22,25 +22,3 @@
|
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
// dark toggle
|
|
26
|
-
// transition
|
|
27
|
-
::view-transition-old(root),
|
|
28
|
-
::view-transition-new(root) {
|
|
29
|
-
animation: none;
|
|
30
|
-
mix-blend-mode: normal;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/* 进入dark模式和退出dark模式时,两个图像的位置顺序正好相反 */
|
|
34
|
-
.dark::view-transition-old(root) {
|
|
35
|
-
z-index: 9999;
|
|
36
|
-
}
|
|
37
|
-
.dark::view-transition-new(root) {
|
|
38
|
-
z-index: 1;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
::view-transition-old(root) {
|
|
42
|
-
z-index: 1;
|
|
43
|
-
}
|
|
44
|
-
::view-transition-new(root) {
|
|
45
|
-
z-index: 9999;
|
|
46
|
-
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/* dark */
|
|
2
|
+
::view-transition-old(root),
|
|
3
|
+
::view-transition-new(root) {
|
|
4
|
+
animation: none;
|
|
5
|
+
mix-blend-mode: normal;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/* 进入dark模式和退出dark模式时,两个图像的位置顺序正好相反 */
|
|
9
|
+
.dark::view-transition-old(root) {
|
|
10
|
+
z-index: 9999;
|
|
11
|
+
}
|
|
12
|
+
.dark::view-transition-new(root) {
|
|
13
|
+
z-index: 1;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
::view-transition-old(root) {
|
|
17
|
+
z-index: 1;
|
|
18
|
+
}
|
|
19
|
+
::view-transition-new(root) {
|
|
20
|
+
z-index: 9999;
|
|
21
|
+
}
|
|
@@ -114,6 +114,7 @@ $c-primary: #0078e7 !default;
|
|
|
114
114
|
:root {
|
|
115
115
|
--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");
|
|
116
116
|
--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");
|
|
117
|
+
--va-icon-collapse: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='32'%20height='32' stroke='rgba(128,128,128,1)' viewBox='0%200%2024%2024'%3E%3Cpath%20fill='currentColor'%20d='m12%2016.175l3.9-3.875q.275-.275.688-.288t.712.288q.275.275.275.7t-.275.7l-4.6%204.6q-.15.15-.325.213t-.375.062q-.2%200-.375-.063T11.3%2018.3l-4.6-4.6q-.275-.275-.288-.687T6.7%2012.3q.275-.275.7-.275t.7.275l3.9%203.875Zm0-6L15.9%206.3q.275-.275.688-.287t.712.287q.275.275.275.7t-.275.7l-4.6%204.6q-.15.15-.325.213t-.375.062q-.2%200-.375-.062T11.3%2012.3L6.7%207.7q-.275-.275-.288-.688T6.7%206.3q.275-.275.7-.275t.7.275l3.9%203.875Z'/%3E%3C/svg%3E")
|
|
117
118
|
}
|
|
118
119
|
|
|
119
120
|
/**
|