@cgboiler/biz-mobile 1.16.0 → 1.17.0
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/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/md-preview/MdPreview.js +7 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/md-preview/MdPreview.js +11 -5
- package/package.json +3 -2
- package/es/md-preview/utils/customRules.d.ts +0 -12
- package/es/md-preview/utils/customRules.js +0 -31
- package/es/md-preview/utils/diffRenderer.d.ts +0 -8
- package/es/md-preview/utils/diffRenderer.js +0 -24
- package/es/md-preview/utils/index.d.ts +0 -4
- package/es/md-preview/utils/index.js +0 -4
- package/es/md-preview/utils/markdownRenderer.d.ts +0 -7
- package/es/md-preview/utils/markdownRenderer.js +0 -24
- package/es/md-preview/utils/typewriterEffect.d.ts +0 -34
- package/es/md-preview/utils/typewriterEffect.js +0 -61
- package/lib/md-preview/utils/customRules.d.ts +0 -12
- package/lib/md-preview/utils/customRules.js +0 -50
- package/lib/md-preview/utils/diffRenderer.d.ts +0 -8
- package/lib/md-preview/utils/diffRenderer.js +0 -53
- package/lib/md-preview/utils/index.d.ts +0 -4
- package/lib/md-preview/utils/index.js +0 -20
- package/lib/md-preview/utils/markdownRenderer.d.ts +0 -7
- package/lib/md-preview/utils/markdownRenderer.js +0 -53
- package/lib/md-preview/utils/typewriterEffect.d.ts +0 -34
- package/lib/md-preview/utils/typewriterEffect.js +0 -79
package/es/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ declare namespace _default {
|
|
|
7
7
|
}
|
|
8
8
|
export default _default;
|
|
9
9
|
export function install(app: any): void;
|
|
10
|
-
export const version: "1.
|
|
10
|
+
export const version: "1.16.0";
|
|
11
11
|
import MdPreview from './md-preview';
|
|
12
12
|
import OrgPicker from './org-picker';
|
|
13
13
|
import ProjectSelect from './project-select';
|
package/es/index.js
CHANGED
|
@@ -18,8 +18,14 @@ import { createVNode as _createVNode } from "vue";
|
|
|
18
18
|
import "./_atomic.css";
|
|
19
19
|
import { defineComponent, computed, watch } from "vue";
|
|
20
20
|
import { mdPreviewProps } from "./types";
|
|
21
|
-
import { initMarked, renderMarkdown, generateDiffHtml, useTypewriter } from "./utils";
|
|
22
21
|
import "./index.css";
|
|
22
|
+
import { mdPreview } from "@cgboiler/shared";
|
|
23
|
+
const {
|
|
24
|
+
initMarked,
|
|
25
|
+
renderMarkdown,
|
|
26
|
+
generateDiffHtml,
|
|
27
|
+
useTypewriter
|
|
28
|
+
} = mdPreview;
|
|
23
29
|
var stdin_default = defineComponent({
|
|
24
30
|
name: "MdPreview",
|
|
25
31
|
props: __spreadValues({}, mdPreviewProps),
|
package/lib/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ declare namespace _default {
|
|
|
7
7
|
}
|
|
8
8
|
export default _default;
|
|
9
9
|
export function install(app: any): void;
|
|
10
|
-
export const version: "1.
|
|
10
|
+
export const version: "1.16.0";
|
|
11
11
|
import MdPreview from './md-preview';
|
|
12
12
|
import OrgPicker from './org-picker';
|
|
13
13
|
import ProjectSelect from './project-select';
|
package/lib/index.js
CHANGED
|
@@ -42,7 +42,7 @@ var import_project_select = __toESM(require("./project-select"));
|
|
|
42
42
|
__reExport(stdin_exports, require("./md-preview"), module.exports);
|
|
43
43
|
__reExport(stdin_exports, require("./org-picker"), module.exports);
|
|
44
44
|
__reExport(stdin_exports, require("./project-select"), module.exports);
|
|
45
|
-
const version = "1.
|
|
45
|
+
const version = "1.16.0";
|
|
46
46
|
function install(app) {
|
|
47
47
|
const components = [
|
|
48
48
|
import_md_preview.default,
|
|
@@ -38,8 +38,14 @@ var import_vue = require("vue");
|
|
|
38
38
|
var import_atomic = require("./_atomic.css");
|
|
39
39
|
var import_vue2 = require("vue");
|
|
40
40
|
var import_types = require("./types");
|
|
41
|
-
var import_utils = require("./utils");
|
|
42
41
|
var import_index = require("./index.css");
|
|
42
|
+
var import_shared = require("@cgboiler/shared");
|
|
43
|
+
const {
|
|
44
|
+
initMarked,
|
|
45
|
+
renderMarkdown,
|
|
46
|
+
generateDiffHtml,
|
|
47
|
+
useTypewriter
|
|
48
|
+
} = import_shared.mdPreview;
|
|
43
49
|
var stdin_default = (0, import_vue2.defineComponent)({
|
|
44
50
|
name: "MdPreview",
|
|
45
51
|
props: __spreadValues({}, import_types.mdPreviewProps),
|
|
@@ -47,17 +53,17 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
|
47
53
|
setup(props, {
|
|
48
54
|
emit
|
|
49
55
|
}) {
|
|
50
|
-
|
|
56
|
+
initMarked();
|
|
51
57
|
const {
|
|
52
58
|
currentText,
|
|
53
59
|
controller: typewriterController
|
|
54
|
-
} =
|
|
60
|
+
} = useTypewriter(() => {
|
|
55
61
|
emit("typewriterComplete");
|
|
56
62
|
});
|
|
57
|
-
const htmlContent = (0, import_vue2.computed)(() =>
|
|
63
|
+
const htmlContent = (0, import_vue2.computed)(() => renderMarkdown(props.text || ""));
|
|
58
64
|
const displayContent = (0, import_vue2.computed)(() => {
|
|
59
65
|
if (props.showDiff) {
|
|
60
|
-
return
|
|
66
|
+
return generateDiffHtml(props.previousText, props.text || "", htmlContent.value);
|
|
61
67
|
}
|
|
62
68
|
return props.typewriter ? currentText.value : htmlContent.value;
|
|
63
69
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cgboiler/biz-mobile",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.17.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -47,7 +47,8 @@
|
|
|
47
47
|
"diff-match-patch": "^1.0.5",
|
|
48
48
|
"katex": "^0.16.22",
|
|
49
49
|
"marked": "^15.0.6",
|
|
50
|
-
"@cgboiler/core": "1.2.1"
|
|
50
|
+
"@cgboiler/core": "1.2.1",
|
|
51
|
+
"@cgboiler/shared": "1.1.0"
|
|
51
52
|
},
|
|
52
53
|
"scripts": {
|
|
53
54
|
"dev": "cg-cli dev",
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export declare const customTildeRule: {
|
|
2
|
-
name: string;
|
|
3
|
-
level: string;
|
|
4
|
-
start(src: string): number;
|
|
5
|
-
tokenizer(src: string): {
|
|
6
|
-
type: string;
|
|
7
|
-
raw: string;
|
|
8
|
-
text: string;
|
|
9
|
-
} | undefined;
|
|
10
|
-
renderer(token: any): any;
|
|
11
|
-
};
|
|
12
|
-
export declare const initMarked: () => void;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { marked } from "marked";
|
|
2
|
-
const customTildeRule = {
|
|
3
|
-
name: "customTilde",
|
|
4
|
-
level: "inline",
|
|
5
|
-
start(src) {
|
|
6
|
-
return src.indexOf("~");
|
|
7
|
-
},
|
|
8
|
-
tokenizer(src) {
|
|
9
|
-
const rule = /^~([^~]+)~/;
|
|
10
|
-
const match = src.match(rule);
|
|
11
|
-
if (match) {
|
|
12
|
-
return {
|
|
13
|
-
type: "customTilde",
|
|
14
|
-
raw: match[0],
|
|
15
|
-
text: match[0]
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
|
-
renderer(token) {
|
|
20
|
-
return token.text;
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
const initMarked = () => {
|
|
24
|
-
marked.use({
|
|
25
|
-
extensions: [customTildeRule]
|
|
26
|
-
});
|
|
27
|
-
};
|
|
28
|
-
export {
|
|
29
|
-
customTildeRule,
|
|
30
|
-
initMarked
|
|
31
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import * as DiffMatchPatch from "diff-match-patch";
|
|
2
|
-
const generateDiffHtml = (previousText, currentText, fallbackHtml) => {
|
|
3
|
-
if (!previousText && !currentText)
|
|
4
|
-
return fallbackHtml;
|
|
5
|
-
const dmp = new DiffMatchPatch.diff_match_patch();
|
|
6
|
-
const diffs = dmp.diff_main(previousText, currentText);
|
|
7
|
-
dmp.diff_cleanupSemantic(diffs);
|
|
8
|
-
let html = '<div class="diff-unified-view"><pre>';
|
|
9
|
-
diffs.forEach(([type, text]) => {
|
|
10
|
-
const escapedText = text.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/\n/g, "<br>");
|
|
11
|
-
if (type === 0) {
|
|
12
|
-
html += `<span class="diff-equal">${escapedText}</span>`;
|
|
13
|
-
} else if (type === -1) {
|
|
14
|
-
html += `<span class="diff-delete">${escapedText}</span>`;
|
|
15
|
-
} else if (type === 1) {
|
|
16
|
-
html += `<span class="diff-insert">${escapedText}</span>`;
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
html += "</pre></div>";
|
|
20
|
-
return html;
|
|
21
|
-
};
|
|
22
|
-
export {
|
|
23
|
-
generateDiffHtml
|
|
24
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { marked } from "marked";
|
|
2
|
-
import * as katex from "katex";
|
|
3
|
-
import "katex/dist/katex.min.css";
|
|
4
|
-
const renderMarkdown = (text) => {
|
|
5
|
-
const processedText = (text || "").replace(/(\$\$[\s\S]+?\$\$|\$[^\$\n]+?\$)/g, (match) => {
|
|
6
|
-
return `@@MATH_FORMULA@@${encodeURIComponent(match)}@@`;
|
|
7
|
-
}).replace(/<\/?(pre|code)(\s[^>]*)?>/g, "").replace(/```markdown|```/g, "").replace(/(.*)```$/gm, "$1");
|
|
8
|
-
let renderedContent = marked(processedText);
|
|
9
|
-
renderedContent = renderedContent.replace(/@@MATH_FORMULA@@([^@]+)@@/g, (_, encoded) => {
|
|
10
|
-
const formula = decodeURIComponent(encoded);
|
|
11
|
-
const isBlock = formula.startsWith("$$") && formula.endsWith("$$");
|
|
12
|
-
const tex = isBlock ? formula.slice(2, -2).trim() : formula.slice(1, -1).trim();
|
|
13
|
-
const html = katex.renderToString(tex, {
|
|
14
|
-
displayMode: isBlock,
|
|
15
|
-
throwOnError: false,
|
|
16
|
-
strict: false
|
|
17
|
-
});
|
|
18
|
-
return isBlock ? `<div class="katex-block">${html}</div>` : html;
|
|
19
|
-
});
|
|
20
|
-
return renderedContent.replace(/<a\s/g, '<a target="_blank" ');
|
|
21
|
-
};
|
|
22
|
-
export {
|
|
23
|
-
renderMarkdown
|
|
24
|
-
};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { Ref } from 'vue';
|
|
2
|
-
/**
|
|
3
|
-
* 打字机效果控制器
|
|
4
|
-
*/
|
|
5
|
-
export declare class TypewriterController {
|
|
6
|
-
private currentText;
|
|
7
|
-
private typingTimer;
|
|
8
|
-
private onComplete;
|
|
9
|
-
/**
|
|
10
|
-
* 构造函数
|
|
11
|
-
* @param currentText 当前文本的响应式引用
|
|
12
|
-
* @param onComplete 打字完成时的回调函数
|
|
13
|
-
*/
|
|
14
|
-
constructor(currentText: Ref<string>, onComplete: () => void);
|
|
15
|
-
/**
|
|
16
|
-
* 开始打字机效果
|
|
17
|
-
* @param fullContent 完整的内容
|
|
18
|
-
* @param speed 打字速度(毫秒)
|
|
19
|
-
*/
|
|
20
|
-
start(fullContent: string, speed?: number): void;
|
|
21
|
-
/**
|
|
22
|
-
* 停止打字机效果
|
|
23
|
-
*/
|
|
24
|
-
stop(): void;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* 创建打字机效果控制器
|
|
28
|
-
* @param onComplete 打字完成时的回调函数
|
|
29
|
-
* @returns 打字机控制器和当前文本的引用
|
|
30
|
-
*/
|
|
31
|
-
export declare const useTypewriter: (onComplete: () => void) => {
|
|
32
|
-
currentText: Ref<string, string>;
|
|
33
|
-
controller: TypewriterController;
|
|
34
|
-
};
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
-
var __publicField = (obj, key, value) => {
|
|
4
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
-
return value;
|
|
6
|
-
};
|
|
7
|
-
import { ref } from "vue";
|
|
8
|
-
class TypewriterController {
|
|
9
|
-
/**
|
|
10
|
-
* 构造函数
|
|
11
|
-
* @param currentText 当前文本的响应式引用
|
|
12
|
-
* @param onComplete 打字完成时的回调函数
|
|
13
|
-
*/
|
|
14
|
-
constructor(currentText, onComplete) {
|
|
15
|
-
__publicField(this, "currentText");
|
|
16
|
-
__publicField(this, "typingTimer", null);
|
|
17
|
-
__publicField(this, "onComplete");
|
|
18
|
-
this.currentText = currentText;
|
|
19
|
-
this.onComplete = onComplete;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* 开始打字机效果
|
|
23
|
-
* @param fullContent 完整的内容
|
|
24
|
-
* @param speed 打字速度(毫秒)
|
|
25
|
-
*/
|
|
26
|
-
start(fullContent, speed = 5) {
|
|
27
|
-
this.stop();
|
|
28
|
-
this.currentText.value = "";
|
|
29
|
-
let index = 0;
|
|
30
|
-
this.typingTimer = window.setInterval(() => {
|
|
31
|
-
if (index < fullContent.length) {
|
|
32
|
-
this.currentText.value = fullContent.slice(0, index + 1);
|
|
33
|
-
index++;
|
|
34
|
-
} else {
|
|
35
|
-
this.stop();
|
|
36
|
-
this.onComplete();
|
|
37
|
-
}
|
|
38
|
-
}, speed);
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* 停止打字机效果
|
|
42
|
-
*/
|
|
43
|
-
stop() {
|
|
44
|
-
if (this.typingTimer) {
|
|
45
|
-
clearInterval(this.typingTimer);
|
|
46
|
-
this.typingTimer = null;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
const useTypewriter = (onComplete) => {
|
|
51
|
-
const currentText = ref("");
|
|
52
|
-
const controller = new TypewriterController(currentText, onComplete);
|
|
53
|
-
return {
|
|
54
|
-
currentText,
|
|
55
|
-
controller
|
|
56
|
-
};
|
|
57
|
-
};
|
|
58
|
-
export {
|
|
59
|
-
TypewriterController,
|
|
60
|
-
useTypewriter
|
|
61
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export declare const customTildeRule: {
|
|
2
|
-
name: string;
|
|
3
|
-
level: string;
|
|
4
|
-
start(src: string): number;
|
|
5
|
-
tokenizer(src: string): {
|
|
6
|
-
type: string;
|
|
7
|
-
raw: string;
|
|
8
|
-
text: string;
|
|
9
|
-
} | undefined;
|
|
10
|
-
renderer(token: any): any;
|
|
11
|
-
};
|
|
12
|
-
export declare const initMarked: () => void;
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
var stdin_exports = {};
|
|
19
|
-
__export(stdin_exports, {
|
|
20
|
-
customTildeRule: () => customTildeRule,
|
|
21
|
-
initMarked: () => initMarked
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(stdin_exports);
|
|
24
|
-
var import_marked = require("marked");
|
|
25
|
-
const customTildeRule = {
|
|
26
|
-
name: "customTilde",
|
|
27
|
-
level: "inline",
|
|
28
|
-
start(src) {
|
|
29
|
-
return src.indexOf("~");
|
|
30
|
-
},
|
|
31
|
-
tokenizer(src) {
|
|
32
|
-
const rule = /^~([^~]+)~/;
|
|
33
|
-
const match = src.match(rule);
|
|
34
|
-
if (match) {
|
|
35
|
-
return {
|
|
36
|
-
type: "customTilde",
|
|
37
|
-
raw: match[0],
|
|
38
|
-
text: match[0]
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
},
|
|
42
|
-
renderer(token) {
|
|
43
|
-
return token.text;
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
const initMarked = () => {
|
|
47
|
-
import_marked.marked.use({
|
|
48
|
-
extensions: [customTildeRule]
|
|
49
|
-
});
|
|
50
|
-
};
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
-
mod
|
|
26
|
-
));
|
|
27
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
-
var stdin_exports = {};
|
|
29
|
-
__export(stdin_exports, {
|
|
30
|
-
generateDiffHtml: () => generateDiffHtml
|
|
31
|
-
});
|
|
32
|
-
module.exports = __toCommonJS(stdin_exports);
|
|
33
|
-
var DiffMatchPatch = __toESM(require("diff-match-patch"));
|
|
34
|
-
const generateDiffHtml = (previousText, currentText, fallbackHtml) => {
|
|
35
|
-
if (!previousText && !currentText)
|
|
36
|
-
return fallbackHtml;
|
|
37
|
-
const dmp = new DiffMatchPatch.diff_match_patch();
|
|
38
|
-
const diffs = dmp.diff_main(previousText, currentText);
|
|
39
|
-
dmp.diff_cleanupSemantic(diffs);
|
|
40
|
-
let html = '<div class="diff-unified-view"><pre>';
|
|
41
|
-
diffs.forEach(([type, text]) => {
|
|
42
|
-
const escapedText = text.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/\n/g, "<br>");
|
|
43
|
-
if (type === 0) {
|
|
44
|
-
html += `<span class="diff-equal">${escapedText}</span>`;
|
|
45
|
-
} else if (type === -1) {
|
|
46
|
-
html += `<span class="diff-delete">${escapedText}</span>`;
|
|
47
|
-
} else if (type === 1) {
|
|
48
|
-
html += `<span class="diff-insert">${escapedText}</span>`;
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
html += "</pre></div>";
|
|
52
|
-
return html;
|
|
53
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __copyProps = (to, from, except, desc) => {
|
|
6
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
-
for (let key of __getOwnPropNames(from))
|
|
8
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
-
}
|
|
11
|
-
return to;
|
|
12
|
-
};
|
|
13
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
14
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
-
var stdin_exports = {};
|
|
16
|
-
module.exports = __toCommonJS(stdin_exports);
|
|
17
|
-
__reExport(stdin_exports, require("./customRules"), module.exports);
|
|
18
|
-
__reExport(stdin_exports, require("./markdownRenderer"), module.exports);
|
|
19
|
-
__reExport(stdin_exports, require("./diffRenderer"), module.exports);
|
|
20
|
-
__reExport(stdin_exports, require("./typewriterEffect"), module.exports);
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
-
mod
|
|
26
|
-
));
|
|
27
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
-
var stdin_exports = {};
|
|
29
|
-
__export(stdin_exports, {
|
|
30
|
-
renderMarkdown: () => renderMarkdown
|
|
31
|
-
});
|
|
32
|
-
module.exports = __toCommonJS(stdin_exports);
|
|
33
|
-
var import_marked = require("marked");
|
|
34
|
-
var katex = __toESM(require("katex"));
|
|
35
|
-
var import_katex_min = require("katex/dist/katex.min.css");
|
|
36
|
-
const renderMarkdown = (text) => {
|
|
37
|
-
const processedText = (text || "").replace(/(\$\$[\s\S]+?\$\$|\$[^\$\n]+?\$)/g, (match) => {
|
|
38
|
-
return `@@MATH_FORMULA@@${encodeURIComponent(match)}@@`;
|
|
39
|
-
}).replace(/<\/?(pre|code)(\s[^>]*)?>/g, "").replace(/```markdown|```/g, "").replace(/(.*)```$/gm, "$1");
|
|
40
|
-
let renderedContent = (0, import_marked.marked)(processedText);
|
|
41
|
-
renderedContent = renderedContent.replace(/@@MATH_FORMULA@@([^@]+)@@/g, (_, encoded) => {
|
|
42
|
-
const formula = decodeURIComponent(encoded);
|
|
43
|
-
const isBlock = formula.startsWith("$$") && formula.endsWith("$$");
|
|
44
|
-
const tex = isBlock ? formula.slice(2, -2).trim() : formula.slice(1, -1).trim();
|
|
45
|
-
const html = katex.renderToString(tex, {
|
|
46
|
-
displayMode: isBlock,
|
|
47
|
-
throwOnError: false,
|
|
48
|
-
strict: false
|
|
49
|
-
});
|
|
50
|
-
return isBlock ? `<div class="katex-block">${html}</div>` : html;
|
|
51
|
-
});
|
|
52
|
-
return renderedContent.replace(/<a\s/g, '<a target="_blank" ');
|
|
53
|
-
};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { Ref } from 'vue';
|
|
2
|
-
/**
|
|
3
|
-
* 打字机效果控制器
|
|
4
|
-
*/
|
|
5
|
-
export declare class TypewriterController {
|
|
6
|
-
private currentText;
|
|
7
|
-
private typingTimer;
|
|
8
|
-
private onComplete;
|
|
9
|
-
/**
|
|
10
|
-
* 构造函数
|
|
11
|
-
* @param currentText 当前文本的响应式引用
|
|
12
|
-
* @param onComplete 打字完成时的回调函数
|
|
13
|
-
*/
|
|
14
|
-
constructor(currentText: Ref<string>, onComplete: () => void);
|
|
15
|
-
/**
|
|
16
|
-
* 开始打字机效果
|
|
17
|
-
* @param fullContent 完整的内容
|
|
18
|
-
* @param speed 打字速度(毫秒)
|
|
19
|
-
*/
|
|
20
|
-
start(fullContent: string, speed?: number): void;
|
|
21
|
-
/**
|
|
22
|
-
* 停止打字机效果
|
|
23
|
-
*/
|
|
24
|
-
stop(): void;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* 创建打字机效果控制器
|
|
28
|
-
* @param onComplete 打字完成时的回调函数
|
|
29
|
-
* @returns 打字机控制器和当前文本的引用
|
|
30
|
-
*/
|
|
31
|
-
export declare const useTypewriter: (onComplete: () => void) => {
|
|
32
|
-
currentText: Ref<string, string>;
|
|
33
|
-
controller: TypewriterController;
|
|
34
|
-
};
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var __publicField = (obj, key, value) => {
|
|
20
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
21
|
-
return value;
|
|
22
|
-
};
|
|
23
|
-
var stdin_exports = {};
|
|
24
|
-
__export(stdin_exports, {
|
|
25
|
-
TypewriterController: () => TypewriterController,
|
|
26
|
-
useTypewriter: () => useTypewriter
|
|
27
|
-
});
|
|
28
|
-
module.exports = __toCommonJS(stdin_exports);
|
|
29
|
-
var import_vue = require("vue");
|
|
30
|
-
class TypewriterController {
|
|
31
|
-
/**
|
|
32
|
-
* 构造函数
|
|
33
|
-
* @param currentText 当前文本的响应式引用
|
|
34
|
-
* @param onComplete 打字完成时的回调函数
|
|
35
|
-
*/
|
|
36
|
-
constructor(currentText, onComplete) {
|
|
37
|
-
__publicField(this, "currentText");
|
|
38
|
-
__publicField(this, "typingTimer", null);
|
|
39
|
-
__publicField(this, "onComplete");
|
|
40
|
-
this.currentText = currentText;
|
|
41
|
-
this.onComplete = onComplete;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* 开始打字机效果
|
|
45
|
-
* @param fullContent 完整的内容
|
|
46
|
-
* @param speed 打字速度(毫秒)
|
|
47
|
-
*/
|
|
48
|
-
start(fullContent, speed = 5) {
|
|
49
|
-
this.stop();
|
|
50
|
-
this.currentText.value = "";
|
|
51
|
-
let index = 0;
|
|
52
|
-
this.typingTimer = window.setInterval(() => {
|
|
53
|
-
if (index < fullContent.length) {
|
|
54
|
-
this.currentText.value = fullContent.slice(0, index + 1);
|
|
55
|
-
index++;
|
|
56
|
-
} else {
|
|
57
|
-
this.stop();
|
|
58
|
-
this.onComplete();
|
|
59
|
-
}
|
|
60
|
-
}, speed);
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* 停止打字机效果
|
|
64
|
-
*/
|
|
65
|
-
stop() {
|
|
66
|
-
if (this.typingTimer) {
|
|
67
|
-
clearInterval(this.typingTimer);
|
|
68
|
-
this.typingTimer = null;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
const useTypewriter = (onComplete) => {
|
|
73
|
-
const currentText = (0, import_vue.ref)("");
|
|
74
|
-
const controller = new TypewriterController(currentText, onComplete);
|
|
75
|
-
return {
|
|
76
|
-
currentText,
|
|
77
|
-
controller
|
|
78
|
-
};
|
|
79
|
-
};
|