@matechat/core 1.2.0 → 1.3.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/Bubble/index.css +1 -1
- package/Bubble/index.js +364 -58
- package/Input/index.css +1 -1
- package/Input/index.js +118 -103
- package/MarkdownCard/index.css +1 -1
- package/MarkdownCard/index.js +155 -138
- package/Prompt/index.css +1 -1
- package/Prompt/index.js +101 -54
- package/package.json +2 -3
package/MarkdownCard/index.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import "./index.css";
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var T = (
|
|
5
|
-
import { defineComponent as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import { debounce as
|
|
9
|
-
import { getDefaultWhiteList as
|
|
10
|
-
const
|
|
11
|
-
class
|
|
2
|
+
var _ = Object.defineProperty;
|
|
3
|
+
var Y = (o, t, s) => t in o ? _(o, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : o[t] = s;
|
|
4
|
+
var T = (o, t, s) => Y(o, typeof t != "symbol" ? t + "" : t, s);
|
|
5
|
+
import { defineComponent as S, ref as f, computed as N, createElementBlock as h, openBlock as I, normalizeClass as x, renderSlot as p, createVNode as Q, createElementVNode as u, toDisplayString as P, unref as v, Transition as G, withCtx as H, createCommentVNode as B, useSlots as Z, h as m, watch as O, onMounted as X, Fragment as R, createBlock as F, resolveDynamicComponent as V } from "vue";
|
|
6
|
+
import K from "markdown-it";
|
|
7
|
+
import w from "highlight.js";
|
|
8
|
+
import { debounce as J } from "lodash-es";
|
|
9
|
+
import { getDefaultWhiteList as $, getDefaultCSSWhiteList as q, filterXSS as ee } from "xss";
|
|
10
|
+
const te = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20width='16px'%20height='16px'%20viewBox='0%200%2016%2016'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%3e%3ctitle%3e全部收起%3c/title%3e%3cg%20id='全部收起'%20stroke='none'%20stroke-width='1'%20fill='none'%20fill-rule='evenodd'%3e%3cpath%20d='M4.715694,14.4114091%20C4.910563,14.5464051%205.179987,14.5271201%205.353553,14.3535531%20L5.353553,14.3535531%20L7.99999988,11.7070001%20L10.646447,14.3535531%20L10.715694,14.4114091%20C10.910563,14.5464051%2011.179987,14.5271201%2011.353553,14.3535531%20C11.548816,14.1582911%2011.548816,13.8417091%2011.353553,13.6464471%20L11.353553,13.6464471%20L8.353553,10.6464471%20L8.284306,10.5885911%20C8.089437,10.4535951%207.820013,10.4728801%207.646447,10.6464471%20L7.646447,10.6464471%20L4.646447,13.6464471%20L4.588591,13.7156941%20C4.453595,13.9105631%204.47288,14.1799871%204.646447,14.3535531%20L4.646447,14.3535531%20L4.715694,14.4114091%20Z%20M14.5,7.50000012%20C14.776142,7.50000012%2015,7.72385812%2015,8.00000012%20C15,8.27614212%2014.776142,8.50000012%2014.5,8.50000012%20L1.5,8.50000012%20C1.223858,8.50000012%201,8.27614212%201,8.00000012%20C1,7.72385812%201.223858,7.50000012%201.5,7.50000012%20L14.5,7.50000012%20Z%20M8.284306,5.41140912%20L8.353553,5.35355312%20L11.353553,2.35355312%20C11.548816,2.15829112%2011.548816,1.84170912%2011.353553,1.64644712%20C11.179987,1.47288012%2010.910563,1.45359512%2010.715694,1.58859112%20L10.646447,1.64644712%20L7.99999988,4.29300012%20L5.353553,1.64644712%20C5.179987,1.47288012%204.910563,1.45359512%204.715694,1.58859112%20L4.646447,1.64644712%20C4.47288,1.82001312%204.453595,2.08943712%204.588591,2.28430612%20L4.646447,2.35355312%20L7.646447,5.35355312%20C7.820013,5.52712012%208.089437,5.54640512%208.284306,5.41140912%20Z'%20id='形状结合'%20fill='%2371757F'%20fill-rule='nonzero'%3e%3c/path%3e%3c/g%3e%3c/svg%3e", se = "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGlu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DggNjAzLjkyMDQ0OSwyMDguNTk0ODg4IDYwMy45OTMxMzMsMjA5LjM1NTU0IEw2MDQsMjA5LjUgTDYwNCwyMTUgTDYwNC41LDIxNSBDNjA0Ljc0NTQ2LDIxNSA2MDQuOTQ5NjA4LDIxNC44MjMxMjUgNjA0Ljk5MTk0NCwyMTQuNTg5ODc2IEw2MDUsMjE0LjUgTDYwNSwyMDcuNSBDNjA1LDIwNy4yNTQ1NCA2MDQuODIzMTI1LDIwNy4wNTAzOTIgNjA0LjU4OTg3NiwyMDcuMDA4MDU2IEw2MDQuNSwyMDcgWiIgaWQ9IuW9oueKtue7k+WQiCIgZmlsbD0iIzcxNzU3RiIgZmlsbC1ydWxlPSJub256ZXJvIj48L3BhdGg+CiAgICAgICAgPC9nPgogICAgPC9nPgo8L3N2Zz4=", ie = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20width='16px'%20height='16px'%20viewBox='0%200%2016%2016'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%3e%3ctitle%3estatus/whiteBG/correct%3c/title%3e%3cdesc%3eCreated%20with%20Sketch.%3c/desc%3e%3cdefs%3e%3cpolygon%20id='path-1'%20points='6.53553391%209.77817459%2012.1923882%204.12132034%2013.6066017%205.53553391%206.53553391%2012.6066017%203%209.07106781%204.41421356%207.65685425%206.53553391%209.77817459'%3e%3c/polygon%3e%3c/defs%3e%3cg%20id='status/whiteBG/correct'%20stroke='none'%20stroke-width='1'%20fill='none'%20fill-rule='evenodd'%3e%3cmask%20id='mask-2'%20fill='white'%3e%3cuse%20xlink:href='%23path-1'%3e%3c/use%3e%3c/mask%3e%3cuse%20id='Mask'%20fill='%233DCCA6'%20xlink:href='%23path-1'%3e%3c/use%3e%3c/g%3e%3c/svg%3e";
|
|
11
|
+
class E {
|
|
12
12
|
constructor() {
|
|
13
|
-
T(this, "xssWhiteList",
|
|
14
|
-
T(this, "cssWhiteList",
|
|
13
|
+
T(this, "xssWhiteList", $());
|
|
14
|
+
T(this, "cssWhiteList", q());
|
|
15
15
|
this.setDefaultXss();
|
|
16
16
|
}
|
|
17
17
|
setDefaultXss() {
|
|
18
18
|
this.xssWhiteList.input = ["type", "checked", "disabled", "class"], this.xssWhiteList.label = ["for"], this.xssWhiteList.ul = ["class"], this.xssWhiteList.div = ["class"], this.xssWhiteList.a = ["href", "class", "target", "name"], this.xssWhiteList.ol = ["start"], this.xssWhiteList.p = ["class"], this.xssWhiteList.span = ["style", "class", "title", "id"], this.xssWhiteList.svg = ["style", "class", "width", "height", "viewbox", "preserveaspectratio", "id", "fill", "stroke"], this.xssWhiteList.path = ["style", "class", "d", "id", "fill", "stroke"], this.xssWhiteList.th = ["style"], this.xssWhiteList.td = ["style"];
|
|
19
19
|
}
|
|
20
|
-
onIgnoreTagAttr(t, s,
|
|
21
|
-
if (!
|
|
22
|
-
return s + "=" +
|
|
20
|
+
onIgnoreTagAttr(t, s, l, n) {
|
|
21
|
+
if (!n && (s === "id" || t === "span" && s === "style"))
|
|
22
|
+
return s + "=" + l;
|
|
23
23
|
}
|
|
24
24
|
getXssWhiteList() {
|
|
25
25
|
return this.xssWhiteList;
|
|
@@ -32,8 +32,14 @@ class b {
|
|
|
32
32
|
s.value === null ? delete this.xssWhiteList[s.key] : this.xssWhiteList[s.key] = s.value;
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
|
+
setMdPlugins(t, s) {
|
|
36
|
+
t && t.length && t.forEach((l) => {
|
|
37
|
+
const { plugin: n, opts: L } = l;
|
|
38
|
+
s.use(n, L);
|
|
39
|
+
});
|
|
40
|
+
}
|
|
35
41
|
filterHtml(t) {
|
|
36
|
-
return
|
|
42
|
+
return ee(t, {
|
|
37
43
|
whiteList: this.xssWhiteList,
|
|
38
44
|
onIgnoreTagAttr: this.onIgnoreTagAttr,
|
|
39
45
|
css: {
|
|
@@ -47,16 +53,16 @@ class b {
|
|
|
47
53
|
});
|
|
48
54
|
}
|
|
49
55
|
}
|
|
50
|
-
const
|
|
56
|
+
const oe = {
|
|
51
57
|
key: 0,
|
|
52
58
|
class: "mc-code-block-header"
|
|
53
|
-
},
|
|
59
|
+
}, ne = { class: "mc-code-lang" }, ce = { class: "mc-code-block-actions" }, ae = {
|
|
54
60
|
key: 0,
|
|
55
|
-
src:
|
|
56
|
-
},
|
|
61
|
+
src: se
|
|
62
|
+
}, re = {
|
|
57
63
|
key: 1,
|
|
58
|
-
src:
|
|
59
|
-
},
|
|
64
|
+
src: ie
|
|
65
|
+
}, le = { key: 0 }, de = { key: 0 }, ge = ["innerHTML"], Me = /* @__PURE__ */ S({
|
|
60
66
|
__name: "CodeBlock",
|
|
61
67
|
props: {
|
|
62
68
|
code: {
|
|
@@ -76,98 +82,98 @@ const te = {
|
|
|
76
82
|
default: "light"
|
|
77
83
|
}
|
|
78
84
|
},
|
|
79
|
-
setup(
|
|
80
|
-
const t =
|
|
81
|
-
if (t.language &&
|
|
85
|
+
setup(o) {
|
|
86
|
+
const t = o, s = new E(), l = f(!0), n = f(!1), L = N(() => {
|
|
87
|
+
if (t.language && w.getLanguage(t.language))
|
|
82
88
|
try {
|
|
83
|
-
return
|
|
89
|
+
return w.highlight(t.code, { language: t.language }).value;
|
|
84
90
|
} catch {
|
|
85
91
|
}
|
|
86
92
|
return s.filterHtml(t.code);
|
|
87
|
-
}),
|
|
88
|
-
|
|
89
|
-
},
|
|
90
|
-
const
|
|
93
|
+
}), a = () => {
|
|
94
|
+
l.value = !l.value;
|
|
95
|
+
}, M = J((e) => {
|
|
96
|
+
const d = e.target;
|
|
91
97
|
if (navigator.clipboard)
|
|
92
98
|
navigator.clipboard.writeText(t.code);
|
|
93
99
|
else {
|
|
94
|
-
const
|
|
95
|
-
|
|
100
|
+
const r = document.createElement("textarea");
|
|
101
|
+
r.style.position = "fixed", r.style.top = "-9999px", r.style.left = "-9999px", r.style.zIndex = "-1", r.value = t.code, document.body.appendChild(r), r.select(), document.execCommand("copy"), document.body.removeChild(r);
|
|
96
102
|
}
|
|
97
|
-
|
|
98
|
-
|
|
103
|
+
d.classList.remove("icon-copy-new"), n.value = !0, setTimeout(() => {
|
|
104
|
+
n.value = !1;
|
|
99
105
|
}, 1500);
|
|
100
|
-
}, 300),
|
|
106
|
+
}, 300), y = (e) => {
|
|
101
107
|
e.dataset || (e.dataset = {}), e.style.height && (e.dataset.height = e.style.height), e.style.maxHeight = 0;
|
|
102
|
-
},
|
|
108
|
+
}, C = (e) => {
|
|
103
109
|
requestAnimationFrame(() => {
|
|
104
110
|
e.dataset.oldOverflow = e.style.overflow, e.dataset.height ? e.style.maxHeight = e.dataset.height : e.scrollHeight !== 0 ? e.style.maxHeight = `${e.scrollHeight}px` : e.style.maxHeight = 0, e.style.overflow = "hidden";
|
|
105
111
|
});
|
|
106
|
-
},
|
|
112
|
+
}, A = (e) => {
|
|
107
113
|
e.style.maxHeight = "", e.style.overflow = e.dataset.oldOverflow;
|
|
108
|
-
},
|
|
114
|
+
}, c = (e) => {
|
|
109
115
|
e.dataset || (e.dataset = {}), e.dataset.oldOverflow = e.style.overflow, e.style.maxHeight = `${e.scrollHeight}px`, e.style.overflow = "hidden";
|
|
110
|
-
},
|
|
116
|
+
}, i = (e) => {
|
|
111
117
|
e.scrollHeight !== 0 && (e.style.maxHeight = 0);
|
|
112
|
-
},
|
|
118
|
+
}, D = (e) => {
|
|
113
119
|
e.style.maxHeight = "", e.style.overflow = e.dataset.oldOverflow;
|
|
114
|
-
},
|
|
115
|
-
return (e,
|
|
120
|
+
}, g = N(() => t.theme === "dark" ? "mc-code-block-dark" : "mc-code-block-light");
|
|
121
|
+
return (e, d) => (I(), h(
|
|
116
122
|
"div",
|
|
117
123
|
{
|
|
118
|
-
class:
|
|
124
|
+
class: x(["mc-code-block", g.value])
|
|
119
125
|
},
|
|
120
126
|
[
|
|
121
|
-
e.$slots.header ?
|
|
122
|
-
|
|
127
|
+
e.$slots.header ? p(e.$slots, "header", { key: 1 }, void 0, !0) : (I(), h("div", oe, [
|
|
128
|
+
u(
|
|
123
129
|
"span",
|
|
124
|
-
|
|
125
|
-
|
|
130
|
+
ne,
|
|
131
|
+
P(o.language),
|
|
126
132
|
1
|
|
127
133
|
/* TEXT */
|
|
128
134
|
),
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
135
|
+
p(e.$slots, "actions", {}, () => [
|
|
136
|
+
u("div", ce, [
|
|
137
|
+
u("div", {
|
|
132
138
|
class: "mc-action-btn mc-toggle-btn",
|
|
133
|
-
onClick:
|
|
134
|
-
},
|
|
135
|
-
|
|
139
|
+
onClick: a
|
|
140
|
+
}, d[1] || (d[1] = [
|
|
141
|
+
u(
|
|
136
142
|
"img",
|
|
137
|
-
{ src:
|
|
143
|
+
{ src: te },
|
|
138
144
|
null,
|
|
139
145
|
-1
|
|
140
146
|
/* HOISTED */
|
|
141
147
|
)
|
|
142
148
|
])),
|
|
143
|
-
|
|
149
|
+
u("div", {
|
|
144
150
|
class: "mc-action-btn mc-copy-btn",
|
|
145
|
-
onClick:
|
|
146
|
-
(...
|
|
151
|
+
onClick: d[0] || (d[0] = //@ts-ignore
|
|
152
|
+
(...r) => v(M) && v(M)(...r))
|
|
147
153
|
}, [
|
|
148
|
-
|
|
154
|
+
n.value ? (I(), h("img", re)) : (I(), h("img", ae))
|
|
149
155
|
])
|
|
150
156
|
])
|
|
151
157
|
], !0)
|
|
152
158
|
])),
|
|
153
|
-
|
|
159
|
+
Q(G, {
|
|
154
160
|
name: "collapse-transition",
|
|
155
|
-
onBeforeEnter:
|
|
156
|
-
onEnter:
|
|
157
|
-
onAfterEnter:
|
|
158
|
-
onBeforeLeave:
|
|
159
|
-
onLeave:
|
|
160
|
-
onAfterLeave:
|
|
161
|
+
onBeforeEnter: y,
|
|
162
|
+
onEnter: C,
|
|
163
|
+
onAfterEnter: A,
|
|
164
|
+
onBeforeLeave: c,
|
|
165
|
+
onLeave: i,
|
|
166
|
+
onAfterLeave: D
|
|
161
167
|
}, {
|
|
162
|
-
default:
|
|
163
|
-
|
|
164
|
-
e.$slots.content ?
|
|
165
|
-
|
|
166
|
-
class:
|
|
167
|
-
innerHTML:
|
|
168
|
-
}, null, 10,
|
|
168
|
+
default: H(() => [
|
|
169
|
+
l.value ? (I(), h("div", le, [
|
|
170
|
+
e.$slots.content ? p(e.$slots, "content", { key: 1 }, void 0, !0) : (I(), h("pre", de, [
|
|
171
|
+
u("code", {
|
|
172
|
+
class: x(`hljs language-${o.language}`),
|
|
173
|
+
innerHTML: L.value
|
|
174
|
+
}, null, 10, ge)
|
|
169
175
|
]))
|
|
170
|
-
])) :
|
|
176
|
+
])) : B("v-if", !0)
|
|
171
177
|
]),
|
|
172
178
|
_: 3
|
|
173
179
|
/* FORWARDED */
|
|
@@ -177,12 +183,12 @@ const te = {
|
|
|
177
183
|
/* CLASS */
|
|
178
184
|
));
|
|
179
185
|
}
|
|
180
|
-
}),
|
|
181
|
-
const s =
|
|
182
|
-
for (const [
|
|
183
|
-
s[
|
|
186
|
+
}), U = (o, t) => {
|
|
187
|
+
const s = o.__vccOpts || o;
|
|
188
|
+
for (const [l, n] of t)
|
|
189
|
+
s[l] = n;
|
|
184
190
|
return s;
|
|
185
|
-
},
|
|
191
|
+
}, Ie = /* @__PURE__ */ U(Me, [["__scopeId", "data-v-de46b77a"]]), he = {
|
|
186
192
|
content: {
|
|
187
193
|
type: String,
|
|
188
194
|
default: ""
|
|
@@ -191,6 +197,10 @@ const te = {
|
|
|
191
197
|
type: Object,
|
|
192
198
|
default: () => ({})
|
|
193
199
|
},
|
|
200
|
+
mdPlugins: {
|
|
201
|
+
type: Array,
|
|
202
|
+
default: () => []
|
|
203
|
+
},
|
|
194
204
|
customXssRules: {
|
|
195
205
|
type: Array,
|
|
196
206
|
default: () => []
|
|
@@ -199,117 +209,124 @@ const te = {
|
|
|
199
209
|
type: String,
|
|
200
210
|
default: "light"
|
|
201
211
|
}
|
|
202
|
-
},
|
|
212
|
+
}, ue = /* @__PURE__ */ S({
|
|
203
213
|
__name: "mdCard",
|
|
204
|
-
props:
|
|
205
|
-
|
|
206
|
-
|
|
214
|
+
props: he,
|
|
215
|
+
emits: ["afterMdtInit"],
|
|
216
|
+
setup(o, { expose: t, emit: s }) {
|
|
217
|
+
const l = new E(), n = o, L = s, a = Z(), M = K({
|
|
207
218
|
breaks: !0,
|
|
208
219
|
linkify: !0,
|
|
209
220
|
html: !0,
|
|
210
|
-
highlight: (
|
|
211
|
-
if (
|
|
221
|
+
highlight: (c, i) => {
|
|
222
|
+
if (i && w.getLanguage(i))
|
|
212
223
|
try {
|
|
213
|
-
return
|
|
224
|
+
return w.highlight(c, { language: i }).value;
|
|
214
225
|
} catch {
|
|
215
226
|
}
|
|
216
227
|
return "";
|
|
217
228
|
},
|
|
218
|
-
...
|
|
229
|
+
...n.mdOptions
|
|
219
230
|
});
|
|
220
|
-
|
|
221
|
-
const
|
|
222
|
-
const
|
|
231
|
+
M.renderer.rules.fence = (c, i) => `<!----MC_MARKDOWN_CODE_BLOCK_${i}---->`;
|
|
232
|
+
const y = (c, i, D) => {
|
|
233
|
+
const g = {
|
|
223
234
|
actions: () => {
|
|
224
|
-
var
|
|
225
|
-
return (
|
|
235
|
+
var e;
|
|
236
|
+
return (e = a.actions) == null ? void 0 : e.call(a, {
|
|
226
237
|
codeBlockData: {
|
|
227
|
-
code:
|
|
228
|
-
language:
|
|
238
|
+
code: i,
|
|
239
|
+
language: c
|
|
229
240
|
}
|
|
230
241
|
});
|
|
231
242
|
}
|
|
232
243
|
};
|
|
233
|
-
return
|
|
234
|
-
var
|
|
235
|
-
return (
|
|
244
|
+
return a.header && (g.header = () => {
|
|
245
|
+
var e;
|
|
246
|
+
return (e = a.header) == null ? void 0 : e.call(a, {
|
|
236
247
|
codeBlockData: {
|
|
237
|
-
code:
|
|
238
|
-
language:
|
|
248
|
+
code: i,
|
|
249
|
+
language: c
|
|
239
250
|
}
|
|
240
251
|
});
|
|
241
|
-
}),
|
|
242
|
-
var
|
|
243
|
-
return (
|
|
252
|
+
}), a.content && (g.content = () => {
|
|
253
|
+
var e;
|
|
254
|
+
return (e = a.content) == null ? void 0 : e.call(a, {
|
|
244
255
|
codeBlockData: {
|
|
245
|
-
code:
|
|
246
|
-
language:
|
|
256
|
+
code: i,
|
|
257
|
+
language: c
|
|
247
258
|
}
|
|
248
259
|
});
|
|
249
|
-
}), m(
|
|
250
|
-
language:
|
|
251
|
-
code:
|
|
260
|
+
}), m(Ie, {
|
|
261
|
+
language: c,
|
|
262
|
+
code: i,
|
|
252
263
|
blockIndex: D,
|
|
253
|
-
theme:
|
|
254
|
-
},
|
|
255
|
-
},
|
|
256
|
-
const
|
|
264
|
+
theme: n.theme
|
|
265
|
+
}, g);
|
|
266
|
+
}, C = N(() => {
|
|
267
|
+
const c = M.parse(n.content, {}), i = M.render(n.content);
|
|
257
268
|
return {
|
|
258
269
|
name: "MarkdownRenderer",
|
|
259
270
|
render() {
|
|
260
271
|
const D = document.createElement("div");
|
|
261
|
-
D.innerHTML =
|
|
262
|
-
const
|
|
263
|
-
let
|
|
264
|
-
const
|
|
265
|
-
let
|
|
266
|
-
for (; (
|
|
267
|
-
|
|
272
|
+
D.innerHTML = i;
|
|
273
|
+
const g = [];
|
|
274
|
+
let e = 0, d;
|
|
275
|
+
const r = /<!----MC_MARKDOWN_CODE_BLOCK_(\d+)---->/g;
|
|
276
|
+
let j = 0;
|
|
277
|
+
for (; (d = r.exec(i)) !== null; ) {
|
|
278
|
+
d.index > e && g.push(m(
|
|
268
279
|
"div",
|
|
269
280
|
{
|
|
270
|
-
innerHTML:
|
|
281
|
+
innerHTML: i.slice(e, d.index)
|
|
271
282
|
}
|
|
272
283
|
));
|
|
273
|
-
const
|
|
274
|
-
|
|
284
|
+
const k = c[parseInt(d[1])], W = k.info || "", z = k.content;
|
|
285
|
+
g.push(y(W, z, j)), j++, e = r.lastIndex;
|
|
275
286
|
}
|
|
276
|
-
return
|
|
277
|
-
innerHTML:
|
|
278
|
-
})), m("div",
|
|
287
|
+
return e < i.length && g.push(m("div", {
|
|
288
|
+
innerHTML: i.slice(e)
|
|
289
|
+
})), m("div", g);
|
|
279
290
|
}
|
|
280
291
|
};
|
|
281
292
|
});
|
|
282
|
-
|
|
283
|
-
|
|
293
|
+
O(() => n.customXssRules, (c) => {
|
|
294
|
+
l.setCustomXssRules(c);
|
|
295
|
+
}), O(() => n.mdPlugins, (c) => {
|
|
296
|
+
l.setMdPlugins(c, M);
|
|
297
|
+
}, {
|
|
298
|
+
immediate: !0
|
|
284
299
|
});
|
|
285
|
-
const A =
|
|
286
|
-
return
|
|
287
|
-
|
|
288
|
-
}), (
|
|
289
|
-
|
|
300
|
+
const A = N(() => n.theme === "dark" ? "mc-markdown-render-dark" : "mc-markdown-render-light");
|
|
301
|
+
return X(() => {
|
|
302
|
+
L("afterMdtInit", M);
|
|
303
|
+
}), t({
|
|
304
|
+
mdt: M
|
|
305
|
+
}), (c, i) => (I(), h(
|
|
306
|
+
R,
|
|
290
307
|
null,
|
|
291
308
|
[
|
|
292
|
-
|
|
309
|
+
u(
|
|
293
310
|
"div",
|
|
294
311
|
{
|
|
295
|
-
class:
|
|
312
|
+
class: x(["mc-markdown-render", A.value])
|
|
296
313
|
},
|
|
297
314
|
[
|
|
298
|
-
(
|
|
315
|
+
(I(), F(V(C.value)))
|
|
299
316
|
],
|
|
300
317
|
2
|
|
301
318
|
/* CLASS */
|
|
302
319
|
),
|
|
303
|
-
|
|
320
|
+
B("v-if", !0)
|
|
304
321
|
],
|
|
305
322
|
64
|
|
306
323
|
/* STABLE_FRAGMENT */
|
|
307
324
|
));
|
|
308
325
|
}
|
|
309
|
-
}),
|
|
310
|
-
|
|
311
|
-
|
|
326
|
+
}), b = /* @__PURE__ */ U(ue, [["__scopeId", "data-v-04a80a4e"]]);
|
|
327
|
+
b.install = (o) => {
|
|
328
|
+
o.component("McMarkdownCard", b);
|
|
312
329
|
};
|
|
313
330
|
export {
|
|
314
|
-
|
|
331
|
+
b as McMarkdownCard
|
|
315
332
|
};
|
package/Prompt/index.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.mc-prompt-item[data-v-
|
|
1
|
+
.mc-prompt-icon{display:inline-block;color:var(--devui-icon-fill, #71757f)}.mc-prompt-icon i{display:block;transition:all var(--devui-animation-duration-slow, .3s) var(--devui-animation-ease-in-out-smooth, cubic-bezier(.645, .045, .355, 1))}.mc-prompt-icon img{display:block}.mc-prompt-item[data-v-d5f7f6f9]{display:flex;gap:8px}.mc-prompt-item .mc-prompt-item-icon.no-description[data-v-d5f7f6f9]{display:flex;align-items:center}.mc-prompt-item .mc-prompt-item-content[data-v-d5f7f6f9]{display:flex;flex-direction:column;gap:4px}.mc-prompt-item .mc-prompt-item-content .mc-prompt-item-label[data-v-d5f7f6f9]{font-weight:700}.mc-prompt-item .mc-prompt-item-content .mc-prompt-item-description[data-v-d5f7f6f9]{color:var(--devui-aide-text, #71757f)}
|