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,99 +1,112 @@
1
- // src/client/composables/demo.ts
2
- import { onClickOutside, useEventListener } from "@vueuse/core";
3
1
  import { computed, getCurrentInstance, onMounted, ref, toValue, useId, watch } from "vue";
2
+ import { onClickOutside, useEventListener } from "@vueuse/core";
4
3
  import { isPlainObject } from "vuepress/shared";
4
+
5
+ //#region src/client/composables/demo.ts
5
6
  function useExpand(defaultExpand = true) {
6
- const expanded = ref(defaultExpand);
7
- function toggle() {
8
- expanded.value = !expanded.value;
9
- }
10
- return [expanded, toggle];
7
+ const expanded = ref(defaultExpand);
8
+ function toggle() {
9
+ expanded.value = !expanded.value;
10
+ }
11
+ return [expanded, toggle];
11
12
  }
12
13
  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
- };
14
+ const resources = computed(() => {
15
+ const conf = toValue(config);
16
+ if (!conf) return [];
17
+ return [{
18
+ name: "JavaScript",
19
+ items: conf.jsLib?.map((url) => ({
20
+ name: normalizeName(url),
21
+ url
22
+ }))
23
+ }, {
24
+ name: "CSS",
25
+ items: conf.cssLib?.map((url) => ({
26
+ name: normalizeName(url),
27
+ url
28
+ }))
29
+ }].filter((i) => i.items?.length);
30
+ });
31
+ function normalizeName(url) {
32
+ return url.slice(url.lastIndexOf("/") + 1);
33
+ }
34
+ const showResources = ref(false);
35
+ function toggleResources() {
36
+ showResources.value = !showResources.value;
37
+ }
38
+ onClickOutside(el, () => {
39
+ showResources.value = false;
40
+ });
41
+ return {
42
+ resources,
43
+ showResources,
44
+ toggleResources
45
+ };
37
46
  }
38
47
  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;
48
+ const data = ref({
49
+ js: "",
50
+ css: "",
51
+ html: "",
52
+ jsType: "",
53
+ cssType: ""
54
+ });
55
+ onMounted(() => {
56
+ if (!fence.value) return;
57
+ const conf = toValue(config);
58
+ data.value.html = conf?.html ?? "";
59
+ const els = Array.from(fence.value.querySelectorAll("div[class*=\"language-\"]"));
60
+ for (const el of els) {
61
+ const lang = el.className.match(/language-(\w+)/)?.[1] ?? "";
62
+ const content = el.querySelector("pre")?.textContent ?? "";
63
+ if (lang === "js" || lang === "javascript") {
64
+ data.value.js = content;
65
+ data.value.jsType = "js";
66
+ }
67
+ if (lang === "ts" || lang === "typescript") {
68
+ data.value.js = content;
69
+ data.value.jsType = "ts";
70
+ }
71
+ if (lang === "css" || lang === "scss" || lang === "less" || lang === "stylus" || lang === "styl") {
72
+ data.value.css = content;
73
+ data.value.cssType = lang === "styl" ? "stylus" : lang;
74
+ }
75
+ }
76
+ });
77
+ return data;
64
78
  }
65
79
  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 };
80
+ const current = getCurrentInstance();
81
+ const id = useId();
82
+ const isDark = computed(() => current?.appContext.config.globalProperties.$isDark.value);
83
+ const height = ref("100px");
84
+ onMounted(() => {
85
+ if (!draw.value) return;
86
+ const iframeDoc = draw.value.contentDocument || draw.value.contentWindow?.document;
87
+ if (!iframeDoc) return;
88
+ const templateId = `VPDemoNormalDraw${id}`;
89
+ useEventListener("message", (event) => {
90
+ const data = parseData(event.data);
91
+ if (data.type === templateId) height.value = `${data.height + 5}px`;
92
+ });
93
+ watch([config, title], () => {
94
+ iframeDoc.write(createHTMLTemplate(toValue(title) || "Demo", templateId, toValue(config)));
95
+ }, { immediate: true });
96
+ watch(isDark, () => {
97
+ iframeDoc.documentElement.dataset.theme = isDark.value ? "dark" : "light";
98
+ }, { immediate: true });
99
+ });
100
+ return {
101
+ id,
102
+ height
103
+ };
91
104
  }
92
105
  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>
106
+ const { cssLib = [], jsLib = [], html, css, script } = config || {};
107
+ const stylesheet = cssLib.map((url) => `<link rel="stylesheet" href="${url}">`).join("");
108
+ const scripts = jsLib.map((url) => `<script src="${url}"></script>`).join("");
109
+ return `<!DOCTYPE html>
97
110
  <html>
98
111
  <head>
99
112
  <meta charset="utf-8">
@@ -120,21 +133,14 @@ function createHTMLTemplate(title, id, config) {
120
133
  </html>`;
121
134
  }
122
135
  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
- }
136
+ try {
137
+ if (typeof data === "string") return JSON.parse(data);
138
+ else if (isPlainObject(data)) return data;
139
+ return {};
140
+ } catch {
141
+ return {};
142
+ }
133
143
  }
134
- export {
135
- parseData,
136
- useExpand,
137
- useFence,
138
- useNormalDemo,
139
- useResources
140
- };
144
+
145
+ //#endregion
146
+ export { parseData, useExpand, useFence, useNormalDemo, useResources };
@@ -1,19 +1,8 @@
1
- import { PDFEmbedType, PDFTokenMeta } from '../../shared/index.js';
1
+ import { PDFEmbedType, PDFTokenMeta } from "../../shared/index.js";
2
2
 
3
- /**
4
- * Fork for https://github.com/vuepress-theme-hope/vuepress-theme-hope/blob/main/packages/components/src/client/utils/viewPDF.ts
5
- *
6
- * The MIT License (MIT)
7
- * Copyright (C) 2021 - PRESENT by Mr.Hope<mister-hope@outlook.com>
8
- *
9
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
10
- *
11
- * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
12
- *
13
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14
- */
3
+ //#region src/client/composables/pdf.d.ts
15
4
 
16
5
  declare function renderPDF(el: HTMLElement, url: string, embedType: PDFEmbedType, options: PDFTokenMeta): void;
17
6
  declare function usePDF(el: HTMLElement, url: string, options: PDFTokenMeta): void;
18
-
19
- export { renderPDF, usePDF };
7
+ //#endregion
8
+ export { renderPDF, usePDF };
@@ -1,59 +1,54 @@
1
- // src/client/composables/pdf.ts
2
- import { checkIsiPad, checkIsMobile, checkIsSafari } from "@vuepress/helper/client";
3
- import { withBase } from "vuepress/client";
4
1
  import { ensureEndingSlash, isLinkHttp } from "vuepress/shared";
2
+ import { checkIsMobile, checkIsSafari, checkIsiPad } from "@vuepress/helper/client";
3
+ import { withBase } from "vuepress/client";
5
4
  import { pluginOptions } from "../options.js";
5
+
6
+ //#region src/client/composables/pdf.ts
6
7
  function queryStringify(options) {
7
- const { page, noToolbar, zoom } = options;
8
- const params = [
9
- `page=${page}`,
10
- `toolbar=${noToolbar ? 0 : 1}`,
11
- `zoom=${zoom}`
12
- ];
13
- let queryString = params.join("&");
14
- if (queryString)
15
- queryString = `#${queryString}`;
16
- return queryString;
8
+ const { page, noToolbar, zoom } = options;
9
+ const params = [
10
+ `page=${page}`,
11
+ `toolbar=${noToolbar ? 0 : 1}`,
12
+ `zoom=${zoom}`
13
+ ];
14
+ let queryString = params.join("&");
15
+ if (queryString) queryString = `#${queryString}`;
16
+ return queryString;
17
17
  }
18
18
  function renderPDF(el, url, embedType, options) {
19
- if (!pluginOptions.pdf)
20
- return;
21
- url = isLinkHttp(url) ? url : new URL(withBase(url), typeof location !== "undefined" ? location.href : "").toString();
22
- const pdfOptions = pluginOptions.pdf === true ? {} : pluginOptions.pdf;
23
- pdfOptions.pdfjsUrl ??= "https://static.pengzhanbo.cn/pdfjs/";
24
- const pdfjsUrl = `${ensureEndingSlash(withBase(pdfOptions.pdfjsUrl))}web/viewer.html`;
25
- const queryString = queryStringify(options);
26
- const source = embedType === "pdfjs" ? `${pdfjsUrl}?file=${url}${queryString}` : `${url}${queryString}`;
27
- const tagName = embedType === "pdfjs" || embedType === "iframe" ? "iframe" : "embed";
28
- el.innerHTML = "";
29
- const pdf = document.createElement(tagName);
30
- pdf.className = "pdf-viewer";
31
- pdf.type = "application/pdf";
32
- pdf.title = options.title || "PDF Viewer";
33
- pdf.src = source;
34
- if (pdf instanceof HTMLIFrameElement)
35
- pdf.allow = "fullscreen";
36
- el.appendChild(pdf);
19
+ if (!pluginOptions.pdf) return;
20
+ url = isLinkHttp(url) ? url : new URL(withBase(url), typeof location !== "undefined" ? location.href : "").toString();
21
+ const pdfOptions = pluginOptions.pdf === true ? {} : pluginOptions.pdf;
22
+ pdfOptions.pdfjsUrl ??= "https://static.pengzhanbo.cn/pdfjs/";
23
+ const pdfjsUrl = `${ensureEndingSlash(withBase(pdfOptions.pdfjsUrl))}web/viewer.html`;
24
+ const queryString = queryStringify(options);
25
+ const source = embedType === "pdfjs" ? `${pdfjsUrl}?file=${url}${queryString}` : `${url}${queryString}`;
26
+ const tagName = embedType === "pdfjs" || embedType === "iframe" ? "iframe" : "embed";
27
+ el.innerHTML = "";
28
+ const pdf = document.createElement(tagName);
29
+ pdf.className = "pdf-viewer";
30
+ pdf.type = "application/pdf";
31
+ pdf.title = options.title || "PDF Viewer";
32
+ pdf.src = source;
33
+ if (pdf instanceof HTMLIFrameElement) pdf.allow = "fullscreen";
34
+ el.appendChild(pdf);
37
35
  }
38
36
  function usePDF(el, url, options) {
39
- if (typeof window === "undefined" || !window?.navigator?.userAgent)
40
- return;
41
- const { navigator } = window;
42
- const { userAgent } = navigator;
43
- const isModernBrowser = typeof window.Promise === "function";
44
- const isMobileDevice = checkIsiPad(userAgent) || checkIsMobile(userAgent);
45
- const isSafariDesktop = !isMobileDevice && checkIsSafari(userAgent);
46
- const isFirefoxWithPDFJS = !isMobileDevice && /firefox/iu.test(userAgent) && userAgent.split("rv:").length > 1 ? Number.parseInt(userAgent.split("rv:")[1].split(".")[0], 10) > 18 : false;
47
- const supportsPDFs = !isMobileDevice && (isModernBrowser || isFirefoxWithPDFJS);
48
- if (!url)
49
- return;
50
- if (supportsPDFs || !isMobileDevice) {
51
- const embedType = isSafariDesktop ? "iframe" : "embed";
52
- return renderPDF(el, url, embedType, options);
53
- }
54
- return renderPDF(el, url, "pdfjs", options);
37
+ if (typeof window === "undefined" || !window?.navigator?.userAgent) return;
38
+ const { navigator } = window;
39
+ const { userAgent } = navigator;
40
+ const isModernBrowser = typeof window.Promise === "function";
41
+ const isMobileDevice = checkIsiPad(userAgent) || checkIsMobile(userAgent);
42
+ const isSafariDesktop = !isMobileDevice && checkIsSafari(userAgent);
43
+ const isFirefoxWithPDFJS = !isMobileDevice && /firefox/iu.test(userAgent) && userAgent.split("rv:").length > 1 ? Number.parseInt(userAgent.split("rv:")[1].split(".")[0], 10) > 18 : false;
44
+ const supportsPDFs = !isMobileDevice && (isModernBrowser || isFirefoxWithPDFJS);
45
+ if (!url) return;
46
+ if (supportsPDFs || !isMobileDevice) {
47
+ const embedType = isSafariDesktop ? "iframe" : "embed";
48
+ return renderPDF(el, url, embedType, options);
49
+ }
50
+ return renderPDF(el, url, "pdfjs", options);
55
51
  }
56
- export {
57
- renderPDF,
58
- usePDF
59
- };
52
+
53
+ //#endregion
54
+ export { renderPDF, usePDF };
@@ -0,0 +1,101 @@
1
+ import { tryOnScopeDispose } from "@vueuse/core";
2
+
3
+ //#region src/client/composables/rustRepl.ts
4
+ const wsUrl = "wss://play.rust-lang.org/websocket";
5
+ const payloadType = {
6
+ connected: "websocket/connected",
7
+ request: "output/execute/wsExecuteRequest",
8
+ execute: {
9
+ begin: "output/execute/wsExecuteBegin",
10
+ stderr: "output/execute/wsExecuteStderr",
11
+ stdout: "output/execute/wsExecuteStdout",
12
+ end: "output/execute/wsExecuteEnd"
13
+ }
14
+ };
15
+ let ws = null;
16
+ let isOpen = false;
17
+ let uuid = 0;
18
+ function connect() {
19
+ if (isOpen) return Promise.resolve();
20
+ ws = new WebSocket(wsUrl);
21
+ uuid = 0;
22
+ ws.addEventListener("open", () => {
23
+ isOpen = true;
24
+ send(payloadType.connected, { iAcceptThisIsAnUnsupportedApi: true }, {
25
+ websocket: true,
26
+ sequenceNumber: uuid
27
+ });
28
+ });
29
+ ws.addEventListener("close", () => {
30
+ isOpen = false;
31
+ ws = null;
32
+ });
33
+ tryOnScopeDispose(() => ws?.close());
34
+ return new Promise((resolve) => {
35
+ function connected(e) {
36
+ const data = JSON.parse(e.data);
37
+ if (data.type === payloadType.connected) {
38
+ ws?.removeEventListener("message", connected);
39
+ resolve();
40
+ }
41
+ }
42
+ ws?.addEventListener("message", connected);
43
+ });
44
+ }
45
+ function send(type, payload, meta) {
46
+ const msg = {
47
+ type,
48
+ meta,
49
+ payload
50
+ };
51
+ ws?.send(JSON.stringify(msg));
52
+ }
53
+ async function rustExecute(code, { onEnd, onError, onStderr, onStdout, onBegin }) {
54
+ await connect();
55
+ const meta = { sequenceNumber: uuid++ };
56
+ const payload = {
57
+ backtrace: false,
58
+ channel: "stable",
59
+ crateType: "bin",
60
+ edition: "2021",
61
+ mode: "release",
62
+ tests: false,
63
+ code
64
+ };
65
+ send(payloadType.request, payload, meta);
66
+ let stdout = "";
67
+ let stderr = "";
68
+ function onMessage(e) {
69
+ const data = JSON.parse(e.data);
70
+ const { type, payload: payload$1, meta: _meta = {} } = data;
71
+ if (_meta.sequenceNumber !== meta.sequenceNumber) return;
72
+ if (type === payloadType.execute.begin) onBegin?.();
73
+ if (type === payloadType.execute.stdout) {
74
+ stdout += payload$1;
75
+ if (stdout.endsWith("\n")) {
76
+ onStdout?.(stdout);
77
+ stdout = "";
78
+ }
79
+ }
80
+ if (type === payloadType.execute.stderr) {
81
+ stderr += payload$1;
82
+ if (stderr.endsWith("\n")) {
83
+ if (stderr.startsWith("error:")) {
84
+ const index = stderr.indexOf("\n");
85
+ onStderr?.(stderr.slice(0, index));
86
+ onStderr?.(stderr.slice(index + 1));
87
+ } else onStderr?.(stderr);
88
+ stderr = "";
89
+ }
90
+ }
91
+ if (type === payloadType.execute.end) {
92
+ if (payload$1.success === false) onError?.(payload$1.exitDetail);
93
+ ws?.removeEventListener("message", onMessage);
94
+ onEnd?.();
95
+ }
96
+ }
97
+ ws?.addEventListener("message", onMessage);
98
+ }
99
+
100
+ //#endregion
101
+ export { rustExecute };
@@ -1,10 +1,18 @@
1
- declare function rustExecute(code: string, { onEnd, onError, onStderr, onStdout, onBegin }: RustExecuteOptions): Promise<void>;
1
+ //#region src/client/composables/rustRepl.d.ts
2
+ declare function rustExecute(code: string, {
3
+ onEnd,
4
+ onError,
5
+ onStderr,
6
+ onStdout,
7
+ onBegin
8
+ }: RustExecuteOptions): Promise<void>;
2
9
  interface RustExecuteOptions {
3
- onBegin?: () => void;
4
- onStdout?: (message: string) => void;
5
- onStderr?: (message: string) => void;
6
- onEnd?: () => void;
7
- onError?: (message: string) => void;
10
+ onBegin?: () => void;
11
+ onStdout?: (message: string) => void;
12
+ onStderr?: (message: string) => void;
13
+ onEnd?: () => void;
14
+ onError?: (message: string) => void;
8
15
  }
9
16
 
10
- export { rustExecute };
17
+ //#endregion
18
+ export { rustExecute };
@@ -1,104 +1,3 @@
1
- // src/client/composables/rustRepl.ts
2
- import { tryOnScopeDispose } from "@vueuse/core";
3
- var wsUrl = "wss://play.rust-lang.org/websocket";
4
- var payloadType = {
5
- connected: "websocket/connected",
6
- request: "output/execute/wsExecuteRequest",
7
- execute: {
8
- begin: "output/execute/wsExecuteBegin",
9
- // status: 'output/execute/wsExecuteStatus',
10
- stderr: "output/execute/wsExecuteStderr",
11
- stdout: "output/execute/wsExecuteStdout",
12
- end: "output/execute/wsExecuteEnd"
13
- }
14
- };
15
- var ws = null;
16
- var isOpen = false;
17
- var uuid = 0;
18
- function connect() {
19
- if (isOpen)
20
- return Promise.resolve();
21
- ws = new WebSocket(wsUrl);
22
- uuid = 0;
23
- ws.addEventListener("open", () => {
24
- isOpen = true;
25
- send(
26
- payloadType.connected,
27
- { iAcceptThisIsAnUnsupportedApi: true },
28
- { websocket: true, sequenceNumber: uuid }
29
- );
30
- });
31
- ws.addEventListener("close", () => {
32
- isOpen = false;
33
- ws = null;
34
- });
35
- tryOnScopeDispose(() => ws?.close());
36
- return new Promise((resolve) => {
37
- function connected(e) {
38
- const data = JSON.parse(e.data);
39
- if (data.type === payloadType.connected) {
40
- ws?.removeEventListener("message", connected);
41
- resolve();
42
- }
43
- }
44
- ws?.addEventListener("message", connected);
45
- });
46
- }
47
- function send(type, payload, meta) {
48
- const msg = { type, meta, payload };
49
- ws?.send(JSON.stringify(msg));
50
- }
51
- async function rustExecute(code, { onEnd, onError, onStderr, onStdout, onBegin }) {
52
- await connect();
53
- const meta = { sequenceNumber: uuid++ };
54
- const payload = {
55
- backtrace: false,
56
- channel: "stable",
57
- crateType: "bin",
58
- edition: "2021",
59
- mode: "release",
60
- tests: false,
61
- code
62
- };
63
- send(payloadType.request, payload, meta);
64
- let stdout = "";
65
- let stderr = "";
66
- function onMessage(e) {
67
- const data = JSON.parse(e.data);
68
- const { type, payload: payload2, meta: _meta = {} } = data;
69
- if (_meta.sequenceNumber !== meta.sequenceNumber)
70
- return;
71
- if (type === payloadType.execute.begin)
72
- onBegin?.();
73
- if (type === payloadType.execute.stdout) {
74
- stdout += payload2;
75
- if (stdout.endsWith("\n")) {
76
- onStdout?.(stdout);
77
- stdout = "";
78
- }
79
- }
80
- if (type === payloadType.execute.stderr) {
81
- stderr += payload2;
82
- if (stderr.endsWith("\n")) {
83
- if (stderr.startsWith("error:")) {
84
- const index = stderr.indexOf("\n");
85
- onStderr?.(stderr.slice(0, index));
86
- onStderr?.(stderr.slice(index + 1));
87
- } else {
88
- onStderr?.(stderr);
89
- }
90
- stderr = "";
91
- }
92
- }
93
- if (type === payloadType.execute.end) {
94
- if (payload2.success === false)
95
- onError?.(payload2.exitDetail);
96
- ws?.removeEventListener("message", onMessage);
97
- onEnd?.();
98
- }
99
- }
100
- ws?.addEventListener("message", onMessage);
101
- }
102
- export {
103
- rustExecute
104
- };
1
+ import { rustExecute } from "./rustRepl-iGLjb94D.js";
2
+
3
+ export { rustExecute };
@@ -1,26 +1,16 @@
1
- import { MaybeRef } from '@vueuse/core';
2
- import { ShallowRef, Ref, ToRefs } from 'vue';
3
- import { SizeOptions } from '../../shared/index.js';
1
+ import { Ref, ShallowRef, ToRefs } from "vue";
2
+ import { MaybeRef as MaybeRef$1 } from "@vueuse/core";
3
+ import { SizeOptions } from "../../shared/index.js";
4
4
 
5
- /**
6
- * Fork for https://github.com/vuepress-theme-hope/vuepress-theme-hope/blob/main/packages/components/src/client/composables/useSize.ts
7
- *
8
- * The MIT License (MIT)
9
- * Copyright (C) 2021 - PRESENT by Mr.Hope<mister-hope@outlook.com>
10
- *
11
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
12
- *
13
- * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
14
- *
15
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
16
- */
5
+ //#region src/client/composables/size.d.ts
17
6
 
18
7
  interface SizeInfo<T extends HTMLElement> {
19
- el: ShallowRef<T | undefined>;
20
- width: Ref<string>;
21
- height: Ref<string>;
22
- resize: () => void;
8
+ el: ShallowRef<T | undefined>;
9
+ width: Ref<string>;
10
+ height: Ref<string>;
11
+ resize: () => void;
23
12
  }
24
- declare function useSize<T extends HTMLElement>(options: ToRefs<SizeOptions>, extraHeight?: MaybeRef<number>): SizeInfo<T>;
13
+ declare function useSize<T extends HTMLElement>(options: ToRefs<SizeOptions>, extraHeight?: MaybeRef$1<number>): SizeInfo<T>;
25
14
 
26
- export { type SizeInfo, useSize };
15
+ //#endregion
16
+ export { SizeInfo, useSize };