@superlc/md-vue 0.1.0 → 0.1.1
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/dist/Markdown.d.ts +13 -2
- package/dist/Markdown.d.ts.map +1 -1
- package/dist/components/CodeBlock.d.ts +26 -0
- package/dist/components/CodeBlock.d.ts.map +1 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +27 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +297 -184
- package/dist/streaming/StreamingMarkdown.d.ts +12 -2
- package/dist/streaming/StreamingMarkdown.d.ts.map +1 -1
- package/dist/streaming/types.d.ts +4 -0
- package/dist/streaming/types.d.ts.map +1 -1
- package/dist/types.d.ts +4 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +11 -11
package/dist/Markdown.d.ts
CHANGED
|
@@ -38,9 +38,13 @@ export declare const Markdown: import('vue').DefineComponent<import('vue').Extra
|
|
|
38
38
|
type: PropType<PluginConfig[]>;
|
|
39
39
|
default: () => never[];
|
|
40
40
|
};
|
|
41
|
+
copyButton: {
|
|
42
|
+
type: BooleanConstructor;
|
|
43
|
+
default: boolean;
|
|
44
|
+
};
|
|
41
45
|
}>, () => string | VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
|
42
46
|
[key: string]: any;
|
|
43
|
-
}> | null, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin,
|
|
47
|
+
}> | null, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, "codeCopy"[], "codeCopy", import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
44
48
|
content: {
|
|
45
49
|
type: StringConstructor;
|
|
46
50
|
required: true;
|
|
@@ -73,9 +77,16 @@ export declare const Markdown: import('vue').DefineComponent<import('vue').Extra
|
|
|
73
77
|
type: PropType<PluginConfig[]>;
|
|
74
78
|
default: () => never[];
|
|
75
79
|
};
|
|
76
|
-
|
|
80
|
+
copyButton: {
|
|
81
|
+
type: BooleanConstructor;
|
|
82
|
+
default: boolean;
|
|
83
|
+
};
|
|
84
|
+
}>> & Readonly<{
|
|
85
|
+
onCodeCopy?: ((...args: any[]) => any) | undefined;
|
|
86
|
+
}>, {
|
|
77
87
|
components: MarkdownComponents;
|
|
78
88
|
class: string;
|
|
89
|
+
copyButton: boolean;
|
|
79
90
|
gfm: boolean;
|
|
80
91
|
highlight: boolean;
|
|
81
92
|
math: boolean;
|
package/dist/Markdown.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Markdown.d.ts","sourceRoot":"","sources":["../src/Markdown.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuC,KAAK,KAAK,EAAE,KAAK,QAAQ,EAAE,MAAM,KAAK,CAAC;AACrF,OAAO,EAAe,KAAK,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAElE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"Markdown.d.ts","sourceRoot":"","sources":["../src/Markdown.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuC,KAAK,KAAK,EAAE,KAAK,QAAQ,EAAE,MAAM,KAAK,CAAC;AACrF,OAAO,EAAe,KAAK,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAElE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAMlD;;GAEG;AACH,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;cAwBC,QAAQ,CAAC,kBAAkB,CAAC;;;;cAI7B,QAAQ,CAAC,YAAY,EAAE,CAAC;;;;cAIxB,QAAQ,CAAC,YAAY,EAAE,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cARvB,QAAQ,CAAC,kBAAkB,CAAC;;;;cAI7B,QAAQ,CAAC,YAAY,EAAE,CAAC;;;;cAIxB,QAAQ,CAAC,YAAY,EAAE,CAAC;;;;;;;;;;;;;;;;;;4EA8G3C,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { PropType, VNode } from 'vue';
|
|
2
|
+
|
|
3
|
+
export interface CodeBlockProps {
|
|
4
|
+
showCopyButton?: boolean;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Vue 代码块组件,包装 <pre> 元素并添加复制按钮
|
|
8
|
+
*/
|
|
9
|
+
export declare const CodeBlock: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
10
|
+
showCopyButton: {
|
|
11
|
+
type: PropType<boolean>;
|
|
12
|
+
default: boolean;
|
|
13
|
+
};
|
|
14
|
+
}>, () => VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
|
15
|
+
[key: string]: any;
|
|
16
|
+
}>, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, "copy"[], "copy", import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
17
|
+
showCopyButton: {
|
|
18
|
+
type: PropType<boolean>;
|
|
19
|
+
default: boolean;
|
|
20
|
+
};
|
|
21
|
+
}>> & Readonly<{
|
|
22
|
+
onCopy?: ((...args: any[]) => any) | undefined;
|
|
23
|
+
}>, {
|
|
24
|
+
showCopyButton: boolean;
|
|
25
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
26
|
+
//# sourceMappingURL=CodeBlock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CodeBlock.d.ts","sourceRoot":"","sources":["../../src/components/CodeBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2B,KAAK,QAAQ,EAAE,KAAK,KAAK,EAAE,MAAM,KAAK,CAAC;AA2FzE,MAAM,WAAW,cAAc;IAC7B,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED;;GAEG;AACH,eAAO,MAAM,SAAS;;cAIC,QAAQ,CAAC,OAAO,CAAC;;;;;;;cAAjB,QAAQ,CAAC,OAAO,CAAC;;;;;;;4EA0CtC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var z=Object.create;var V=Object.defineProperty;var E=Object.getOwnPropertyDescriptor;var _=Object.getOwnPropertyNames;var $=Object.getPrototypeOf,W=Object.prototype.hasOwnProperty;var D=(e,t,a,l)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of _(t))!W.call(e,o)&&o!==a&&V(e,o,{get:()=>t[o],enumerable:!(l=E(t,o))||l.enumerable});return e};var G=(e,t,a)=>(a=e!=null?z($(e)):{},D(t||!e||!e.__esModule?V(a,"default",{value:e,enumerable:!0}):a,e));Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("vue"),w=require("@superlc/md-core");let S=!1,B=null;async function J(){if(!S)return B||(B=(async()=>{await import("katex/dist/katex.min.css"),S=!0})(),B)}function Q(){return S}function T(){return J()}async function X(e){try{return await navigator.clipboard.writeText(e),!0}catch{return Y(e)}}function Y(e){const t=document.createElement("textarea");t.value=e,t.style.position="fixed",t.style.left="-9999px",document.body.appendChild(t),t.select();try{return document.execCommand("copy"),!0}catch{return!1}finally{document.body.removeChild(t)}}const Z=()=>n.h("svg",{viewBox:"0 0 24 24",fill:"currentColor"},[n.h("path",{d:"M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"})]),ee=()=>n.h("svg",{viewBox:"0 0 24 24",fill:"currentColor"},[n.h("path",{d:"M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"})]);function O(e){return typeof e=="string"?e:Array.isArray(e)?e.map(t=>typeof t=="string"?t:t&&typeof t=="object"&&"children"in t?O(t.children):"").join(""):""}const j=n.defineComponent({name:"CodeBlock",props:{showCopyButton:{type:Boolean,default:!0}},emits:["copy"],setup(e,{slots:t,emit:a}){const l=n.ref(!1),o=async()=>{var s;const u=(s=t.default)==null?void 0:s.call(t),r=u?O(u):"";await X(r)&&(l.value=!0,a("copy",r),setTimeout(()=>{l.value=!1},2e3))};return()=>{var r;const u=(r=t.default)==null?void 0:r.call(t);return n.h("div",{class:"md-code-block-wrapper"},[n.h("pre",{},u),e.showCopyButton&&n.h("button",{type:"button",class:`md-copy-button${l.value?" md-copy-button--copied":""}`,onClick:o,title:l.value?"已复制":"复制代码","aria-label":l.value?"已复制":"复制代码"},[l.value?n.h(ee):n.h(Z)])])}}}),P=n.defineComponent({name:"Markdown",props:{content:{type:String,required:!0},class:{type:String,default:""},gfm:{type:Boolean,default:!0},highlight:{type:Boolean,default:!0},math:{type:Boolean,default:!1},components:{type:Object,default:()=>({})},remarkPlugins:{type:Array,default:()=>[]},rehypePlugins:{type:Array,default:()=>[]},copyButton:{type:Boolean,default:!0}},emits:["codeCopy"],setup(e,{emit:t}){n.watch(()=>e.math,o=>{o&&T()},{immediate:!0});function a(o,u={}){if(o.type==="text")return o.value;if(o.type==="comment")return null;if(o.type==="root"){const r=o.children.map(i=>a(i,u)).filter(i=>i!==null);return n.h("div",{class:e.class},r)}if(o.type==="element"){const{tagName:r,properties:i,children:s}=o,m=u[r]||r,f={};if(i)for(const[c,d]of Object.entries(i))c==="className"?f.class=Array.isArray(d)?d.join(" "):d:f[c]=d;const h=s.map(c=>a(c,u)).filter(c=>c!==null);return typeof m=="string"?n.h(m,f,h):n.h(m,f,()=>h)}return null}const l=n.computed(()=>{if(!e.content)return null;const o=w.parseToHast(e.content,{gfm:e.gfm,highlight:e.highlight,math:e.math,remarkPlugins:e.remarkPlugins,rehypePlugins:e.rehypePlugins}),u={...e.copyButton?{pre:n.defineComponent({setup(r,{slots:i}){return()=>n.h(j,{showCopyButton:e.copyButton,onCopy:s=>t("codeCopy",s)},i.default)}})}:{},...e.components};return a(o,u)});return()=>l.value?l.value:null}});function x(e,t){if(e.type==="text")return e.value;if(e.type==="root"){const a=e.children.map(l=>x(l,t)).filter(l=>l!==null);return n.h("div",{},a)}if(e.type==="element"){const a=e,l=a.tagName,o=t==null?void 0:t[l],u={...a.properties};u.className&&(u.class=Array.isArray(u.className)?u.className.join(" "):u.className,delete u.className);const r=a.children.map(i=>x(i,t)).filter(i=>i!==null);return o?n.h(o,u,()=>r):n.h(l,u,r)}return null}function te(e={}){const{components:t,minUpdateInterval:a=16,immediate:l=!1,outputRate:o="medium",...u}=e,r=w.createStreamingParser(u),i=new w.OutputRateController(o),s=n.ref(0),m=n.ref(!1),f=n.ref(0),h=n.ref("idle");let c=0,d=null;const v=()=>{const y=performance.now(),k=y-c;l||k>=a?(c=y,s.value++):d===null&&(d=requestAnimationFrame(()=>{d=null,c=performance.now(),s.value++}))},C=y=>{r.append(y),v()},p=y=>{r.reset(),m.value=!1,f.value=0,h.value="running",i.start(y,k=>{k&&r.append(k),f.value=i.progress,v()},()=>{r.finish(),m.value=!0,f.value=1,h.value="complete",v()})},b=()=>{i.pause(),h.value=i.status},N=()=>{i.resume(),h.value=i.status},R=()=>{i.skipToEnd(),h.value=i.status,f.value=1},L=()=>{i.stop(),r.finish(),m.value=!0,h.value="complete",d!==null&&(cancelAnimationFrame(d),d=null),s.value++},q=()=>{i.stop(),r.reset(),m.value=!1,f.value=0,h.value="idle",d!==null&&(cancelAnimationFrame(d),d=null),s.value++};n.onUnmounted(()=>{i.stop(),d!==null&&cancelAnimationFrame(d)});const H=n.computed(()=>(s.value,r.getState().blocks)),I=n.computed(()=>(s.value,r.getStats())),K=n.computed(()=>(s.value,r.getContent()));return{vnode:n.computed(()=>{s.value;const y=r.getState();if(y.blocks.length===0)return null;const k=y.blocks.map(g=>g.hast?n.h("div",{key:g.key,"data-block-key":g.key,"data-pending":!g.stable||void 0},[x(g.hast,t)]):null).filter(g=>g!==null);return n.h("div",{"data-streaming":!m.value},k)}),append:C,start:p,pause:b,resume:N,skipToEnd:R,reset:q,finish:L,blocks:H,stats:I,isComplete:m,content:K,progress:f,outputStatus:h}}function A(e,t,a,l,o){if(e.type==="text")return e.value;if(e.type==="root"){const u=e.children.map(r=>A(r,t,a,l,o)).filter(r=>r!==null);return n.h("div",{},u)}if(e.type==="element"){const u=e,r=u.tagName,i=t==null?void 0:t[r],s={...u.properties};s.className&&(s.class=Array.isArray(s.className)?s.className.join(" "):s.className,delete s.className);const m=u.children.map(f=>A(f,t,a,l,o)).filter(f=>f!==null);return r==="pre"&&a&&!i?n.h(j,{showCopyButton:o&&a,onCopy:l},()=>m):i?n.h(i,s,()=>m):n.h(r,s,m)}return null}const U=n.defineComponent({name:"StreamingMarkdown",props:{content:{type:String,default:void 0},source:{type:String,default:void 0},outputRate:{type:[String,Object],default:"medium"},isComplete:{type:Boolean,default:!1},components:{type:Object,default:void 0},class:{type:String,default:void 0},minUpdateInterval:{type:Number,default:16},autoStart:{type:Boolean,default:!0},gfm:{type:Boolean,default:!0},highlight:{type:Boolean,default:!0},math:{type:Boolean,default:!1},copyButton:{type:Boolean,default:!0}},emits:["complete","blockStable","progress","codeCopy"],setup(e,{emit:t}){n.watch(()=>e.math,c=>{c&&T()},{immediate:!0});const a=w.createStreamingParser({gfm:e.gfm,highlight:e.highlight,math:e.math}),l=new w.OutputRateController(e.outputRate),o=n.ref(0),u=n.ref(""),r=n.ref(void 0),i=n.ref([]),s=n.ref(!1);let m=0,f=null;const h=()=>{const c=performance.now();c-m>=e.minUpdateInterval?(m=c,o.value++):f===null&&(f=requestAnimationFrame(()=>{f=null,m=performance.now(),o.value++}))};return n.watch(()=>e.source,c=>{c!==void 0&&c!==r.value&&(r.value=c,e.autoStart&&c&&(a.reset(),u.value="",s.value=!1,l.start(c,d=>{d&&(a.append(d),u.value+=d),t("progress",l.progress),h()},()=>{a.finish(),s.value=!0,t("complete"),h()})))},{immediate:!0}),n.watch(()=>e.content,c=>{if(e.source!==void 0)return;const d=u.value,v=c||"";if(v!==d){if(v.startsWith(d)){const p=v.slice(d.length);p&&a.append(p)}else a.reset(),v&&a.append(v);u.value=v,h();const C=a.getState().blocks;C.forEach((p,b)=>{const N=i.value[b];p.stable&&(!N||!N.stable)&&t("blockStable",p)}),i.value=C}},{immediate:!0}),n.watch(()=>e.isComplete,c=>{e.source===void 0&&c&&(a.finish(),f!==null&&(cancelAnimationFrame(f),f=null),o.value++,t("complete"))}),n.watch(()=>e.outputRate,c=>{l.setRate(c)}),n.onUnmounted(()=>{l.stop(),f!==null&&cancelAnimationFrame(f)}),()=>{o.value;const c=a.getState(),d=e.source!==void 0?s.value:e.isComplete,v=p=>t("codeCopy",p),C=c.blocks.map(p=>p.hast?n.h("div",{key:p.key,"data-block-key":p.key,"data-pending":!p.stable||void 0},[A(p.hast,e.components,e.copyButton,v,p.stable)]):null).filter(p=>p!==null);return n.h("div",{class:e.class,"data-streaming":!d},C)}}});function M(e,t={}){if(e.type==="text")return e.value;if(e.type==="comment")return null;if(e.type==="root"){const a=e.children.map(l=>M(l,t)).filter(l=>l!==null);return n.h("div",{},a)}if(e.type==="element"){const{tagName:a,properties:l,children:o}=e,u=t[a]||a,r={};if(l)for(const[s,m]of Object.entries(l))s==="className"?r.class=Array.isArray(m)?m.join(" "):m:r[s]=m;const i=o.map(s=>M(s,t)).filter(s=>s!==null);return n.h(u,r,()=>i)}return null}function ne(e,t={}){const{components:a={},...l}=t;return n.computed(()=>{const o=e();if(!o)return null;const u=w.parseToHast(o,l);return M(u,a)})}function F(e){e.component("Markdown",P),e.component("StreamingMarkdown",U)}const ae={install:F,Markdown:P,StreamingMarkdown:U};exports.CodeBlock=j;exports.Markdown=P;exports.StreamingMarkdown=U;exports.default=ae;exports.install=F;exports.isKatexCssLoaded=Q;exports.preloadKatexCss=T;exports.useMarkdown=ne;exports.useStreamingMarkdown=te;
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,8 @@ import { Markdown } from './Markdown';
|
|
|
3
3
|
|
|
4
4
|
export { Markdown };
|
|
5
5
|
export { useMarkdown } from './useMarkdown';
|
|
6
|
+
export { CodeBlock } from './components';
|
|
7
|
+
export type { CodeBlockProps } from './components';
|
|
6
8
|
export type { MarkdownProps, MarkdownComponents, UseMarkdownOptions } from './types';
|
|
7
9
|
export { useStreamingMarkdown, StreamingMarkdown } from './streaming';
|
|
8
10
|
export type { UseStreamingMarkdownOptions, UseStreamingMarkdownResult, StreamingMarkdownProps, StreamingMarkdownEmits, } from './streaming';
|
|
@@ -47,9 +49,13 @@ declare const _default: {
|
|
|
47
49
|
type: import('vue').PropType<import('@superlc/md-core').PluginConfig[]>;
|
|
48
50
|
default: () => never[];
|
|
49
51
|
};
|
|
52
|
+
copyButton: {
|
|
53
|
+
type: BooleanConstructor;
|
|
54
|
+
default: boolean;
|
|
55
|
+
};
|
|
50
56
|
}>, () => string | import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
|
51
57
|
[key: string]: any;
|
|
52
|
-
}> | null, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin,
|
|
58
|
+
}> | null, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, "codeCopy"[], "codeCopy", import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
53
59
|
content: {
|
|
54
60
|
type: StringConstructor;
|
|
55
61
|
required: true;
|
|
@@ -82,9 +88,16 @@ declare const _default: {
|
|
|
82
88
|
type: import('vue').PropType<import('@superlc/md-core').PluginConfig[]>;
|
|
83
89
|
default: () => never[];
|
|
84
90
|
};
|
|
85
|
-
|
|
91
|
+
copyButton: {
|
|
92
|
+
type: BooleanConstructor;
|
|
93
|
+
default: boolean;
|
|
94
|
+
};
|
|
95
|
+
}>> & Readonly<{
|
|
96
|
+
onCodeCopy?: ((...args: any[]) => any) | undefined;
|
|
97
|
+
}>, {
|
|
86
98
|
components: import('./types').MarkdownComponents;
|
|
87
99
|
class: string;
|
|
100
|
+
copyButton: boolean;
|
|
88
101
|
gfm: boolean;
|
|
89
102
|
highlight: boolean;
|
|
90
103
|
math: boolean;
|
|
@@ -136,9 +149,13 @@ declare const _default: {
|
|
|
136
149
|
type: BooleanConstructor;
|
|
137
150
|
default: boolean;
|
|
138
151
|
};
|
|
152
|
+
copyButton: {
|
|
153
|
+
type: BooleanConstructor;
|
|
154
|
+
default: boolean;
|
|
155
|
+
};
|
|
139
156
|
}>, () => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
|
140
157
|
[key: string]: any;
|
|
141
|
-
}>, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, ("progress" | "complete" | "blockStable")[], "progress" | "complete" | "blockStable", import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
158
|
+
}>, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, ("progress" | "codeCopy" | "complete" | "blockStable")[], "progress" | "codeCopy" | "complete" | "blockStable", import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
142
159
|
content: {
|
|
143
160
|
type: StringConstructor;
|
|
144
161
|
default: undefined;
|
|
@@ -183,18 +200,24 @@ declare const _default: {
|
|
|
183
200
|
type: BooleanConstructor;
|
|
184
201
|
default: boolean;
|
|
185
202
|
};
|
|
203
|
+
copyButton: {
|
|
204
|
+
type: BooleanConstructor;
|
|
205
|
+
default: boolean;
|
|
206
|
+
};
|
|
186
207
|
}>> & Readonly<{
|
|
187
208
|
onProgress?: ((...args: any[]) => any) | undefined;
|
|
209
|
+
onCodeCopy?: ((...args: any[]) => any) | undefined;
|
|
188
210
|
onComplete?: ((...args: any[]) => any) | undefined;
|
|
189
211
|
onBlockStable?: ((...args: any[]) => any) | undefined;
|
|
190
212
|
}>, {
|
|
191
213
|
content: string;
|
|
192
214
|
components: import('./types').MarkdownComponents;
|
|
193
215
|
class: string;
|
|
216
|
+
copyButton: boolean;
|
|
217
|
+
source: string;
|
|
194
218
|
gfm: boolean;
|
|
195
219
|
highlight: boolean;
|
|
196
220
|
math: boolean;
|
|
197
|
-
source: string;
|
|
198
221
|
minUpdateInterval: number;
|
|
199
222
|
outputRate: import('@superlc/md-core').OutputRate;
|
|
200
223
|
isComplete: boolean;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGtC,OAAO,EAAE,QAAQ,EAAE,CAAC;AACpB,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,YAAY,EAAE,aAAa,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAGrF,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACtE,YAAY,EACV,2BAA2B,EAC3B,0BAA0B,EAC1B,sBAAsB,EACtB,sBAAsB,GACvB,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAGnE,YAAY,EACV,gBAAgB,EAChB,YAAY,EACZ,SAAS,EACT,WAAW,EACX,UAAU,EACV,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,UAAU,EACV,uBAAuB,GACxB,MAAM,kBAAkB,CAAC;AAE1B;;GAEG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,GAAG,GAAG,IAAI,CAGtC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["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|
|
3
|
-
let
|
|
4
|
-
async function
|
|
5
|
-
if (!
|
|
6
|
-
return
|
|
7
|
-
await import("katex/dist/katex.min.css"),
|
|
8
|
-
})(),
|
|
1
|
+
import { defineComponent as A, ref as h, h as f, watch as w, computed as B, onUnmounted as U } from "vue";
|
|
2
|
+
import { parseToHast as P, createStreamingParser as F, OutputRateController as O } from "@superlc/md-core";
|
|
3
|
+
let T = !1, x = null;
|
|
4
|
+
async function D() {
|
|
5
|
+
if (!T)
|
|
6
|
+
return x || (x = (async () => {
|
|
7
|
+
await import("katex/dist/katex.min.css"), T = !0;
|
|
8
|
+
})(), x);
|
|
9
9
|
}
|
|
10
|
-
function
|
|
11
|
-
return
|
|
10
|
+
function ne() {
|
|
11
|
+
return T;
|
|
12
12
|
}
|
|
13
|
-
function
|
|
14
|
-
return
|
|
13
|
+
function R() {
|
|
14
|
+
return D();
|
|
15
15
|
}
|
|
16
|
-
|
|
16
|
+
async function G(e) {
|
|
17
|
+
try {
|
|
18
|
+
return await navigator.clipboard.writeText(e), !0;
|
|
19
|
+
} catch {
|
|
20
|
+
return J(e);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
function J(e) {
|
|
24
|
+
const t = document.createElement("textarea");
|
|
25
|
+
t.value = e, t.style.position = "fixed", t.style.left = "-9999px", document.body.appendChild(t), t.select();
|
|
26
|
+
try {
|
|
27
|
+
return document.execCommand("copy"), !0;
|
|
28
|
+
} catch {
|
|
29
|
+
return !1;
|
|
30
|
+
} finally {
|
|
31
|
+
document.body.removeChild(t);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
const Q = () => f(
|
|
35
|
+
"svg",
|
|
36
|
+
{
|
|
37
|
+
viewBox: "0 0 24 24",
|
|
38
|
+
fill: "currentColor"
|
|
39
|
+
},
|
|
40
|
+
[
|
|
41
|
+
f("path", {
|
|
42
|
+
d: "M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"
|
|
43
|
+
})
|
|
44
|
+
]
|
|
45
|
+
), X = () => f(
|
|
46
|
+
"svg",
|
|
47
|
+
{
|
|
48
|
+
viewBox: "0 0 24 24",
|
|
49
|
+
fill: "currentColor"
|
|
50
|
+
},
|
|
51
|
+
[
|
|
52
|
+
f("path", {
|
|
53
|
+
d: "M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"
|
|
54
|
+
})
|
|
55
|
+
]
|
|
56
|
+
);
|
|
57
|
+
function I(e) {
|
|
58
|
+
return typeof e == "string" ? e : Array.isArray(e) ? e.map((t) => typeof t == "string" ? t : t && typeof t == "object" && "children" in t ? I(t.children) : "").join("") : "";
|
|
59
|
+
}
|
|
60
|
+
const L = A({
|
|
61
|
+
name: "CodeBlock",
|
|
62
|
+
props: {
|
|
63
|
+
showCopyButton: {
|
|
64
|
+
type: Boolean,
|
|
65
|
+
default: !0
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
emits: ["copy"],
|
|
69
|
+
setup(e, { slots: t, emit: l }) {
|
|
70
|
+
const a = h(!1), u = async () => {
|
|
71
|
+
var o;
|
|
72
|
+
const r = (o = t.default) == null ? void 0 : o.call(t), n = r ? I(r) : "";
|
|
73
|
+
await G(n) && (a.value = !0, l("copy", n), setTimeout(() => {
|
|
74
|
+
a.value = !1;
|
|
75
|
+
}, 2e3));
|
|
76
|
+
};
|
|
77
|
+
return () => {
|
|
78
|
+
var n;
|
|
79
|
+
const r = (n = t.default) == null ? void 0 : n.call(t);
|
|
80
|
+
return f("div", { class: "md-code-block-wrapper" }, [
|
|
81
|
+
f("pre", {}, r),
|
|
82
|
+
e.showCopyButton && f(
|
|
83
|
+
"button",
|
|
84
|
+
{
|
|
85
|
+
type: "button",
|
|
86
|
+
class: `md-copy-button${a.value ? " md-copy-button--copied" : ""}`,
|
|
87
|
+
onClick: u,
|
|
88
|
+
title: a.value ? "已复制" : "复制代码",
|
|
89
|
+
"aria-label": a.value ? "已复制" : "复制代码"
|
|
90
|
+
},
|
|
91
|
+
[a.value ? f(X) : f(Q)]
|
|
92
|
+
)
|
|
93
|
+
]);
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
}), z = A({
|
|
17
97
|
name: "Markdown",
|
|
18
98
|
props: {
|
|
19
99
|
content: {
|
|
@@ -47,153 +127,181 @@ const q = M({
|
|
|
47
127
|
rehypePlugins: {
|
|
48
128
|
type: Array,
|
|
49
129
|
default: () => []
|
|
130
|
+
},
|
|
131
|
+
copyButton: {
|
|
132
|
+
type: Boolean,
|
|
133
|
+
default: !0
|
|
50
134
|
}
|
|
51
135
|
},
|
|
52
|
-
|
|
53
|
-
|
|
136
|
+
emits: ["codeCopy"],
|
|
137
|
+
setup(e, { emit: t }) {
|
|
138
|
+
w(
|
|
54
139
|
() => e.math,
|
|
55
|
-
(
|
|
56
|
-
|
|
140
|
+
(u) => {
|
|
141
|
+
u && R();
|
|
57
142
|
},
|
|
58
143
|
{ immediate: !0 }
|
|
59
144
|
);
|
|
60
|
-
function
|
|
61
|
-
if (
|
|
62
|
-
return
|
|
63
|
-
if (
|
|
145
|
+
function l(u, r = {}) {
|
|
146
|
+
if (u.type === "text")
|
|
147
|
+
return u.value;
|
|
148
|
+
if (u.type === "comment")
|
|
64
149
|
return null;
|
|
65
|
-
if (
|
|
66
|
-
const
|
|
67
|
-
return
|
|
150
|
+
if (u.type === "root") {
|
|
151
|
+
const n = u.children.map((s) => l(s, r)).filter((s) => s !== null);
|
|
152
|
+
return f("div", { class: e.class }, n);
|
|
68
153
|
}
|
|
69
|
-
if (
|
|
70
|
-
const { tagName:
|
|
71
|
-
if (
|
|
72
|
-
for (const [
|
|
73
|
-
|
|
74
|
-
const
|
|
75
|
-
return typeof
|
|
154
|
+
if (u.type === "element") {
|
|
155
|
+
const { tagName: n, properties: s, children: o } = u, m = r[n] || n, d = {};
|
|
156
|
+
if (s)
|
|
157
|
+
for (const [i, c] of Object.entries(s))
|
|
158
|
+
i === "className" ? d.class = Array.isArray(c) ? c.join(" ") : c : d[i] = c;
|
|
159
|
+
const v = o.map((i) => l(i, r)).filter((i) => i !== null);
|
|
160
|
+
return typeof m == "string" ? f(m, d, v) : f(m, d, () => v);
|
|
76
161
|
}
|
|
77
162
|
return null;
|
|
78
163
|
}
|
|
79
|
-
const
|
|
164
|
+
const a = B(() => {
|
|
80
165
|
if (!e.content) return null;
|
|
81
|
-
const
|
|
166
|
+
const u = P(e.content, {
|
|
82
167
|
gfm: e.gfm,
|
|
83
168
|
highlight: e.highlight,
|
|
84
169
|
math: e.math,
|
|
85
170
|
remarkPlugins: e.remarkPlugins,
|
|
86
171
|
rehypePlugins: e.rehypePlugins
|
|
87
|
-
})
|
|
88
|
-
|
|
172
|
+
}), r = {
|
|
173
|
+
...e.copyButton ? {
|
|
174
|
+
pre: A({
|
|
175
|
+
setup(n, { slots: s }) {
|
|
176
|
+
return () => f(
|
|
177
|
+
L,
|
|
178
|
+
{
|
|
179
|
+
showCopyButton: e.copyButton,
|
|
180
|
+
onCopy: (o) => t("codeCopy", o)
|
|
181
|
+
},
|
|
182
|
+
s.default
|
|
183
|
+
);
|
|
184
|
+
}
|
|
185
|
+
})
|
|
186
|
+
} : {},
|
|
187
|
+
...e.components
|
|
188
|
+
};
|
|
189
|
+
return l(u, r);
|
|
89
190
|
});
|
|
90
|
-
return () =>
|
|
191
|
+
return () => a.value ? a.value : null;
|
|
91
192
|
}
|
|
92
193
|
});
|
|
93
|
-
function
|
|
194
|
+
function j(e, t) {
|
|
94
195
|
if (e.type === "text")
|
|
95
196
|
return e.value;
|
|
96
197
|
if (e.type === "root") {
|
|
97
|
-
const
|
|
98
|
-
return
|
|
198
|
+
const l = e.children.map((a) => j(a, t)).filter((a) => a !== null);
|
|
199
|
+
return f("div", {}, l);
|
|
99
200
|
}
|
|
100
201
|
if (e.type === "element") {
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
-
const
|
|
104
|
-
return
|
|
202
|
+
const l = e, a = l.tagName, u = t == null ? void 0 : t[a], r = { ...l.properties };
|
|
203
|
+
r.className && (r.class = Array.isArray(r.className) ? r.className.join(" ") : r.className, delete r.className);
|
|
204
|
+
const n = l.children.map((s) => j(s, t)).filter((s) => s !== null);
|
|
205
|
+
return u ? f(u, r, () => n) : f(a, r, n);
|
|
105
206
|
}
|
|
106
207
|
return null;
|
|
107
208
|
}
|
|
108
|
-
function
|
|
209
|
+
function ae(e = {}) {
|
|
109
210
|
const {
|
|
110
|
-
components:
|
|
111
|
-
minUpdateInterval:
|
|
112
|
-
immediate:
|
|
113
|
-
outputRate:
|
|
114
|
-
...
|
|
115
|
-
} = e,
|
|
116
|
-
let
|
|
117
|
-
const
|
|
118
|
-
const
|
|
119
|
-
|
|
120
|
-
|
|
211
|
+
components: t,
|
|
212
|
+
minUpdateInterval: l = 16,
|
|
213
|
+
immediate: a = !1,
|
|
214
|
+
outputRate: u = "medium",
|
|
215
|
+
...r
|
|
216
|
+
} = e, n = F(r), s = new O(u), o = h(0), m = h(!1), d = h(0), v = h("idle");
|
|
217
|
+
let i = 0, c = null;
|
|
218
|
+
const y = () => {
|
|
219
|
+
const g = performance.now(), N = g - i;
|
|
220
|
+
a || N >= l ? (i = g, o.value++) : c === null && (c = requestAnimationFrame(() => {
|
|
221
|
+
c = null, i = performance.now(), o.value++;
|
|
121
222
|
}));
|
|
122
|
-
},
|
|
123
|
-
|
|
124
|
-
},
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
(
|
|
128
|
-
|
|
223
|
+
}, k = (g) => {
|
|
224
|
+
n.append(g), y();
|
|
225
|
+
}, p = (g) => {
|
|
226
|
+
n.reset(), m.value = !1, d.value = 0, v.value = "running", s.start(
|
|
227
|
+
g,
|
|
228
|
+
(N) => {
|
|
229
|
+
N && n.append(N), d.value = s.progress, y();
|
|
129
230
|
},
|
|
130
231
|
() => {
|
|
131
|
-
|
|
232
|
+
n.finish(), m.value = !0, d.value = 1, v.value = "complete", y();
|
|
132
233
|
}
|
|
133
234
|
);
|
|
134
|
-
},
|
|
135
|
-
|
|
136
|
-
},
|
|
137
|
-
|
|
138
|
-
},
|
|
139
|
-
|
|
235
|
+
}, S = () => {
|
|
236
|
+
s.pause(), v.value = s.status;
|
|
237
|
+
}, b = () => {
|
|
238
|
+
s.resume(), v.value = s.status;
|
|
239
|
+
}, H = () => {
|
|
240
|
+
s.skipToEnd(), v.value = s.status, d.value = 1;
|
|
241
|
+
}, q = () => {
|
|
242
|
+
s.stop(), n.finish(), m.value = !0, v.value = "complete", c !== null && (cancelAnimationFrame(c), c = null), o.value++;
|
|
140
243
|
}, K = () => {
|
|
141
|
-
|
|
142
|
-
}, L = () => {
|
|
143
|
-
i.stop(), l.reset(), f.value = !1, d.value = 0, m.value = "idle", o !== null && (cancelAnimationFrame(o), o = null), u.value++;
|
|
244
|
+
s.stop(), n.reset(), m.value = !1, d.value = 0, v.value = "idle", c !== null && (cancelAnimationFrame(c), c = null), o.value++;
|
|
144
245
|
};
|
|
145
|
-
|
|
146
|
-
|
|
246
|
+
U(() => {
|
|
247
|
+
s.stop(), c !== null && cancelAnimationFrame(c);
|
|
147
248
|
});
|
|
148
|
-
const $ =
|
|
249
|
+
const $ = B(() => (o.value, n.getState().blocks)), W = B(() => (o.value, n.getStats())), _ = B(() => (o.value, n.getContent()));
|
|
149
250
|
return {
|
|
150
|
-
vnode:
|
|
151
|
-
|
|
152
|
-
const
|
|
153
|
-
if (
|
|
251
|
+
vnode: B(() => {
|
|
252
|
+
o.value;
|
|
253
|
+
const g = n.getState();
|
|
254
|
+
if (g.blocks.length === 0)
|
|
154
255
|
return null;
|
|
155
|
-
const
|
|
256
|
+
const N = g.blocks.map((C) => C.hast ? f(
|
|
156
257
|
"div",
|
|
157
258
|
{
|
|
158
|
-
key:
|
|
159
|
-
"data-block-key":
|
|
160
|
-
"data-pending": !
|
|
259
|
+
key: C.key,
|
|
260
|
+
"data-block-key": C.key,
|
|
261
|
+
"data-pending": !C.stable || void 0
|
|
161
262
|
},
|
|
162
|
-
[
|
|
163
|
-
) : null).filter((
|
|
164
|
-
return
|
|
263
|
+
[j(C.hast, t)]
|
|
264
|
+
) : null).filter((C) => C !== null);
|
|
265
|
+
return f("div", { "data-streaming": !m.value }, N);
|
|
165
266
|
}),
|
|
166
|
-
append:
|
|
167
|
-
start:
|
|
168
|
-
pause:
|
|
169
|
-
resume:
|
|
170
|
-
skipToEnd:
|
|
171
|
-
reset:
|
|
172
|
-
finish:
|
|
267
|
+
append: k,
|
|
268
|
+
start: p,
|
|
269
|
+
pause: S,
|
|
270
|
+
resume: b,
|
|
271
|
+
skipToEnd: H,
|
|
272
|
+
reset: K,
|
|
273
|
+
finish: q,
|
|
173
274
|
blocks: $,
|
|
174
|
-
stats:
|
|
175
|
-
isComplete:
|
|
176
|
-
content:
|
|
275
|
+
stats: W,
|
|
276
|
+
isComplete: m,
|
|
277
|
+
content: _,
|
|
177
278
|
progress: d,
|
|
178
|
-
outputStatus:
|
|
279
|
+
outputStatus: v
|
|
179
280
|
};
|
|
180
281
|
}
|
|
181
|
-
function
|
|
282
|
+
function V(e, t, l, a, u) {
|
|
182
283
|
if (e.type === "text")
|
|
183
284
|
return e.value;
|
|
184
285
|
if (e.type === "root") {
|
|
185
|
-
const
|
|
186
|
-
return
|
|
286
|
+
const r = e.children.map((n) => V(n, t, l, a, u)).filter((n) => n !== null);
|
|
287
|
+
return f("div", {}, r);
|
|
187
288
|
}
|
|
188
289
|
if (e.type === "element") {
|
|
189
|
-
const
|
|
190
|
-
|
|
191
|
-
const
|
|
192
|
-
return
|
|
290
|
+
const r = e, n = r.tagName, s = t == null ? void 0 : t[n], o = { ...r.properties };
|
|
291
|
+
o.className && (o.class = Array.isArray(o.className) ? o.className.join(" ") : o.className, delete o.className);
|
|
292
|
+
const m = r.children.map((d) => V(d, t, l, a, u)).filter((d) => d !== null);
|
|
293
|
+
return n === "pre" && l && !s ? f(
|
|
294
|
+
L,
|
|
295
|
+
{
|
|
296
|
+
showCopyButton: u && l,
|
|
297
|
+
onCopy: a
|
|
298
|
+
},
|
|
299
|
+
() => m
|
|
300
|
+
) : s ? f(s, o, () => m) : f(n, o, m);
|
|
193
301
|
}
|
|
194
302
|
return null;
|
|
195
303
|
}
|
|
196
|
-
const E =
|
|
304
|
+
const E = A({
|
|
197
305
|
name: "StreamingMarkdown",
|
|
198
306
|
props: {
|
|
199
307
|
content: {
|
|
@@ -239,141 +347,146 @@ const E = M({
|
|
|
239
347
|
math: {
|
|
240
348
|
type: Boolean,
|
|
241
349
|
default: !1
|
|
350
|
+
},
|
|
351
|
+
copyButton: {
|
|
352
|
+
type: Boolean,
|
|
353
|
+
default: !0
|
|
242
354
|
}
|
|
243
355
|
},
|
|
244
|
-
emits: ["complete", "blockStable", "progress"],
|
|
245
|
-
setup(e, { emit:
|
|
246
|
-
|
|
356
|
+
emits: ["complete", "blockStable", "progress", "codeCopy"],
|
|
357
|
+
setup(e, { emit: t }) {
|
|
358
|
+
w(
|
|
247
359
|
() => e.math,
|
|
248
|
-
(
|
|
249
|
-
|
|
360
|
+
(i) => {
|
|
361
|
+
i && R();
|
|
250
362
|
},
|
|
251
363
|
{ immediate: !0 }
|
|
252
364
|
);
|
|
253
|
-
const
|
|
365
|
+
const l = F({
|
|
254
366
|
gfm: e.gfm,
|
|
255
367
|
highlight: e.highlight,
|
|
256
368
|
math: e.math
|
|
257
|
-
}),
|
|
258
|
-
let
|
|
259
|
-
const
|
|
260
|
-
const
|
|
261
|
-
|
|
262
|
-
d = null,
|
|
369
|
+
}), a = new O(e.outputRate), u = h(0), r = h(""), n = h(void 0), s = h([]), o = h(!1);
|
|
370
|
+
let m = 0, d = null;
|
|
371
|
+
const v = () => {
|
|
372
|
+
const i = performance.now();
|
|
373
|
+
i - m >= e.minUpdateInterval ? (m = i, u.value++) : d === null && (d = requestAnimationFrame(() => {
|
|
374
|
+
d = null, m = performance.now(), u.value++;
|
|
263
375
|
}));
|
|
264
376
|
};
|
|
265
|
-
return
|
|
377
|
+
return w(
|
|
266
378
|
() => e.source,
|
|
267
|
-
(
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
(
|
|
271
|
-
|
|
379
|
+
(i) => {
|
|
380
|
+
i !== void 0 && i !== n.value && (n.value = i, e.autoStart && i && (l.reset(), r.value = "", o.value = !1, a.start(
|
|
381
|
+
i,
|
|
382
|
+
(c) => {
|
|
383
|
+
c && (l.append(c), r.value += c), t("progress", a.progress), v();
|
|
272
384
|
},
|
|
273
385
|
() => {
|
|
274
|
-
|
|
386
|
+
l.finish(), o.value = !0, t("complete"), v();
|
|
275
387
|
}
|
|
276
388
|
)));
|
|
277
389
|
},
|
|
278
390
|
{ immediate: !0 }
|
|
279
|
-
),
|
|
391
|
+
), w(
|
|
280
392
|
() => e.content,
|
|
281
|
-
(
|
|
393
|
+
(i) => {
|
|
282
394
|
if (e.source !== void 0)
|
|
283
395
|
return;
|
|
284
|
-
const
|
|
285
|
-
if (
|
|
286
|
-
if (
|
|
287
|
-
const
|
|
288
|
-
|
|
396
|
+
const c = r.value, y = i || "";
|
|
397
|
+
if (y !== c) {
|
|
398
|
+
if (y.startsWith(c)) {
|
|
399
|
+
const p = y.slice(c.length);
|
|
400
|
+
p && l.append(p);
|
|
289
401
|
} else
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
const
|
|
293
|
-
|
|
294
|
-
const
|
|
295
|
-
|
|
296
|
-
}),
|
|
402
|
+
l.reset(), y && l.append(y);
|
|
403
|
+
r.value = y, v();
|
|
404
|
+
const k = l.getState().blocks;
|
|
405
|
+
k.forEach((p, S) => {
|
|
406
|
+
const b = s.value[S];
|
|
407
|
+
p.stable && (!b || !b.stable) && t("blockStable", p);
|
|
408
|
+
}), s.value = k;
|
|
297
409
|
}
|
|
298
410
|
},
|
|
299
411
|
{ immediate: !0 }
|
|
300
|
-
),
|
|
412
|
+
), w(
|
|
301
413
|
() => e.isComplete,
|
|
302
|
-
(
|
|
303
|
-
e.source === void 0 &&
|
|
414
|
+
(i) => {
|
|
415
|
+
e.source === void 0 && i && (l.finish(), d !== null && (cancelAnimationFrame(d), d = null), u.value++, t("complete"));
|
|
304
416
|
}
|
|
305
|
-
),
|
|
417
|
+
), w(
|
|
306
418
|
() => e.outputRate,
|
|
307
|
-
(
|
|
308
|
-
|
|
419
|
+
(i) => {
|
|
420
|
+
a.setRate(i);
|
|
309
421
|
}
|
|
310
|
-
),
|
|
311
|
-
|
|
422
|
+
), U(() => {
|
|
423
|
+
a.stop(), d !== null && cancelAnimationFrame(d);
|
|
312
424
|
}), () => {
|
|
313
|
-
|
|
314
|
-
const
|
|
425
|
+
u.value;
|
|
426
|
+
const i = l.getState(), c = e.source !== void 0 ? o.value : e.isComplete, y = (p) => t("codeCopy", p), k = i.blocks.map((p) => p.hast ? f(
|
|
315
427
|
"div",
|
|
316
428
|
{
|
|
317
|
-
key:
|
|
318
|
-
"data-block-key":
|
|
319
|
-
"data-pending": !
|
|
429
|
+
key: p.key,
|
|
430
|
+
"data-block-key": p.key,
|
|
431
|
+
"data-pending": !p.stable || void 0
|
|
320
432
|
},
|
|
321
|
-
[
|
|
322
|
-
) : null).filter((
|
|
323
|
-
return
|
|
433
|
+
[V(p.hast, e.components, e.copyButton, y, p.stable)]
|
|
434
|
+
) : null).filter((p) => p !== null);
|
|
435
|
+
return f(
|
|
324
436
|
"div",
|
|
325
437
|
{
|
|
326
438
|
class: e.class,
|
|
327
|
-
"data-streaming": !
|
|
439
|
+
"data-streaming": !c
|
|
328
440
|
},
|
|
329
|
-
|
|
441
|
+
k
|
|
330
442
|
);
|
|
331
443
|
};
|
|
332
444
|
}
|
|
333
445
|
});
|
|
334
|
-
function
|
|
446
|
+
function M(e, t = {}) {
|
|
335
447
|
if (e.type === "text")
|
|
336
448
|
return e.value;
|
|
337
449
|
if (e.type === "comment")
|
|
338
450
|
return null;
|
|
339
451
|
if (e.type === "root") {
|
|
340
|
-
const
|
|
341
|
-
return
|
|
452
|
+
const l = e.children.map((a) => M(a, t)).filter((a) => a !== null);
|
|
453
|
+
return f("div", {}, l);
|
|
342
454
|
}
|
|
343
455
|
if (e.type === "element") {
|
|
344
|
-
const { tagName:
|
|
345
|
-
if (
|
|
346
|
-
for (const [
|
|
347
|
-
|
|
348
|
-
const
|
|
349
|
-
return
|
|
456
|
+
const { tagName: l, properties: a, children: u } = e, r = t[l] || l, n = {};
|
|
457
|
+
if (a)
|
|
458
|
+
for (const [o, m] of Object.entries(a))
|
|
459
|
+
o === "className" ? n.class = Array.isArray(m) ? m.join(" ") : m : n[o] = m;
|
|
460
|
+
const s = u.map((o) => M(o, t)).filter((o) => o !== null);
|
|
461
|
+
return f(r, n, () => s);
|
|
350
462
|
}
|
|
351
463
|
return null;
|
|
352
464
|
}
|
|
353
|
-
function
|
|
354
|
-
const { components:
|
|
355
|
-
return
|
|
356
|
-
const
|
|
357
|
-
if (!
|
|
358
|
-
const
|
|
359
|
-
return
|
|
465
|
+
function re(e, t = {}) {
|
|
466
|
+
const { components: l = {}, ...a } = t;
|
|
467
|
+
return B(() => {
|
|
468
|
+
const u = e();
|
|
469
|
+
if (!u) return null;
|
|
470
|
+
const r = P(u, a);
|
|
471
|
+
return M(r, l);
|
|
360
472
|
});
|
|
361
473
|
}
|
|
362
|
-
function
|
|
363
|
-
e.component("Markdown",
|
|
474
|
+
function Y(e) {
|
|
475
|
+
e.component("Markdown", z), e.component("StreamingMarkdown", E);
|
|
364
476
|
}
|
|
365
|
-
const
|
|
366
|
-
install:
|
|
367
|
-
Markdown:
|
|
477
|
+
const le = {
|
|
478
|
+
install: Y,
|
|
479
|
+
Markdown: z,
|
|
368
480
|
StreamingMarkdown: E
|
|
369
481
|
};
|
|
370
482
|
export {
|
|
371
|
-
|
|
483
|
+
L as CodeBlock,
|
|
484
|
+
z as Markdown,
|
|
372
485
|
E as StreamingMarkdown,
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
486
|
+
le as default,
|
|
487
|
+
Y as install,
|
|
488
|
+
ne as isKatexCssLoaded,
|
|
489
|
+
R as preloadKatexCss,
|
|
490
|
+
re as useMarkdown,
|
|
491
|
+
ae as useStreamingMarkdown
|
|
379
492
|
};
|
|
@@ -50,9 +50,13 @@ export declare const StreamingMarkdown: import('vue').DefineComponent<import('vu
|
|
|
50
50
|
type: BooleanConstructor;
|
|
51
51
|
default: boolean;
|
|
52
52
|
};
|
|
53
|
+
copyButton: {
|
|
54
|
+
type: BooleanConstructor;
|
|
55
|
+
default: boolean;
|
|
56
|
+
};
|
|
53
57
|
}>, () => VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
|
54
58
|
[key: string]: any;
|
|
55
|
-
}>, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, ("progress" | "complete" | "blockStable")[], "progress" | "complete" | "blockStable", import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
59
|
+
}>, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, ("progress" | "codeCopy" | "complete" | "blockStable")[], "progress" | "codeCopy" | "complete" | "blockStable", import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
56
60
|
content: {
|
|
57
61
|
type: StringConstructor;
|
|
58
62
|
default: undefined;
|
|
@@ -97,18 +101,24 @@ export declare const StreamingMarkdown: import('vue').DefineComponent<import('vu
|
|
|
97
101
|
type: BooleanConstructor;
|
|
98
102
|
default: boolean;
|
|
99
103
|
};
|
|
104
|
+
copyButton: {
|
|
105
|
+
type: BooleanConstructor;
|
|
106
|
+
default: boolean;
|
|
107
|
+
};
|
|
100
108
|
}>> & Readonly<{
|
|
101
109
|
onProgress?: ((...args: any[]) => any) | undefined;
|
|
110
|
+
onCodeCopy?: ((...args: any[]) => any) | undefined;
|
|
102
111
|
onComplete?: ((...args: any[]) => any) | undefined;
|
|
103
112
|
onBlockStable?: ((...args: any[]) => any) | undefined;
|
|
104
113
|
}>, {
|
|
105
114
|
content: string;
|
|
106
115
|
components: MarkdownComponents;
|
|
107
116
|
class: string;
|
|
117
|
+
copyButton: boolean;
|
|
118
|
+
source: string;
|
|
108
119
|
gfm: boolean;
|
|
109
120
|
highlight: boolean;
|
|
110
121
|
math: boolean;
|
|
111
|
-
source: string;
|
|
112
122
|
minUpdateInterval: number;
|
|
113
123
|
outputRate: OutputRate;
|
|
114
124
|
isComplete: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StreamingMarkdown.d.ts","sourceRoot":"","sources":["../../src/streaming/StreamingMarkdown.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,QAAQ,EACb,KAAK,KAAK,EACX,MAAM,KAAK,CAAC;AACb,OAAO,EAML,KAAK,UAAU,EAChB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"StreamingMarkdown.d.ts","sourceRoot":"","sources":["../../src/streaming/StreamingMarkdown.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,QAAQ,EACb,KAAK,KAAK,EACX,MAAM,KAAK,CAAC;AACb,OAAO,EAML,KAAK,UAAU,EAChB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAgEnD;;GAEG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;cAaE,QAAQ,CAAC,UAAU,CAAC;;;;;;;;cAQ9B,QAAQ,CAAC,kBAAkB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cARlB,QAAQ,CAAC,UAAU,CAAC;;;;;;;;cAQ9B,QAAQ,CAAC,kBAAkB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4EAiOhD,CAAC"}
|
|
@@ -68,6 +68,8 @@ export interface StreamingMarkdownProps extends StreamingParserOptions {
|
|
|
68
68
|
minUpdateInterval?: number;
|
|
69
69
|
/** 是否自动开始输出(仅 source 模式) */
|
|
70
70
|
autoStart?: boolean;
|
|
71
|
+
/** 是否显示代码块复制按钮,默认 true */
|
|
72
|
+
copyButton?: boolean;
|
|
71
73
|
}
|
|
72
74
|
/**
|
|
73
75
|
* StreamingMarkdown 组件 Emits
|
|
@@ -79,5 +81,7 @@ export interface StreamingMarkdownEmits {
|
|
|
79
81
|
(e: 'blockStable', block: BlockInfo): void;
|
|
80
82
|
/** 进度变化事件 */
|
|
81
83
|
(e: 'progress', progress: number): void;
|
|
84
|
+
/** 代码复制事件 */
|
|
85
|
+
(e: 'codeCopy', code: string): void;
|
|
82
86
|
}
|
|
83
87
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/streaming/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AACtC,OAAO,KAAK,EAAE,sBAAsB,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACrH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAEnD;;GAEG;AACH,MAAM,WAAW,2BAA4B,SAAQ,sBAAsB;IACzE,cAAc;IACd,UAAU,CAAC,EAAE,kBAAkB,CAAC;IAChC,kCAAkC;IAClC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,6BAA6B;IAC7B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,aAAa;IACb,UAAU,CAAC,EAAE,UAAU,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC,iBAAiB;IACjB,KAAK,EAAE,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC;IACzB,iBAAiB;IACjB,MAAM,EAAE,CAAC,KAAK,EAAE,M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AC,MAAM,CAAC,CAAC;IACrB,iBAAiB;IACjB,QAAQ,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACtB,WAAW;IACX,YAAY,EAAE,GAAG,CAAC,gBAAgB,CAAC,CAAC;CACrC;AAED;;GAEG;AACH,MAAM,WAAW,sBAAuB,SAAQ,sBAAsB;IACpE,gCAAgC;IAChC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iCAAiC;IACjC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,yBAAyB;IACzB,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,gBAAgB;IAChB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,cAAc;IACd,UAAU,CAAC,EAAE,kBAAkB,CAAC;IAChC,eAAe;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kBAAkB;IAClB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,4BAA4B;IAC5B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,0BAA0B;IAC1B,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,WAAW;IACX,CAAC,CAAC,EAAE,UAAU,GAAG,IAAI,CAAC;IACtB,YAAY;IACZ,CAAC,CAAC,EAAE,aAAa,EAAE,KAAK,EAAE,SAAS,GAAG,IAAI,CAAC;IAC3C,aAAa;IACb,CAAC,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxC,aAAa;IACb,CAAC,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CACrC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -51,6 +51,8 @@ export interface MarkdownProps extends ProcessorOptions {
|
|
|
51
51
|
components?: MarkdownComponents;
|
|
52
52
|
/** 容器 class */
|
|
53
53
|
class?: string;
|
|
54
|
+
/** 是否显示代码块复制按钮,默认 true */
|
|
55
|
+
copyButton?: boolean;
|
|
54
56
|
}
|
|
55
57
|
/**
|
|
56
58
|
* useMarkdown Composable 配置
|
|
@@ -58,5 +60,7 @@ export interface MarkdownProps extends ProcessorOptions {
|
|
|
58
60
|
export interface UseMarkdownOptions extends ProcessorOptions {
|
|
59
61
|
/** 自定义组件映射 */
|
|
60
62
|
components?: MarkdownComponents;
|
|
63
|
+
/** 是否显示代码块复制按钮,默认 true */
|
|
64
|
+
copyButton?: boolean;
|
|
61
65
|
}
|
|
62
66
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AACrC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAGzD,YAAY,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErD;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,eAAe;IACf,EAAE,CAAC,EAAE,SAAS,CAAC;IACf,EAAE,CAAC,EAAE,SAAS,CAAC;IACf,EAAE,CAAC,EAAE,SAAS,CAAC;IACf,EAAE,CAAC,EAAE,SAAS,CAAC;IACf,EAAE,CAAC,EAAE,SAAS,CAAC;IACf,EAAE,CAAC,EAAE,SAAS,CAAC;IACf,SAAS;IACT,CAAC,CAAC,EAAE,SAAS,CAAC;IACd,SAAS;IACT,CAAC,CAAC,EAAE,SAAS,CAAC;IACd,SAAS;IACT,GAAG,CAAC,EAAE,SAAS,CAAC;IAChB,UAAU;IACV,GAAG,CAAC,EAAE,SAAS,CAAC;IAChB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,SAAS;IACT,EAAE,CAAC,EAAE,SAAS,CAAC;IACf,EAAE,CAAC,EAAE,SAAS,CAAC;IACf,EAAE,CAAC,EAAE,SAAS,CAAC;IACf,SAAS;IACT,UAAU,CAAC,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,CAAC;IAChB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,SAAS;IACT,EAAE,CAAC,EAAE,SAAS,CAAC;IACf,EAAE,CAAC,EAAE,SAAS,CAAC;IACf,EAAE,CAAC,EAAE,SAAS,CAAC;IACf,SAAS;IACT,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,SAAS;IACT,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,EAAE,CAAC,EAAE,SAAS,CAAC;IACf,EAAE,CAAC,EAAE,SAAS,CAAC;IACf,EAAE,CAAC,EAAE,SAAS,CAAC;IACf,UAAU;IACV,EAAE,CAAC,EAAE,SAAS,CAAC;IACf,cAAc;IACd,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAAC;CACtC;AAED;;GAEG;AACH,MAAM,WAAW,aAAc,SAAQ,gBAAgB;IACrD,mBAAmB;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc;IACd,UAAU,CAAC,EAAE,kBAAkB,CAAC;IAChC,eAAe;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,0BAA0B;IAC1B,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAmB,SAAQ,gBAAgB;IAC1D,cAAc;IACd,UAAU,CAAC,EAAE,kBAAkB,CAAC;IAChC,0BAA0B;IAC1B,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superlc/md-vue",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "基于 @superlc/md-core 的 Vue 3 Markdown 渲染组件",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -17,15 +17,9 @@
|
|
|
17
17
|
"files": [
|
|
18
18
|
"dist"
|
|
19
19
|
],
|
|
20
|
-
"scripts": {
|
|
21
|
-
"build": "vite build",
|
|
22
|
-
"dev": "vite build --watch",
|
|
23
|
-
"test": "vitest",
|
|
24
|
-
"test:run": "vitest run"
|
|
25
|
-
},
|
|
26
20
|
"dependencies": {
|
|
27
|
-
"
|
|
28
|
-
"
|
|
21
|
+
"katex": "^0.16.28",
|
|
22
|
+
"@superlc/md-core": "0.1.1"
|
|
29
23
|
},
|
|
30
24
|
"peerDependencies": {
|
|
31
25
|
"vue": ">=3.3.0"
|
|
@@ -41,5 +35,11 @@
|
|
|
41
35
|
"component",
|
|
42
36
|
"unified"
|
|
43
37
|
],
|
|
44
|
-
"license": "MIT"
|
|
45
|
-
|
|
38
|
+
"license": "MIT",
|
|
39
|
+
"scripts": {
|
|
40
|
+
"build": "vite build",
|
|
41
|
+
"dev": "vite build --watch",
|
|
42
|
+
"test": "vitest",
|
|
43
|
+
"test:run": "vitest run"
|
|
44
|
+
}
|
|
45
|
+
}
|