markstream-vue 0.0.2-beta.8 → 0.0.2
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-CnH6kN6F.js +4908 -0
- package/dist/exports-DsdRlFsA.cjs +246 -0
- package/dist/exports.js +1 -1
- package/dist/index-BVEX3mF2.js +113 -0
- package/dist/index-Bie7KQwi.js +950 -0
- package/dist/index-D4WvXLjB.cjs +22 -0
- package/dist/index-DObBCK_f.cjs +1 -0
- package/dist/index-DRwD-ixu.js +122 -0
- package/dist/index-Dp_yMiDW.cjs +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.ts +23 -1
- package/dist/index.js +68 -57
- 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 +9 -9
- package/dist/exports-BD7Y_TjZ.cjs +0 -247
- package/dist/exports-BreegGo9.js +0 -4719
- package/dist/index-BM9Oro93.js +0 -860
- package/dist/index-Cc3u_ylp.js +0 -117
- package/dist/index-CoB_G9GJ.cjs +0 -1
- package/dist/index-DbbC_URx.cjs +0 -1
- package/dist/index-Dq586yJ8.cjs +0 -1
- package/dist/index-ELonlW3Z.js +0 -108
|
@@ -0,0 +1,950 @@
|
|
|
1
|
+
var Ht = Object.defineProperty, Tt = Object.defineProperties;
|
|
2
|
+
var Dt = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var Ve = Object.getOwnPropertySymbols;
|
|
4
|
+
var Pt = Object.prototype.hasOwnProperty, Lt = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var Re = (f, u, i) => u in f ? Ht(f, u, { enumerable: !0, configurable: !0, writable: !0, value: i }) : f[u] = i, _e = (f, u) => {
|
|
6
|
+
for (var i in u || (u = {}))
|
|
7
|
+
Pt.call(u, i) && Re(f, i, u[i]);
|
|
8
|
+
if (Ve)
|
|
9
|
+
for (var i of Ve(u))
|
|
10
|
+
Lt.call(u, i) && Re(f, i, u[i]);
|
|
11
|
+
return f;
|
|
12
|
+
}, Ye = (f, u) => Tt(f, Dt(u));
|
|
13
|
+
var _ = (f, u, i) => new Promise((j, I) => {
|
|
14
|
+
var F = (y) => {
|
|
15
|
+
try {
|
|
16
|
+
m(i.next(y));
|
|
17
|
+
} catch ($) {
|
|
18
|
+
I($);
|
|
19
|
+
}
|
|
20
|
+
}, a = (y) => {
|
|
21
|
+
try {
|
|
22
|
+
m(i.throw(y));
|
|
23
|
+
} catch ($) {
|
|
24
|
+
I($);
|
|
25
|
+
}
|
|
26
|
+
}, m = (y) => y.done ? j(y.value) : Promise.resolve(y.value).then(F, a);
|
|
27
|
+
m((i = i.apply(f, u)).next());
|
|
28
|
+
});
|
|
29
|
+
import { defineComponent as Ze, computed as z, onMounted as Ot, onUnmounted as et, createBlock as Ce, openBlock as E, Teleport as $t, createElementVNode as r, normalizeClass as Q, withModifiers as Nt, toDisplayString as Me, unref as g, getCurrentInstance as zt, ref as B, watch as Y, onBeforeUnmount as It, nextTick as ye, createElementBlock as O, normalizeStyle as Ae, createCommentVNode as X, withDirectives as We, renderSlot as ke, Fragment as Vt, vShow as je } from "vue";
|
|
30
|
+
import { u as tt, _ as ot, n as xe, r as Rt, a as _t, g as Yt, s as ae, l as qe, b as At, c as Wt, d as Xe, h as jt } from "./exports-CnH6kN6F.js";
|
|
31
|
+
const qt = { class: "html-preview-frame__header" }, Xt = { class: "html-preview-frame__title" }, Ut = { class: "html-preview-frame__label" }, Gt = ["srcdoc"], Kt = /* @__PURE__ */ Ze({
|
|
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 } = tt(), j = z(() => {
|
|
41
|
+
const F = u.code || "", a = F.trim().toLowerCase();
|
|
42
|
+
if (a.startsWith("<!doctype") || a.startsWith("<html") || a.startsWith("<body"))
|
|
43
|
+
return F;
|
|
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
|
+
${F}
|
|
65
|
+
</body>
|
|
66
|
+
</html>`;
|
|
67
|
+
});
|
|
68
|
+
function I(F) {
|
|
69
|
+
var a;
|
|
70
|
+
(F.key === "Escape" || F.key === "Esc") && ((a = u.onClose) == null || a.call(u));
|
|
71
|
+
}
|
|
72
|
+
return Ot(() => {
|
|
73
|
+
typeof window != "undefined" && window.addEventListener("keydown", I);
|
|
74
|
+
}), et(() => {
|
|
75
|
+
typeof window != "undefined" && window.removeEventListener("keydown", I);
|
|
76
|
+
}), (F, a) => (E(), Ce($t, { to: "body" }, [
|
|
77
|
+
r("div", {
|
|
78
|
+
class: Q(["html-preview-frame__backdrop", { "html-preview-frame__backdrop--dark": u.isDark }]),
|
|
79
|
+
onClick: a[2] || (a[2] = (m) => {
|
|
80
|
+
var y;
|
|
81
|
+
return (y = u.onClose) == null ? void 0 : y.call(u);
|
|
82
|
+
})
|
|
83
|
+
}, [
|
|
84
|
+
r("div", {
|
|
85
|
+
class: Q(["html-preview-frame", { "html-preview-frame--dark": u.isDark }]),
|
|
86
|
+
onClick: a[1] || (a[1] = Nt(() => {
|
|
87
|
+
}, ["stop"]))
|
|
88
|
+
}, [
|
|
89
|
+
r("div", qt, [
|
|
90
|
+
r("div", Xt, [
|
|
91
|
+
a[3] || (a[3] = r("span", { class: "html-preview-frame__dot" }, null, -1)),
|
|
92
|
+
r("span", Ut, Me(u.title || g(i)("common.preview") || "Preview"), 1)
|
|
93
|
+
]),
|
|
94
|
+
r("button", {
|
|
95
|
+
type: "button",
|
|
96
|
+
class: Q(["html-preview-frame__close", { "html-preview-frame__close--dark": u.isDark }]),
|
|
97
|
+
onClick: a[0] || (a[0] = (m) => {
|
|
98
|
+
var y;
|
|
99
|
+
return (y = u.onClose) == null ? void 0 : y.call(u);
|
|
100
|
+
})
|
|
101
|
+
}, " × ", 2)
|
|
102
|
+
]),
|
|
103
|
+
r("iframe", {
|
|
104
|
+
class: "html-preview-frame__iframe",
|
|
105
|
+
sandbox: "allow-scripts allow-same-origin",
|
|
106
|
+
srcdoc: j.value
|
|
107
|
+
}, null, 8, Gt)
|
|
108
|
+
], 2)
|
|
109
|
+
], 2)
|
|
110
|
+
]));
|
|
111
|
+
}
|
|
112
|
+
}), Jt = /* @__PURE__ */ ot(Kt, [["__scopeId", "data-v-3cf0ed56"]]), Qt = {
|
|
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
|
+
}, Zt = { class: "flex items-center space-x-2 flex-1 overflow-hidden" }, eo = ["innerHTML"], to = { class: "text-sm font-medium font-mono truncate" }, oo = { class: "flex items-center space-x-2" }, no = ["aria-pressed"], io = ["disabled"], lo = ["disabled"], ao = ["disabled"], ro = ["aria-label"], so = {
|
|
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
|
+
}, uo = {
|
|
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
|
+
}, co = ["aria-pressed"], fo = {
|
|
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
|
+
}, vo = {
|
|
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
|
+
}, mo = ["aria-label"], ho = { class: "code-loading-placeholder" }, go = {
|
|
157
|
+
class: "sr-only",
|
|
158
|
+
"aria-live": "polite",
|
|
159
|
+
role: "status"
|
|
160
|
+
}, Ue = 10, Ge = 36, Ke = 1, Je = 0, Qe = 1.5, re = 1, po = /* @__PURE__ */ Ze({
|
|
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 Le;
|
|
185
|
+
const i = f, j = u, I = zt(), F = z(() => {
|
|
186
|
+
const t = I == null ? void 0 : I.vnode.props;
|
|
187
|
+
return !!(t && (t.onPreviewCode || t.onPreviewCode));
|
|
188
|
+
}), { t: a } = tt(), m = B(null), y = B(null), $ = B(!1), P = B(xe(i.node.language)), U = z(() => Rt(P.value)), C = B(!1), M = B(!1), Z = B(!1), Be = B(!1), A = B(null);
|
|
189
|
+
let se = 0;
|
|
190
|
+
const nt = _t(), G = B(null), V = B(typeof window == "undefined");
|
|
191
|
+
typeof window != "undefined" && Y(
|
|
192
|
+
() => y.value,
|
|
193
|
+
(t) => {
|
|
194
|
+
var o;
|
|
195
|
+
if ((o = G.value) == null || o.destroy(), G.value = null, !t) {
|
|
196
|
+
V.value = !1;
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
const e = nt(t, { rootMargin: "400px" });
|
|
200
|
+
G.value = e, V.value = e.isVisible.value, e.whenVisible.then(() => {
|
|
201
|
+
V.value = !0;
|
|
202
|
+
});
|
|
203
|
+
},
|
|
204
|
+
{ immediate: !0 }
|
|
205
|
+
), It(() => {
|
|
206
|
+
var t;
|
|
207
|
+
(t = G.value) == null || t.destroy(), G.value = null;
|
|
208
|
+
});
|
|
209
|
+
let R = null, ee = null, ue = () => {
|
|
210
|
+
}, ce = () => {
|
|
211
|
+
}, te = () => null, N = () => ({ getModel: () => ({ getLineCount: () => 1 }), getOption: () => 14, updateOptions: () => {
|
|
212
|
+
} }), L = () => ({ getModel: () => ({ getLineCount: () => 1 }), getOption: () => 14, updateOptions: () => {
|
|
213
|
+
} }), oe = () => {
|
|
214
|
+
}, de = () => {
|
|
215
|
+
}, K = null, Se = () => {
|
|
216
|
+
var t;
|
|
217
|
+
return String((t = i.node.language) != null ? t : "plaintext");
|
|
218
|
+
}, fe = () => _(null, null, function* () {
|
|
219
|
+
});
|
|
220
|
+
const H = z(() => i.node.diff), ve = B(!1), ne = B(!1);
|
|
221
|
+
typeof window != "undefined" && _(null, null, function* () {
|
|
222
|
+
try {
|
|
223
|
+
const t = yield Yt();
|
|
224
|
+
if (!t) {
|
|
225
|
+
ve.value = !0;
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
const e = t.useMonaco, o = t.detectLanguage;
|
|
229
|
+
if (typeof o == "function" && (Se = o), typeof e == "function") {
|
|
230
|
+
const n = Pe();
|
|
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(Ye(_e({
|
|
234
|
+
wordWrap: "on",
|
|
235
|
+
wrappingIndent: "same",
|
|
236
|
+
themes: i.themes,
|
|
237
|
+
theme: n
|
|
238
|
+
}, i.monacoOptions || {}), {
|
|
239
|
+
onThemeChange() {
|
|
240
|
+
ut();
|
|
241
|
+
}
|
|
242
|
+
}));
|
|
243
|
+
R = l.createEditor || R, ee = l.createDiffEditor || ee, ue = l.updateCode || ue, ce = l.updateDiff || ce, te = l.getEditor || te, N = l.getEditorView || N, L = l.getDiffEditorView || L, oe = l.cleanupEditor || oe, de = l.safeClean || l.cleanupEditor || de, fe = l.setTheme || fe, Be.value = !0, m.value && (yield pe(m.value));
|
|
244
|
+
}
|
|
245
|
+
} catch (t) {
|
|
246
|
+
ve.value = !0;
|
|
247
|
+
}
|
|
248
|
+
});
|
|
249
|
+
const T = B(
|
|
250
|
+
typeof ((Le = i.monacoOptions) == null ? void 0 : Le.fontSize) == "number" ? i.monacoOptions.fontSize : Number.NaN
|
|
251
|
+
), v = B(T.value), it = z(() => {
|
|
252
|
+
const t = T.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 lt() {
|
|
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 Ee() {
|
|
271
|
+
var t, e, o, n, l;
|
|
272
|
+
try {
|
|
273
|
+
const s = H.value ? (o = (e = (t = L()) == null ? void 0 : t.getModifiedEditor) == null ? void 0 : e.call(t)) != null ? o : L() : N(), w = te(), 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 me(t) {
|
|
300
|
+
var n, l;
|
|
301
|
+
try {
|
|
302
|
+
const s = te(), 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 = lt();
|
|
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 he() {
|
|
317
|
+
var e;
|
|
318
|
+
if (Number.isFinite(v.value) && v.value > 0 && Number.isFinite(T.value))
|
|
319
|
+
return v.value;
|
|
320
|
+
const t = Ee();
|
|
321
|
+
return typeof ((e = i.monacoOptions) == null ? void 0 : e.fontSize) == "number" ? (T.value = i.monacoOptions.fontSize, v.value = i.monacoOptions.fontSize, v.value) : t && t > 0 ? (T.value = t, v.value = t, t) : (T.value = 12, v.value = 12, 12);
|
|
322
|
+
}
|
|
323
|
+
function at() {
|
|
324
|
+
const t = he(), e = Math.min(Ge, t + Ke);
|
|
325
|
+
v.value = e;
|
|
326
|
+
}
|
|
327
|
+
function rt() {
|
|
328
|
+
const t = he(), e = Math.max(Ue, t - Ke);
|
|
329
|
+
v.value = e;
|
|
330
|
+
}
|
|
331
|
+
function st() {
|
|
332
|
+
he(), Number.isFinite(T.value) && (v.value = T.value);
|
|
333
|
+
}
|
|
334
|
+
function Fe() {
|
|
335
|
+
var t, e, o, n, l, s, w, p, k, d, h, Oe, $e, Ne;
|
|
336
|
+
try {
|
|
337
|
+
const c = H.value ? L() : N();
|
|
338
|
+
if (!c)
|
|
339
|
+
return null;
|
|
340
|
+
if (H.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 Ct = ((l = x == null ? void 0 : x.getContentHeight) == null ? void 0 : l.call(x)) || 0, Mt = ((s = b == null ? void 0 : b.getContentHeight) == null ? void 0 : s.call(b)) || 0, Ie = Math.max(Ct, Mt);
|
|
344
|
+
if (Ie > 0)
|
|
345
|
+
return Math.ceil(Ie + re);
|
|
346
|
+
const Bt = ((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, St = ((Oe = (h = (d = b == null ? void 0 : b.getModel) == null ? void 0 : d.call(b)) == null ? void 0 : h.getLineCount) == null ? void 0 : Oe.call(h)) || 1, Et = Math.max(Bt, St), Ft = Math.max(me(x), me(b));
|
|
347
|
+
return Math.ceil(Et * (Ft + Qe) + Je + re);
|
|
348
|
+
} else if (c != null && c.getContentHeight) {
|
|
349
|
+
($e = c == null ? void 0 : c.layout) == null || $e.call(c);
|
|
350
|
+
const x = c.getContentHeight();
|
|
351
|
+
if (x > 0)
|
|
352
|
+
return Math.ceil(x + re);
|
|
353
|
+
}
|
|
354
|
+
const we = (Ne = c == null ? void 0 : c.getModel) == null ? void 0 : Ne.call(c);
|
|
355
|
+
let ze = 1;
|
|
356
|
+
we && typeof we.getLineCount == "function" && (ze = we.getLineCount());
|
|
357
|
+
const bt = me(c);
|
|
358
|
+
return Math.ceil(ze * (bt + Qe) + Je + re);
|
|
359
|
+
} catch (c) {
|
|
360
|
+
return null;
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
function ut() {
|
|
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 = Fe();
|
|
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 = ct();
|
|
401
|
+
if (se > 0 && (se--, 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 = Fe();
|
|
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 ct() {
|
|
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 ge = z(() => i.isShowPreview && (P.value === "html" || P.value === "svg")), J = z(() => P.value === "mermaid");
|
|
456
|
+
Y(
|
|
457
|
+
() => i.node.language,
|
|
458
|
+
(t) => {
|
|
459
|
+
P.value = xe(t);
|
|
460
|
+
}
|
|
461
|
+
), Y(
|
|
462
|
+
() => i.node.code,
|
|
463
|
+
(t) => _(null, null, function* () {
|
|
464
|
+
var e, o;
|
|
465
|
+
if (i.stream !== !1) {
|
|
466
|
+
if (P.value || (P.value = xe(Se(t))), R && !Z.value && m.value)
|
|
467
|
+
try {
|
|
468
|
+
yield pe(m.value);
|
|
469
|
+
} catch (n) {
|
|
470
|
+
}
|
|
471
|
+
H.value ? ce(String((e = i.node.originalCode) != null ? e : ""), String((o = i.node.updatedCode) != null ? o : ""), U.value) : ue(t, U.value), C.value && ae(() => W());
|
|
472
|
+
}
|
|
473
|
+
})
|
|
474
|
+
);
|
|
475
|
+
const dt = z(() => {
|
|
476
|
+
const t = P.value;
|
|
477
|
+
return t ? qe[t] || t.charAt(0).toUpperCase() + t.slice(1) : qe[""] || "Plain Text";
|
|
478
|
+
}), ft = z(() => At(P.value || "")), vt = z(() => {
|
|
479
|
+
const t = {}, e = (l) => {
|
|
480
|
+
if (l != null)
|
|
481
|
+
return typeof l == "number" ? `${l}px` : String(l);
|
|
482
|
+
}, o = e(i.minWidth), n = e(i.maxWidth);
|
|
483
|
+
return o && (t.minWidth = o), n && (t.maxWidth = n), t;
|
|
484
|
+
});
|
|
485
|
+
function mt() {
|
|
486
|
+
return _(this, null, function* () {
|
|
487
|
+
try {
|
|
488
|
+
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(() => {
|
|
489
|
+
$.value = !1;
|
|
490
|
+
}, 1e3);
|
|
491
|
+
} catch (t) {
|
|
492
|
+
console.error("复制失败:", t);
|
|
493
|
+
}
|
|
494
|
+
});
|
|
495
|
+
}
|
|
496
|
+
function He(t) {
|
|
497
|
+
const e = t;
|
|
498
|
+
return !e || e.disabled;
|
|
499
|
+
}
|
|
500
|
+
function D(t, e, o = "top") {
|
|
501
|
+
if (He(t.currentTarget))
|
|
502
|
+
return;
|
|
503
|
+
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;
|
|
504
|
+
Xe(t.currentTarget, e, o, !1, l, i.isDark);
|
|
505
|
+
}
|
|
506
|
+
function S() {
|
|
507
|
+
jt();
|
|
508
|
+
}
|
|
509
|
+
function Te(t) {
|
|
510
|
+
if (He(t.currentTarget))
|
|
511
|
+
return;
|
|
512
|
+
const e = $.value ? a("common.copied") || "Copied" : a("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;
|
|
513
|
+
Xe(t.currentTarget, e, "top", !1, n, i.isDark);
|
|
514
|
+
}
|
|
515
|
+
function ht() {
|
|
516
|
+
C.value = !C.value;
|
|
517
|
+
const t = H.value ? L() : N(), e = m.value;
|
|
518
|
+
!t || !e || (C.value ? (ie(!0), e.style.maxHeight = "none", e.style.overflow = "visible", W()) : (ie(!1), e.style.overflow = "auto", q()));
|
|
519
|
+
}
|
|
520
|
+
function gt() {
|
|
521
|
+
var t, e, o;
|
|
522
|
+
if (M.value = !M.value, M.value) {
|
|
523
|
+
if (m.value) {
|
|
524
|
+
const n = Math.ceil(((e = (t = m.value).getBoundingClientRect) == null ? void 0 : e.call(t).height) || 0);
|
|
525
|
+
n > 0 && (A.value = n);
|
|
526
|
+
}
|
|
527
|
+
ie(!1);
|
|
528
|
+
} else {
|
|
529
|
+
C.value && ie(!0), m.value && A.value != null && (m.value.style.height = `${A.value}px`);
|
|
530
|
+
const n = H.value ? L() : N();
|
|
531
|
+
try {
|
|
532
|
+
(o = n == null ? void 0 : n.layout) == null || o.call(n);
|
|
533
|
+
} catch (l) {
|
|
534
|
+
}
|
|
535
|
+
se = 2, ae(() => {
|
|
536
|
+
C.value ? W() : q();
|
|
537
|
+
});
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
Y(
|
|
541
|
+
() => v.value,
|
|
542
|
+
(t, e) => {
|
|
543
|
+
const o = H.value ? L() : N();
|
|
544
|
+
o && typeof t == "number" && Number.isFinite(t) && t > 0 && (o.updateOptions({ fontSize: t }), C.value && !M.value && W());
|
|
545
|
+
},
|
|
546
|
+
{ flush: "post", immediate: !1 }
|
|
547
|
+
);
|
|
548
|
+
function pt() {
|
|
549
|
+
if (!ge.value)
|
|
550
|
+
return;
|
|
551
|
+
const t = P.value;
|
|
552
|
+
if (F.value) {
|
|
553
|
+
const e = t === "html" ? "text/html" : "image/svg+xml", o = t === "html" ? a("artifacts.htmlPreviewTitle") || "HTML Preview" : a("artifacts.svgPreviewTitle") || "SVG Preview";
|
|
554
|
+
j("previewCode", {
|
|
555
|
+
node: i.node,
|
|
556
|
+
artifactType: e,
|
|
557
|
+
artifactTitle: o,
|
|
558
|
+
id: `temp-${t}-${Date.now()}`
|
|
559
|
+
});
|
|
560
|
+
return;
|
|
561
|
+
}
|
|
562
|
+
t === "html" && (ne.value = !ne.value);
|
|
563
|
+
}
|
|
564
|
+
function ie(t) {
|
|
565
|
+
var e, o;
|
|
566
|
+
try {
|
|
567
|
+
if (H.value) {
|
|
568
|
+
const n = L();
|
|
569
|
+
(e = n == null ? void 0 : n.updateOptions) == null || e.call(n, { automaticLayout: t });
|
|
570
|
+
} else {
|
|
571
|
+
const n = N();
|
|
572
|
+
(o = n == null ? void 0 : n.updateOptions) == null || o.call(n, { automaticLayout: t });
|
|
573
|
+
}
|
|
574
|
+
} catch (n) {
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
function wt(t) {
|
|
578
|
+
return _(this, null, function* () {
|
|
579
|
+
var o, n, l;
|
|
580
|
+
if (!R)
|
|
581
|
+
return;
|
|
582
|
+
H.value ? (de(), ee ? yield ee(t, String((o = i.node.originalCode) != null ? o : ""), String((n = i.node.updatedCode) != null ? n : ""), U.value) : yield R(t, i.node.code, U.value)) : yield R(t, i.node.code, U.value);
|
|
583
|
+
const e = H.value ? L() : N();
|
|
584
|
+
if (typeof ((l = i.monacoOptions) == null ? void 0 : l.fontSize) == "number")
|
|
585
|
+
e == null || e.updateOptions({ fontSize: i.monacoOptions.fontSize, automaticLayout: !1 }), T.value = i.monacoOptions.fontSize, v.value = i.monacoOptions.fontSize;
|
|
586
|
+
else {
|
|
587
|
+
const s = Ee();
|
|
588
|
+
s && s > 0 ? (T.value = s, v.value = s) : (T.value = 12, v.value = 12);
|
|
589
|
+
}
|
|
590
|
+
!C.value && !M.value && q(), i.loading === !1 && (yield ye(), ae(() => {
|
|
591
|
+
C.value && !M.value ? W() : M.value || q();
|
|
592
|
+
}));
|
|
593
|
+
});
|
|
594
|
+
}
|
|
595
|
+
function pe(t) {
|
|
596
|
+
return R ? K || (Z.value = !0, K = _(null, null, function* () {
|
|
597
|
+
yield wt(t);
|
|
598
|
+
}).finally(() => {
|
|
599
|
+
K = null;
|
|
600
|
+
}), K) : null;
|
|
601
|
+
}
|
|
602
|
+
const De = Y(
|
|
603
|
+
() => [m.value, J.value, H.value, i.stream, i.loading, Be.value, V.value],
|
|
604
|
+
(p) => _(null, [p], function* ([t, e, o, n, l, s, w]) {
|
|
605
|
+
if (!t || !R || !w || n === !1 && l !== !1)
|
|
606
|
+
return;
|
|
607
|
+
if (J.value) {
|
|
608
|
+
oe(), De();
|
|
609
|
+
return;
|
|
610
|
+
}
|
|
611
|
+
const k = pe(t);
|
|
612
|
+
k && (yield k, De());
|
|
613
|
+
})
|
|
614
|
+
), yt = Y(
|
|
615
|
+
() => [i.darkTheme, i.lightTheme, Z.value, V.value],
|
|
616
|
+
() => {
|
|
617
|
+
if (!(!Z.value || !V.value)) {
|
|
618
|
+
if (J.value)
|
|
619
|
+
return yt();
|
|
620
|
+
kt();
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
);
|
|
624
|
+
function Pe() {
|
|
625
|
+
return i.isDark ? i.darkTheme : i.lightTheme;
|
|
626
|
+
}
|
|
627
|
+
function kt() {
|
|
628
|
+
const t = Pe();
|
|
629
|
+
t && fe(t);
|
|
630
|
+
}
|
|
631
|
+
const xt = Y(
|
|
632
|
+
() => [i.monacoOptions, V.value],
|
|
633
|
+
() => {
|
|
634
|
+
var o, n;
|
|
635
|
+
if (!R || !V.value)
|
|
636
|
+
return;
|
|
637
|
+
if (J.value)
|
|
638
|
+
return xt();
|
|
639
|
+
const t = H.value ? L() : N(), e = typeof ((o = i.monacoOptions) == null ? void 0 : o.fontSize) == "number" ? i.monacoOptions.fontSize : Number.isFinite(v.value) ? v.value : void 0;
|
|
640
|
+
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();
|
|
641
|
+
},
|
|
642
|
+
{ deep: !0 }
|
|
643
|
+
), le = Y(
|
|
644
|
+
() => [i.loading, V.value],
|
|
645
|
+
(o) => _(null, [o], function* ([t, e]) {
|
|
646
|
+
if (e) {
|
|
647
|
+
if (J.value) {
|
|
648
|
+
ye(() => {
|
|
649
|
+
le == null || le();
|
|
650
|
+
});
|
|
651
|
+
return;
|
|
652
|
+
}
|
|
653
|
+
t || (yield ye(), ae(() => {
|
|
654
|
+
M.value || (C.value ? W() : q()), le();
|
|
655
|
+
}));
|
|
656
|
+
}
|
|
657
|
+
}),
|
|
658
|
+
{ immediate: !0, flush: "post" }
|
|
659
|
+
);
|
|
660
|
+
return et(() => {
|
|
661
|
+
oe();
|
|
662
|
+
}), (t, e) => ve.value ? (E(), Ce(g(Wt), {
|
|
663
|
+
key: 0,
|
|
664
|
+
node: f.node,
|
|
665
|
+
loading: i.loading
|
|
666
|
+
}, null, 8, ["node", "loading"])) : (E(), O("div", {
|
|
667
|
+
key: 1,
|
|
668
|
+
ref_key: "container",
|
|
669
|
+
ref: y,
|
|
670
|
+
style: Ae(vt.value),
|
|
671
|
+
class: Q(["code-block-container my-4 rounded-lg border overflow-hidden shadow-sm", [
|
|
672
|
+
i.isDark ? "border-gray-700/30 bg-gray-900" : "border-gray-200 bg-white",
|
|
673
|
+
{ "is-rendering": i.loading, "is-dark": i.isDark }
|
|
674
|
+
]])
|
|
675
|
+
}, [
|
|
676
|
+
i.showHeader ? (E(), O("div", Qt, [
|
|
677
|
+
ke(t.$slots, "header-left", {}, () => [
|
|
678
|
+
r("div", Zt, [
|
|
679
|
+
r("span", {
|
|
680
|
+
class: "icon-slot h-4 w-4 flex-shrink-0",
|
|
681
|
+
innerHTML: ft.value
|
|
682
|
+
}, null, 8, eo),
|
|
683
|
+
r("span", to, Me(dt.value), 1)
|
|
684
|
+
])
|
|
685
|
+
], !0),
|
|
686
|
+
ke(t.$slots, "header-right", {}, () => [
|
|
687
|
+
r("div", oo, [
|
|
688
|
+
r("button", {
|
|
689
|
+
type: "button",
|
|
690
|
+
class: "code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",
|
|
691
|
+
"aria-pressed": M.value,
|
|
692
|
+
onClick: gt,
|
|
693
|
+
onMouseenter: e[0] || (e[0] = (o) => D(o, M.value ? g(a)("common.expand") || "Expand" : g(a)("common.collapse") || "Collapse")),
|
|
694
|
+
onFocus: e[1] || (e[1] = (o) => D(o, M.value ? g(a)("common.expand") || "Expand" : g(a)("common.collapse") || "Collapse")),
|
|
695
|
+
onMouseleave: S,
|
|
696
|
+
onBlur: S
|
|
697
|
+
}, [
|
|
698
|
+
(E(), O("svg", {
|
|
699
|
+
style: Ae({ rotate: M.value ? "0deg" : "90deg" }),
|
|
700
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
701
|
+
"xmlns:xlink": "http://www.w3.org/1999/xlink",
|
|
702
|
+
"aria-hidden": "true",
|
|
703
|
+
role: "img",
|
|
704
|
+
width: "1em",
|
|
705
|
+
height: "1em",
|
|
706
|
+
viewBox: "0 0 24 24",
|
|
707
|
+
class: "w-3 h-3"
|
|
708
|
+
}, [...e[17] || (e[17] = [
|
|
709
|
+
r("path", {
|
|
710
|
+
fill: "none",
|
|
711
|
+
stroke: "currentColor",
|
|
712
|
+
"stroke-linecap": "round",
|
|
713
|
+
"stroke-linejoin": "round",
|
|
714
|
+
"stroke-width": "2",
|
|
715
|
+
d: "m9 18l6-6l-6-6"
|
|
716
|
+
}, null, -1)
|
|
717
|
+
])], 4))
|
|
718
|
+
], 40, no),
|
|
719
|
+
i.showFontSizeButtons && i.enableFontSizeControl ? (E(), O(Vt, { key: 0 }, [
|
|
720
|
+
r("button", {
|
|
721
|
+
type: "button",
|
|
722
|
+
class: "code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",
|
|
723
|
+
disabled: Number.isFinite(v.value) ? v.value <= Ue : !1,
|
|
724
|
+
onClick: e[2] || (e[2] = (o) => rt()),
|
|
725
|
+
onMouseenter: e[3] || (e[3] = (o) => D(o, g(a)("common.decrease") || "Decrease")),
|
|
726
|
+
onFocus: e[4] || (e[4] = (o) => D(o, g(a)("common.decrease") || "Decrease")),
|
|
727
|
+
onMouseleave: S,
|
|
728
|
+
onBlur: S
|
|
729
|
+
}, [...e[18] || (e[18] = [
|
|
730
|
+
r("svg", {
|
|
731
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
732
|
+
"xmlns:xlink": "http://www.w3.org/1999/xlink",
|
|
733
|
+
"aria-hidden": "true",
|
|
734
|
+
role: "img",
|
|
735
|
+
width: "1em",
|
|
736
|
+
height: "1em",
|
|
737
|
+
viewBox: "0 0 24 24",
|
|
738
|
+
class: "w-3 h-3"
|
|
739
|
+
}, [
|
|
740
|
+
r("path", {
|
|
741
|
+
fill: "none",
|
|
742
|
+
stroke: "currentColor",
|
|
743
|
+
"stroke-linecap": "round",
|
|
744
|
+
"stroke-linejoin": "round",
|
|
745
|
+
"stroke-width": "2",
|
|
746
|
+
d: "M5 12h14"
|
|
747
|
+
})
|
|
748
|
+
], -1)
|
|
749
|
+
])], 40, io),
|
|
750
|
+
r("button", {
|
|
751
|
+
type: "button",
|
|
752
|
+
class: "code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",
|
|
753
|
+
disabled: !it.value || v.value === T.value,
|
|
754
|
+
onClick: e[5] || (e[5] = (o) => st()),
|
|
755
|
+
onMouseenter: e[6] || (e[6] = (o) => D(o, g(a)("common.reset") || "Reset")),
|
|
756
|
+
onFocus: e[7] || (e[7] = (o) => D(o, g(a)("common.reset") || "Reset")),
|
|
757
|
+
onMouseleave: S,
|
|
758
|
+
onBlur: S
|
|
759
|
+
}, [...e[19] || (e[19] = [
|
|
760
|
+
r("svg", {
|
|
761
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
762
|
+
"xmlns:xlink": "http://www.w3.org/1999/xlink",
|
|
763
|
+
"aria-hidden": "true",
|
|
764
|
+
role: "img",
|
|
765
|
+
width: "1em",
|
|
766
|
+
height: "1em",
|
|
767
|
+
viewBox: "0 0 24 24",
|
|
768
|
+
class: "w-3 h-3"
|
|
769
|
+
}, [
|
|
770
|
+
r("g", {
|
|
771
|
+
fill: "none",
|
|
772
|
+
stroke: "currentColor",
|
|
773
|
+
"stroke-linecap": "round",
|
|
774
|
+
"stroke-linejoin": "round",
|
|
775
|
+
"stroke-width": "2"
|
|
776
|
+
}, [
|
|
777
|
+
r("path", { d: "M3 12a9 9 0 1 0 9-9a9.75 9.75 0 0 0-6.74 2.74L3 8" }),
|
|
778
|
+
r("path", { d: "M3 3v5h5" })
|
|
779
|
+
])
|
|
780
|
+
], -1)
|
|
781
|
+
])], 40, lo),
|
|
782
|
+
r("button", {
|
|
783
|
+
type: "button",
|
|
784
|
+
class: "code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",
|
|
785
|
+
disabled: Number.isFinite(v.value) ? v.value >= Ge : !1,
|
|
786
|
+
onClick: e[8] || (e[8] = (o) => at()),
|
|
787
|
+
onMouseenter: e[9] || (e[9] = (o) => D(o, g(a)("common.increase") || "Increase")),
|
|
788
|
+
onFocus: e[10] || (e[10] = (o) => D(o, g(a)("common.increase") || "Increase")),
|
|
789
|
+
onMouseleave: S,
|
|
790
|
+
onBlur: S
|
|
791
|
+
}, [...e[20] || (e[20] = [
|
|
792
|
+
r("svg", {
|
|
793
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
794
|
+
"xmlns:xlink": "http://www.w3.org/1999/xlink",
|
|
795
|
+
"aria-hidden": "true",
|
|
796
|
+
role: "img",
|
|
797
|
+
width: "1em",
|
|
798
|
+
height: "1em",
|
|
799
|
+
viewBox: "0 0 24 24",
|
|
800
|
+
class: "w-3 h-3"
|
|
801
|
+
}, [
|
|
802
|
+
r("path", {
|
|
803
|
+
fill: "none",
|
|
804
|
+
stroke: "currentColor",
|
|
805
|
+
"stroke-linecap": "round",
|
|
806
|
+
"stroke-linejoin": "round",
|
|
807
|
+
"stroke-width": "2",
|
|
808
|
+
d: "M5 12h14m-7-7v14"
|
|
809
|
+
})
|
|
810
|
+
], -1)
|
|
811
|
+
])], 40, ao)
|
|
812
|
+
], 64)) : X("", !0),
|
|
813
|
+
i.showCopyButton ? (E(), O("button", {
|
|
814
|
+
key: 1,
|
|
815
|
+
type: "button",
|
|
816
|
+
class: "code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",
|
|
817
|
+
"aria-label": $.value ? g(a)("common.copied") || "Copied" : g(a)("common.copy") || "Copy",
|
|
818
|
+
onClick: mt,
|
|
819
|
+
onMouseenter: e[11] || (e[11] = (o) => Te(o)),
|
|
820
|
+
onFocus: e[12] || (e[12] = (o) => Te(o)),
|
|
821
|
+
onMouseleave: S,
|
|
822
|
+
onBlur: S
|
|
823
|
+
}, [
|
|
824
|
+
$.value ? (E(), O("svg", uo, [...e[22] || (e[22] = [
|
|
825
|
+
r("path", {
|
|
826
|
+
fill: "none",
|
|
827
|
+
stroke: "currentColor",
|
|
828
|
+
"stroke-linecap": "round",
|
|
829
|
+
"stroke-linejoin": "round",
|
|
830
|
+
"stroke-width": "2",
|
|
831
|
+
d: "M20 6L9 17l-5-5"
|
|
832
|
+
}, null, -1)
|
|
833
|
+
])])) : (E(), O("svg", so, [...e[21] || (e[21] = [
|
|
834
|
+
r("g", {
|
|
835
|
+
fill: "none",
|
|
836
|
+
stroke: "currentColor",
|
|
837
|
+
"stroke-linecap": "round",
|
|
838
|
+
"stroke-linejoin": "round",
|
|
839
|
+
"stroke-width": "2"
|
|
840
|
+
}, [
|
|
841
|
+
r("rect", {
|
|
842
|
+
width: "14",
|
|
843
|
+
height: "14",
|
|
844
|
+
x: "8",
|
|
845
|
+
y: "8",
|
|
846
|
+
rx: "2",
|
|
847
|
+
ry: "2"
|
|
848
|
+
}),
|
|
849
|
+
r("path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" })
|
|
850
|
+
], -1)
|
|
851
|
+
])]))
|
|
852
|
+
], 40, ro)) : X("", !0),
|
|
853
|
+
i.showExpandButton ? (E(), O("button", {
|
|
854
|
+
key: 2,
|
|
855
|
+
type: "button",
|
|
856
|
+
class: "code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",
|
|
857
|
+
"aria-pressed": C.value,
|
|
858
|
+
onClick: ht,
|
|
859
|
+
onMouseenter: e[13] || (e[13] = (o) => D(o, C.value ? g(a)("common.collapse") || "Collapse" : g(a)("common.expand") || "Expand")),
|
|
860
|
+
onFocus: e[14] || (e[14] = (o) => D(o, C.value ? g(a)("common.collapse") || "Collapse" : g(a)("common.expand") || "Expand")),
|
|
861
|
+
onMouseleave: S,
|
|
862
|
+
onBlur: S
|
|
863
|
+
}, [
|
|
864
|
+
C.value ? (E(), O("svg", fo, [...e[23] || (e[23] = [
|
|
865
|
+
r("path", {
|
|
866
|
+
fill: "none",
|
|
867
|
+
stroke: "currentColor",
|
|
868
|
+
"stroke-linecap": "round",
|
|
869
|
+
"stroke-linejoin": "round",
|
|
870
|
+
"stroke-width": "2",
|
|
871
|
+
d: "M15 3h6v6m0-6l-7 7M3 21l7-7m-1 7H3v-6"
|
|
872
|
+
}, null, -1)
|
|
873
|
+
])])) : (E(), O("svg", vo, [...e[24] || (e[24] = [
|
|
874
|
+
r("path", {
|
|
875
|
+
fill: "none",
|
|
876
|
+
stroke: "currentColor",
|
|
877
|
+
"stroke-linecap": "round",
|
|
878
|
+
"stroke-linejoin": "round",
|
|
879
|
+
"stroke-width": "2",
|
|
880
|
+
d: "m14 10l7-7m-1 7h-6V4M3 21l7-7m-6 0h6v6"
|
|
881
|
+
}, null, -1)
|
|
882
|
+
])]))
|
|
883
|
+
], 40, co)) : X("", !0),
|
|
884
|
+
ge.value && i.showPreviewButton ? (E(), O("button", {
|
|
885
|
+
key: 3,
|
|
886
|
+
type: "button",
|
|
887
|
+
class: "code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",
|
|
888
|
+
"aria-label": g(a)("common.preview") || "Preview",
|
|
889
|
+
onClick: pt,
|
|
890
|
+
onMouseenter: e[15] || (e[15] = (o) => D(o, g(a)("common.preview") || "Preview")),
|
|
891
|
+
onFocus: e[16] || (e[16] = (o) => D(o, g(a)("common.preview") || "Preview")),
|
|
892
|
+
onMouseleave: S,
|
|
893
|
+
onBlur: S
|
|
894
|
+
}, [...e[25] || (e[25] = [
|
|
895
|
+
r("svg", {
|
|
896
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
897
|
+
width: "12",
|
|
898
|
+
height: "12",
|
|
899
|
+
viewBox: "0 0 24 24"
|
|
900
|
+
}, [
|
|
901
|
+
r("g", {
|
|
902
|
+
fill: "currentColor",
|
|
903
|
+
"fill-rule": "evenodd",
|
|
904
|
+
"clip-rule": "evenodd"
|
|
905
|
+
}, [
|
|
906
|
+
r("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" }),
|
|
907
|
+
r("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" })
|
|
908
|
+
])
|
|
909
|
+
], -1)
|
|
910
|
+
])], 40, mo)) : X("", !0)
|
|
911
|
+
])
|
|
912
|
+
], !0)
|
|
913
|
+
])) : X("", !0),
|
|
914
|
+
We(r("div", {
|
|
915
|
+
ref_key: "codeEditor",
|
|
916
|
+
ref: m,
|
|
917
|
+
class: Q(["code-editor-container", [f.stream ? "" : "code-height-placeholder"]])
|
|
918
|
+
}, null, 2), [
|
|
919
|
+
[je, !M.value && (f.stream ? !0 : !f.loading)]
|
|
920
|
+
]),
|
|
921
|
+
ne.value && !F.value && ge.value && P.value === "html" ? (E(), Ce(Jt, {
|
|
922
|
+
key: 1,
|
|
923
|
+
code: f.node.code,
|
|
924
|
+
"is-dark": i.isDark,
|
|
925
|
+
"on-close": () => ne.value = !1
|
|
926
|
+
}, null, 8, ["code", "is-dark", "on-close"])) : X("", !0),
|
|
927
|
+
We(r("div", ho, [
|
|
928
|
+
ke(t.$slots, "loading", {
|
|
929
|
+
loading: f.loading,
|
|
930
|
+
stream: f.stream
|
|
931
|
+
}, () => [
|
|
932
|
+
e[26] || (e[26] = r("div", { class: "loading-skeleton" }, [
|
|
933
|
+
r("div", { class: "skeleton-line" }),
|
|
934
|
+
r("div", { class: "skeleton-line" }),
|
|
935
|
+
r("div", { class: "skeleton-line short" })
|
|
936
|
+
], -1))
|
|
937
|
+
], !0)
|
|
938
|
+
], 512), [
|
|
939
|
+
[je, !f.stream && f.loading]
|
|
940
|
+
]),
|
|
941
|
+
r("span", go, Me($.value ? g(a)("common.copied") || "Copied" : ""), 1)
|
|
942
|
+
], 6));
|
|
943
|
+
}
|
|
944
|
+
}), be = /* @__PURE__ */ ot(po, [["__scopeId", "data-v-f37961ae"]]);
|
|
945
|
+
be.install = (f) => {
|
|
946
|
+
f.component(be.__name, be);
|
|
947
|
+
};
|
|
948
|
+
export {
|
|
949
|
+
be as default
|
|
950
|
+
};
|