vuepress-plugin-md-power 1.0.0-rc.145 → 1.0.0-rc.147
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/FileTreeNode.vue +3 -2
- package/lib/client/components/VPCodeTree.vue +175 -0
- package/lib/client/composables/audio.d.ts +35 -35
- package/lib/client/composables/audio.js +169 -181
- package/lib/client/composables/codeRepl.d.ts +20 -17
- package/lib/client/composables/codeRepl.js +146 -252
- package/lib/client/composables/demo.d.ts +34 -41
- package/lib/client/composables/demo.js +108 -102
- package/lib/client/composables/pdf.d.ts +4 -15
- package/lib/client/composables/pdf.js +46 -51
- package/lib/client/composables/rustRepl-iGLjb94D.js +101 -0
- package/lib/client/composables/rustRepl.d.ts +15 -7
- package/lib/client/composables/rustRepl.js +3 -104
- package/lib/client/composables/size.d.ts +11 -21
- package/lib/client/composables/size.js +35 -32
- package/lib/client/index.d.ts +1 -1
- package/lib/client/index.js +1 -2
- package/lib/client/options.d.ts +8 -8
- package/lib/client/options.js +20 -29
- package/lib/client/utils/http.d.ts +5 -3
- package/lib/client/utils/http.js +19 -24
- package/lib/client/utils/link.d.ts +3 -1
- package/lib/client/utils/link.js +6 -5
- package/lib/client/utils/sleep.d.ts +3 -1
- package/lib/client/utils/sleep.js +7 -7
- package/lib/node/index.d.ts +408 -352
- package/lib/node/index.js +3790 -3618
- package/lib/shared/index.d.ts +398 -349
- package/package.json +20 -19
|
@@ -1,37 +1,40 @@
|
|
|
1
|
-
// src/client/composables/size.ts
|
|
2
|
-
import { useEventListener } from "@vueuse/core";
|
|
3
1
|
import { computed, isRef, onMounted, ref, shallowRef, toValue, watch } from "vue";
|
|
2
|
+
import { useEventListener } from "@vueuse/core";
|
|
3
|
+
|
|
4
|
+
//#region src/client/composables/size.ts
|
|
4
5
|
function useSize(options, extraHeight = 0) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
6
|
+
const el = shallowRef();
|
|
7
|
+
const width = computed(() => toValue(options.width) || "100%");
|
|
8
|
+
const height = ref("auto");
|
|
9
|
+
const getHeight = (width$1) => {
|
|
10
|
+
const height$1 = toValue(options.height);
|
|
11
|
+
const ratio = getRadio(toValue(options.ratio));
|
|
12
|
+
return height$1 || `${Number(width$1) / ratio + toValue(extraHeight)}px`;
|
|
13
|
+
};
|
|
14
|
+
const resize = () => {
|
|
15
|
+
if (el.value) height.value = getHeight(el.value.offsetWidth);
|
|
16
|
+
};
|
|
17
|
+
onMounted(() => {
|
|
18
|
+
resize();
|
|
19
|
+
if (isRef(extraHeight)) watch(extraHeight, resize);
|
|
20
|
+
useEventListener("orientationchange", resize);
|
|
21
|
+
useEventListener("resize", resize);
|
|
22
|
+
});
|
|
23
|
+
return {
|
|
24
|
+
el,
|
|
25
|
+
width,
|
|
26
|
+
height,
|
|
27
|
+
resize
|
|
28
|
+
};
|
|
25
29
|
}
|
|
26
30
|
function getRadio(ratio) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
return typeof ratio === "number" ? ratio : 16 / 9;
|
|
31
|
+
if (typeof ratio === "string") {
|
|
32
|
+
const [width, height] = ratio.split(":");
|
|
33
|
+
const parsedRadio = Number(width) / Number(height);
|
|
34
|
+
if (!Number.isNaN(parsedRadio)) return parsedRadio;
|
|
35
|
+
}
|
|
36
|
+
return typeof ratio === "number" ? ratio : 16 / 9;
|
|
34
37
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
};
|
|
38
|
+
|
|
39
|
+
//#endregion
|
|
40
|
+
export { useSize };
|
package/lib/client/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from
|
|
1
|
+
export * from "../shared/index.js";
|
package/lib/client/index.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export * from "../shared/index.js";
|
|
1
|
+
export * from "../shared/index.js"
|
package/lib/client/options.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { MarkdownPowerPluginOptions } from
|
|
1
|
+
import { MarkdownPowerPluginOptions } from "../shared/index.js";
|
|
2
2
|
|
|
3
|
+
//#region src/client/options.d.ts
|
|
3
4
|
declare const pluginOptions: MarkdownPowerPluginOptions;
|
|
4
5
|
declare const installed: {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
dashjs: boolean;
|
|
7
|
+
hlsjs: boolean;
|
|
8
|
+
mpegtsjs: boolean;
|
|
8
9
|
};
|
|
9
10
|
declare const ART_PLAYER_SUPPORTED_VIDEO_TYPES: string[];
|
|
10
|
-
declare const INJECT_TIMELINE_KEY:
|
|
11
|
-
declare const INJECT_COLLAPSE_KEY:
|
|
12
|
-
|
|
13
|
-
export { ART_PLAYER_SUPPORTED_VIDEO_TYPES, INJECT_COLLAPSE_KEY, INJECT_TIMELINE_KEY, installed, pluginOptions };
|
|
11
|
+
declare const INJECT_TIMELINE_KEY: symbol;
|
|
12
|
+
declare const INJECT_COLLAPSE_KEY: symbol; //#endregion
|
|
13
|
+
export { ART_PLAYER_SUPPORTED_VIDEO_TYPES, INJECT_COLLAPSE_KEY, INJECT_TIMELINE_KEY, installed, pluginOptions };
|
package/lib/client/options.js
CHANGED
|
@@ -1,30 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
};
|
|
8
|
-
var ART_PLAYER_SUPPORTED_VIDEO_TYPES = ["mp4", "mp3", "webm", "ogg"];
|
|
9
|
-
if (installed.dashjs) {
|
|
10
|
-
ART_PLAYER_SUPPORTED_VIDEO_TYPES.push("mpd", "dash");
|
|
11
|
-
}
|
|
12
|
-
if (installed.hlsjs) {
|
|
13
|
-
ART_PLAYER_SUPPORTED_VIDEO_TYPES.push("m3u8", "hls");
|
|
14
|
-
}
|
|
15
|
-
if (installed.mpegtsjs) {
|
|
16
|
-
ART_PLAYER_SUPPORTED_VIDEO_TYPES.push("ts", "flv");
|
|
17
|
-
}
|
|
18
|
-
var INJECT_TIMELINE_KEY = Symbol(
|
|
19
|
-
__VUEPRESS_DEV__ ? "timeline" : ""
|
|
20
|
-
);
|
|
21
|
-
var INJECT_COLLAPSE_KEY = Symbol(
|
|
22
|
-
__VUEPRESS_DEV__ ? "collapse" : ""
|
|
23
|
-
);
|
|
24
|
-
export {
|
|
25
|
-
ART_PLAYER_SUPPORTED_VIDEO_TYPES,
|
|
26
|
-
INJECT_COLLAPSE_KEY,
|
|
27
|
-
INJECT_TIMELINE_KEY,
|
|
28
|
-
installed,
|
|
29
|
-
pluginOptions
|
|
1
|
+
//#region src/client/options.ts
|
|
2
|
+
const pluginOptions = __MD_POWER_INJECT_OPTIONS__;
|
|
3
|
+
const installed = {
|
|
4
|
+
dashjs: __MD_POWER_DASHJS_INSTALLED__,
|
|
5
|
+
hlsjs: __MD_POWER_HLSJS_INSTALLED__,
|
|
6
|
+
mpegtsjs: __MD_POWER_MPEGTSJS_INSTALLED__
|
|
30
7
|
};
|
|
8
|
+
const ART_PLAYER_SUPPORTED_VIDEO_TYPES = [
|
|
9
|
+
"mp4",
|
|
10
|
+
"mp3",
|
|
11
|
+
"webm",
|
|
12
|
+
"ogg"
|
|
13
|
+
];
|
|
14
|
+
if (installed.dashjs) ART_PLAYER_SUPPORTED_VIDEO_TYPES.push("mpd", "dash");
|
|
15
|
+
if (installed.hlsjs) ART_PLAYER_SUPPORTED_VIDEO_TYPES.push("m3u8", "hls");
|
|
16
|
+
if (installed.mpegtsjs) ART_PLAYER_SUPPORTED_VIDEO_TYPES.push("ts", "flv");
|
|
17
|
+
const INJECT_TIMELINE_KEY = Symbol(__VUEPRESS_DEV__ ? "timeline" : "");
|
|
18
|
+
const INJECT_COLLAPSE_KEY = Symbol(__VUEPRESS_DEV__ ? "collapse" : "");
|
|
19
|
+
|
|
20
|
+
//#endregion
|
|
21
|
+
export { ART_PLAYER_SUPPORTED_VIDEO_TYPES, INJECT_COLLAPSE_KEY, INJECT_TIMELINE_KEY, installed, pluginOptions };
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
//#region src/client/utils/http.d.ts
|
|
1
2
|
declare const http: {
|
|
2
|
-
|
|
3
|
-
|
|
3
|
+
get: <T extends object = object, R = any>(url: string, query?: T) => Promise<R>;
|
|
4
|
+
post: <T extends object = object, R = any>(url: string, data?: T) => Promise<R>;
|
|
4
5
|
};
|
|
5
6
|
|
|
6
|
-
|
|
7
|
+
//#endregion
|
|
8
|
+
export { http };
|
package/lib/client/utils/http.js
CHANGED
|
@@ -1,25 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
},
|
|
18
|
-
body: data ? JSON.stringify(data) : void 0
|
|
19
|
-
});
|
|
20
|
-
return await res.json();
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
export {
|
|
24
|
-
http
|
|
1
|
+
//#region src/client/utils/http.ts
|
|
2
|
+
const http = {
|
|
3
|
+
get: async (url, query) => {
|
|
4
|
+
const _url = new URL(url);
|
|
5
|
+
if (query) for (const [key, value] of Object.entries(query)) _url.searchParams.append(key, value);
|
|
6
|
+
const res = await fetch(_url.toString());
|
|
7
|
+
return await res.json();
|
|
8
|
+
},
|
|
9
|
+
post: async (url, data) => {
|
|
10
|
+
const res = await fetch(url, {
|
|
11
|
+
method: "POST",
|
|
12
|
+
headers: { "Content-Type": "application/json" },
|
|
13
|
+
body: data ? JSON.stringify(data) : void 0
|
|
14
|
+
});
|
|
15
|
+
return await res.json();
|
|
16
|
+
}
|
|
25
17
|
};
|
|
18
|
+
|
|
19
|
+
//#endregion
|
|
20
|
+
export { http };
|
package/lib/client/utils/link.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
// src/client/utils/link.ts
|
|
2
1
|
import { withBase } from "vuepress/client";
|
|
3
2
|
import { isLinkHttp } from "vuepress/shared";
|
|
3
|
+
|
|
4
|
+
//#region src/client/utils/link.ts
|
|
4
5
|
function normalizeLink(url) {
|
|
5
|
-
|
|
6
|
+
return isLinkHttp(url) ? url : withBase(url);
|
|
6
7
|
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
};
|
|
8
|
+
|
|
9
|
+
//#endregion
|
|
10
|
+
export { normalizeLink };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
//#region src/client/utils/sleep.ts
|
|
2
2
|
function sleep(ms) {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
return new Promise((resolve) => {
|
|
4
|
+
setTimeout(resolve, ms);
|
|
5
|
+
});
|
|
6
6
|
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
};
|
|
7
|
+
|
|
8
|
+
//#endregion
|
|
9
|
+
export { sleep };
|