@matechat/core 1.3.0 → 1.4.0-alpha.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.
@@ -1,25 +1,20 @@
1
1
  import "./index.css";
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";
2
+ import { defineComponent as E, ref as O, computed as y, createElementBlock as u, openBlock as I, normalizeClass as x, renderSlot as T, createVNode as Q, createElementVNode as D, toDisplayString as P, unref as b, Transition as G, withCtx as H, createCommentVNode as U, useSlots as Z, h as w, watch as S, onMounted as X, Fragment as R, createBlock as F, resolveDynamicComponent as V } from "vue";
3
+ import C from "highlight.js";
6
4
  import K from "markdown-it";
7
- import w from "highlight.js";
8
5
  import { debounce as J } from "lodash-es";
9
6
  import { getDefaultWhiteList as $, getDefaultCSSWhiteList as q, filterXSS as ee } from "xss";
10
7
  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,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iMTZweCIgaGVpZ2h0PSIxNnB4IiB2aWV3Qm94PSIwIDAgMTYgMTYiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94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jUgTDYwNSwyMDcuNSBDNjA1LDIwNy4yNTQ1NCA2MDQuODIzMTI1LDIwNy4wNTAzOTIgNjA0LjU4OTg3NiwyMDcuMDA4MDU2IEw2MDQuNSwyMDcgWiIgaWQ9IuW9oueKtue7k+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 {
8
+ class W {
12
9
  constructor() {
13
- T(this, "xssWhiteList", $());
14
- T(this, "cssWhiteList", q());
15
- this.setDefaultXss();
10
+ this.xssWhiteList = $(), this.cssWhiteList = q(), this.setDefaultXss();
16
11
  }
17
12
  setDefaultXss() {
18
13
  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
14
  }
20
- onIgnoreTagAttr(t, s, l, n) {
21
- if (!n && (s === "id" || t === "span" && s === "style"))
22
- return s + "=" + l;
15
+ onIgnoreTagAttr(t, o, r, s) {
16
+ if (!s && (o === "id" || t === "span" && o === "style"))
17
+ return o + "=" + r;
23
18
  }
24
19
  getXssWhiteList() {
25
20
  return this.xssWhiteList;
@@ -28,14 +23,14 @@ class E {
28
23
  this.xssWhiteList = t;
29
24
  }
30
25
  setCustomXssRules(t) {
31
- t && t.forEach((s) => {
32
- s.value === null ? delete this.xssWhiteList[s.key] : this.xssWhiteList[s.key] = s.value;
26
+ t && t.forEach((o) => {
27
+ o.value === null ? delete this.xssWhiteList[o.key] : this.xssWhiteList[o.key] = o.value;
33
28
  });
34
29
  }
35
- setMdPlugins(t, s) {
36
- t && t.length && t.forEach((l) => {
37
- const { plugin: n, opts: L } = l;
38
- s.use(n, L);
30
+ setMdPlugins(t, o) {
31
+ t && t.length && t.forEach((r) => {
32
+ const { plugin: s, opts: m } = r;
33
+ o.use(s, m);
39
34
  });
40
35
  }
41
36
  filterHtml(t) {
@@ -62,7 +57,7 @@ const oe = {
62
57
  }, re = {
63
58
  key: 1,
64
59
  src: ie
65
- }, le = { key: 0 }, de = { key: 0 }, ge = ["innerHTML"], Me = /* @__PURE__ */ S({
60
+ }, le = { key: 0 }, de = { key: 0 }, ge = ["innerHTML"], Me = /* @__PURE__ */ E({
66
61
  __name: "CodeBlock",
67
62
  props: {
68
63
  code: {
@@ -82,63 +77,63 @@ const oe = {
82
77
  default: "light"
83
78
  }
84
79
  },
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))
80
+ setup(l) {
81
+ const t = l, o = new W(), r = O(!0), s = O(!1), m = y(() => {
82
+ if (t.language && C.getLanguage(t.language))
88
83
  try {
89
- return w.highlight(t.code, { language: t.language }).value;
84
+ return C.highlight(t.code, { language: t.language }).value;
90
85
  } catch {
91
86
  }
92
- return s.filterHtml(t.code);
87
+ return o.filterHtml(t.code);
93
88
  }), a = () => {
94
- l.value = !l.value;
89
+ r.value = !r.value;
95
90
  }, M = J((e) => {
96
- const d = e.target;
91
+ const g = e.target;
97
92
  if (navigator.clipboard)
98
93
  navigator.clipboard.writeText(t.code);
99
94
  else {
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);
95
+ const c = document.createElement("textarea");
96
+ c.style.position = "fixed", c.style.top = "-9999px", c.style.left = "-9999px", c.style.zIndex = "-1", c.value = t.code, document.body.appendChild(c), c.select(), document.execCommand("copy"), document.body.removeChild(c);
102
97
  }
103
- d.classList.remove("icon-copy-new"), n.value = !0, setTimeout(() => {
104
- n.value = !1;
98
+ g.classList.remove("icon-copy-new"), s.value = !0, setTimeout(() => {
99
+ s.value = !1;
105
100
  }, 1500);
106
- }, 300), y = (e) => {
101
+ }, 300), A = (e) => {
107
102
  e.dataset || (e.dataset = {}), e.style.height && (e.dataset.height = e.style.height), e.style.maxHeight = 0;
108
- }, C = (e) => {
103
+ }, p = (e) => {
109
104
  requestAnimationFrame(() => {
110
105
  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";
111
106
  });
112
- }, A = (e) => {
107
+ }, k = (e) => {
113
108
  e.style.maxHeight = "", e.style.overflow = e.dataset.oldOverflow;
114
- }, c = (e) => {
115
- e.dataset || (e.dataset = {}), e.dataset.oldOverflow = e.style.overflow, e.style.maxHeight = `${e.scrollHeight}px`, e.style.overflow = "hidden";
116
109
  }, i = (e) => {
110
+ e.dataset || (e.dataset = {}), e.dataset.oldOverflow = e.style.overflow, e.style.maxHeight = `${e.scrollHeight}px`, e.style.overflow = "hidden";
111
+ }, n = (e) => {
117
112
  e.scrollHeight !== 0 && (e.style.maxHeight = 0);
118
- }, D = (e) => {
113
+ }, d = (e) => {
119
114
  e.style.maxHeight = "", e.style.overflow = e.dataset.oldOverflow;
120
- }, g = N(() => t.theme === "dark" ? "mc-code-block-dark" : "mc-code-block-light");
121
- return (e, d) => (I(), h(
115
+ }, h = y(() => t.theme === "dark" ? "mc-code-block-dark" : "mc-code-block-light");
116
+ return (e, g) => (I(), u(
122
117
  "div",
123
118
  {
124
- class: x(["mc-code-block", g.value])
119
+ class: x(["mc-code-block", h.value])
125
120
  },
126
121
  [
127
- e.$slots.header ? p(e.$slots, "header", { key: 1 }, void 0, !0) : (I(), h("div", oe, [
128
- u(
122
+ e.$slots.header ? T(e.$slots, "header", { key: 1 }, void 0, !0) : (I(), u("div", oe, [
123
+ D(
129
124
  "span",
130
125
  ne,
131
- P(o.language),
126
+ P(l.language),
132
127
  1
133
128
  /* TEXT */
134
129
  ),
135
- p(e.$slots, "actions", {}, () => [
136
- u("div", ce, [
137
- u("div", {
130
+ T(e.$slots, "actions", {}, () => [
131
+ D("div", ce, [
132
+ D("div", {
138
133
  class: "mc-action-btn mc-toggle-btn",
139
134
  onClick: a
140
- }, d[1] || (d[1] = [
141
- u(
135
+ }, g[1] || (g[1] = [
136
+ D(
142
137
  "img",
143
138
  { src: te },
144
139
  null,
@@ -146,34 +141,34 @@ const oe = {
146
141
  /* HOISTED */
147
142
  )
148
143
  ])),
149
- u("div", {
144
+ D("div", {
150
145
  class: "mc-action-btn mc-copy-btn",
151
- onClick: d[0] || (d[0] = //@ts-ignore
152
- (...r) => v(M) && v(M)(...r))
146
+ onClick: g[0] || (g[0] = //@ts-ignore
147
+ (...c) => b(M) && b(M)(...c))
153
148
  }, [
154
- n.value ? (I(), h("img", re)) : (I(), h("img", ae))
149
+ s.value ? (I(), u("img", re)) : (I(), u("img", ae))
155
150
  ])
156
151
  ])
157
152
  ], !0)
158
153
  ])),
159
154
  Q(G, {
160
155
  name: "collapse-transition",
161
- onBeforeEnter: y,
162
- onEnter: C,
163
- onAfterEnter: A,
164
- onBeforeLeave: c,
165
- onLeave: i,
166
- onAfterLeave: D
156
+ onBeforeEnter: A,
157
+ onEnter: p,
158
+ onAfterEnter: k,
159
+ onBeforeLeave: i,
160
+ onLeave: n,
161
+ onAfterLeave: d
167
162
  }, {
168
163
  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
164
+ r.value ? (I(), u("div", le, [
165
+ e.$slots.content ? T(e.$slots, "content", { key: 1 }, void 0, !0) : (I(), u("pre", de, [
166
+ D("code", {
167
+ class: x(`hljs language-${l.language}`),
168
+ innerHTML: m.value
174
169
  }, null, 10, ge)
175
170
  ]))
176
- ])) : B("v-if", !0)
171
+ ])) : U("v-if", !0)
177
172
  ]),
178
173
  _: 3
179
174
  /* FORWARDED */
@@ -183,16 +178,26 @@ const oe = {
183
178
  /* CLASS */
184
179
  ));
185
180
  }
186
- }), U = (o, t) => {
187
- const s = o.__vccOpts || o;
188
- for (const [l, n] of t)
189
- s[l] = n;
190
- return s;
191
- }, Ie = /* @__PURE__ */ U(Me, [["__scopeId", "data-v-de46b77a"]]), he = {
181
+ }), z = (l, t) => {
182
+ const o = l.__vccOpts || l;
183
+ for (const [r, s] of t)
184
+ o[r] = s;
185
+ return o;
186
+ }, he = /* @__PURE__ */ z(Me, [["__scopeId", "data-v-675aa633"]]), Ie = {
192
187
  content: {
193
188
  type: String,
194
189
  default: ""
195
190
  },
191
+ enableThink: {
192
+ type: Boolean,
193
+ default: !1
194
+ },
195
+ thinkOptions: {
196
+ customClass: {
197
+ type: String,
198
+ default: ""
199
+ }
200
+ },
196
201
  mdOptions: {
197
202
  type: Object,
198
203
  default: () => ({})
@@ -209,124 +214,144 @@ const oe = {
209
214
  type: String,
210
215
  default: "light"
211
216
  }
212
- }, ue = /* @__PURE__ */ S({
217
+ }, ue = /* @__PURE__ */ E({
213
218
  __name: "mdCard",
214
- props: he,
219
+ props: Ie,
215
220
  emits: ["afterMdtInit"],
216
- setup(o, { expose: t, emit: s }) {
217
- const l = new E(), n = o, L = s, a = Z(), M = K({
221
+ setup(l, { expose: t, emit: o }) {
222
+ const r = new W(), s = l, m = o, a = Z(), M = K({
218
223
  breaks: !0,
219
224
  linkify: !0,
220
225
  html: !0,
221
- highlight: (c, i) => {
222
- if (i && w.getLanguage(i))
226
+ highlight: (i, n) => {
227
+ if (n && C.getLanguage(n))
223
228
  try {
224
- return w.highlight(c, { language: i }).value;
229
+ return C.highlight(i, { language: n }).value;
225
230
  } catch {
226
231
  }
227
232
  return "";
228
233
  },
229
- ...n.mdOptions
234
+ ...s.mdOptions
230
235
  });
231
- M.renderer.rules.fence = (c, i) => `<!----MC_MARKDOWN_CODE_BLOCK_${i}---->`;
232
- const y = (c, i, D) => {
233
- const g = {
236
+ M.renderer.rules.fence = (i, n) => `<!----MC_MARKDOWN_CODE_BLOCK_${n}---->`;
237
+ const A = (i, n, d) => {
238
+ const h = {
234
239
  actions: () => {
235
240
  var e;
236
241
  return (e = a.actions) == null ? void 0 : e.call(a, {
237
242
  codeBlockData: {
238
- code: i,
239
- language: c
243
+ code: n,
244
+ language: i
240
245
  }
241
246
  });
242
247
  }
243
248
  };
244
- return a.header && (g.header = () => {
249
+ return a.header && (h.header = () => {
245
250
  var e;
246
251
  return (e = a.header) == null ? void 0 : e.call(a, {
247
252
  codeBlockData: {
248
- code: i,
249
- language: c
253
+ code: n,
254
+ language: i
250
255
  }
251
256
  });
252
- }), a.content && (g.content = () => {
257
+ }), a.content && (h.content = () => {
253
258
  var e;
254
259
  return (e = a.content) == null ? void 0 : e.call(a, {
255
260
  codeBlockData: {
256
- code: i,
257
- language: c
261
+ code: n,
262
+ language: i
258
263
  }
259
264
  });
260
- }), m(Ie, {
261
- language: c,
262
- code: i,
263
- blockIndex: D,
264
- theme: n.theme
265
- }, g);
266
- }, C = N(() => {
267
- const c = M.parse(n.content, {}), i = M.render(n.content);
265
+ }), w(
266
+ he,
267
+ {
268
+ language: i,
269
+ code: n,
270
+ blockIndex: d,
271
+ theme: s.theme
272
+ },
273
+ h
274
+ );
275
+ }, p = y(() => {
276
+ var h, e;
277
+ let i = s.content || "";
278
+ if (s.enableThink) {
279
+ const g = ((h = s.thinkOptions) == null ? void 0 : h.customClass) || "mc-think-block";
280
+ i = ((e = s.content) == null ? void 0 : e.replace("<think>", `<div class="${g}">`).replace("</think>", "</div>")) || "";
281
+ }
282
+ const n = M.parse(i, {}), d = M.render(i);
268
283
  return {
269
284
  name: "MarkdownRenderer",
270
285
  render() {
271
- const D = document.createElement("div");
272
- D.innerHTML = i;
273
- const g = [];
274
- let e = 0, d;
275
- const r = /<!----MC_MARKDOWN_CODE_BLOCK_(\d+)---->/g;
286
+ if (typeof document > "u")
287
+ return;
288
+ const g = document.createElement("div");
289
+ g.innerHTML = d;
290
+ const c = [];
291
+ let L = 0, N;
292
+ const f = /<!----MC_MARKDOWN_CODE_BLOCK_(\d+)---->/g;
276
293
  let j = 0;
277
- for (; (d = r.exec(i)) !== null; ) {
278
- d.index > e && g.push(m(
279
- "div",
280
- {
281
- innerHTML: i.slice(e, d.index)
282
- }
283
- ));
284
- const k = c[parseInt(d[1])], W = k.info || "", z = k.content;
285
- g.push(y(W, z, j)), j++, e = r.lastIndex;
294
+ for (; N = f.exec(d), !!N; ) {
295
+ N.index > L && c.push(
296
+ w("div", {
297
+ innerHTML: d.slice(L, N.index)
298
+ })
299
+ );
300
+ const v = n[Number.parseInt(N[1])], _ = v.info || "", Y = v.content;
301
+ c.push(A(_, Y, j)), j++, L = f.lastIndex;
286
302
  }
287
- return e < i.length && g.push(m("div", {
288
- innerHTML: i.slice(e)
289
- })), m("div", g);
303
+ return L < d.length && c.push(
304
+ w("div", {
305
+ innerHTML: d.slice(L)
306
+ })
307
+ ), w("div", c);
290
308
  }
291
309
  };
292
310
  });
293
- O(() => n.customXssRules, (c) => {
294
- l.setCustomXssRules(c);
295
- }), O(() => n.mdPlugins, (c) => {
296
- l.setMdPlugins(c, M);
297
- }, {
298
- immediate: !0
299
- });
300
- const A = N(() => n.theme === "dark" ? "mc-markdown-render-dark" : "mc-markdown-render-light");
311
+ S(
312
+ () => s.customXssRules,
313
+ (i) => {
314
+ r.setCustomXssRules(i);
315
+ }
316
+ ), S(
317
+ () => s.mdPlugins,
318
+ (i) => {
319
+ r.setMdPlugins(i, M);
320
+ },
321
+ {
322
+ immediate: !0
323
+ }
324
+ );
325
+ const k = y(() => s.theme === "dark" ? "mc-markdown-render-dark" : "mc-markdown-render-light");
301
326
  return X(() => {
302
- L("afterMdtInit", M);
327
+ m("afterMdtInit", M);
303
328
  }), t({
304
329
  mdt: M
305
- }), (c, i) => (I(), h(
330
+ }), (i, n) => (I(), u(
306
331
  R,
307
332
  null,
308
333
  [
309
- u(
334
+ D(
310
335
  "div",
311
336
  {
312
- class: x(["mc-markdown-render", A.value])
337
+ class: x(["mc-markdown-render", k.value])
313
338
  },
314
339
  [
315
- (I(), F(V(C.value)))
340
+ (I(), F(V(p.value)))
316
341
  ],
317
342
  2
318
343
  /* CLASS */
319
344
  ),
320
- B("v-if", !0)
345
+ U("v-if", !0)
321
346
  ],
322
347
  64
323
348
  /* STABLE_FRAGMENT */
324
349
  ));
325
350
  }
326
- }), b = /* @__PURE__ */ U(ue, [["__scopeId", "data-v-04a80a4e"]]);
327
- b.install = (o) => {
328
- o.component("McMarkdownCard", b);
351
+ }), B = /* @__PURE__ */ z(ue, [["__scopeId", "data-v-0183c1e8"]]);
352
+ B.install = (l) => {
353
+ l.component("McMarkdownCard", B);
329
354
  };
330
355
  export {
331
- b as McMarkdownCard
356
+ B as McMarkdownCard
332
357
  };
package/Mention/index.css CHANGED
@@ -1 +1 @@
1
- .mc-mention[data-v-4ce5ce76]{position:fixed;max-height:300px;border-radius:var(--devui-border-radius, 2px);background-color:var(--devui-connected-overlay-bg, #ffffff);box-shadow:var(--devui-shadow-length-connected-overlay, 0 2px 12px 0) var(--devui-shadow, rgba(37, 43, 58, .24));transform-origin:0% 100%;z-index:1000}.mc-mention-fade-enter-from[data-v-4ce5ce76],.mc-mention-fade-leave-to[data-v-4ce5ce76]{opacity:.8;transform:scaleY(.8) translateY(4px)}.mc-mention-fade-enter-to[data-v-4ce5ce76],.mc-mention-fade-leave-from[data-v-4ce5ce76]{opacity:1;transform:scaleY(.9999) translateY(0)}.mc-mention-fade-enter-active[data-v-4ce5ce76]{transition:transform .2s cubic-bezier(.16,.75,.5,1),opacity .2s cubic-bezier(.16,.75,.5,1)}.mc-mention-fade-leave-active[data-v-4ce5ce76]{transition:transform .2s cubic-bezier(.5,0,.84,.25),opacity .2s cubic-bezier(.5,0,.84,.25)}
1
+ .mc-mention[data-v-3397c63c]{position:fixed;max-height:300px;border-radius:var(--devui-border-radius, 2px);background-color:var(--devui-connected-overlay-bg, #ffffff);box-shadow:var(--devui-shadow-length-connected-overlay, 0 2px 12px 0) var(--devui-shadow, rgba(37, 43, 58, .24));transform-origin:0% 100%;z-index:1000}.mc-mention-fade-enter-from[data-v-3397c63c],.mc-mention-fade-leave-to[data-v-3397c63c]{opacity:.8;transform:scaleY(.8) translateY(4px)}.mc-mention-fade-enter-to[data-v-3397c63c],.mc-mention-fade-leave-from[data-v-3397c63c]{opacity:1;transform:scaleY(.9999) translateY(0)}.mc-mention-fade-enter-active[data-v-3397c63c]{transition:transform .2s cubic-bezier(.16,.75,.5,1),opacity .2s cubic-bezier(.16,.75,.5,1)}.mc-mention-fade-leave-active[data-v-3397c63c]{transition:transform .2s cubic-bezier(.5,0,.84,.25),opacity .2s cubic-bezier(.5,0,.84,.25)}
package/Mention/index.js CHANGED
@@ -163,7 +163,7 @@ const ve = /* @__PURE__ */ Q({
163
163
  for (const [t, a] of l)
164
164
  s[t] = a;
165
165
  return s;
166
- }, z = /* @__PURE__ */ ge(ve, [["__scopeId", "data-v-4ce5ce76"]]);
166
+ }, z = /* @__PURE__ */ ge(ve, [["__scopeId", "data-v-3397c63c"]]);
167
167
  z.install = (r) => {
168
168
  r.component("McMention", z);
169
169
  };
package/Prompt/index.css CHANGED
@@ -1 +1 @@
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)}
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-1e833dfc]{display:flex;gap:8px}.mc-prompt-item .mc-prompt-item-icon.no-description[data-v-1e833dfc]{display:flex;align-items:center}.mc-prompt-item .mc-prompt-item-content[data-v-1e833dfc]{display:flex;flex-direction:column;gap:4px}.mc-prompt-item .mc-prompt-item-content .mc-prompt-item-label[data-v-1e833dfc]{font-weight:700}.mc-prompt-item .mc-prompt-item-content .mc-prompt-item-description[data-v-1e833dfc]{color:var(--devui-aide-text, #71757f)}
package/Prompt/index.js CHANGED
@@ -124,7 +124,7 @@ const L = {
124
124
  for (const [o, p] of t)
125
125
  i[o] = p;
126
126
  return i;
127
- }, J = /* @__PURE__ */ H(G, [["__scopeId", "data-v-d5f7f6f9"]]), K = { class: "mc-prompt" }, g = /* @__PURE__ */ a({
127
+ }, J = /* @__PURE__ */ H(G, [["__scopeId", "data-v-1e833dfc"]]), K = { class: "mc-prompt" }, g = /* @__PURE__ */ a({
128
128
  __name: "Prompt",
129
129
  props: w,
130
130
  emits: ["itemClick"],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@matechat/core",
3
- "version": "1.3.0",
3
+ "version": "1.4.0-alpha.1",
4
4
  "license": "MIT",
5
5
  "description": "前端智能化场景解决方案UI库,轻松构建你的AI应用。",
6
6
  "keywords": [
@@ -18,7 +18,9 @@
18
18
  },
19
19
  "module": "mate-chat.js",
20
20
  "types": "index.d.ts",
21
- "sideEffects": false,
21
+ "sideEffects": [
22
+ "**/*.css"
23
+ ],
22
24
  "dependencies": {
23
25
  "@floating-ui/dom": "^1.6.12",
24
26
  "@vue/shared": "^3.5.13",
@@ -31,4 +33,4 @@
31
33
  "peerDependencies": {
32
34
  "vue": "^3.5.13"
33
35
  }
34
- }
36
+ }
@@ -1,48 +0,0 @@
1
- import { Comment as s, Text as a, Fragment as m, h as g, defineComponent as h, ref as v, withDirectives as C, cloneVNode as y } from "vue";
2
- import { isObject as x } from "@vue/shared";
3
- function p(e) {
4
- return g("span", {}, e);
5
- }
6
- function c(e) {
7
- for (const t of e) {
8
- if (x(t)) {
9
- if (t.type === s)
10
- continue;
11
- return t.type === "svg" || t.type === a ? p(t) : t.type === m ? c(t.children) : t;
12
- }
13
- return p(t);
14
- }
15
- return null;
16
- }
17
- const F = /* @__PURE__ */ h({
18
- setup(e, t) {
19
- const {
20
- slots: r,
21
- attrs: i,
22
- expose: d
23
- } = t, n = v();
24
- return d({
25
- triggerEl: n
26
- }), () => {
27
- var f;
28
- const o = (f = r.default) == null ? void 0 : f.call(r, i);
29
- if (!o)
30
- return null;
31
- const l = c(o);
32
- return l ? C(y(l, i), [[{
33
- mounted(u) {
34
- n.value = u;
35
- },
36
- updated(u) {
37
- n.value = u;
38
- },
39
- unmounted() {
40
- n.value = null;
41
- }
42
- }]]) : null;
43
- };
44
- }
45
- });
46
- export {
47
- F as PopperTrigger
48
- };