markstream-vue 0.0.2-beta.7 → 0.0.2-beta.9
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/README.md +1 -0
- package/README.zh-CN.md +1 -0
- package/dist/exports-CyoL-8XF.js +4827 -0
- package/dist/exports-DADWwNRQ.cjs +246 -0
- package/dist/exports.js +1 -1
- package/dist/index-Br7IvHNe.cjs +1 -0
- package/dist/index-CDRkq20z.js +958 -0
- package/dist/index-CcqRGphH.cjs +22 -0
- package/dist/index-DdtMPiwH.js +113 -0
- package/dist/index-DoRl8S3_.js +122 -0
- package/dist/index-OTPe0l-Z.cjs +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.ts +21 -1
- package/dist/index.js +71 -62
- package/dist/index.tailwind.css +1 -1
- package/dist/index2.js +1 -1
- package/dist/index3.js +1 -1
- package/dist/index4.js +1 -1
- package/dist/tailwind.ts +0 -0
- package/package.json +7 -7
- package/dist/exports-C7d2XCaM.cjs +0 -247
- package/dist/exports-CPUhsjyb.js +0 -4719
- package/dist/index-BLMNAobs.js +0 -117
- package/dist/index-BWCpJDUq.js +0 -108
- package/dist/index-BZTwjxhO.cjs +0 -1
- package/dist/index-CaLfBjAM.js +0 -860
- package/dist/index-DqNfDUws.cjs +0 -1
- package/dist/index-IDe4W9b6.cjs +0 -1
|
@@ -0,0 +1,958 @@
|
|
|
1
|
+
var Et = Object.defineProperty, Ft = Object.defineProperties;
|
|
2
|
+
var Ht = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var Ie = Object.getOwnPropertySymbols;
|
|
4
|
+
var Lt = Object.prototype.hasOwnProperty, Dt = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var Ve = (f, u, i) => u in f ? Et(f, u, { enumerable: !0, configurable: !0, writable: !0, value: i }) : f[u] = i, Re = (f, u) => {
|
|
6
|
+
for (var i in u || (u = {}))
|
|
7
|
+
Lt.call(u, i) && Ve(f, i, u[i]);
|
|
8
|
+
if (Ie)
|
|
9
|
+
for (var i of Ie(u))
|
|
10
|
+
Dt.call(u, i) && Ve(f, i, u[i]);
|
|
11
|
+
return f;
|
|
12
|
+
}, _e = (f, u) => Ft(f, Ht(u));
|
|
13
|
+
var R = (f, u, i) => new Promise((j, z) => {
|
|
14
|
+
var H = (y) => {
|
|
15
|
+
try {
|
|
16
|
+
m(i.next(y));
|
|
17
|
+
} catch ($) {
|
|
18
|
+
z($);
|
|
19
|
+
}
|
|
20
|
+
}, r = (y) => {
|
|
21
|
+
try {
|
|
22
|
+
m(i.throw(y));
|
|
23
|
+
} catch ($) {
|
|
24
|
+
z($);
|
|
25
|
+
}
|
|
26
|
+
}, m = (y) => y.done ? j(y.value) : Promise.resolve(y.value).then(H, r);
|
|
27
|
+
m((i = i.apply(f, u)).next());
|
|
28
|
+
});
|
|
29
|
+
import { defineComponent as Je, computed as _, onMounted as Tt, onUnmounted as Qe, createBlock as xe, openBlock as F, Teleport as Pt, createElementVNode as a, normalizeClass as J, withModifiers as Ot, toDisplayString as be, unref as g, getCurrentInstance as $t, ref as B, watch as Y, onBeforeUnmount as Nt, nextTick as we, createElementBlock as O, normalizeStyle as Ye, createCommentVNode as X, withDirectives as Ae, renderSlot as ye, Fragment as zt, vShow as We } from "vue";
|
|
30
|
+
import { u as Ze, _ as et, a as It, g as Vt, s as le, l as Rt, b as _t, c as Yt, d as je, h as At } from "./exports-CyoL-8XF.js";
|
|
31
|
+
const Wt = { class: "html-preview-frame__header" }, jt = { class: "html-preview-frame__title" }, qt = { class: "html-preview-frame__label" }, Xt = ["srcdoc"], Ut = /* @__PURE__ */ Je({
|
|
32
|
+
__name: "HtmlPreviewFrame",
|
|
33
|
+
props: {
|
|
34
|
+
code: {},
|
|
35
|
+
isDark: { type: Boolean },
|
|
36
|
+
onClose: { type: Function },
|
|
37
|
+
title: {}
|
|
38
|
+
},
|
|
39
|
+
setup(f) {
|
|
40
|
+
const u = f, { t: i } = Ze(), j = _(() => {
|
|
41
|
+
const H = u.code || "", r = H.trim().toLowerCase();
|
|
42
|
+
if (r.startsWith("<!doctype") || r.startsWith("<html") || r.startsWith("<body"))
|
|
43
|
+
return H;
|
|
44
|
+
const m = u.isDark ? "#020617" : "#ffffff", y = u.isDark ? "#e5e7eb" : "#020617";
|
|
45
|
+
return `<!doctype html>
|
|
46
|
+
<html lang="en">
|
|
47
|
+
<head>
|
|
48
|
+
<meta charset="utf-8" />
|
|
49
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
50
|
+
<style>
|
|
51
|
+
html, body {
|
|
52
|
+
margin: 0;
|
|
53
|
+
padding: 0;
|
|
54
|
+
height: 100%;
|
|
55
|
+
background-color: ${m};
|
|
56
|
+
color: ${y};
|
|
57
|
+
}
|
|
58
|
+
body {
|
|
59
|
+
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'SF Pro Text', ui-sans-serif, sans-serif;
|
|
60
|
+
}
|
|
61
|
+
</style>
|
|
62
|
+
</head>
|
|
63
|
+
<body>
|
|
64
|
+
${H}
|
|
65
|
+
</body>
|
|
66
|
+
</html>`;
|
|
67
|
+
});
|
|
68
|
+
function z(H) {
|
|
69
|
+
var r;
|
|
70
|
+
(H.key === "Escape" || H.key === "Esc") && ((r = u.onClose) == null || r.call(u));
|
|
71
|
+
}
|
|
72
|
+
return Tt(() => {
|
|
73
|
+
typeof window != "undefined" && window.addEventListener("keydown", z);
|
|
74
|
+
}), Qe(() => {
|
|
75
|
+
typeof window != "undefined" && window.removeEventListener("keydown", z);
|
|
76
|
+
}), (H, r) => (F(), xe(Pt, { to: "body" }, [
|
|
77
|
+
a("div", {
|
|
78
|
+
class: J(["html-preview-frame__backdrop", { "html-preview-frame__backdrop--dark": u.isDark }]),
|
|
79
|
+
onClick: r[2] || (r[2] = (m) => {
|
|
80
|
+
var y;
|
|
81
|
+
return (y = u.onClose) == null ? void 0 : y.call(u);
|
|
82
|
+
})
|
|
83
|
+
}, [
|
|
84
|
+
a("div", {
|
|
85
|
+
class: J(["html-preview-frame", { "html-preview-frame--dark": u.isDark }]),
|
|
86
|
+
onClick: r[1] || (r[1] = Ot(() => {
|
|
87
|
+
}, ["stop"]))
|
|
88
|
+
}, [
|
|
89
|
+
a("div", Wt, [
|
|
90
|
+
a("div", jt, [
|
|
91
|
+
r[3] || (r[3] = a("span", { class: "html-preview-frame__dot" }, null, -1)),
|
|
92
|
+
a("span", qt, be(u.title || g(i)("common.preview") || "Preview"), 1)
|
|
93
|
+
]),
|
|
94
|
+
a("button", {
|
|
95
|
+
type: "button",
|
|
96
|
+
class: J(["html-preview-frame__close", { "html-preview-frame__close--dark": u.isDark }]),
|
|
97
|
+
onClick: r[0] || (r[0] = (m) => {
|
|
98
|
+
var y;
|
|
99
|
+
return (y = u.onClose) == null ? void 0 : y.call(u);
|
|
100
|
+
})
|
|
101
|
+
}, " × ", 2)
|
|
102
|
+
]),
|
|
103
|
+
a("iframe", {
|
|
104
|
+
class: "html-preview-frame__iframe",
|
|
105
|
+
sandbox: "allow-scripts allow-same-origin",
|
|
106
|
+
srcdoc: j.value
|
|
107
|
+
}, null, 8, Xt)
|
|
108
|
+
], 2)
|
|
109
|
+
], 2)
|
|
110
|
+
]));
|
|
111
|
+
}
|
|
112
|
+
}), Gt = /* @__PURE__ */ et(Ut, [["__scopeId", "data-v-3cf0ed56"]]), Kt = {
|
|
113
|
+
key: 0,
|
|
114
|
+
class: "code-block-header flex justify-between items-center px-4 py-2.5 border-b border-gray-400/5",
|
|
115
|
+
style: { color: "var(--vscode-editor-foreground)", "background-color": "var(--vscode-editor-background)" }
|
|
116
|
+
}, Jt = { class: "flex items-center space-x-2 flex-1 overflow-hidden" }, Qt = ["innerHTML"], Zt = { class: "text-sm font-medium font-mono truncate" }, eo = { class: "flex items-center space-x-2" }, to = ["aria-pressed"], oo = ["disabled"], no = ["disabled"], io = ["disabled"], lo = ["aria-label"], ro = {
|
|
117
|
+
key: 0,
|
|
118
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
119
|
+
"xmlns:xlink": "http://www.w3.org/1999/xlink",
|
|
120
|
+
"aria-hidden": "true",
|
|
121
|
+
role: "img",
|
|
122
|
+
width: "1em",
|
|
123
|
+
height: "1em",
|
|
124
|
+
viewBox: "0 0 24 24",
|
|
125
|
+
class: "w-3 h-3"
|
|
126
|
+
}, ao = {
|
|
127
|
+
key: 1,
|
|
128
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
129
|
+
"xmlns:xlink": "http://www.w3.org/1999/xlink",
|
|
130
|
+
"aria-hidden": "true",
|
|
131
|
+
role: "img",
|
|
132
|
+
width: "1em",
|
|
133
|
+
height: "1em",
|
|
134
|
+
viewBox: "0 0 24 24",
|
|
135
|
+
class: "w-3 h-3"
|
|
136
|
+
}, so = ["aria-pressed"], uo = {
|
|
137
|
+
key: 0,
|
|
138
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
139
|
+
"xmlns:xlink": "http://www.w3.org/1999/xlink",
|
|
140
|
+
"aria-hidden": "true",
|
|
141
|
+
role: "img",
|
|
142
|
+
width: "1em",
|
|
143
|
+
height: "1em",
|
|
144
|
+
viewBox: "0 0 24 24",
|
|
145
|
+
class: "w-3 h-3"
|
|
146
|
+
}, co = {
|
|
147
|
+
key: 1,
|
|
148
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
149
|
+
"xmlns:xlink": "http://www.w3.org/1999/xlink",
|
|
150
|
+
"aria-hidden": "true",
|
|
151
|
+
role: "img",
|
|
152
|
+
width: "1em",
|
|
153
|
+
height: "1em",
|
|
154
|
+
viewBox: "0 0 24 24",
|
|
155
|
+
class: "w-3 h-3"
|
|
156
|
+
}, fo = ["aria-label"], vo = { class: "code-loading-placeholder" }, mo = {
|
|
157
|
+
class: "sr-only",
|
|
158
|
+
"aria-live": "polite",
|
|
159
|
+
role: "status"
|
|
160
|
+
}, qe = 10, Xe = 36, Ue = 1, Ge = 0, Ke = 1.5, re = 1, ho = /* @__PURE__ */ Je({
|
|
161
|
+
__name: "CodeBlockNode",
|
|
162
|
+
props: {
|
|
163
|
+
node: {},
|
|
164
|
+
isDark: { type: Boolean },
|
|
165
|
+
loading: { type: Boolean, default: !0 },
|
|
166
|
+
stream: { type: Boolean, default: !0 },
|
|
167
|
+
darkTheme: { default: void 0 },
|
|
168
|
+
lightTheme: { default: void 0 },
|
|
169
|
+
isShowPreview: { type: Boolean, default: !0 },
|
|
170
|
+
monacoOptions: {},
|
|
171
|
+
enableFontSizeControl: { type: Boolean, default: !0 },
|
|
172
|
+
minWidth: { default: void 0 },
|
|
173
|
+
maxWidth: { default: void 0 },
|
|
174
|
+
themes: {},
|
|
175
|
+
showHeader: { type: Boolean, default: !0 },
|
|
176
|
+
showCopyButton: { type: Boolean, default: !0 },
|
|
177
|
+
showExpandButton: { type: Boolean, default: !0 },
|
|
178
|
+
showPreviewButton: { type: Boolean, default: !0 },
|
|
179
|
+
showFontSizeButtons: { type: Boolean, default: !0 },
|
|
180
|
+
customId: {}
|
|
181
|
+
},
|
|
182
|
+
emits: ["previewCode", "copy"],
|
|
183
|
+
setup(f, { emit: u }) {
|
|
184
|
+
var De, Te;
|
|
185
|
+
const i = f, j = u, z = $t(), H = _(() => {
|
|
186
|
+
const t = z == null ? void 0 : z.vnode.props;
|
|
187
|
+
return !!(t && (t.onPreviewCode || t.onPreviewCode));
|
|
188
|
+
}), { t: r } = Ze(), m = B(null), y = B(null), $ = B(!1), S = B(String((De = i.node.language) != null ? De : "")), C = B(!1), M = B(!1), Q = B(!1), Ce = B(!1), A = B(null);
|
|
189
|
+
let ae = 0;
|
|
190
|
+
const tt = It(), U = B(null), I = B(typeof window == "undefined");
|
|
191
|
+
typeof window != "undefined" && Y(
|
|
192
|
+
() => y.value,
|
|
193
|
+
(t) => {
|
|
194
|
+
var o;
|
|
195
|
+
if ((o = U.value) == null || o.destroy(), U.value = null, !t) {
|
|
196
|
+
I.value = !1;
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
const e = tt(t, { rootMargin: "400px" });
|
|
200
|
+
U.value = e, I.value = e.isVisible.value, e.whenVisible.then(() => {
|
|
201
|
+
I.value = !0;
|
|
202
|
+
});
|
|
203
|
+
},
|
|
204
|
+
{ immediate: !0 }
|
|
205
|
+
), Nt(() => {
|
|
206
|
+
var t;
|
|
207
|
+
(t = U.value) == null || t.destroy(), U.value = null;
|
|
208
|
+
});
|
|
209
|
+
let V = null, Z = null, se = () => {
|
|
210
|
+
}, ue = () => {
|
|
211
|
+
}, ee = () => null, N = () => ({ getModel: () => ({ getLineCount: () => 1 }), getOption: () => 14, updateOptions: () => {
|
|
212
|
+
} }), P = () => ({ getModel: () => ({ getLineCount: () => 1 }), getOption: () => 14, updateOptions: () => {
|
|
213
|
+
} }), te = () => {
|
|
214
|
+
}, ce = () => {
|
|
215
|
+
}, G = null, Me = () => {
|
|
216
|
+
var t;
|
|
217
|
+
return String((t = i.node.language) != null ? t : "plaintext");
|
|
218
|
+
}, de = () => R(null, null, function* () {
|
|
219
|
+
});
|
|
220
|
+
const L = _(() => i.node.diff), fe = B(!1), oe = B(!1);
|
|
221
|
+
typeof window != "undefined" && R(null, null, function* () {
|
|
222
|
+
try {
|
|
223
|
+
const t = yield Vt();
|
|
224
|
+
if (!t) {
|
|
225
|
+
fe.value = !0;
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
const e = t.useMonaco, o = t.detectLanguage;
|
|
229
|
+
if (typeof o == "function" && (Me = o), typeof e == "function") {
|
|
230
|
+
const n = Le();
|
|
231
|
+
if (n && i.themes && Array.isArray(i.themes) && !i.themes.includes(n))
|
|
232
|
+
throw new Error("Preferred theme not in provided themes array");
|
|
233
|
+
const l = e(_e(Re({
|
|
234
|
+
wordWrap: "on",
|
|
235
|
+
wrappingIndent: "same",
|
|
236
|
+
themes: i.themes,
|
|
237
|
+
theme: n
|
|
238
|
+
}, i.monacoOptions || {}), {
|
|
239
|
+
onThemeChange() {
|
|
240
|
+
at();
|
|
241
|
+
}
|
|
242
|
+
}));
|
|
243
|
+
V = l.createEditor || V, Z = l.createDiffEditor || Z, se = l.updateCode || se, ue = l.updateDiff || ue, ee = l.getEditor || ee, N = l.getEditorView || N, P = l.getDiffEditorView || P, te = l.cleanupEditor || te, ce = l.safeClean || l.cleanupEditor || ce, de = l.setTheme || de, Ce.value = !0, m.value && (yield ge(m.value));
|
|
244
|
+
}
|
|
245
|
+
} catch (t) {
|
|
246
|
+
fe.value = !0;
|
|
247
|
+
}
|
|
248
|
+
});
|
|
249
|
+
const D = B(
|
|
250
|
+
typeof ((Te = i.monacoOptions) == null ? void 0 : Te.fontSize) == "number" ? i.monacoOptions.fontSize : Number.NaN
|
|
251
|
+
), v = B(D.value), ot = _(() => {
|
|
252
|
+
const t = D.value, e = v.value;
|
|
253
|
+
return typeof t == "number" && Number.isFinite(t) && t > 0 && typeof e == "number" && Number.isFinite(e) && e > 0;
|
|
254
|
+
});
|
|
255
|
+
function nt() {
|
|
256
|
+
try {
|
|
257
|
+
const t = m.value;
|
|
258
|
+
if (!t)
|
|
259
|
+
return null;
|
|
260
|
+
const e = t.querySelector(".view-lines .view-line");
|
|
261
|
+
if (e) {
|
|
262
|
+
const o = Math.ceil(e.getBoundingClientRect().height);
|
|
263
|
+
if (o > 0)
|
|
264
|
+
return o;
|
|
265
|
+
}
|
|
266
|
+
} catch (t) {
|
|
267
|
+
}
|
|
268
|
+
return null;
|
|
269
|
+
}
|
|
270
|
+
function Be() {
|
|
271
|
+
var t, e, o, n, l;
|
|
272
|
+
try {
|
|
273
|
+
const s = L.value ? (o = (e = (t = P()) == null ? void 0 : t.getModifiedEditor) == null ? void 0 : e.call(t)) != null ? o : P() : N(), w = ee(), p = (n = w == null ? void 0 : w.EditorOption) == null ? void 0 : n.fontInfo;
|
|
274
|
+
if (s && p != null) {
|
|
275
|
+
const k = (l = s.getOption) == null ? void 0 : l.call(s, p), d = k == null ? void 0 : k.fontSize;
|
|
276
|
+
if (typeof d == "number" && Number.isFinite(d) && d > 0)
|
|
277
|
+
return d;
|
|
278
|
+
}
|
|
279
|
+
} catch (s) {
|
|
280
|
+
}
|
|
281
|
+
try {
|
|
282
|
+
const s = m.value;
|
|
283
|
+
if (s) {
|
|
284
|
+
const w = s.querySelector(".view-lines .view-line");
|
|
285
|
+
if (w)
|
|
286
|
+
try {
|
|
287
|
+
if (typeof window != "undefined" && typeof window.getComputedStyle == "function") {
|
|
288
|
+
const p = window.getComputedStyle(w).fontSize, k = p && p.match(/^(\d+(?:\.\d+)?)/);
|
|
289
|
+
if (k)
|
|
290
|
+
return Number.parseFloat(k[1]);
|
|
291
|
+
}
|
|
292
|
+
} catch (p) {
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
} catch (s) {
|
|
296
|
+
}
|
|
297
|
+
return null;
|
|
298
|
+
}
|
|
299
|
+
function ve(t) {
|
|
300
|
+
var n, l;
|
|
301
|
+
try {
|
|
302
|
+
const s = ee(), w = (n = s == null ? void 0 : s.EditorOption) == null ? void 0 : n.lineHeight;
|
|
303
|
+
if (w != null) {
|
|
304
|
+
const p = (l = t == null ? void 0 : t.getOption) == null ? void 0 : l.call(t, w);
|
|
305
|
+
if (typeof p == "number" && p > 0)
|
|
306
|
+
return p;
|
|
307
|
+
}
|
|
308
|
+
} catch (s) {
|
|
309
|
+
}
|
|
310
|
+
const e = nt();
|
|
311
|
+
if (e && e > 0)
|
|
312
|
+
return e;
|
|
313
|
+
const o = Number.isFinite(v.value) && v.value > 0 ? v.value : 12;
|
|
314
|
+
return Math.max(12, Math.round(o * 1.35));
|
|
315
|
+
}
|
|
316
|
+
function me() {
|
|
317
|
+
var e;
|
|
318
|
+
if (Number.isFinite(v.value) && v.value > 0 && Number.isFinite(D.value))
|
|
319
|
+
return v.value;
|
|
320
|
+
const t = Be();
|
|
321
|
+
return typeof ((e = i.monacoOptions) == null ? void 0 : e.fontSize) == "number" ? (D.value = i.monacoOptions.fontSize, v.value = i.monacoOptions.fontSize, v.value) : t && t > 0 ? (D.value = t, v.value = t, t) : (D.value = 12, v.value = 12, 12);
|
|
322
|
+
}
|
|
323
|
+
function it() {
|
|
324
|
+
const t = me(), e = Math.min(Xe, t + Ue);
|
|
325
|
+
v.value = e;
|
|
326
|
+
}
|
|
327
|
+
function lt() {
|
|
328
|
+
const t = me(), e = Math.max(qe, t - Ue);
|
|
329
|
+
v.value = e;
|
|
330
|
+
}
|
|
331
|
+
function rt() {
|
|
332
|
+
me(), Number.isFinite(D.value) && (v.value = D.value);
|
|
333
|
+
}
|
|
334
|
+
function Se() {
|
|
335
|
+
var t, e, o, n, l, s, w, p, k, d, h, Pe, Oe, $e;
|
|
336
|
+
try {
|
|
337
|
+
const c = L.value ? P() : N();
|
|
338
|
+
if (!c)
|
|
339
|
+
return null;
|
|
340
|
+
if (L.value && (c != null && c.getOriginalEditor) && (c != null && c.getModifiedEditor)) {
|
|
341
|
+
const x = (t = c.getOriginalEditor) == null ? void 0 : t.call(c), b = (e = c.getModifiedEditor) == null ? void 0 : e.call(c);
|
|
342
|
+
(o = x == null ? void 0 : x.layout) == null || o.call(x), (n = b == null ? void 0 : b.layout) == null || n.call(b);
|
|
343
|
+
const xt = ((l = x == null ? void 0 : x.getContentHeight) == null ? void 0 : l.call(x)) || 0, bt = ((s = b == null ? void 0 : b.getContentHeight) == null ? void 0 : s.call(b)) || 0, ze = Math.max(xt, bt);
|
|
344
|
+
if (ze > 0)
|
|
345
|
+
return Math.ceil(ze + re);
|
|
346
|
+
const Ct = ((k = (p = (w = x == null ? void 0 : x.getModel) == null ? void 0 : w.call(x)) == null ? void 0 : p.getLineCount) == null ? void 0 : k.call(p)) || 1, Mt = ((Pe = (h = (d = b == null ? void 0 : b.getModel) == null ? void 0 : d.call(b)) == null ? void 0 : h.getLineCount) == null ? void 0 : Pe.call(h)) || 1, Bt = Math.max(Ct, Mt), St = Math.max(ve(x), ve(b));
|
|
347
|
+
return Math.ceil(Bt * (St + Ke) + Ge + re);
|
|
348
|
+
} else if (c != null && c.getContentHeight) {
|
|
349
|
+
(Oe = c == null ? void 0 : c.layout) == null || Oe.call(c);
|
|
350
|
+
const x = c.getContentHeight();
|
|
351
|
+
if (x > 0)
|
|
352
|
+
return Math.ceil(x + re);
|
|
353
|
+
}
|
|
354
|
+
const pe = ($e = c == null ? void 0 : c.getModel) == null ? void 0 : $e.call(c);
|
|
355
|
+
let Ne = 1;
|
|
356
|
+
pe && typeof pe.getLineCount == "function" && (Ne = pe.getLineCount());
|
|
357
|
+
const kt = ve(c);
|
|
358
|
+
return Math.ceil(Ne * (kt + Ke) + Ge + re);
|
|
359
|
+
} catch (c) {
|
|
360
|
+
return null;
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
function at() {
|
|
364
|
+
var p, k, d;
|
|
365
|
+
const t = m.value, e = y.value;
|
|
366
|
+
if (!t || !e)
|
|
367
|
+
return;
|
|
368
|
+
const o = t.querySelector(".monaco-editor") || t;
|
|
369
|
+
let n = null;
|
|
370
|
+
try {
|
|
371
|
+
typeof window != "undefined" && typeof window.getComputedStyle == "function" && (n = window.getComputedStyle(o));
|
|
372
|
+
} catch (h) {
|
|
373
|
+
n = null;
|
|
374
|
+
}
|
|
375
|
+
const l = String((p = n == null ? void 0 : n.getPropertyValue("--vscode-editor-foreground")) != null ? p : ""), s = String((k = n == null ? void 0 : n.getPropertyValue("--vscode-editor-background")) != null ? k : ""), w = String((d = n == null ? void 0 : n.getPropertyValue("--vscode-editor-hoverHighlightBackground")) != null ? d : "");
|
|
376
|
+
if (l && s)
|
|
377
|
+
return e.style.setProperty("--vscode-editor-foreground", l.trim()), e.style.setProperty("--vscode-editor-background", s.trim()), e.style.setProperty("--vscode-editor-selectionBackground", w.trim()), !0;
|
|
378
|
+
}
|
|
379
|
+
function W() {
|
|
380
|
+
try {
|
|
381
|
+
const t = m.value;
|
|
382
|
+
if (!t)
|
|
383
|
+
return;
|
|
384
|
+
const e = t.getBoundingClientRect(), o = window.scrollY + e.top, n = Se();
|
|
385
|
+
if (n != null && n > 0) {
|
|
386
|
+
const l = e.height;
|
|
387
|
+
t.style.height = `${Math.ceil(n)}px`, t.style.maxHeight = "none";
|
|
388
|
+
const s = Math.ceil(n) - l;
|
|
389
|
+
s !== 0 && o < window.scrollY && window.scrollBy(0, s);
|
|
390
|
+
}
|
|
391
|
+
} catch (t) {
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
function q() {
|
|
395
|
+
var t;
|
|
396
|
+
try {
|
|
397
|
+
const e = m.value;
|
|
398
|
+
if (!e)
|
|
399
|
+
return;
|
|
400
|
+
const o = e.getBoundingClientRect(), n = window.scrollY + o.top, l = o.height, s = st();
|
|
401
|
+
if (ae > 0 && (ae--, A.value != null)) {
|
|
402
|
+
const d = Math.min(A.value, s);
|
|
403
|
+
e.style.height = `${Math.ceil(d)}px`, e.style.maxHeight = `${Math.ceil(s)}px`, e.style.overflow = "auto";
|
|
404
|
+
const h = Math.ceil(d) - l;
|
|
405
|
+
h !== 0 && n < window.scrollY && window.scrollBy(0, h);
|
|
406
|
+
return;
|
|
407
|
+
}
|
|
408
|
+
const w = Se();
|
|
409
|
+
if (w != null && w > 0) {
|
|
410
|
+
const d = Math.min(w, s);
|
|
411
|
+
e.style.height = `${Math.ceil(d)}px`, e.style.maxHeight = `${Math.ceil(s)}px`, e.style.overflow = "auto";
|
|
412
|
+
const h = Math.ceil(d) - l;
|
|
413
|
+
h !== 0 && n < window.scrollY && window.scrollBy(0, h);
|
|
414
|
+
return;
|
|
415
|
+
}
|
|
416
|
+
if (A.value != null) {
|
|
417
|
+
const d = Math.min(A.value, s);
|
|
418
|
+
e.style.height = `${Math.ceil(d)}px`, e.style.maxHeight = `${Math.ceil(s)}px`, e.style.overflow = "auto";
|
|
419
|
+
const h = Math.ceil(d) - l;
|
|
420
|
+
h !== 0 && n < window.scrollY && window.scrollBy(0, h);
|
|
421
|
+
return;
|
|
422
|
+
}
|
|
423
|
+
const p = Math.ceil(((t = e.getBoundingClientRect) == null ? void 0 : t.call(e).height) || 0);
|
|
424
|
+
if (p > 0) {
|
|
425
|
+
const d = Math.min(p, s);
|
|
426
|
+
e.style.height = `${Math.ceil(d)}px`, e.style.maxHeight = `${Math.ceil(s)}px`, e.style.overflow = "auto";
|
|
427
|
+
const h = Math.ceil(d) - l;
|
|
428
|
+
h !== 0 && n < window.scrollY && window.scrollBy(0, h);
|
|
429
|
+
return;
|
|
430
|
+
}
|
|
431
|
+
const k = Number.parseFloat(e.style.height);
|
|
432
|
+
if (!Number.isNaN(k) && k > 0) {
|
|
433
|
+
const d = Math.ceil(Math.min(k, s));
|
|
434
|
+
e.style.height = `${d}px`;
|
|
435
|
+
const h = d - l;
|
|
436
|
+
h !== 0 && n < window.scrollY && window.scrollBy(0, h);
|
|
437
|
+
} else {
|
|
438
|
+
const d = Math.ceil(s);
|
|
439
|
+
e.style.height = `${d}px`;
|
|
440
|
+
const h = d - l;
|
|
441
|
+
h !== 0 && n < window.scrollY && window.scrollBy(0, h);
|
|
442
|
+
}
|
|
443
|
+
e.style.maxHeight = `${Math.ceil(s)}px`, e.style.overflow = "auto";
|
|
444
|
+
} catch (e) {
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
function st() {
|
|
448
|
+
var o, n;
|
|
449
|
+
const t = (n = (o = i.monacoOptions) == null ? void 0 : o.MAX_HEIGHT) != null ? n : 500;
|
|
450
|
+
if (typeof t == "number")
|
|
451
|
+
return t;
|
|
452
|
+
const e = String(t).match(/^(\d+(?:\.\d+)?)/);
|
|
453
|
+
return e ? Number.parseFloat(e[1]) : 500;
|
|
454
|
+
}
|
|
455
|
+
const he = _(() => {
|
|
456
|
+
const t = S.value.trim().toLowerCase();
|
|
457
|
+
return i.isShowPreview && (t === "html" || t === "svg");
|
|
458
|
+
}), K = _(
|
|
459
|
+
() => S.value.trim().toLowerCase() === "mermaid"
|
|
460
|
+
);
|
|
461
|
+
Y(
|
|
462
|
+
() => i.node.language,
|
|
463
|
+
(t) => {
|
|
464
|
+
S.value = t;
|
|
465
|
+
}
|
|
466
|
+
), Y(
|
|
467
|
+
() => i.node.code,
|
|
468
|
+
(t) => R(null, null, function* () {
|
|
469
|
+
var e, o;
|
|
470
|
+
if (i.stream !== !1) {
|
|
471
|
+
if (S.value || (S.value = Me(t)), V && !Q.value && m.value)
|
|
472
|
+
try {
|
|
473
|
+
yield ge(m.value);
|
|
474
|
+
} catch (n) {
|
|
475
|
+
}
|
|
476
|
+
L.value ? ue(String((e = i.node.originalCode) != null ? e : ""), String((o = i.node.updatedCode) != null ? o : ""), S.value) : se(t, S.value), C.value && le(() => W());
|
|
477
|
+
}
|
|
478
|
+
})
|
|
479
|
+
);
|
|
480
|
+
const ut = _(() => {
|
|
481
|
+
const t = S.value.trim().toLowerCase();
|
|
482
|
+
return Rt[t] || t.charAt(0).toUpperCase() + t.slice(1);
|
|
483
|
+
}), ct = _(() => {
|
|
484
|
+
const t = S.value.trim().toLowerCase();
|
|
485
|
+
return _t(t.split(":")[0]);
|
|
486
|
+
}), dt = _(() => {
|
|
487
|
+
const t = {}, e = (l) => {
|
|
488
|
+
if (l != null)
|
|
489
|
+
return typeof l == "number" ? `${l}px` : String(l);
|
|
490
|
+
}, o = e(i.minWidth), n = e(i.maxWidth);
|
|
491
|
+
return o && (t.minWidth = o), n && (t.maxWidth = n), t;
|
|
492
|
+
});
|
|
493
|
+
function ft() {
|
|
494
|
+
return R(this, null, function* () {
|
|
495
|
+
try {
|
|
496
|
+
typeof navigator != "undefined" && navigator.clipboard && typeof navigator.clipboard.writeText == "function" && (yield navigator.clipboard.writeText(i.node.code)), $.value = !0, j("copy", i.node.code), setTimeout(() => {
|
|
497
|
+
$.value = !1;
|
|
498
|
+
}, 1e3);
|
|
499
|
+
} catch (t) {
|
|
500
|
+
console.error("复制失败:", t);
|
|
501
|
+
}
|
|
502
|
+
});
|
|
503
|
+
}
|
|
504
|
+
function Ee(t) {
|
|
505
|
+
const e = t;
|
|
506
|
+
return !e || e.disabled;
|
|
507
|
+
}
|
|
508
|
+
function T(t, e, o = "top") {
|
|
509
|
+
if (Ee(t.currentTarget))
|
|
510
|
+
return;
|
|
511
|
+
const n = t, l = (n == null ? void 0 : n.clientX) != null && (n == null ? void 0 : n.clientY) != null ? { x: n.clientX, y: n.clientY } : void 0;
|
|
512
|
+
je(t.currentTarget, e, o, !1, l, i.isDark);
|
|
513
|
+
}
|
|
514
|
+
function E() {
|
|
515
|
+
At();
|
|
516
|
+
}
|
|
517
|
+
function Fe(t) {
|
|
518
|
+
if (Ee(t.currentTarget))
|
|
519
|
+
return;
|
|
520
|
+
const e = $.value ? r("common.copied") || "Copied" : r("common.copy") || "Copy", o = t, n = (o == null ? void 0 : o.clientX) != null && (o == null ? void 0 : o.clientY) != null ? { x: o.clientX, y: o.clientY } : void 0;
|
|
521
|
+
je(t.currentTarget, e, "top", !1, n, i.isDark);
|
|
522
|
+
}
|
|
523
|
+
function vt() {
|
|
524
|
+
C.value = !C.value;
|
|
525
|
+
const t = L.value ? P() : N(), e = m.value;
|
|
526
|
+
!t || !e || (C.value ? (ne(!0), e.style.maxHeight = "none", e.style.overflow = "visible", W()) : (ne(!1), e.style.overflow = "auto", q()));
|
|
527
|
+
}
|
|
528
|
+
function mt() {
|
|
529
|
+
var t, e, o;
|
|
530
|
+
if (M.value = !M.value, M.value) {
|
|
531
|
+
if (m.value) {
|
|
532
|
+
const n = Math.ceil(((e = (t = m.value).getBoundingClientRect) == null ? void 0 : e.call(t).height) || 0);
|
|
533
|
+
n > 0 && (A.value = n);
|
|
534
|
+
}
|
|
535
|
+
ne(!1);
|
|
536
|
+
} else {
|
|
537
|
+
C.value && ne(!0), m.value && A.value != null && (m.value.style.height = `${A.value}px`);
|
|
538
|
+
const n = L.value ? P() : N();
|
|
539
|
+
try {
|
|
540
|
+
(o = n == null ? void 0 : n.layout) == null || o.call(n);
|
|
541
|
+
} catch (l) {
|
|
542
|
+
}
|
|
543
|
+
ae = 2, le(() => {
|
|
544
|
+
C.value ? W() : q();
|
|
545
|
+
});
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
Y(
|
|
549
|
+
() => v.value,
|
|
550
|
+
(t, e) => {
|
|
551
|
+
const o = L.value ? P() : N();
|
|
552
|
+
o && typeof t == "number" && Number.isFinite(t) && t > 0 && (o.updateOptions({ fontSize: t }), C.value && !M.value && W());
|
|
553
|
+
},
|
|
554
|
+
{ flush: "post", immediate: !1 }
|
|
555
|
+
);
|
|
556
|
+
function ht() {
|
|
557
|
+
if (!he.value)
|
|
558
|
+
return;
|
|
559
|
+
const t = (S.value || i.node.language).toLowerCase();
|
|
560
|
+
if (H.value) {
|
|
561
|
+
const e = t === "html" ? "text/html" : "image/svg+xml", o = t === "html" ? r("artifacts.htmlPreviewTitle") || "HTML Preview" : r("artifacts.svgPreviewTitle") || "SVG Preview";
|
|
562
|
+
j("previewCode", {
|
|
563
|
+
node: i.node,
|
|
564
|
+
artifactType: e,
|
|
565
|
+
artifactTitle: o,
|
|
566
|
+
id: `temp-${t}-${Date.now()}`
|
|
567
|
+
});
|
|
568
|
+
return;
|
|
569
|
+
}
|
|
570
|
+
t === "html" && (oe.value = !oe.value);
|
|
571
|
+
}
|
|
572
|
+
function ne(t) {
|
|
573
|
+
var e, o;
|
|
574
|
+
try {
|
|
575
|
+
if (L.value) {
|
|
576
|
+
const n = P();
|
|
577
|
+
(e = n == null ? void 0 : n.updateOptions) == null || e.call(n, { automaticLayout: t });
|
|
578
|
+
} else {
|
|
579
|
+
const n = N();
|
|
580
|
+
(o = n == null ? void 0 : n.updateOptions) == null || o.call(n, { automaticLayout: t });
|
|
581
|
+
}
|
|
582
|
+
} catch (n) {
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
function gt(t) {
|
|
586
|
+
return R(this, null, function* () {
|
|
587
|
+
var o, n, l;
|
|
588
|
+
if (!V)
|
|
589
|
+
return;
|
|
590
|
+
L.value ? (ce(), Z ? yield Z(t, String((o = i.node.originalCode) != null ? o : ""), String((n = i.node.updatedCode) != null ? n : ""), S.value) : yield V(t, i.node.code, S.value)) : yield V(t, i.node.code, S.value);
|
|
591
|
+
const e = L.value ? P() : N();
|
|
592
|
+
if (typeof ((l = i.monacoOptions) == null ? void 0 : l.fontSize) == "number")
|
|
593
|
+
e == null || e.updateOptions({ fontSize: i.monacoOptions.fontSize, automaticLayout: !1 }), D.value = i.monacoOptions.fontSize, v.value = i.monacoOptions.fontSize;
|
|
594
|
+
else {
|
|
595
|
+
const s = Be();
|
|
596
|
+
s && s > 0 ? (D.value = s, v.value = s) : (D.value = 12, v.value = 12);
|
|
597
|
+
}
|
|
598
|
+
!C.value && !M.value && q(), i.loading === !1 && (yield we(), le(() => {
|
|
599
|
+
C.value && !M.value ? W() : M.value || q();
|
|
600
|
+
}));
|
|
601
|
+
});
|
|
602
|
+
}
|
|
603
|
+
function ge(t) {
|
|
604
|
+
return V ? G || (Q.value = !0, G = R(null, null, function* () {
|
|
605
|
+
yield gt(t);
|
|
606
|
+
}).finally(() => {
|
|
607
|
+
G = null;
|
|
608
|
+
}), G) : null;
|
|
609
|
+
}
|
|
610
|
+
const He = Y(
|
|
611
|
+
() => [m.value, K.value, L.value, i.stream, i.loading, Ce.value, I.value],
|
|
612
|
+
(p) => R(null, [p], function* ([t, e, o, n, l, s, w]) {
|
|
613
|
+
if (!t || !V || !w || n === !1 && l !== !1)
|
|
614
|
+
return;
|
|
615
|
+
if (K.value) {
|
|
616
|
+
te(), He();
|
|
617
|
+
return;
|
|
618
|
+
}
|
|
619
|
+
const k = ge(t);
|
|
620
|
+
k && (yield k, He());
|
|
621
|
+
})
|
|
622
|
+
), pt = Y(
|
|
623
|
+
() => [i.darkTheme, i.lightTheme, Q.value, I.value],
|
|
624
|
+
() => {
|
|
625
|
+
if (!(!Q.value || !I.value)) {
|
|
626
|
+
if (K.value)
|
|
627
|
+
return pt();
|
|
628
|
+
wt();
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
);
|
|
632
|
+
function Le() {
|
|
633
|
+
return i.isDark ? i.darkTheme : i.lightTheme;
|
|
634
|
+
}
|
|
635
|
+
function wt() {
|
|
636
|
+
const t = Le();
|
|
637
|
+
t && de(t);
|
|
638
|
+
}
|
|
639
|
+
const yt = Y(
|
|
640
|
+
() => [i.monacoOptions, I.value],
|
|
641
|
+
() => {
|
|
642
|
+
var o, n;
|
|
643
|
+
if (!V || !I.value)
|
|
644
|
+
return;
|
|
645
|
+
if (K.value)
|
|
646
|
+
return yt();
|
|
647
|
+
const t = L.value ? P() : N(), e = typeof ((o = i.monacoOptions) == null ? void 0 : o.fontSize) == "number" ? i.monacoOptions.fontSize : Number.isFinite(v.value) ? v.value : void 0;
|
|
648
|
+
typeof e == "number" && Number.isFinite(e) && e > 0 && ((n = t == null ? void 0 : t.updateOptions) == null || n.call(t, { fontSize: e })), C.value && !M.value ? W() : M.value || q();
|
|
649
|
+
},
|
|
650
|
+
{ deep: !0 }
|
|
651
|
+
), ie = Y(
|
|
652
|
+
() => [i.loading, I.value],
|
|
653
|
+
(o) => R(null, [o], function* ([t, e]) {
|
|
654
|
+
if (e) {
|
|
655
|
+
if (K.value) {
|
|
656
|
+
we(() => {
|
|
657
|
+
ie == null || ie();
|
|
658
|
+
});
|
|
659
|
+
return;
|
|
660
|
+
}
|
|
661
|
+
t || (yield we(), le(() => {
|
|
662
|
+
M.value || (C.value ? W() : q()), ie();
|
|
663
|
+
}));
|
|
664
|
+
}
|
|
665
|
+
}),
|
|
666
|
+
{ immediate: !0, flush: "post" }
|
|
667
|
+
);
|
|
668
|
+
return Qe(() => {
|
|
669
|
+
te();
|
|
670
|
+
}), (t, e) => fe.value ? (F(), xe(g(Yt), {
|
|
671
|
+
key: 0,
|
|
672
|
+
node: f.node,
|
|
673
|
+
loading: i.loading
|
|
674
|
+
}, null, 8, ["node", "loading"])) : (F(), O("div", {
|
|
675
|
+
key: 1,
|
|
676
|
+
ref_key: "container",
|
|
677
|
+
ref: y,
|
|
678
|
+
style: Ye(dt.value),
|
|
679
|
+
class: J(["code-block-container my-4 rounded-lg border overflow-hidden shadow-sm", [
|
|
680
|
+
i.isDark ? "border-gray-700/30 bg-gray-900" : "border-gray-200 bg-white",
|
|
681
|
+
{ "is-rendering": i.loading, "is-dark": i.isDark }
|
|
682
|
+
]])
|
|
683
|
+
}, [
|
|
684
|
+
i.showHeader ? (F(), O("div", Kt, [
|
|
685
|
+
ye(t.$slots, "header-left", {}, () => [
|
|
686
|
+
a("div", Jt, [
|
|
687
|
+
a("span", {
|
|
688
|
+
class: "icon-slot h-4 w-4 flex-shrink-0",
|
|
689
|
+
innerHTML: ct.value
|
|
690
|
+
}, null, 8, Qt),
|
|
691
|
+
a("span", Zt, be(ut.value), 1)
|
|
692
|
+
])
|
|
693
|
+
], !0),
|
|
694
|
+
ye(t.$slots, "header-right", {}, () => [
|
|
695
|
+
a("div", eo, [
|
|
696
|
+
a("button", {
|
|
697
|
+
type: "button",
|
|
698
|
+
class: "code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",
|
|
699
|
+
"aria-pressed": M.value,
|
|
700
|
+
onClick: mt,
|
|
701
|
+
onMouseenter: e[0] || (e[0] = (o) => T(o, M.value ? g(r)("common.expand") || "Expand" : g(r)("common.collapse") || "Collapse")),
|
|
702
|
+
onFocus: e[1] || (e[1] = (o) => T(o, M.value ? g(r)("common.expand") || "Expand" : g(r)("common.collapse") || "Collapse")),
|
|
703
|
+
onMouseleave: E,
|
|
704
|
+
onBlur: E
|
|
705
|
+
}, [
|
|
706
|
+
(F(), O("svg", {
|
|
707
|
+
style: Ye({ rotate: M.value ? "0deg" : "90deg" }),
|
|
708
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
709
|
+
"xmlns:xlink": "http://www.w3.org/1999/xlink",
|
|
710
|
+
"aria-hidden": "true",
|
|
711
|
+
role: "img",
|
|
712
|
+
width: "1em",
|
|
713
|
+
height: "1em",
|
|
714
|
+
viewBox: "0 0 24 24",
|
|
715
|
+
class: "w-3 h-3"
|
|
716
|
+
}, [...e[17] || (e[17] = [
|
|
717
|
+
a("path", {
|
|
718
|
+
fill: "none",
|
|
719
|
+
stroke: "currentColor",
|
|
720
|
+
"stroke-linecap": "round",
|
|
721
|
+
"stroke-linejoin": "round",
|
|
722
|
+
"stroke-width": "2",
|
|
723
|
+
d: "m9 18l6-6l-6-6"
|
|
724
|
+
}, null, -1)
|
|
725
|
+
])], 4))
|
|
726
|
+
], 40, to),
|
|
727
|
+
i.showFontSizeButtons && i.enableFontSizeControl ? (F(), O(zt, { key: 0 }, [
|
|
728
|
+
a("button", {
|
|
729
|
+
type: "button",
|
|
730
|
+
class: "code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",
|
|
731
|
+
disabled: Number.isFinite(v.value) ? v.value <= qe : !1,
|
|
732
|
+
onClick: e[2] || (e[2] = (o) => lt()),
|
|
733
|
+
onMouseenter: e[3] || (e[3] = (o) => T(o, g(r)("common.decrease") || "Decrease")),
|
|
734
|
+
onFocus: e[4] || (e[4] = (o) => T(o, g(r)("common.decrease") || "Decrease")),
|
|
735
|
+
onMouseleave: E,
|
|
736
|
+
onBlur: E
|
|
737
|
+
}, [...e[18] || (e[18] = [
|
|
738
|
+
a("svg", {
|
|
739
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
740
|
+
"xmlns:xlink": "http://www.w3.org/1999/xlink",
|
|
741
|
+
"aria-hidden": "true",
|
|
742
|
+
role: "img",
|
|
743
|
+
width: "1em",
|
|
744
|
+
height: "1em",
|
|
745
|
+
viewBox: "0 0 24 24",
|
|
746
|
+
class: "w-3 h-3"
|
|
747
|
+
}, [
|
|
748
|
+
a("path", {
|
|
749
|
+
fill: "none",
|
|
750
|
+
stroke: "currentColor",
|
|
751
|
+
"stroke-linecap": "round",
|
|
752
|
+
"stroke-linejoin": "round",
|
|
753
|
+
"stroke-width": "2",
|
|
754
|
+
d: "M5 12h14"
|
|
755
|
+
})
|
|
756
|
+
], -1)
|
|
757
|
+
])], 40, oo),
|
|
758
|
+
a("button", {
|
|
759
|
+
type: "button",
|
|
760
|
+
class: "code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",
|
|
761
|
+
disabled: !ot.value || v.value === D.value,
|
|
762
|
+
onClick: e[5] || (e[5] = (o) => rt()),
|
|
763
|
+
onMouseenter: e[6] || (e[6] = (o) => T(o, g(r)("common.reset") || "Reset")),
|
|
764
|
+
onFocus: e[7] || (e[7] = (o) => T(o, g(r)("common.reset") || "Reset")),
|
|
765
|
+
onMouseleave: E,
|
|
766
|
+
onBlur: E
|
|
767
|
+
}, [...e[19] || (e[19] = [
|
|
768
|
+
a("svg", {
|
|
769
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
770
|
+
"xmlns:xlink": "http://www.w3.org/1999/xlink",
|
|
771
|
+
"aria-hidden": "true",
|
|
772
|
+
role: "img",
|
|
773
|
+
width: "1em",
|
|
774
|
+
height: "1em",
|
|
775
|
+
viewBox: "0 0 24 24",
|
|
776
|
+
class: "w-3 h-3"
|
|
777
|
+
}, [
|
|
778
|
+
a("g", {
|
|
779
|
+
fill: "none",
|
|
780
|
+
stroke: "currentColor",
|
|
781
|
+
"stroke-linecap": "round",
|
|
782
|
+
"stroke-linejoin": "round",
|
|
783
|
+
"stroke-width": "2"
|
|
784
|
+
}, [
|
|
785
|
+
a("path", { d: "M3 12a9 9 0 1 0 9-9a9.75 9.75 0 0 0-6.74 2.74L3 8" }),
|
|
786
|
+
a("path", { d: "M3 3v5h5" })
|
|
787
|
+
])
|
|
788
|
+
], -1)
|
|
789
|
+
])], 40, no),
|
|
790
|
+
a("button", {
|
|
791
|
+
type: "button",
|
|
792
|
+
class: "code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",
|
|
793
|
+
disabled: Number.isFinite(v.value) ? v.value >= Xe : !1,
|
|
794
|
+
onClick: e[8] || (e[8] = (o) => it()),
|
|
795
|
+
onMouseenter: e[9] || (e[9] = (o) => T(o, g(r)("common.increase") || "Increase")),
|
|
796
|
+
onFocus: e[10] || (e[10] = (o) => T(o, g(r)("common.increase") || "Increase")),
|
|
797
|
+
onMouseleave: E,
|
|
798
|
+
onBlur: E
|
|
799
|
+
}, [...e[20] || (e[20] = [
|
|
800
|
+
a("svg", {
|
|
801
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
802
|
+
"xmlns:xlink": "http://www.w3.org/1999/xlink",
|
|
803
|
+
"aria-hidden": "true",
|
|
804
|
+
role: "img",
|
|
805
|
+
width: "1em",
|
|
806
|
+
height: "1em",
|
|
807
|
+
viewBox: "0 0 24 24",
|
|
808
|
+
class: "w-3 h-3"
|
|
809
|
+
}, [
|
|
810
|
+
a("path", {
|
|
811
|
+
fill: "none",
|
|
812
|
+
stroke: "currentColor",
|
|
813
|
+
"stroke-linecap": "round",
|
|
814
|
+
"stroke-linejoin": "round",
|
|
815
|
+
"stroke-width": "2",
|
|
816
|
+
d: "M5 12h14m-7-7v14"
|
|
817
|
+
})
|
|
818
|
+
], -1)
|
|
819
|
+
])], 40, io)
|
|
820
|
+
], 64)) : X("", !0),
|
|
821
|
+
i.showCopyButton ? (F(), O("button", {
|
|
822
|
+
key: 1,
|
|
823
|
+
type: "button",
|
|
824
|
+
class: "code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",
|
|
825
|
+
"aria-label": $.value ? g(r)("common.copied") || "Copied" : g(r)("common.copy") || "Copy",
|
|
826
|
+
onClick: ft,
|
|
827
|
+
onMouseenter: e[11] || (e[11] = (o) => Fe(o)),
|
|
828
|
+
onFocus: e[12] || (e[12] = (o) => Fe(o)),
|
|
829
|
+
onMouseleave: E,
|
|
830
|
+
onBlur: E
|
|
831
|
+
}, [
|
|
832
|
+
$.value ? (F(), O("svg", ao, [...e[22] || (e[22] = [
|
|
833
|
+
a("path", {
|
|
834
|
+
fill: "none",
|
|
835
|
+
stroke: "currentColor",
|
|
836
|
+
"stroke-linecap": "round",
|
|
837
|
+
"stroke-linejoin": "round",
|
|
838
|
+
"stroke-width": "2",
|
|
839
|
+
d: "M20 6L9 17l-5-5"
|
|
840
|
+
}, null, -1)
|
|
841
|
+
])])) : (F(), O("svg", ro, [...e[21] || (e[21] = [
|
|
842
|
+
a("g", {
|
|
843
|
+
fill: "none",
|
|
844
|
+
stroke: "currentColor",
|
|
845
|
+
"stroke-linecap": "round",
|
|
846
|
+
"stroke-linejoin": "round",
|
|
847
|
+
"stroke-width": "2"
|
|
848
|
+
}, [
|
|
849
|
+
a("rect", {
|
|
850
|
+
width: "14",
|
|
851
|
+
height: "14",
|
|
852
|
+
x: "8",
|
|
853
|
+
y: "8",
|
|
854
|
+
rx: "2",
|
|
855
|
+
ry: "2"
|
|
856
|
+
}),
|
|
857
|
+
a("path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" })
|
|
858
|
+
], -1)
|
|
859
|
+
])]))
|
|
860
|
+
], 40, lo)) : X("", !0),
|
|
861
|
+
i.showExpandButton ? (F(), O("button", {
|
|
862
|
+
key: 2,
|
|
863
|
+
type: "button",
|
|
864
|
+
class: "code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",
|
|
865
|
+
"aria-pressed": C.value,
|
|
866
|
+
onClick: vt,
|
|
867
|
+
onMouseenter: e[13] || (e[13] = (o) => T(o, C.value ? g(r)("common.collapse") || "Collapse" : g(r)("common.expand") || "Expand")),
|
|
868
|
+
onFocus: e[14] || (e[14] = (o) => T(o, C.value ? g(r)("common.collapse") || "Collapse" : g(r)("common.expand") || "Expand")),
|
|
869
|
+
onMouseleave: E,
|
|
870
|
+
onBlur: E
|
|
871
|
+
}, [
|
|
872
|
+
C.value ? (F(), O("svg", uo, [...e[23] || (e[23] = [
|
|
873
|
+
a("path", {
|
|
874
|
+
fill: "none",
|
|
875
|
+
stroke: "currentColor",
|
|
876
|
+
"stroke-linecap": "round",
|
|
877
|
+
"stroke-linejoin": "round",
|
|
878
|
+
"stroke-width": "2",
|
|
879
|
+
d: "M15 3h6v6m0-6l-7 7M3 21l7-7m-1 7H3v-6"
|
|
880
|
+
}, null, -1)
|
|
881
|
+
])])) : (F(), O("svg", co, [...e[24] || (e[24] = [
|
|
882
|
+
a("path", {
|
|
883
|
+
fill: "none",
|
|
884
|
+
stroke: "currentColor",
|
|
885
|
+
"stroke-linecap": "round",
|
|
886
|
+
"stroke-linejoin": "round",
|
|
887
|
+
"stroke-width": "2",
|
|
888
|
+
d: "m14 10l7-7m-1 7h-6V4M3 21l7-7m-6 0h6v6"
|
|
889
|
+
}, null, -1)
|
|
890
|
+
])]))
|
|
891
|
+
], 40, so)) : X("", !0),
|
|
892
|
+
he.value && i.showPreviewButton ? (F(), O("button", {
|
|
893
|
+
key: 3,
|
|
894
|
+
type: "button",
|
|
895
|
+
class: "code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",
|
|
896
|
+
"aria-label": g(r)("common.preview") || "Preview",
|
|
897
|
+
onClick: ht,
|
|
898
|
+
onMouseenter: e[15] || (e[15] = (o) => T(o, g(r)("common.preview") || "Preview")),
|
|
899
|
+
onFocus: e[16] || (e[16] = (o) => T(o, g(r)("common.preview") || "Preview")),
|
|
900
|
+
onMouseleave: E,
|
|
901
|
+
onBlur: E
|
|
902
|
+
}, [...e[25] || (e[25] = [
|
|
903
|
+
a("svg", {
|
|
904
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
905
|
+
width: "12",
|
|
906
|
+
height: "12",
|
|
907
|
+
viewBox: "0 0 24 24"
|
|
908
|
+
}, [
|
|
909
|
+
a("g", {
|
|
910
|
+
fill: "currentColor",
|
|
911
|
+
"fill-rule": "evenodd",
|
|
912
|
+
"clip-rule": "evenodd"
|
|
913
|
+
}, [
|
|
914
|
+
a("path", { d: "M23.628 7.41c-.12-1.172-.08-3.583-.9-4.233c-1.921-1.51-6.143-1.11-8.815-1.19c-3.481-.15-7.193.14-10.625.24a.34.34 0 0 0 0 .67c3.472-.05 7.074-.29 10.575-.09c2.471.15 6.653-.14 8.254 1.16c.4.33.41 2.732.49 3.582a42 42 0 0 1 .08 9.005a13.8 13.8 0 0 1-.45 3.001c-2.42 1.4-19.69 2.381-20.72.55a21 21 0 0 1-.65-4.632a41.5 41.5 0 0 1 .12-7.964c.08 0 7.334.33 12.586.24c2.331 0 4.682-.13 6.764-.21a.33.33 0 0 0 0-.66c-7.714-.16-12.897-.43-19.31.05c.11-1.38.48-3.922.38-4.002a.3.3 0 0 0-.42 0c-.37.41-.29 1.77-.36 2.251s-.14 1.07-.2 1.6a45 45 0 0 0-.36 8.645a21.8 21.8 0 0 0 .66 5.002c1.46 2.702 17.248 1.461 20.95.43c1.45-.4 1.69-.8 1.871-1.95c.575-3.809.602-7.68.08-11.496" }),
|
|
915
|
+
a("path", { d: "M4.528 5.237a.84.84 0 0 0-.21-1c-.77-.41-1.71.39-1 1.1a.83.83 0 0 0 1.21-.1m2.632-.25c.14-.14.19-.84-.2-1c-.77-.41-1.71.39-1 1.09a.82.82 0 0 0 1.2-.09m2.88 0a.83.83 0 0 0-.21-1c-.77-.41-1.71.39-1 1.09a.82.82 0 0 0 1.21-.09m-4.29 8.735c0 .08.23 2.471.31 2.561a.371.371 0 0 0 .63-.14c0-.09 0 0 .15-1.72a10 10 0 0 0-.11-2.232a5.3 5.3 0 0 1-.26-1.37a.3.3 0 0 0-.54-.24a6.8 6.8 0 0 0-.2 2.33c-1.281-.38-1.121.13-1.131-.42a15 15 0 0 0-.19-1.93c-.16-.17-.36-.17-.51.14a20 20 0 0 0-.43 3.471c.04.773.18 1.536.42 2.272c.26.4.7.22.7-.1c0-.09-.16-.09 0-1.862c.06-1.18-.23-.3 1.16-.76m5.033-2.552c.32-.07.41-.28.39-.37c0-.55-3.322-.34-3.462-.24s-.2.18-.18.28s0 .11 0 .16a3.8 3.8 0 0 0 1.591.361v.82a15 15 0 0 0-.13 3.132c0 .2-.09.94.17 1.16a.34.34 0 0 0 .48 0c.125-.35.196-.718.21-1.09a8 8 0 0 0 .14-3.232c0-.13.05-.7-.1-.89a8 8 0 0 0 .89-.09m5.544-.181a.69.69 0 0 0-.89-.44a2.8 2.8 0 0 0-1.252 1.001a2.3 2.3 0 0 0-.41-.83a1 1 0 0 0-1.6.27a7 7 0 0 0-.35 2.07c0 .571 0 2.642.06 2.762c.14 1.09 1 .51.63.13a17.6 17.6 0 0 1 .38-3.962c.32-1.18.32.2.39.51s.11 1.081.73 1.081s.48-.93 1.401-1.78q.075 1.345 0 2.69a15 15 0 0 0 0 1.811a.34.34 0 0 0 .68 0q.112-.861.11-1.73a16.7 16.7 0 0 0 .12-3.582m1.441-.201c-.05.16-.3 3.002-.31 3.202a6.3 6.3 0 0 0 .21 1.741c.33 1 1.21 1.07 2.291.82a3.7 3.7 0 0 0 1.14-.23c.21-.22.10-.59-.41-.64q-.817.096-1.64.07c-.44-.07-.34 0-.67-4.442q.015-.185 0-.37a.316.316 0 0 0-.23-.38a.316.316 0 0 0-.38.23" })
|
|
916
|
+
])
|
|
917
|
+
], -1)
|
|
918
|
+
])], 40, fo)) : X("", !0)
|
|
919
|
+
])
|
|
920
|
+
], !0)
|
|
921
|
+
])) : X("", !0),
|
|
922
|
+
Ae(a("div", {
|
|
923
|
+
ref_key: "codeEditor",
|
|
924
|
+
ref: m,
|
|
925
|
+
class: J(["code-editor-container", [f.stream ? "" : "code-height-placeholder"]])
|
|
926
|
+
}, null, 2), [
|
|
927
|
+
[We, !M.value && (f.stream ? !0 : !f.loading)]
|
|
928
|
+
]),
|
|
929
|
+
oe.value && !H.value && he.value && S.value.trim().toLowerCase() === "html" ? (F(), xe(Gt, {
|
|
930
|
+
key: 1,
|
|
931
|
+
code: f.node.code,
|
|
932
|
+
"is-dark": i.isDark,
|
|
933
|
+
"on-close": () => oe.value = !1
|
|
934
|
+
}, null, 8, ["code", "is-dark", "on-close"])) : X("", !0),
|
|
935
|
+
Ae(a("div", vo, [
|
|
936
|
+
ye(t.$slots, "loading", {
|
|
937
|
+
loading: f.loading,
|
|
938
|
+
stream: f.stream
|
|
939
|
+
}, () => [
|
|
940
|
+
e[26] || (e[26] = a("div", { class: "loading-skeleton" }, [
|
|
941
|
+
a("div", { class: "skeleton-line" }),
|
|
942
|
+
a("div", { class: "skeleton-line" }),
|
|
943
|
+
a("div", { class: "skeleton-line short" })
|
|
944
|
+
], -1))
|
|
945
|
+
], !0)
|
|
946
|
+
], 512), [
|
|
947
|
+
[We, !f.stream && f.loading]
|
|
948
|
+
]),
|
|
949
|
+
a("span", mo, be($.value ? g(r)("common.copied") || "Copied" : ""), 1)
|
|
950
|
+
], 6));
|
|
951
|
+
}
|
|
952
|
+
}), ke = /* @__PURE__ */ et(ho, [["__scopeId", "data-v-d44250c0"]]);
|
|
953
|
+
ke.install = (f) => {
|
|
954
|
+
f.component(ke.__name, ke);
|
|
955
|
+
};
|
|
956
|
+
export {
|
|
957
|
+
ke as default
|
|
958
|
+
};
|