vuepress-plugin-md-power 1.0.0-rc.174 → 1.0.0-rc.176
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/lib/client/components/Annotation.vue +2 -2
- package/lib/client/components/AudioReader.vue +10 -11
- package/lib/client/components/CanIUse.vue +5 -9
- package/lib/client/components/CodePen.vue +7 -7
- package/lib/client/components/FileTreeNode.vue +5 -5
- package/lib/client/components/JsFiddle.vue +3 -3
- package/lib/client/components/Replit.vue +5 -5
- package/lib/client/components/Tabs.vue +12 -12
- package/lib/client/components/VPCodeTree.vue +5 -5
- package/lib/client/components/VPCollapse.vue +3 -3
- package/lib/client/components/VPCollapseItem.vue +13 -13
- package/lib/client/components/VPDemoBasic.vue +3 -3
- package/lib/client/components/VPDemoNormal.vue +6 -6
- package/lib/client/components/VPTable.vue +12 -3
- package/lib/client/components/VPTimeline.vue +5 -5
- package/lib/client/components/VPTimelineItem.vue +10 -10
- package/lib/client/composables/codeRepl.js +1 -1
- package/lib/client/composables/{rustRepl-DU344AGc.js → rustRepl-B5uio_ep.js} +5 -0
- package/lib/client/composables/rustRepl.js +1 -1
- package/lib/node/index.d.ts +6 -0
- package/lib/node/index.js +2 -0
- package/lib/shared/index.d.ts +6 -0
- package/package.json +11 -11
|
@@ -4,13 +4,13 @@ import { computed, nextTick, ref, useTemplateRef, watch } from 'vue'
|
|
|
4
4
|
|
|
5
5
|
import '@vuepress/helper/transition/fade-in.css'
|
|
6
6
|
|
|
7
|
-
const
|
|
7
|
+
const { label, total } = defineProps<{
|
|
8
8
|
label: string
|
|
9
9
|
total: number
|
|
10
10
|
}>()
|
|
11
11
|
|
|
12
12
|
const active = ref(false)
|
|
13
|
-
const list = computed(() => Array.from({ length:
|
|
13
|
+
const list = computed(() => Array.from({ length: total }, (_, i) => i))
|
|
14
14
|
const position = ref({ x: 0, y: 0 })
|
|
15
15
|
|
|
16
16
|
const popover = useTemplateRef<HTMLDivElement>('popover')
|
|
@@ -3,7 +3,7 @@ import { useInterval } from '@vueuse/core'
|
|
|
3
3
|
import { onMounted, toRef, watch } from 'vue'
|
|
4
4
|
import { useAudioPlayer } from '../composables/audio.js'
|
|
5
5
|
|
|
6
|
-
const
|
|
6
|
+
const { src, autoplay, type, volume, startTime, endTime } = defineProps<{
|
|
7
7
|
src: string
|
|
8
8
|
autoplay?: boolean
|
|
9
9
|
type?: string
|
|
@@ -13,20 +13,19 @@ const props = defineProps<{
|
|
|
13
13
|
}>()
|
|
14
14
|
|
|
15
15
|
const { paused, play, pause, seek, setVolume } = useAudioPlayer(
|
|
16
|
-
toRef(() =>
|
|
16
|
+
toRef(() => src),
|
|
17
17
|
{
|
|
18
|
-
type: toRef(() =>
|
|
19
|
-
autoplay
|
|
18
|
+
type: toRef(() => type || ''),
|
|
19
|
+
autoplay,
|
|
20
20
|
oncanplay: () => {
|
|
21
|
-
if (
|
|
22
|
-
seek(
|
|
23
|
-
}
|
|
21
|
+
if (startTime)
|
|
22
|
+
seek(startTime)
|
|
24
23
|
},
|
|
25
24
|
ontimeupdate: (time) => {
|
|
26
|
-
if (
|
|
25
|
+
if (endTime && time >= endTime) {
|
|
27
26
|
pause()
|
|
28
|
-
if (
|
|
29
|
-
seek(
|
|
27
|
+
if (startTime) {
|
|
28
|
+
seek(startTime)
|
|
30
29
|
}
|
|
31
30
|
}
|
|
32
31
|
},
|
|
@@ -56,7 +55,7 @@ function toggle() {
|
|
|
56
55
|
}
|
|
57
56
|
|
|
58
57
|
onMounted(() => {
|
|
59
|
-
watch(() =>
|
|
58
|
+
watch(() => volume, (volume) => {
|
|
60
59
|
if (typeof volume !== 'undefined') {
|
|
61
60
|
setVolume(volume)
|
|
62
61
|
}
|
|
@@ -12,16 +12,12 @@ interface MessageData {
|
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
const
|
|
15
|
+
const { feature, past = 2, future = 1, meta = '' } = defineProps<{
|
|
16
16
|
feature: string
|
|
17
17
|
past?: number
|
|
18
18
|
future?: number
|
|
19
19
|
meta?: string
|
|
20
|
-
}>()
|
|
21
|
-
past: 2,
|
|
22
|
-
future: 1,
|
|
23
|
-
meta: '',
|
|
24
|
-
})
|
|
20
|
+
}>()
|
|
25
21
|
|
|
26
22
|
const url = 'https://caniuse.pengzhanbo.cn/'
|
|
27
23
|
|
|
@@ -29,7 +25,7 @@ const height = ref('330px')
|
|
|
29
25
|
|
|
30
26
|
const isDark = useDarkMode()
|
|
31
27
|
const source = computed(() => {
|
|
32
|
-
const source = `${url}${
|
|
28
|
+
const source = `${url}${feature}#past=${past}&future=${future}&meta=${meta}&theme=${isDark.value ? 'dark' : 'light'}`
|
|
33
29
|
|
|
34
30
|
return source
|
|
35
31
|
})
|
|
@@ -40,8 +36,8 @@ useEventListener('message', (event) => {
|
|
|
40
36
|
if (
|
|
41
37
|
type === 'ciu_embed'
|
|
42
38
|
&& payload
|
|
43
|
-
&& payload.feature ===
|
|
44
|
-
&& payload.meta ===
|
|
39
|
+
&& payload.feature === feature
|
|
40
|
+
&& payload.meta === meta
|
|
45
41
|
) {
|
|
46
42
|
height.value = `${Math.ceil(payload.height)}px`
|
|
47
43
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { useDarkMode } from '@vuepress/helper/client'
|
|
3
3
|
import { computed } from 'vue'
|
|
4
4
|
|
|
5
|
-
const
|
|
5
|
+
const { user, slash, title, preview, editable, tab, theme, width, height } = defineProps<{
|
|
6
6
|
user: string
|
|
7
7
|
slash: string
|
|
8
8
|
title?: string
|
|
@@ -19,16 +19,16 @@ const CODEPEN_LINK = 'https://codepen.io/'
|
|
|
19
19
|
const isDark = useDarkMode()
|
|
20
20
|
|
|
21
21
|
const link = computed(() => {
|
|
22
|
-
const middle =
|
|
22
|
+
const middle = preview ? '/embed/preview/' : '/embed/'
|
|
23
23
|
const params = new URLSearchParams()
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
editable && params.set('editable', 'true')
|
|
26
|
+
tab && params.set('default-tab', tab)
|
|
27
27
|
|
|
28
|
-
const
|
|
29
|
-
|
|
28
|
+
const themeMode = theme ?? (isDark.value ? 'dark' : 'light')
|
|
29
|
+
themeMode && params.set('theme-id', themeMode)
|
|
30
30
|
|
|
31
|
-
return `${CODEPEN_LINK}${
|
|
31
|
+
return `${CODEPEN_LINK}${user}${middle}${slash}?${params.toString()}`
|
|
32
32
|
})
|
|
33
33
|
</script>
|
|
34
34
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import type { Ref } from 'vue'
|
|
3
3
|
import { inject, ref } from 'vue'
|
|
4
4
|
|
|
5
|
-
const
|
|
5
|
+
const { type, filename, level, diff, expanded, focus, filepath } = defineProps<{
|
|
6
6
|
type: 'file' | 'folder'
|
|
7
7
|
filename: string
|
|
8
8
|
level: number
|
|
@@ -18,17 +18,17 @@ const onNodeClick = inject<
|
|
|
18
18
|
(filename: string, type: 'file' | 'folder') => void
|
|
19
19
|
>('on-file-tree-node-click', () => {})
|
|
20
20
|
|
|
21
|
-
const active = ref(
|
|
21
|
+
const active = ref(expanded)
|
|
22
22
|
|
|
23
23
|
function nodeClick() {
|
|
24
|
-
if (
|
|
24
|
+
if (filename === '…' || filename === '...')
|
|
25
25
|
return
|
|
26
26
|
|
|
27
|
-
onNodeClick(
|
|
27
|
+
onNodeClick(filepath || filename, type)
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
function toggle(ev: MouseEvent) {
|
|
31
|
-
if (
|
|
31
|
+
if (type === 'folder') {
|
|
32
32
|
const el = ev.target as HTMLElement
|
|
33
33
|
if (!el.matches('.comment, .comment *')) {
|
|
34
34
|
active.value = !active.value
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { useDarkMode } from '@vuepress/helper/client'
|
|
3
3
|
import { computed } from 'vue'
|
|
4
4
|
|
|
5
|
-
const
|
|
5
|
+
const { source, title, tab, theme, width, height } = defineProps<{
|
|
6
6
|
source: string
|
|
7
7
|
title?: string
|
|
8
8
|
tab: string
|
|
@@ -14,8 +14,8 @@ const props = defineProps<{
|
|
|
14
14
|
const isDark = useDarkMode()
|
|
15
15
|
|
|
16
16
|
const link = computed(() => {
|
|
17
|
-
const
|
|
18
|
-
return `https://jsfiddle.net/${
|
|
17
|
+
const themeMode = theme === 'dark' ? '/dark/' : isDark.value ? '/dark/' : ''
|
|
18
|
+
return `https://jsfiddle.net/${source}/embedded/${tab}${themeMode}`
|
|
19
19
|
})
|
|
20
20
|
</script>
|
|
21
21
|
|
|
@@ -8,7 +8,7 @@ defineOptions({
|
|
|
8
8
|
inheritAttrs: false,
|
|
9
9
|
})
|
|
10
10
|
|
|
11
|
-
const
|
|
11
|
+
const { source, theme, width, height: h, title } = defineProps<ReplitTokenMeta>()
|
|
12
12
|
|
|
13
13
|
// magic height
|
|
14
14
|
const height = ref('47px')
|
|
@@ -19,18 +19,18 @@ const REPLIT_LINK = 'https://replit.com/'
|
|
|
19
19
|
const isDark = useDarkMode()
|
|
20
20
|
|
|
21
21
|
const link = computed(() => {
|
|
22
|
-
const url = new URL(`/${
|
|
22
|
+
const url = new URL(`/${source}`, REPLIT_LINK)
|
|
23
23
|
url.searchParams.set('embed', 'true')
|
|
24
24
|
|
|
25
|
-
const
|
|
26
|
-
url.searchParams.set('theme',
|
|
25
|
+
const themeMode = theme || (isDark.value ? 'dark' : 'light')
|
|
26
|
+
url.searchParams.set('theme', themeMode)
|
|
27
27
|
|
|
28
28
|
return url.toString()
|
|
29
29
|
})
|
|
30
30
|
|
|
31
31
|
function onload() {
|
|
32
32
|
loaded.value = true
|
|
33
|
-
height.value =
|
|
33
|
+
height.value = h || '450px'
|
|
34
34
|
}
|
|
35
35
|
</script>
|
|
36
36
|
|
|
@@ -5,27 +5,27 @@ import { onMounted, ref, shallowRef, watch } from 'vue'
|
|
|
5
5
|
interface TabProps extends Record<string, unknown> {
|
|
6
6
|
id: string
|
|
7
7
|
}
|
|
8
|
-
const
|
|
8
|
+
const { id, tabId = '', active = 0, data } = defineProps<{
|
|
9
9
|
id: string
|
|
10
10
|
tabId?: string
|
|
11
11
|
active?: number
|
|
12
12
|
data: TabProps[]
|
|
13
|
-
}>()
|
|
13
|
+
}>()
|
|
14
14
|
|
|
15
15
|
const TAB_STORE_NAME = 'VUEPRESS_TAB_STORE'
|
|
16
16
|
|
|
17
17
|
const tabStore = useStorage<Record<string, string>>(TAB_STORE_NAME, {})
|
|
18
18
|
|
|
19
19
|
// Index of current active item
|
|
20
|
-
const activeIndex = ref(
|
|
20
|
+
const activeIndex = ref(active)
|
|
21
21
|
|
|
22
22
|
// Refs of the tab buttons
|
|
23
23
|
const tabRefs = shallowRef<HTMLUListElement[]>([])
|
|
24
24
|
|
|
25
25
|
// Update store
|
|
26
26
|
function updateStore(): void {
|
|
27
|
-
if (
|
|
28
|
-
tabStore.value[
|
|
27
|
+
if (tabId)
|
|
28
|
+
tabStore.value[tabId] = data[activeIndex.value]?.id
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
// Activate next tab
|
|
@@ -59,26 +59,26 @@ function keyboardHandler(event: KeyboardEvent, index: number): void {
|
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
function getInitialIndex(): number {
|
|
62
|
-
if (
|
|
63
|
-
const valueIndex =
|
|
64
|
-
({ id }) => tabStore.value[
|
|
62
|
+
if (tabId) {
|
|
63
|
+
const valueIndex = data.findIndex(
|
|
64
|
+
({ id }) => tabStore.value[tabId] === id,
|
|
65
65
|
)
|
|
66
66
|
|
|
67
67
|
if (valueIndex !== -1)
|
|
68
68
|
return valueIndex
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
return
|
|
71
|
+
return active
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
onMounted(() => {
|
|
75
75
|
activeIndex.value = getInitialIndex()
|
|
76
76
|
|
|
77
77
|
watch(
|
|
78
|
-
() => tabStore.value[
|
|
78
|
+
() => tabStore.value[tabId],
|
|
79
79
|
(newValue, oldValue) => {
|
|
80
|
-
if (
|
|
81
|
-
const index =
|
|
80
|
+
if (tabId && newValue !== oldValue) {
|
|
81
|
+
const index = data.findIndex(({ id }) => id === newValue)
|
|
82
82
|
|
|
83
83
|
if (index !== -1)
|
|
84
84
|
activeIndex.value = index
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { onMounted, provide, ref, useTemplateRef, watch } from 'vue'
|
|
3
3
|
|
|
4
|
-
const
|
|
4
|
+
const { title, height = '320px', entryFile } = defineProps<{
|
|
5
5
|
title?: string
|
|
6
6
|
height?: string
|
|
7
7
|
entryFile?: string
|
|
8
|
-
}>()
|
|
8
|
+
}>()
|
|
9
9
|
|
|
10
|
-
const activeNode = ref(
|
|
10
|
+
const activeNode = ref(entryFile || '')
|
|
11
11
|
const isEmpty = ref(true)
|
|
12
12
|
const codePanel = useTemplateRef<HTMLDivElement>('codePanel')
|
|
13
13
|
|
|
@@ -44,7 +44,7 @@ onMounted(() => {
|
|
|
44
44
|
|
|
45
45
|
<template>
|
|
46
46
|
<div class="vp-code-tree">
|
|
47
|
-
<div class="code-tree-panel" :style="{ 'max-height':
|
|
47
|
+
<div class="code-tree-panel" :style="{ 'max-height': height }">
|
|
48
48
|
<div v-if="title" class="code-tree-title" :title="title">
|
|
49
49
|
<span>{{ title }}</span>
|
|
50
50
|
</div>
|
|
@@ -52,7 +52,7 @@ onMounted(() => {
|
|
|
52
52
|
<slot name="file-tree" />
|
|
53
53
|
</div>
|
|
54
54
|
</div>
|
|
55
|
-
<div ref="codePanel" class="code-panel" :style="{ height
|
|
55
|
+
<div ref="codePanel" class="code-panel" :style="{ height }">
|
|
56
56
|
<slot />
|
|
57
57
|
<div v-if="isEmpty" class="code-tree-empty">
|
|
58
58
|
<span class="vpi-code-tree-empty" />
|
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
import { provide, ref } from 'vue'
|
|
3
3
|
import { INJECT_COLLAPSE_KEY } from '../options.js'
|
|
4
4
|
|
|
5
|
-
const
|
|
5
|
+
const { accordion, index } = defineProps<{
|
|
6
6
|
accordion?: boolean
|
|
7
7
|
index?: number
|
|
8
8
|
}>()
|
|
9
9
|
|
|
10
|
-
const currentIndex = ref<number | undefined>(
|
|
10
|
+
const currentIndex = ref<number | undefined>(index)
|
|
11
11
|
|
|
12
12
|
provide(INJECT_COLLAPSE_KEY, {
|
|
13
|
-
accordion:
|
|
13
|
+
accordion: accordion ?? false,
|
|
14
14
|
index: currentIndex,
|
|
15
15
|
})
|
|
16
16
|
</script>
|
|
@@ -6,7 +6,7 @@ import { INJECT_COLLAPSE_KEY } from '../options.js'
|
|
|
6
6
|
|
|
7
7
|
import '@vuepress/helper/transition/fade-in-height-expand.css'
|
|
8
8
|
|
|
9
|
-
const
|
|
9
|
+
const { expand, index } = defineProps<{
|
|
10
10
|
expand?: boolean
|
|
11
11
|
index: number
|
|
12
12
|
}>()
|
|
@@ -20,36 +20,36 @@ if (__VUEPRESS_DEV__ && !collapse) {
|
|
|
20
20
|
throw new Error('<VPCollapseItem /> must be used inside <VPCollapse />')
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
const
|
|
23
|
+
const expanded = ref(
|
|
24
24
|
collapse?.accordion && typeof collapse.index.value !== 'undefined'
|
|
25
|
-
?
|
|
26
|
-
:
|
|
25
|
+
? index === collapse.index.value
|
|
26
|
+
: expand,
|
|
27
27
|
)
|
|
28
28
|
|
|
29
29
|
if (collapse?.accordion) {
|
|
30
30
|
watch(collapse?.index, () => {
|
|
31
|
-
|
|
31
|
+
expanded.value = collapse?.index.value === index
|
|
32
32
|
})
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
function toggle() {
|
|
36
36
|
if (collapse?.accordion) {
|
|
37
|
-
if (collapse.index.value ===
|
|
38
|
-
|
|
37
|
+
if (collapse.index.value === index && expanded.value) {
|
|
38
|
+
expanded.value = false
|
|
39
39
|
}
|
|
40
40
|
else {
|
|
41
|
-
collapse!.index.value =
|
|
42
|
-
|
|
41
|
+
collapse!.index.value = index!
|
|
42
|
+
expanded.value = true
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
else {
|
|
46
|
-
|
|
46
|
+
expanded.value = !expanded.value
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
</script>
|
|
50
50
|
|
|
51
51
|
<template>
|
|
52
|
-
<div class="vp-collapse-item" :class="{
|
|
52
|
+
<div class="vp-collapse-item" :class="{ expanded }">
|
|
53
53
|
<div class="vp-collapse-header" @click="toggle">
|
|
54
54
|
<span class="vpi-chevron-right" />
|
|
55
55
|
<p class="vp-collapse-title">
|
|
@@ -57,7 +57,7 @@ function toggle() {
|
|
|
57
57
|
</p>
|
|
58
58
|
</div>
|
|
59
59
|
<FadeInExpandTransition>
|
|
60
|
-
<div v-show="
|
|
60
|
+
<div v-show="expanded" class="vp-collapse-content">
|
|
61
61
|
<div class="vp-collapse-content-inner">
|
|
62
62
|
<slot />
|
|
63
63
|
</div>
|
|
@@ -95,7 +95,7 @@ function toggle() {
|
|
|
95
95
|
transform: rotate(0deg);
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
-
.vp-collapse-item.
|
|
98
|
+
.vp-collapse-item.expanded .vpi-chevron-right {
|
|
99
99
|
transform: rotate(90deg);
|
|
100
100
|
}
|
|
101
101
|
|
|
@@ -8,14 +8,14 @@ import { useExpand } from '../composables/demo.js'
|
|
|
8
8
|
import '@vuepress/helper/transition/fade-in-height-expand.css'
|
|
9
9
|
import '../styles/demo.css'
|
|
10
10
|
|
|
11
|
-
const
|
|
11
|
+
const { type, title, desc, expanded } = defineProps<{
|
|
12
12
|
type?: 'vue' | 'markdown'
|
|
13
13
|
title?: string
|
|
14
14
|
desc?: string
|
|
15
15
|
expanded?: boolean
|
|
16
16
|
}>()
|
|
17
17
|
|
|
18
|
-
const [showCode, toggleCode] = useExpand(
|
|
18
|
+
const [showCode, toggleCode] = useExpand(expanded)
|
|
19
19
|
|
|
20
20
|
const draw = useTemplateRef<HTMLIFrameElement>('draw')
|
|
21
21
|
const vueDraw = useTemplateRef<HTMLIFrameElement>('draw-vue')
|
|
@@ -30,7 +30,7 @@ function resizeAndPositionVueDraw() {
|
|
|
30
30
|
vueDraw.value.style.left = `${rect.x + scrollLeft}px`
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
if (
|
|
33
|
+
if (type === 'vue' && !__VUEPRESS_SSR__) {
|
|
34
34
|
watch([draw, vueDraw], () => {
|
|
35
35
|
resizeAndPositionVueDraw()
|
|
36
36
|
if (draw.value && vueDraw.value) {
|
|
@@ -8,29 +8,29 @@ import '@vuepress/helper/transition/fade-in.css'
|
|
|
8
8
|
import '@vuepress/helper/transition/fade-in-height-expand.css'
|
|
9
9
|
import '../styles/demo.css'
|
|
10
10
|
|
|
11
|
-
const
|
|
11
|
+
const { title, desc, expanded, config } = defineProps<{
|
|
12
12
|
title?: string
|
|
13
13
|
desc?: string
|
|
14
14
|
expanded?: boolean
|
|
15
15
|
config?: DemoConfig
|
|
16
16
|
}>()
|
|
17
17
|
|
|
18
|
-
const [showCode, toggleCode] = useExpand(
|
|
18
|
+
const [showCode, toggleCode] = useExpand(expanded)
|
|
19
19
|
|
|
20
20
|
const { resources, showResources, toggleResources } = useResources(
|
|
21
21
|
useTemplateRef<HTMLDivElement>('resourcesEl'),
|
|
22
|
-
() =>
|
|
22
|
+
() => config,
|
|
23
23
|
)
|
|
24
24
|
|
|
25
25
|
const { id, height } = useNormalDemo(
|
|
26
26
|
useTemplateRef<HTMLIFrameElement>('draw'),
|
|
27
|
-
() =>
|
|
28
|
-
() =>
|
|
27
|
+
() => title,
|
|
28
|
+
() => config,
|
|
29
29
|
)
|
|
30
30
|
|
|
31
31
|
const data = useFence(
|
|
32
32
|
useTemplateRef<HTMLDivElement>('fence'),
|
|
33
|
-
() =>
|
|
33
|
+
() => config,
|
|
34
34
|
)
|
|
35
35
|
</script>
|
|
36
36
|
|
|
@@ -3,7 +3,7 @@ import { decodeData } from '@vuepress/helper/client'
|
|
|
3
3
|
import { useClipboard, useToggle } from '@vueuse/core'
|
|
4
4
|
import { computed, useTemplateRef } from 'vue'
|
|
5
5
|
|
|
6
|
-
const
|
|
6
|
+
const { title, align = 'left', copy, maxContent, fullWidth, markdown } = defineProps<{
|
|
7
7
|
/** 表格标题 */
|
|
8
8
|
title?: string
|
|
9
9
|
/** 对其方式 */
|
|
@@ -12,12 +12,14 @@ const props = defineProps<{
|
|
|
12
12
|
copy?: false | 'all' | 'html' | 'md'
|
|
13
13
|
/** 最大化内容 */
|
|
14
14
|
maxContent?: boolean
|
|
15
|
+
/** 填充整行宽度 */
|
|
16
|
+
fullWidth?: boolean
|
|
15
17
|
/** @internal */
|
|
16
18
|
markdown?: string
|
|
17
19
|
}>()
|
|
18
20
|
|
|
19
21
|
const tableEl = useTemplateRef('table')
|
|
20
|
-
const rawContent = computed(() =>
|
|
22
|
+
const rawContent = computed(() => markdown ? decodeData(markdown) : '')
|
|
21
23
|
|
|
22
24
|
const [isHTMLCopied, toggleHTMLCopy] = useToggle()
|
|
23
25
|
const [isMDCopied, toggleMDCopy] = useToggle()
|
|
@@ -33,7 +35,7 @@ function onCopy(type: 'html' | 'md') {
|
|
|
33
35
|
</script>
|
|
34
36
|
|
|
35
37
|
<template>
|
|
36
|
-
<div class="vp-table" :class="{ [align
|
|
38
|
+
<div class="vp-table" :class="{ [align]: true, full: fullWidth }">
|
|
37
39
|
<div class="table-container">
|
|
38
40
|
<div class="table-content">
|
|
39
41
|
<div v-if="copy" class="table-toolbar">
|
|
@@ -144,6 +146,13 @@ function onCopy(type: 'html' | 'md') {
|
|
|
144
146
|
width: max-content;
|
|
145
147
|
}
|
|
146
148
|
|
|
149
|
+
.vp-table.full,
|
|
150
|
+
.vp-table.full .table-container,
|
|
151
|
+
.vp-table.full .table-content,
|
|
152
|
+
.vp-table.full .table-content table {
|
|
153
|
+
min-width: 100%;
|
|
154
|
+
}
|
|
155
|
+
|
|
147
156
|
/* ----- Highlight --------- */
|
|
148
157
|
.vp-table table th.tip,
|
|
149
158
|
.vp-table table td.tip,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { computed, provide } from 'vue'
|
|
3
3
|
import { INJECT_TIMELINE_KEY } from '../options.js'
|
|
4
4
|
|
|
5
|
-
const
|
|
5
|
+
const { horizontal, card, placement, line } = defineProps<{
|
|
6
6
|
horizontal?: boolean
|
|
7
7
|
card?: boolean
|
|
8
8
|
placement?: 'left' | 'right' | 'between'
|
|
@@ -10,10 +10,10 @@ const props = defineProps<{
|
|
|
10
10
|
}>()
|
|
11
11
|
|
|
12
12
|
provide(INJECT_TIMELINE_KEY, computed(() => ({
|
|
13
|
-
line:
|
|
14
|
-
card:
|
|
15
|
-
horizontal:
|
|
16
|
-
placement:
|
|
13
|
+
line: line || 'solid',
|
|
14
|
+
card: card ?? false,
|
|
15
|
+
horizontal: horizontal ?? false,
|
|
16
|
+
placement: placement || 'left',
|
|
17
17
|
})))
|
|
18
18
|
</script>
|
|
19
19
|
|
|
@@ -4,7 +4,7 @@ import { useMediaQuery } from '@vueuse/core'
|
|
|
4
4
|
import { computed, inject } from 'vue'
|
|
5
5
|
import { INJECT_TIMELINE_KEY } from '../options.js'
|
|
6
6
|
|
|
7
|
-
const
|
|
7
|
+
const { time, type, card, line, icon, color, placement } = defineProps<{
|
|
8
8
|
time?: string
|
|
9
9
|
type?: 'info' | 'tip' | 'success' | 'warning' | 'danger' | 'caution' | 'important' | (string & {})
|
|
10
10
|
card?: boolean
|
|
@@ -25,17 +25,17 @@ const defaultOptions = inject<ComputedRef<{
|
|
|
25
25
|
|
|
26
26
|
const timeline = computed(() => {
|
|
27
27
|
const between = defaultOptions?.value.placement === 'between' && !is639.value
|
|
28
|
-
const
|
|
28
|
+
const defaultPlacement = defaultOptions?.value.placement === 'between' ? 'left' : defaultOptions?.value.placement
|
|
29
29
|
return {
|
|
30
|
-
time
|
|
31
|
-
type:
|
|
32
|
-
line:
|
|
33
|
-
icon
|
|
34
|
-
color
|
|
30
|
+
time,
|
|
31
|
+
type: type || 'info',
|
|
32
|
+
line: line || defaultOptions?.value.line || 'solid',
|
|
33
|
+
icon,
|
|
34
|
+
color,
|
|
35
35
|
horizontal: defaultOptions?.value.horizontal ?? false,
|
|
36
|
-
between: between ?
|
|
37
|
-
placement: between ? '' : (
|
|
38
|
-
card:
|
|
36
|
+
between: between ? placement || 'left' : false,
|
|
37
|
+
placement: between ? '' : (defaultPlacement || 'left'),
|
|
38
|
+
card: card ?? defaultOptions?.value.card ?? false,
|
|
39
39
|
}
|
|
40
40
|
})
|
|
41
41
|
</script>
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { tryOnScopeDispose } from "@vueuse/core";
|
|
2
2
|
|
|
3
3
|
//#region src/client/composables/rustRepl.ts
|
|
4
|
+
/**
|
|
5
|
+
* 相比于 golang 和 kotlin 可以比较简单的实现,
|
|
6
|
+
* rust 需要通过 websocket 建立连接在实现交互,因此,将其进行一些包装,
|
|
7
|
+
* 方便在 codeRepl 中使用
|
|
8
|
+
*/
|
|
4
9
|
const wsUrl = "wss://play.rust-lang.org/websocket";
|
|
5
10
|
const payloadType = {
|
|
6
11
|
connected: "websocket/connected",
|
package/lib/node/index.d.ts
CHANGED
package/lib/node/index.js
CHANGED
|
@@ -1939,6 +1939,7 @@ async function read(file) {
|
|
|
1939
1939
|
|
|
1940
1940
|
//#endregion
|
|
1941
1941
|
//#region src/node/utils/logger.ts
|
|
1942
|
+
/* istanbul ignore file -- @preserve */
|
|
1942
1943
|
/**
|
|
1943
1944
|
* Logger utils
|
|
1944
1945
|
*/
|
|
@@ -2441,6 +2442,7 @@ function tablePlugin(md, options = {}) {
|
|
|
2441
2442
|
const props = {
|
|
2442
2443
|
copy: true,
|
|
2443
2444
|
maxContent: false,
|
|
2445
|
+
fullWidth: false,
|
|
2444
2446
|
...options,
|
|
2445
2447
|
...meta
|
|
2446
2448
|
};
|
package/lib/shared/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vuepress-plugin-md-power",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.0-rc.
|
|
4
|
+
"version": "1.0.0-rc.176",
|
|
5
5
|
"description": "The Plugin for VuePress 2 - markdown power",
|
|
6
6
|
"author": "pengzhanbo <volodymyr@foxmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -33,14 +33,14 @@
|
|
|
33
33
|
"peerDependencies": {
|
|
34
34
|
"artplayer": "^5.3.0",
|
|
35
35
|
"dashjs": "^5.0.3",
|
|
36
|
-
"esbuild": "^0.
|
|
37
|
-
"hls.js": "^1.6.
|
|
36
|
+
"esbuild": "^0.26.0",
|
|
37
|
+
"hls.js": "^1.6.14",
|
|
38
38
|
"less": "^4.4.2",
|
|
39
39
|
"markdown-it": "^14.1.0",
|
|
40
40
|
"mpegts.js": "^1.7.3",
|
|
41
41
|
"pyodide": "^0.29.0",
|
|
42
|
-
"sass": "^1.93.
|
|
43
|
-
"sass-embedded": "^1.93.
|
|
42
|
+
"sass": "^1.93.3",
|
|
43
|
+
"sass-embedded": "^1.93.3",
|
|
44
44
|
"stylus": "^0.64.0",
|
|
45
45
|
"vuepress": "2.0.0-rc.26"
|
|
46
46
|
},
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
}
|
|
78
78
|
},
|
|
79
79
|
"dependencies": {
|
|
80
|
-
"@mdit/plugin-attrs": "^0.23.
|
|
80
|
+
"@mdit/plugin-attrs": "^0.23.3",
|
|
81
81
|
"@mdit/plugin-footnote": "^0.22.3",
|
|
82
82
|
"@mdit/plugin-mark": "^0.22.1",
|
|
83
83
|
"@mdit/plugin-sub": "^0.22.2",
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
"@mdit/plugin-tab": "^0.22.3",
|
|
86
86
|
"@mdit/plugin-tasklist": "^0.22.2",
|
|
87
87
|
"@pengzhanbo/utils": "^2.1.0",
|
|
88
|
-
"@vuepress/helper": "2.0.0-rc.
|
|
88
|
+
"@vuepress/helper": "2.0.0-rc.118",
|
|
89
89
|
"@vueuse/core": "^14.0.0",
|
|
90
90
|
"chokidar": "4.0.3",
|
|
91
91
|
"image-size": "^2.0.2",
|
|
@@ -93,16 +93,16 @@
|
|
|
93
93
|
"lru-cache": "^11.2.2",
|
|
94
94
|
"markdown-it-container": "^4.0.0",
|
|
95
95
|
"nanoid": "^5.1.6",
|
|
96
|
-
"shiki": "^3.
|
|
97
|
-
"tm-grammars": "^1.25.
|
|
96
|
+
"shiki": "^3.15.0",
|
|
97
|
+
"tm-grammars": "^1.25.3",
|
|
98
98
|
"tm-themes": "^1.10.12",
|
|
99
|
-
"vue": "^3.5.
|
|
99
|
+
"vue": "^3.5.24"
|
|
100
100
|
},
|
|
101
101
|
"devDependencies": {
|
|
102
102
|
"@types/markdown-it": "^14.1.2",
|
|
103
103
|
"artplayer": "^5.3.0",
|
|
104
104
|
"dashjs": "^5.0.3",
|
|
105
|
-
"hls.js": "^1.6.
|
|
105
|
+
"hls.js": "^1.6.14",
|
|
106
106
|
"mpegts.js": "1.7.3"
|
|
107
107
|
},
|
|
108
108
|
"publishConfig": {
|