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.
@@ -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
- const el = shallowRef();
6
- const width = computed(() => toValue(options.width) || "100%");
7
- const height = ref("auto");
8
- const getHeight = (width2) => {
9
- const height2 = toValue(options.height);
10
- const ratio = getRadio(toValue(options.ratio));
11
- return height2 || `${Number(width2) / ratio + toValue(extraHeight)}px`;
12
- };
13
- const resize = () => {
14
- if (el.value)
15
- height.value = getHeight(el.value.offsetWidth);
16
- };
17
- onMounted(() => {
18
- resize();
19
- if (isRef(extraHeight))
20
- watch(extraHeight, resize);
21
- useEventListener("orientationchange", resize);
22
- useEventListener("resize", resize);
23
- });
24
- return { el, width, height, resize };
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
- if (typeof ratio === "string") {
28
- const [width, height] = ratio.split(":");
29
- const parsedRadio = Number(width) / Number(height);
30
- if (!Number.isNaN(parsedRadio))
31
- return parsedRadio;
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
- export {
36
- useSize
37
- };
38
+
39
+ //#endregion
40
+ export { useSize };
@@ -1 +1 @@
1
- export * from '../shared/index.js';
1
+ export * from "../shared/index.js";
@@ -1,2 +1 @@
1
- // src/client/index.ts
2
- export * from "../shared/index.js";
1
+ export * from "../shared/index.js"
@@ -1,13 +1,13 @@
1
- import { MarkdownPowerPluginOptions } from '../shared/index.js';
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
- dashjs: boolean;
6
- hlsjs: boolean;
7
- mpegtsjs: boolean;
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: unique symbol;
11
- declare const INJECT_COLLAPSE_KEY: unique symbol;
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 };
@@ -1,30 +1,21 @@
1
- // src/client/options.ts
2
- var pluginOptions = __MD_POWER_INJECT_OPTIONS__;
3
- var installed = {
4
- dashjs: __MD_POWER_DASHJS_INSTALLED__,
5
- hlsjs: __MD_POWER_HLSJS_INSTALLED__,
6
- mpegtsjs: __MD_POWER_MPEGTSJS_INSTALLED__
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
- get: <T extends object = object, R = any>(url: string, query?: T) => Promise<R>;
3
- post: <T extends object = object, R = any>(url: string, data?: T) => Promise<R>;
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
- export { http };
7
+ //#endregion
8
+ export { http };
@@ -1,25 +1,20 @@
1
- // src/client/utils/http.ts
2
- var http = {
3
- get: async (url, query) => {
4
- const _url = new URL(url);
5
- if (query) {
6
- for (const [key, value] of Object.entries(query))
7
- _url.searchParams.append(key, value);
8
- }
9
- const res = await fetch(_url.toString());
10
- return await res.json();
11
- },
12
- post: async (url, data) => {
13
- const res = await fetch(url, {
14
- method: "POST",
15
- headers: {
16
- "Content-Type": "application/json"
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 };
@@ -1,3 +1,5 @@
1
+ //#region src/client/utils/link.d.ts
1
2
  declare function normalizeLink(url: string): string;
2
3
 
3
- export { normalizeLink };
4
+ //#endregion
5
+ export { normalizeLink };
@@ -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
- return isLinkHttp(url) ? url : withBase(url);
6
+ return isLinkHttp(url) ? url : withBase(url);
6
7
  }
7
- export {
8
- normalizeLink
9
- };
8
+
9
+ //#endregion
10
+ export { normalizeLink };
@@ -1,3 +1,5 @@
1
+ //#region src/client/utils/sleep.d.ts
1
2
  declare function sleep(ms: number): Promise<void>;
2
3
 
3
- export { sleep };
4
+ //#endregion
5
+ export { sleep };
@@ -1,9 +1,9 @@
1
- // src/client/utils/sleep.ts
1
+ //#region src/client/utils/sleep.ts
2
2
  function sleep(ms) {
3
- return new Promise((resolve) => {
4
- setTimeout(resolve, ms);
5
- });
3
+ return new Promise((resolve) => {
4
+ setTimeout(resolve, ms);
5
+ });
6
6
  }
7
- export {
8
- sleep
9
- };
7
+
8
+ //#endregion
9
+ export { sleep };