vuepress-plugin-md-power 1.0.0-rc.128 → 1.0.0-rc.130
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/CodeTabs.vue +2 -0
- package/lib/client/components/VPDemoBasic.vue +2 -5
- package/lib/client/components/VPDemoNormal.vue +28 -109
- package/lib/client/composables/demo.d.ts +48 -0
- package/lib/client/composables/demo.js +140 -0
- package/lib/client/styles/demo.css +7 -0
- package/lib/client/styles/steps.css +10 -16
- package/lib/node/index.js +6 -3
- package/package.json +15 -15
- package/lib/client/utils/shared.d.ts +0 -4
- package/lib/client/utils/shared.js +0 -36
|
@@ -134,6 +134,8 @@ function onTabNavClick(index: number): void {
|
|
|
134
134
|
border-radius: 6px 6px 0 0;
|
|
135
135
|
box-shadow: inset 0 -1px var(--vp-code-tab-divider);
|
|
136
136
|
transition: background-color var(--vp-t-color), box-shadow var(--vp-t-color);
|
|
137
|
+
|
|
138
|
+
scrollbar-width: thin;
|
|
137
139
|
}
|
|
138
140
|
|
|
139
141
|
@media print {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import { useExpand } from '../composables/demo.js'
|
|
3
3
|
|
|
4
4
|
import '../styles/demo.css'
|
|
5
5
|
|
|
@@ -10,10 +10,7 @@ const props = defineProps<{
|
|
|
10
10
|
expanded?: boolean
|
|
11
11
|
}>()
|
|
12
12
|
|
|
13
|
-
const showCode =
|
|
14
|
-
function toggleCode() {
|
|
15
|
-
showCode.value = !showCode.value
|
|
16
|
-
}
|
|
13
|
+
const [showCode, toggleCode] = useExpand(props.expanded)
|
|
17
14
|
</script>
|
|
18
15
|
|
|
19
16
|
<template>
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import Loading from './icons/Loading.vue'
|
|
2
|
+
import type { DemoConfig } from '../composables/demo.js'
|
|
3
|
+
import { useTemplateRef } from 'vue'
|
|
4
|
+
import { useExpand, useFence, useNormalDemo, useResources } from '../composables/demo.js'
|
|
6
5
|
|
|
7
6
|
import '../styles/demo.css'
|
|
8
7
|
|
|
@@ -10,121 +9,41 @@ const props = defineProps<{
|
|
|
10
9
|
title?: string
|
|
11
10
|
desc?: string
|
|
12
11
|
expanded?: boolean
|
|
13
|
-
config?:
|
|
14
|
-
html: string
|
|
15
|
-
css: string
|
|
16
|
-
script: string
|
|
17
|
-
jsLib: string[]
|
|
18
|
-
cssLib: string[]
|
|
19
|
-
}
|
|
12
|
+
config?: DemoConfig
|
|
20
13
|
}>()
|
|
21
14
|
|
|
22
|
-
const
|
|
23
|
-
const id = useId()
|
|
24
|
-
const loaded = ref(true)
|
|
15
|
+
const [showCode, toggleCode] = useExpand(props.expanded)
|
|
25
16
|
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}[]>(() => {
|
|
31
|
-
if (!props.config)
|
|
32
|
-
return []
|
|
33
|
-
return [
|
|
34
|
-
{ name: 'JavaScript', items: props.config.jsLib.map(url => ({ name: normalizeName(url), url })) },
|
|
35
|
-
{ name: 'CSS', items: props.config.cssLib.map(url => ({ name: normalizeName(url), url })) },
|
|
36
|
-
].filter(i => i.items.length)
|
|
37
|
-
})
|
|
17
|
+
const { resources, showResources, toggleResources } = useResources(
|
|
18
|
+
useTemplateRef<HTMLDivElement>('resourcesEl'),
|
|
19
|
+
() => props.config,
|
|
20
|
+
)
|
|
38
21
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
22
|
+
const { id, height } = useNormalDemo(
|
|
23
|
+
useTemplateRef<HTMLIFrameElement>('draw'),
|
|
24
|
+
() => props.title,
|
|
25
|
+
() => props.config,
|
|
26
|
+
)
|
|
42
27
|
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
onClickOutside(resourcesEl, () => {
|
|
50
|
-
showResources.value = false
|
|
51
|
-
})
|
|
52
|
-
|
|
53
|
-
onMounted(() => {
|
|
54
|
-
if (!draw.value)
|
|
55
|
-
return
|
|
56
|
-
const root = draw.value.attachShadow({ mode: 'open' })
|
|
57
|
-
|
|
58
|
-
watch(() => props.config, async () => {
|
|
59
|
-
root.innerHTML = props.config?.html ?? ''
|
|
60
|
-
|
|
61
|
-
props.config?.cssLib?.forEach(url => loadStyle(url, root))
|
|
62
|
-
if (props.config?.css) {
|
|
63
|
-
const style = document.createElement('style')
|
|
64
|
-
style.innerHTML = props.config?.css ?? ''
|
|
65
|
-
root.appendChild(style)
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
if (props.config?.jsLib?.length) {
|
|
69
|
-
loaded.value = false
|
|
70
|
-
await Promise.all(props.config.jsLib.map(url => loadScript(url)))
|
|
71
|
-
.catch(e => console.warn(e))
|
|
72
|
-
loaded.value = true
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
if (props.config?.script) {
|
|
76
|
-
const script = document.createElement('script')
|
|
77
|
-
script.type = 'text/javascript'
|
|
78
|
-
script.innerHTML = `;(function(document){\n${props.config.script}\n})(document.querySelector('#VPDemoNormalDraw${id}').shadowRoot);`
|
|
79
|
-
root.appendChild(script)
|
|
80
|
-
}
|
|
81
|
-
}, { immediate: true })
|
|
82
|
-
})
|
|
83
|
-
|
|
84
|
-
const fence = useTemplateRef<HTMLDivElement>('fence')
|
|
85
|
-
const data = ref<{
|
|
86
|
-
js: string
|
|
87
|
-
css: string
|
|
88
|
-
html: string
|
|
89
|
-
jsType: string
|
|
90
|
-
cssType: string
|
|
91
|
-
}>({ js: '', css: '', html: '', jsType: '', cssType: '' })
|
|
92
|
-
|
|
93
|
-
onMounted(() => {
|
|
94
|
-
if (!fence.value)
|
|
95
|
-
return
|
|
96
|
-
|
|
97
|
-
data.value.html = props.config?.html ?? ''
|
|
98
|
-
const els = Array.from(fence.value.querySelectorAll('div[class*="language-"]'))
|
|
99
|
-
for (const el of els) {
|
|
100
|
-
const lang = el.className.match(/language-(\w+)/)?.[1] ?? ''
|
|
101
|
-
const content = el.querySelector('pre')?.textContent ?? ''
|
|
102
|
-
if (lang === 'js' || lang === 'javascript') {
|
|
103
|
-
data.value.js = content
|
|
104
|
-
data.value.jsType = 'js'
|
|
105
|
-
}
|
|
106
|
-
if (lang === 'ts' || lang === 'typescript') {
|
|
107
|
-
data.value.js = content
|
|
108
|
-
data.value.jsType = 'ts'
|
|
109
|
-
}
|
|
110
|
-
if (lang === 'css' || lang === 'scss' || lang === 'less' || lang === 'stylus' || lang === 'styl') {
|
|
111
|
-
data.value.css = content
|
|
112
|
-
data.value.cssType = lang === 'styl' ? 'stylus' : lang
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
})
|
|
116
|
-
|
|
117
|
-
const showCode = ref(props.expanded ?? false)
|
|
118
|
-
function toggleCode() {
|
|
119
|
-
showCode.value = !showCode.value
|
|
120
|
-
}
|
|
28
|
+
const data = useFence(
|
|
29
|
+
useTemplateRef<HTMLDivElement>('fence'),
|
|
30
|
+
() => props.config,
|
|
31
|
+
)
|
|
121
32
|
</script>
|
|
122
33
|
|
|
123
34
|
<template>
|
|
124
35
|
<div class="vp-demo-wrapper normal">
|
|
125
36
|
<div class="demo-draw">
|
|
126
|
-
<
|
|
127
|
-
|
|
37
|
+
<iframe
|
|
38
|
+
:id="`VPDemoNormalDraw${id}`"
|
|
39
|
+
ref="draw"
|
|
40
|
+
class="draw-iframe"
|
|
41
|
+
allow="accelerometer *; bluetooth *; camera *; encrypted-media *; display-capture *; geolocation *; gyroscope *; microphone *; midi *; clipboard-read *; clipboard-write *; web-share *; serial *; xr-spatial-tracking *"
|
|
42
|
+
allowfullscreen="true"
|
|
43
|
+
allowpaymentrequest="true"
|
|
44
|
+
allowtransparency="true"
|
|
45
|
+
sandbox="allow-downloads allow-forms allow-modals allow-pointer-lock allow-popups-to-escape-sandbox allow-popups allow-presentation allow-same-origin allow-scripts allow-top-navigation-by-user-activation" :style="{ height }"
|
|
46
|
+
/>
|
|
128
47
|
</div>
|
|
129
48
|
<div v-if="title || desc" class="demo-info">
|
|
130
49
|
<p v-if="title" class="title">
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import * as vue from 'vue';
|
|
2
|
+
import { ShallowRef, MaybeRefOrGetter } from 'vue';
|
|
3
|
+
|
|
4
|
+
interface DemoConfig {
|
|
5
|
+
html: string;
|
|
6
|
+
css: string;
|
|
7
|
+
script: string;
|
|
8
|
+
jsLib: string[];
|
|
9
|
+
cssLib: string[];
|
|
10
|
+
}
|
|
11
|
+
declare function useExpand(defaultExpand?: boolean): readonly [vue.Ref<boolean, boolean>, () => void];
|
|
12
|
+
declare function useResources(el: ShallowRef<HTMLDivElement | null>, config: MaybeRefOrGetter<DemoConfig | undefined>): {
|
|
13
|
+
resources: vue.ComputedRef<{
|
|
14
|
+
name: string;
|
|
15
|
+
items: {
|
|
16
|
+
name: string;
|
|
17
|
+
url: string;
|
|
18
|
+
}[];
|
|
19
|
+
}[]>;
|
|
20
|
+
showResources: vue.Ref<boolean, boolean>;
|
|
21
|
+
toggleResources: () => void;
|
|
22
|
+
};
|
|
23
|
+
declare function useFence(fence: ShallowRef<HTMLDivElement | null>, config: MaybeRefOrGetter<DemoConfig | undefined>): vue.Ref<{
|
|
24
|
+
js: string;
|
|
25
|
+
css: string;
|
|
26
|
+
html: string;
|
|
27
|
+
jsType: string;
|
|
28
|
+
cssType: string;
|
|
29
|
+
}, {
|
|
30
|
+
js: string;
|
|
31
|
+
css: string;
|
|
32
|
+
html: string;
|
|
33
|
+
jsType: string;
|
|
34
|
+
cssType: string;
|
|
35
|
+
} | {
|
|
36
|
+
js: string;
|
|
37
|
+
css: string;
|
|
38
|
+
html: string;
|
|
39
|
+
jsType: string;
|
|
40
|
+
cssType: string;
|
|
41
|
+
}>;
|
|
42
|
+
declare function useNormalDemo(draw: ShallowRef<HTMLIFrameElement | null>, title: MaybeRefOrGetter<string | undefined>, config: MaybeRefOrGetter<DemoConfig | undefined>): {
|
|
43
|
+
id: string;
|
|
44
|
+
height: vue.Ref<string, string>;
|
|
45
|
+
};
|
|
46
|
+
declare function parseData(data: any): any;
|
|
47
|
+
|
|
48
|
+
export { type DemoConfig, parseData, useExpand, useFence, useNormalDemo, useResources };
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
// src/client/composables/demo.ts
|
|
2
|
+
import { onClickOutside, useEventListener } from "@vueuse/core";
|
|
3
|
+
import { computed, getCurrentInstance, onMounted, ref, toValue, useId, watch } from "vue";
|
|
4
|
+
import { isPlainObject } from "vuepress/shared";
|
|
5
|
+
function useExpand(defaultExpand = true) {
|
|
6
|
+
const expanded = ref(defaultExpand);
|
|
7
|
+
function toggle() {
|
|
8
|
+
expanded.value = !expanded.value;
|
|
9
|
+
}
|
|
10
|
+
return [expanded, toggle];
|
|
11
|
+
}
|
|
12
|
+
function useResources(el, config) {
|
|
13
|
+
const resources = computed(() => {
|
|
14
|
+
const conf = toValue(config);
|
|
15
|
+
if (!conf)
|
|
16
|
+
return [];
|
|
17
|
+
return [
|
|
18
|
+
{ name: "JavaScript", items: conf.jsLib.map((url) => ({ name: normalizeName(url), url })) },
|
|
19
|
+
{ name: "CSS", items: conf.cssLib.map((url) => ({ name: normalizeName(url), url })) }
|
|
20
|
+
].filter((i) => i.items.length);
|
|
21
|
+
});
|
|
22
|
+
function normalizeName(url) {
|
|
23
|
+
return url.slice(url.lastIndexOf("/") + 1);
|
|
24
|
+
}
|
|
25
|
+
const showResources = ref(false);
|
|
26
|
+
function toggleResources() {
|
|
27
|
+
showResources.value = !showResources.value;
|
|
28
|
+
}
|
|
29
|
+
onClickOutside(el, () => {
|
|
30
|
+
showResources.value = false;
|
|
31
|
+
});
|
|
32
|
+
return {
|
|
33
|
+
resources,
|
|
34
|
+
showResources,
|
|
35
|
+
toggleResources
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
function useFence(fence, config) {
|
|
39
|
+
const data = ref({ js: "", css: "", html: "", jsType: "", cssType: "" });
|
|
40
|
+
onMounted(() => {
|
|
41
|
+
if (!fence.value)
|
|
42
|
+
return;
|
|
43
|
+
const conf = toValue(config);
|
|
44
|
+
data.value.html = conf?.html ?? "";
|
|
45
|
+
const els = Array.from(fence.value.querySelectorAll('div[class*="language-"]'));
|
|
46
|
+
for (const el of els) {
|
|
47
|
+
const lang = el.className.match(/language-(\w+)/)?.[1] ?? "";
|
|
48
|
+
const content = el.querySelector("pre")?.textContent ?? "";
|
|
49
|
+
if (lang === "js" || lang === "javascript") {
|
|
50
|
+
data.value.js = content;
|
|
51
|
+
data.value.jsType = "js";
|
|
52
|
+
}
|
|
53
|
+
if (lang === "ts" || lang === "typescript") {
|
|
54
|
+
data.value.js = content;
|
|
55
|
+
data.value.jsType = "ts";
|
|
56
|
+
}
|
|
57
|
+
if (lang === "css" || lang === "scss" || lang === "less" || lang === "stylus" || lang === "styl") {
|
|
58
|
+
data.value.css = content;
|
|
59
|
+
data.value.cssType = lang === "styl" ? "stylus" : lang;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
return data;
|
|
64
|
+
}
|
|
65
|
+
function useNormalDemo(draw, title, config) {
|
|
66
|
+
const current = getCurrentInstance();
|
|
67
|
+
const id = useId();
|
|
68
|
+
const isDark = computed(() => current?.appContext.config.globalProperties.$isDark.value);
|
|
69
|
+
const height = ref("100px");
|
|
70
|
+
onMounted(() => {
|
|
71
|
+
if (!draw.value)
|
|
72
|
+
return;
|
|
73
|
+
const iframeDoc = draw.value.contentDocument || draw.value.contentWindow?.document;
|
|
74
|
+
if (!iframeDoc)
|
|
75
|
+
return;
|
|
76
|
+
const templateId = `VPDemoNormalDraw${id}`;
|
|
77
|
+
useEventListener("message", (event) => {
|
|
78
|
+
const data = parseData(event.data);
|
|
79
|
+
if (data.type === templateId) {
|
|
80
|
+
height.value = `${data.height + 5}px`;
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
watch([config, title], () => {
|
|
84
|
+
iframeDoc.write(createHTMLTemplate(toValue(title) || "Demo", templateId, toValue(config)));
|
|
85
|
+
}, { immediate: true });
|
|
86
|
+
watch(isDark, () => {
|
|
87
|
+
iframeDoc.documentElement.dataset.theme = isDark.value ? "dark" : "light";
|
|
88
|
+
}, { immediate: true });
|
|
89
|
+
});
|
|
90
|
+
return { id, height };
|
|
91
|
+
}
|
|
92
|
+
function createHTMLTemplate(title, id, config) {
|
|
93
|
+
const { cssLib = [], jsLib = [], html, css, script } = config || {};
|
|
94
|
+
const stylesheet = cssLib.map((url) => `<link rel="stylesheet" href="${url}">`).join("");
|
|
95
|
+
const scripts = jsLib.map((url) => `<script src="${url}"></script>`).join("");
|
|
96
|
+
return `<!DOCTYPE html>
|
|
97
|
+
<html>
|
|
98
|
+
<head>
|
|
99
|
+
<meta charset="utf-8">
|
|
100
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
101
|
+
<title>${title}</title>
|
|
102
|
+
${stylesheet}${scripts}
|
|
103
|
+
<style>${css}</style>
|
|
104
|
+
</head>
|
|
105
|
+
<body>
|
|
106
|
+
${html}
|
|
107
|
+
<script>;(function(){${script}})();</script>
|
|
108
|
+
<script>;(function(){
|
|
109
|
+
const height = Math.ceil(document.documentElement.getBoundingClientRect().height)
|
|
110
|
+
window.parent?.postMessage({ type: '${id}', height }, '*')
|
|
111
|
+
if (typeof window.ResizeObserver === 'undefined')
|
|
112
|
+
return
|
|
113
|
+
const resizeObserver = new ResizeObserver(entries => {
|
|
114
|
+
const height = Math.ceil(document.documentElement.getBoundingClientRect().height)
|
|
115
|
+
window.parent?.postMessage({ type: '${id}', height }, '*')
|
|
116
|
+
})
|
|
117
|
+
resizeObserver.observe(document.documentElement)
|
|
118
|
+
})();</script>
|
|
119
|
+
</body>
|
|
120
|
+
</html>`;
|
|
121
|
+
}
|
|
122
|
+
function parseData(data) {
|
|
123
|
+
try {
|
|
124
|
+
if (typeof data === "string") {
|
|
125
|
+
return JSON.parse(data);
|
|
126
|
+
} else if (isPlainObject(data)) {
|
|
127
|
+
return data;
|
|
128
|
+
}
|
|
129
|
+
return {};
|
|
130
|
+
} catch {
|
|
131
|
+
return {};
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
export {
|
|
135
|
+
parseData,
|
|
136
|
+
useExpand,
|
|
137
|
+
useFence,
|
|
138
|
+
useNormalDemo,
|
|
139
|
+
useResources
|
|
140
|
+
};
|
|
@@ -2,22 +2,20 @@
|
|
|
2
2
|
margin: 16px 0;
|
|
3
3
|
}
|
|
4
4
|
|
|
5
|
-
.vp-doc .vp-steps > ol,
|
|
6
|
-
.vp-doc .vp-steps > ul {
|
|
5
|
+
.vp-doc .vp-steps > :where(ol,ul) {
|
|
7
6
|
padding-inline-start: 0;
|
|
8
7
|
list-style: none;
|
|
9
8
|
}
|
|
10
9
|
|
|
11
|
-
.vp-doc .vp-steps > ol > li
|
|
12
|
-
.vp-doc .vp-steps > ul > li {
|
|
10
|
+
.vp-doc .vp-steps > :where(ol,ul) > li {
|
|
13
11
|
position: relative;
|
|
14
|
-
min-height:
|
|
12
|
+
min-height: 28px;
|
|
15
13
|
padding-bottom: 1px;
|
|
16
14
|
padding-left: 44px;
|
|
15
|
+
line-height: 28px;
|
|
17
16
|
}
|
|
18
17
|
|
|
19
|
-
.vp-doc .vp-steps > ol > li::before
|
|
20
|
-
.vp-doc .vp-steps > ul > li::before {
|
|
18
|
+
.vp-doc .vp-steps > :where(ol,ul) > li::before {
|
|
21
19
|
position: absolute;
|
|
22
20
|
inset-inline-start: 0;
|
|
23
21
|
top: 0;
|
|
@@ -36,8 +34,7 @@
|
|
|
36
34
|
transition-property: color, background-color, border-color;
|
|
37
35
|
}
|
|
38
36
|
|
|
39
|
-
.vp-doc .vp-steps > ol > li:not(:last-of-type)::after
|
|
40
|
-
.vp-doc .vp-steps > ul > li:not(:last-of-type)::after {
|
|
37
|
+
.vp-doc .vp-steps > :where(ol,ul) > li:not(:last-of-type)::after {
|
|
41
38
|
position: absolute;
|
|
42
39
|
inset-inline-start: 14px;
|
|
43
40
|
top: 34px;
|
|
@@ -48,22 +45,19 @@
|
|
|
48
45
|
transition: background-color var(--vp-t-color);
|
|
49
46
|
}
|
|
50
47
|
|
|
51
|
-
.vp-doc .vp-steps > ol > li > :first-child
|
|
52
|
-
.vp-doc .vp-steps > ul > li > :first-child {
|
|
48
|
+
.vp-doc .vp-steps > :where(ol,ul) > li > :first-child {
|
|
53
49
|
margin-top: 0;
|
|
54
50
|
}
|
|
55
51
|
|
|
56
|
-
.vp-doc .vp-steps > ol > li > :first-child:where(h1,h2,h3,h4,h5,h6)
|
|
57
|
-
.vp-doc .vp-steps > ul > li > :first-child:where(h1,h2,h3,h4,h5,h6) {
|
|
52
|
+
.vp-doc .vp-steps > :where(ol,ul) > li > :first-child:where(h1,h2,h3,h4,h5,h6) {
|
|
58
53
|
padding-top: 0;
|
|
59
54
|
border-top: none;
|
|
60
55
|
}
|
|
61
56
|
|
|
62
|
-
.vp-doc .vp-steps > ol > li > :first-child:where(p) {
|
|
57
|
+
.vp-doc .vp-steps > :where(ol,ul) > li > :first-child:where(p) {
|
|
63
58
|
line-height: 28px;
|
|
64
59
|
}
|
|
65
60
|
|
|
66
|
-
.vp-doc .vp-steps > ol > li + li
|
|
67
|
-
.vp-doc .vp-steps > ul > li + li {
|
|
61
|
+
.vp-doc .vp-steps > :where(ol,ul) > li + li {
|
|
68
62
|
margin-top: 1px;
|
|
69
63
|
}
|
package/lib/node/index.js
CHANGED
|
@@ -1977,6 +1977,7 @@ async function compileScript(source, type2) {
|
|
|
1977
1977
|
const transform = await compiler.script();
|
|
1978
1978
|
const res = await transform(source, {
|
|
1979
1979
|
target: "es2018",
|
|
1980
|
+
platform: "browser",
|
|
1980
1981
|
format: "cjs",
|
|
1981
1982
|
loader: type2 === "ts" ? "ts" : "js",
|
|
1982
1983
|
sourcemap: false
|
|
@@ -2100,9 +2101,11 @@ function demoWatcher(app, watchers) {
|
|
|
2100
2101
|
delete tasks[path9];
|
|
2101
2102
|
watcher.unwatch(path9);
|
|
2102
2103
|
});
|
|
2103
|
-
watchers.push(
|
|
2104
|
-
|
|
2105
|
-
|
|
2104
|
+
watchers.push({
|
|
2105
|
+
close: () => {
|
|
2106
|
+
watcher.close();
|
|
2107
|
+
watcher = null;
|
|
2108
|
+
}
|
|
2106
2109
|
});
|
|
2107
2110
|
}
|
|
2108
2111
|
function addTask(app, path9, output) {
|
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.130",
|
|
5
5
|
"description": "The Plugin for VuePress 2 - markdown power",
|
|
6
6
|
"author": "pengzhanbo <volodymyr@foxmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -61,31 +61,31 @@
|
|
|
61
61
|
}
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@mdit/plugin-attrs": "^0.
|
|
65
|
-
"@mdit/plugin-footnote": "^0.
|
|
66
|
-
"@mdit/plugin-mark": "^0.
|
|
67
|
-
"@mdit/plugin-sub": "^0.
|
|
68
|
-
"@mdit/plugin-sup": "^0.
|
|
69
|
-
"@mdit/plugin-tab": "^0.
|
|
70
|
-
"@mdit/plugin-tasklist": "^0.
|
|
71
|
-
"@vuepress/helper": "2.0.0-rc.
|
|
72
|
-
"@vueuse/core": "^12.
|
|
64
|
+
"@mdit/plugin-attrs": "^0.16.7",
|
|
65
|
+
"@mdit/plugin-footnote": "^0.16.0",
|
|
66
|
+
"@mdit/plugin-mark": "^0.16.0",
|
|
67
|
+
"@mdit/plugin-sub": "^0.16.0",
|
|
68
|
+
"@mdit/plugin-sup": "^0.16.0",
|
|
69
|
+
"@mdit/plugin-tab": "^0.16.0",
|
|
70
|
+
"@mdit/plugin-tasklist": "^0.16.0",
|
|
71
|
+
"@vuepress/helper": "2.0.0-rc.73",
|
|
72
|
+
"@vueuse/core": "^12.5.0",
|
|
73
73
|
"chokidar": "3.6.0",
|
|
74
74
|
"image-size": "^1.2.0",
|
|
75
75
|
"local-pkg": "^1.0.0",
|
|
76
76
|
"lru-cache": "^11.0.2",
|
|
77
77
|
"markdown-it-container": "^4.0.0",
|
|
78
78
|
"nanoid": "^5.0.9",
|
|
79
|
-
"shiki": "^
|
|
80
|
-
"tm-grammars": "^1.22.
|
|
81
|
-
"tm-themes": "^1.9.
|
|
79
|
+
"shiki": "^2.3.2",
|
|
80
|
+
"tm-grammars": "^1.22.13",
|
|
81
|
+
"tm-themes": "^1.9.12",
|
|
82
82
|
"vue": "^3.5.13"
|
|
83
83
|
},
|
|
84
84
|
"devDependencies": {
|
|
85
85
|
"@types/markdown-it": "^14.1.2",
|
|
86
|
-
"artplayer": "^5.2.
|
|
86
|
+
"artplayer": "^5.2.2",
|
|
87
87
|
"dashjs": "^4.7.4",
|
|
88
|
-
"hls.js": "^1.5.
|
|
88
|
+
"hls.js": "^1.5.20",
|
|
89
89
|
"mpegts.js": "1.7.3"
|
|
90
90
|
},
|
|
91
91
|
"publishConfig": {
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
// src/client/utils/shared.ts
|
|
2
|
-
var cache = {};
|
|
3
|
-
function loadScript(src) {
|
|
4
|
-
if (__VUEPRESS_SSR__)
|
|
5
|
-
return Promise.resolve();
|
|
6
|
-
if (document.querySelector(`script[src="${src}"]`)) {
|
|
7
|
-
if (cache[src])
|
|
8
|
-
return cache[src];
|
|
9
|
-
return Promise.resolve();
|
|
10
|
-
}
|
|
11
|
-
const script = document.createElement("script");
|
|
12
|
-
script.src = src;
|
|
13
|
-
document.body.appendChild(script);
|
|
14
|
-
cache[src] = new Promise((resolve, reject) => {
|
|
15
|
-
script.onload = () => {
|
|
16
|
-
resolve();
|
|
17
|
-
delete cache[src];
|
|
18
|
-
};
|
|
19
|
-
script.onerror = reject;
|
|
20
|
-
});
|
|
21
|
-
return cache[src];
|
|
22
|
-
}
|
|
23
|
-
function loadStyle(href, target) {
|
|
24
|
-
if (__VUEPRESS_SSR__)
|
|
25
|
-
return;
|
|
26
|
-
if (target.querySelector(`link[href="${href}"]`))
|
|
27
|
-
return;
|
|
28
|
-
const link = document.createElement("link");
|
|
29
|
-
link.rel = "stylesheet";
|
|
30
|
-
link.href = href;
|
|
31
|
-
target.appendChild(link);
|
|
32
|
-
}
|
|
33
|
-
export {
|
|
34
|
-
loadScript,
|
|
35
|
-
loadStyle
|
|
36
|
-
};
|