@onerjs/code-input 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/code-input.cjs +22 -14
- package/dist/code-input.es.js +613 -519
- package/package.json +7 -4
package/dist/code-input.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
const
|
|
1
|
+
import { defineComponent as bt, ref as C, computed as V, watch as Me, nextTick as j, onMounted as gt, onBeforeUnmount as vt, openBlock as T, createElementBlock as S, normalizeStyle as oe, normalizeClass as ie, createElementVNode as M, Fragment as He, renderList as Ae, toDisplayString as K, createCommentVNode as D, withModifiers as yt, createTextVNode as kt } from "vue";
|
|
2
|
+
const wt = [
|
|
3
3
|
{
|
|
4
4
|
label: "Math",
|
|
5
5
|
kind: "class",
|
|
@@ -134,7 +134,7 @@ const yt = [
|
|
|
134
134
|
kind: "function",
|
|
135
135
|
detail: "(id: number) => void"
|
|
136
136
|
}
|
|
137
|
-
],
|
|
137
|
+
], Be = [
|
|
138
138
|
"break",
|
|
139
139
|
"case",
|
|
140
140
|
"catch",
|
|
@@ -179,7 +179,7 @@ const yt = [
|
|
|
179
179
|
"undefined",
|
|
180
180
|
"NaN",
|
|
181
181
|
"Infinity"
|
|
182
|
-
],
|
|
182
|
+
], xt = [
|
|
183
183
|
"abstract",
|
|
184
184
|
"any",
|
|
185
185
|
"as",
|
|
@@ -209,414 +209,508 @@ const yt = [
|
|
|
209
209
|
"type",
|
|
210
210
|
"unknown"
|
|
211
211
|
];
|
|
212
|
-
function
|
|
213
|
-
return
|
|
212
|
+
function Ke(l) {
|
|
213
|
+
return l === "typescript" ? [...Be, ...xt] : Be;
|
|
214
214
|
}
|
|
215
|
-
function Le(
|
|
216
|
-
return new Set(
|
|
215
|
+
function Le(l) {
|
|
216
|
+
return new Set(Ke(l));
|
|
217
217
|
}
|
|
218
|
-
const
|
|
219
|
-
function
|
|
220
|
-
const
|
|
218
|
+
const $t = /((?:[A-Za-z_$][\w$]*\??\.)*)([A-Za-z_$][\w$]*)?$/, Oe = /\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g, Ct = /^[A-Za-z_$]/;
|
|
219
|
+
function Tt(l, r) {
|
|
220
|
+
const a = l.slice(0, r), n = $t.exec(a);
|
|
221
221
|
if (!n) return { prefix: "", chain: [] };
|
|
222
|
-
const
|
|
222
|
+
const o = n[1] ?? "", c = n[2] ?? "", u = o.split(".").filter(Boolean).map((d) => d.replace(/\?$/, ""));
|
|
223
223
|
return { prefix: c, chain: u };
|
|
224
224
|
}
|
|
225
|
-
function
|
|
226
|
-
const
|
|
227
|
-
let
|
|
228
|
-
for (
|
|
229
|
-
const c =
|
|
225
|
+
function Ne(l, r) {
|
|
226
|
+
const a = [], n = /* @__PURE__ */ new Set();
|
|
227
|
+
let o;
|
|
228
|
+
for (Oe.lastIndex = 0; (o = Oe.exec(l)) && !(o.index >= r); ) {
|
|
229
|
+
const c = o[1];
|
|
230
230
|
if (n.has(c)) continue;
|
|
231
231
|
n.add(c);
|
|
232
|
-
const u =
|
|
233
|
-
|
|
232
|
+
const u = o[0].slice(0, o[0].indexOf(c)).trim();
|
|
233
|
+
a.push({
|
|
234
234
|
label: c,
|
|
235
235
|
kind: u === "function" ? "function" : u === "class" ? "class" : "variable",
|
|
236
236
|
detail: "当前文件"
|
|
237
237
|
});
|
|
238
238
|
}
|
|
239
|
-
return
|
|
239
|
+
return a;
|
|
240
240
|
}
|
|
241
|
-
function
|
|
242
|
-
let
|
|
243
|
-
for (const n of
|
|
244
|
-
if (!
|
|
245
|
-
const
|
|
246
|
-
if (!
|
|
247
|
-
|
|
241
|
+
function Ze(l, r) {
|
|
242
|
+
let a = r;
|
|
243
|
+
for (const n of l) {
|
|
244
|
+
if (!a) return null;
|
|
245
|
+
const o = a.find((c) => c.label === n);
|
|
246
|
+
if (!o) return null;
|
|
247
|
+
a = o.members ?? [];
|
|
248
248
|
}
|
|
249
|
-
return
|
|
249
|
+
return a;
|
|
250
250
|
}
|
|
251
|
-
function
|
|
252
|
-
const
|
|
253
|
-
if (
|
|
254
|
-
if (
|
|
251
|
+
function St(l, r) {
|
|
252
|
+
const a = l.toLowerCase(), n = r.toLowerCase(), o = a.indexOf(n);
|
|
253
|
+
if (o === 0) return 1e3 - a.length;
|
|
254
|
+
if (o > 0) return 800 - o;
|
|
255
255
|
let c = 0, u = 0, d = -1;
|
|
256
|
-
for (let
|
|
257
|
-
i
|
|
258
|
-
return c !== n.length ? null : 400 - u -
|
|
256
|
+
for (let i = 0; i < a.length && c < n.length; i++)
|
|
257
|
+
a[i] === n[c] && (d >= 0 && (u += i - d - 1), d = i, c++);
|
|
258
|
+
return c !== n.length ? null : 400 - u - a.length;
|
|
259
259
|
}
|
|
260
|
-
function
|
|
261
|
-
if (!r) return
|
|
262
|
-
const
|
|
263
|
-
for (const n of
|
|
264
|
-
const
|
|
265
|
-
|
|
260
|
+
function Et(l, r) {
|
|
261
|
+
if (!r) return l;
|
|
262
|
+
const a = [];
|
|
263
|
+
for (const n of l) {
|
|
264
|
+
const o = St(n.label, r);
|
|
265
|
+
o !== null && a.push({ item: n, score: o });
|
|
266
266
|
}
|
|
267
|
-
return
|
|
267
|
+
return a.sort((n, o) => o.score - n.score || n.item.label.localeCompare(o.item.label)), a.map((n) => n.item);
|
|
268
268
|
}
|
|
269
|
-
function
|
|
270
|
-
const r = /* @__PURE__ */ new Set(),
|
|
271
|
-
for (const n of
|
|
272
|
-
r.has(n.label) || (r.add(n.label),
|
|
273
|
-
return
|
|
269
|
+
function _t(l) {
|
|
270
|
+
const r = /* @__PURE__ */ new Set(), a = [];
|
|
271
|
+
for (const n of l)
|
|
272
|
+
r.has(n.label) || (r.add(n.label), a.push(n));
|
|
273
|
+
return a;
|
|
274
274
|
}
|
|
275
|
-
function
|
|
276
|
-
const { prefix: n, chain:
|
|
277
|
-
if (
|
|
275
|
+
function Rt(l, r, a) {
|
|
276
|
+
const { prefix: n, chain: o } = Tt(l, r);
|
|
277
|
+
if (a.auto && (!n && o.length === 0 || n && !Ct.test(n)))
|
|
278
278
|
return null;
|
|
279
|
-
const c =
|
|
279
|
+
const c = a.declared ?? [], u = [...c, ...a.completions];
|
|
280
280
|
let d;
|
|
281
|
-
if (
|
|
282
|
-
const f =
|
|
281
|
+
if (o.length > 0) {
|
|
282
|
+
const f = Ze(o, u);
|
|
283
283
|
if (!f || f.length === 0) return null;
|
|
284
284
|
d = f;
|
|
285
285
|
} else
|
|
286
286
|
d = [
|
|
287
|
-
...
|
|
287
|
+
...a.completions,
|
|
288
288
|
...c,
|
|
289
|
-
...
|
|
289
|
+
...Ke(a.language).map((f) => ({
|
|
290
290
|
label: f,
|
|
291
291
|
kind: "keyword"
|
|
292
292
|
}))
|
|
293
293
|
];
|
|
294
|
-
const
|
|
295
|
-
return
|
|
296
|
-
items:
|
|
294
|
+
const i = Et(_t(d), n);
|
|
295
|
+
return i.length === 0 ? null : {
|
|
296
|
+
items: i,
|
|
297
297
|
start: r - n.length,
|
|
298
298
|
end: r
|
|
299
299
|
};
|
|
300
300
|
}
|
|
301
|
-
const
|
|
302
|
-
function
|
|
303
|
-
const
|
|
304
|
-
if (!
|
|
305
|
-
const c = [...n.declared ?? [], ...n.completions], u =
|
|
301
|
+
const It = /([A-Za-z_$][\w$]*(?:\??\.[A-Za-z_$][\w$]*)*)\??\.\s*$/;
|
|
302
|
+
function Mt(l, r, a, n) {
|
|
303
|
+
const o = l.slice(r, a);
|
|
304
|
+
if (!o) return null;
|
|
305
|
+
const c = [...n.declared ?? [], ...n.completions], u = It.exec(l.slice(0, r));
|
|
306
306
|
if (u) {
|
|
307
|
-
const d = u[1].split(".").filter(Boolean).map((
|
|
307
|
+
const d = u[1].split(".").filter(Boolean).map((_) => _.replace(/\?$/, "")), i = Ze(d, c), f = i == null ? void 0 : i.find((_) => _.label === o);
|
|
308
308
|
if (f) return f;
|
|
309
309
|
}
|
|
310
|
-
return c.find((d) => d.label ===
|
|
310
|
+
return c.find((d) => d.label === o) ?? null;
|
|
311
311
|
}
|
|
312
|
-
const
|
|
313
|
-
function
|
|
314
|
-
let
|
|
315
|
-
for (let c = r; c <
|
|
316
|
-
const u =
|
|
312
|
+
const Z = "[A-Za-z_$][\\w$]*", je = "(?:readonly\\s+|public\\s+|private\\s+|protected\\s+|static\\s+|abstract\\s+)*";
|
|
313
|
+
function ze(l, r) {
|
|
314
|
+
let a = 0, n = !1, o = r;
|
|
315
|
+
for (let c = r; c < l.length; c++) {
|
|
316
|
+
const u = l[c];
|
|
317
317
|
for (let d = 0; d < u.length; d++) {
|
|
318
|
-
const
|
|
319
|
-
|
|
318
|
+
const i = u[d];
|
|
319
|
+
i === "{" ? (a++, n = !0) : i === "}" && a--;
|
|
320
320
|
}
|
|
321
|
-
if (n &&
|
|
322
|
-
|
|
321
|
+
if (n && a <= 0) {
|
|
322
|
+
o = c;
|
|
323
323
|
break;
|
|
324
324
|
}
|
|
325
325
|
}
|
|
326
|
-
return { end:
|
|
326
|
+
return { end: o, body: l.slice(r + 1, o) };
|
|
327
|
+
}
|
|
328
|
+
function De(l) {
|
|
329
|
+
return l.trim().replace(/[,;]$/, "").trim();
|
|
327
330
|
}
|
|
328
|
-
function
|
|
329
|
-
return
|
|
331
|
+
function U(l) {
|
|
332
|
+
return l.length ? l.join(`
|
|
333
|
+
`).replace(/^\s*\/\*\*?/, "").replace(/\*\/\s*$/, "").split(`
|
|
334
|
+
`).map((r) => r.replace(/^\s*\*+\s?/, "").replace(/^\s*\/\/\s?/, "")).join(`
|
|
335
|
+
`).replace(/\n{3,}/g, `
|
|
336
|
+
|
|
337
|
+
`).trim() : "";
|
|
330
338
|
}
|
|
331
|
-
function
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
339
|
+
function We(l) {
|
|
340
|
+
return l.split(`
|
|
341
|
+
`).filter((r) => !/^\s*(\/\/|\/\*|\*)/.test(r)).join(`
|
|
342
|
+
`).replace(/\n{2,}/g, `
|
|
343
|
+
`).trim();
|
|
344
|
+
}
|
|
345
|
+
function Pe(l) {
|
|
346
|
+
const r = [], a = /* @__PURE__ */ new Set(), n = new RegExp(`^${je}(${Z})(\\?)?\\s*\\((.*)\\)\\s*:\\s*(.+?);?$`), o = new RegExp(`^${je}(${Z})(\\?)?\\s*:\\s*(.+?);?$`);
|
|
347
|
+
let c = [], u = !1;
|
|
348
|
+
for (const d of l) {
|
|
349
|
+
const i = d.trim();
|
|
350
|
+
if (u) {
|
|
351
|
+
c.push(i), i.includes("*/") && (u = !1);
|
|
336
352
|
continue;
|
|
337
|
-
|
|
338
|
-
if (
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
353
|
+
}
|
|
354
|
+
if (i.startsWith("/*")) {
|
|
355
|
+
c.push(i), i.includes("*/") || (u = !0);
|
|
356
|
+
continue;
|
|
357
|
+
}
|
|
358
|
+
if (i.startsWith("//")) {
|
|
359
|
+
c.push(i);
|
|
360
|
+
continue;
|
|
361
|
+
}
|
|
362
|
+
if (!i || i.startsWith("}") || i.startsWith("[")) {
|
|
363
|
+
c = [];
|
|
364
|
+
continue;
|
|
365
|
+
}
|
|
366
|
+
const f = n.exec(i);
|
|
367
|
+
if (f) {
|
|
368
|
+
const W = U(c);
|
|
369
|
+
c = [];
|
|
370
|
+
const g = f[1];
|
|
371
|
+
if (a.has(g)) continue;
|
|
372
|
+
a.add(g), r.push({
|
|
373
|
+
label: g,
|
|
343
374
|
kind: "function",
|
|
344
|
-
detail: `(${
|
|
375
|
+
detail: `(${f[3].trim()}) => ${De(f[4])}`,
|
|
376
|
+
documentation: W || void 0
|
|
345
377
|
});
|
|
346
378
|
continue;
|
|
347
379
|
}
|
|
348
|
-
const
|
|
349
|
-
if (
|
|
350
|
-
const
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
380
|
+
const _ = o.exec(i);
|
|
381
|
+
if (_) {
|
|
382
|
+
const W = U(c);
|
|
383
|
+
c = [];
|
|
384
|
+
const g = _[1];
|
|
385
|
+
if (a.has(g)) continue;
|
|
386
|
+
a.add(g);
|
|
387
|
+
const b = De(_[3]), H = /^\(|=>/.test(b) ? "function" : "property";
|
|
388
|
+
r.push({
|
|
389
|
+
label: g,
|
|
390
|
+
kind: H,
|
|
391
|
+
detail: b,
|
|
392
|
+
documentation: W || void 0
|
|
393
|
+
});
|
|
355
394
|
}
|
|
356
395
|
}
|
|
357
396
|
return r;
|
|
358
397
|
}
|
|
359
|
-
function
|
|
360
|
-
const r =
|
|
361
|
-
return
|
|
398
|
+
function qe(l) {
|
|
399
|
+
const r = l.replace(/\[\]/g, "").replace(/<[^>]*>/g, "").replace(/\s*\|\s*null\s*/g, "").trim(), a = new RegExp(`^(${Z})$`).exec(r);
|
|
400
|
+
return a ? a[1] : null;
|
|
362
401
|
}
|
|
363
|
-
function
|
|
364
|
-
const r =
|
|
402
|
+
function Ht(l) {
|
|
403
|
+
const r = l.trim();
|
|
365
404
|
if (!r || r.endsWith(";")) return !1;
|
|
366
|
-
const
|
|
367
|
-
return /[|&,(<]\s*$/.test(r) ||
|
|
405
|
+
const a = (r.match(/[(<[{]/g) ?? []).length, n = (r.match(/[)>\]}]/g) ?? []).length;
|
|
406
|
+
return /[|&,(<]\s*$/.test(r) || a > n;
|
|
368
407
|
}
|
|
369
|
-
function
|
|
370
|
-
return n > 6 ?
|
|
371
|
-
if (
|
|
372
|
-
const c =
|
|
373
|
-
if (!u ||
|
|
374
|
-
const d = new Set(
|
|
408
|
+
function Ue(l, r, a, n = 0) {
|
|
409
|
+
return n > 6 ? l : l.map((o) => {
|
|
410
|
+
if (o.kind !== "property" || !o.detail) return o;
|
|
411
|
+
const c = qe(o.detail), u = c ? r.get(c) : void 0;
|
|
412
|
+
if (!u || a.has(u.label)) return o;
|
|
413
|
+
const d = new Set(a);
|
|
375
414
|
return d.add(u.label), {
|
|
376
|
-
...
|
|
415
|
+
...o,
|
|
377
416
|
type: u.type,
|
|
378
|
-
members:
|
|
417
|
+
members: Ue(u.members, r, d, n + 1)
|
|
379
418
|
};
|
|
380
419
|
});
|
|
381
420
|
}
|
|
382
|
-
function
|
|
383
|
-
if (!
|
|
384
|
-
const r =
|
|
385
|
-
`),
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
const { end: w, body: x } = We(r, b), g = A[1];
|
|
392
|
-
i.set(g, {
|
|
393
|
-
label: g,
|
|
394
|
-
type: r.slice(b, w + 1).join(`
|
|
395
|
-
`).replace(/^\s*export\s+/, "").trim(),
|
|
396
|
-
members: De(x),
|
|
397
|
-
kind: "interface"
|
|
398
|
-
}), b = w;
|
|
421
|
+
function At(l) {
|
|
422
|
+
if (!l || !l.trim()) return [];
|
|
423
|
+
const r = l.split(`
|
|
424
|
+
`), a = /* @__PURE__ */ new Map(), n = new RegExp(`^(?:export\\s+)?(?:declare\\s+)?interface\\s+(${Z})`), o = new RegExp(`^(?:export\\s+)?(?:declare\\s+)?(?:abstract\\s+)?class\\s+(${Z})`), c = new RegExp(`^(?:export\\s+)?(?:declare\\s+)?type\\s+(${Z})\\s*=`);
|
|
425
|
+
let u = [], d = !1;
|
|
426
|
+
for (let g = 0; g < r.length; g++) {
|
|
427
|
+
const b = r[g].trim();
|
|
428
|
+
if (d) {
|
|
429
|
+
u.push(b), b.includes("*/") && (d = !1);
|
|
399
430
|
continue;
|
|
400
431
|
}
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
432
|
+
if (b.startsWith("/*")) {
|
|
433
|
+
u.push(b), b.includes("*/") || (d = !0);
|
|
434
|
+
continue;
|
|
435
|
+
}
|
|
436
|
+
if (b.startsWith("//")) {
|
|
437
|
+
u.push(b);
|
|
438
|
+
continue;
|
|
439
|
+
}
|
|
440
|
+
if (!b) {
|
|
441
|
+
u = [];
|
|
411
442
|
continue;
|
|
412
443
|
}
|
|
413
|
-
const
|
|
414
|
-
if (
|
|
415
|
-
const
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
444
|
+
const H = n.exec(b);
|
|
445
|
+
if (H && b.includes("{")) {
|
|
446
|
+
const k = U(u);
|
|
447
|
+
u = [];
|
|
448
|
+
const { end: w, body: E } = ze(r, g), v = H[1];
|
|
449
|
+
a.set(v, {
|
|
450
|
+
label: v,
|
|
451
|
+
type: We(
|
|
452
|
+
r.slice(g, w + 1).join(`
|
|
453
|
+
`).replace(/^\s*export\s+/, "")
|
|
454
|
+
),
|
|
455
|
+
members: Pe(E),
|
|
456
|
+
kind: "interface",
|
|
457
|
+
documentation: k || void 0
|
|
458
|
+
}), g = w;
|
|
459
|
+
continue;
|
|
460
|
+
}
|
|
461
|
+
const O = o.exec(b);
|
|
462
|
+
if (O && b.includes("{")) {
|
|
463
|
+
const k = U(u);
|
|
464
|
+
u = [];
|
|
465
|
+
const { end: w, body: E } = ze(r, g), v = O[1];
|
|
466
|
+
a.set(v, {
|
|
467
|
+
label: v,
|
|
468
|
+
type: We(
|
|
469
|
+
r.slice(g, w + 1).join(`
|
|
470
|
+
`).replace(/^\s*export\s+/, "")
|
|
471
|
+
),
|
|
472
|
+
members: Pe(E),
|
|
473
|
+
kind: "class",
|
|
474
|
+
documentation: k || void 0
|
|
475
|
+
}), g = w;
|
|
476
|
+
continue;
|
|
477
|
+
}
|
|
478
|
+
const A = c.exec(b);
|
|
479
|
+
if (A) {
|
|
480
|
+
const k = U(u);
|
|
481
|
+
u = [];
|
|
482
|
+
const w = [r[g]];
|
|
483
|
+
let E = g;
|
|
484
|
+
for (; Ht(w.join(`
|
|
485
|
+
`)) && E + 1 < r.length; )
|
|
486
|
+
E++, w.push(r[E]);
|
|
487
|
+
const v = w.join(`
|
|
421
488
|
`).replace(/^\s*export\s+/, "").replace(/;\s*$/, "").trim();
|
|
422
|
-
|
|
423
|
-
label:
|
|
424
|
-
type:
|
|
489
|
+
a.set(A[1], {
|
|
490
|
+
label: A[1],
|
|
491
|
+
type: v,
|
|
425
492
|
members: [],
|
|
426
|
-
kind: "type"
|
|
427
|
-
|
|
493
|
+
kind: "type",
|
|
494
|
+
documentation: k || void 0
|
|
495
|
+
}), g = E;
|
|
496
|
+
continue;
|
|
428
497
|
}
|
|
498
|
+
u = [];
|
|
429
499
|
}
|
|
430
|
-
const
|
|
431
|
-
`^(?:export\\s+)?(?:declare\\s+)?function\\s+(${
|
|
432
|
-
),
|
|
433
|
-
`^(?:export\\s+)?(?:declare\\s+)?(?:const|let|var)\\s+(${
|
|
500
|
+
const i = [], f = /* @__PURE__ */ new Set(), _ = new RegExp(
|
|
501
|
+
`^(?:export\\s+)?(?:declare\\s+)?function\\s+(${Z})\\s*\\(([^)]*)\\)\\s*:\\s*([^;{]+)`
|
|
502
|
+
), W = new RegExp(
|
|
503
|
+
`^(?:export\\s+)?(?:declare\\s+)?(?:const|let|var)\\s+(${Z})\\s*:\\s*([^=;]+)`
|
|
434
504
|
);
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
505
|
+
u = [], d = !1;
|
|
506
|
+
for (const g of r) {
|
|
507
|
+
const b = g.trim();
|
|
508
|
+
if (d) {
|
|
509
|
+
u.push(b), b.includes("*/") && (d = !1);
|
|
510
|
+
continue;
|
|
511
|
+
}
|
|
512
|
+
if (b.startsWith("/*")) {
|
|
513
|
+
u.push(b), b.includes("*/") || (d = !0);
|
|
514
|
+
continue;
|
|
515
|
+
}
|
|
516
|
+
if (b.startsWith("//")) {
|
|
517
|
+
u.push(b);
|
|
518
|
+
continue;
|
|
519
|
+
}
|
|
520
|
+
if (!b) {
|
|
521
|
+
u = [];
|
|
522
|
+
continue;
|
|
523
|
+
}
|
|
524
|
+
const H = _.exec(b);
|
|
525
|
+
if (H) {
|
|
526
|
+
const A = U(u);
|
|
527
|
+
u = [];
|
|
528
|
+
const k = H[1];
|
|
529
|
+
f.has(k) || (f.add(k), i.push({
|
|
530
|
+
label: k,
|
|
443
531
|
kind: "function",
|
|
444
|
-
detail: `(${
|
|
532
|
+
detail: `(${H[2].trim()}) => ${H[3].trim()}`,
|
|
533
|
+
documentation: A || void 0
|
|
445
534
|
}));
|
|
446
535
|
continue;
|
|
447
536
|
}
|
|
448
|
-
const
|
|
449
|
-
if (
|
|
450
|
-
const
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
537
|
+
const O = W.exec(b);
|
|
538
|
+
if (O) {
|
|
539
|
+
const A = U(u);
|
|
540
|
+
u = [];
|
|
541
|
+
const k = O[1];
|
|
542
|
+
if (f.has(k)) continue;
|
|
543
|
+
f.add(k);
|
|
544
|
+
const w = O[2].trim(), E = qe(w), v = E ? a.get(E) : void 0, $ = (v == null ? void 0 : v.kind) === "class" ? "class" : /^\(|=>/.test(w) ? "function" : "variable";
|
|
545
|
+
i.push({
|
|
546
|
+
label: k,
|
|
547
|
+
kind: $,
|
|
457
548
|
detail: w,
|
|
458
|
-
type:
|
|
459
|
-
|
|
549
|
+
type: v == null ? void 0 : v.type,
|
|
550
|
+
documentation: A || (v == null ? void 0 : v.documentation) || void 0,
|
|
551
|
+
members: v ? Ue(v.members, a, /* @__PURE__ */ new Set([v.label])) : void 0
|
|
460
552
|
});
|
|
553
|
+
continue;
|
|
461
554
|
}
|
|
555
|
+
u = [];
|
|
462
556
|
}
|
|
463
|
-
return
|
|
557
|
+
return i;
|
|
464
558
|
}
|
|
465
|
-
function
|
|
466
|
-
if (!
|
|
467
|
-
const
|
|
468
|
-
if (c === -1 ||
|
|
469
|
-
const d =
|
|
559
|
+
function he(l, r, a, n) {
|
|
560
|
+
if (!a || !n) return null;
|
|
561
|
+
const o = Math.max(0, r - 1), c = l.lastIndexOf(a, o);
|
|
562
|
+
if (c === -1 || l.lastIndexOf(n, o) > c) return null;
|
|
563
|
+
const d = l.indexOf(n, c + a.length);
|
|
470
564
|
return {
|
|
471
|
-
start: c +
|
|
472
|
-
end: d === -1 ?
|
|
565
|
+
start: c + a.length,
|
|
566
|
+
end: d === -1 ? l.length : d
|
|
473
567
|
};
|
|
474
568
|
}
|
|
475
|
-
function
|
|
476
|
-
return
|
|
569
|
+
function ln(l, r, a, n) {
|
|
570
|
+
return he(l, r, a, n) !== null;
|
|
477
571
|
}
|
|
478
|
-
const
|
|
479
|
-
function
|
|
480
|
-
const
|
|
481
|
-
let
|
|
482
|
-
for (;
|
|
483
|
-
const c = o
|
|
484
|
-
if (
|
|
485
|
-
|
|
572
|
+
const Fe = /[A-Za-z_$]/, Bt = /[\w$]/, Ve = /\s/;
|
|
573
|
+
function ae(l, r) {
|
|
574
|
+
const a = [], n = l.length;
|
|
575
|
+
let o = 0;
|
|
576
|
+
for (; o < n; ) {
|
|
577
|
+
const c = l[o], u = l[o + 1];
|
|
578
|
+
if (Ve.test(c)) {
|
|
579
|
+
o++;
|
|
486
580
|
continue;
|
|
487
581
|
}
|
|
488
582
|
if (c === "/" && u === "/") {
|
|
489
|
-
let
|
|
490
|
-
`,
|
|
491
|
-
|
|
583
|
+
let i = l.indexOf(`
|
|
584
|
+
`, o);
|
|
585
|
+
i === -1 && (i = n), a.push({ start: o, end: i, type: "comment" }), o = i;
|
|
492
586
|
continue;
|
|
493
587
|
}
|
|
494
588
|
if (c === "/" && u === "*") {
|
|
495
|
-
const
|
|
496
|
-
|
|
589
|
+
const i = l.indexOf("*/", o + 2), f = i === -1 ? n : i + 2;
|
|
590
|
+
a.push({ start: o, end: f, type: "comment" }), o = f;
|
|
497
591
|
continue;
|
|
498
592
|
}
|
|
499
593
|
if (c === '"' || c === "'") {
|
|
500
|
-
let
|
|
501
|
-
for (;
|
|
502
|
-
if (
|
|
503
|
-
|
|
594
|
+
let i = o + 1;
|
|
595
|
+
for (; i < n; ) {
|
|
596
|
+
if (l[i] === "\\") {
|
|
597
|
+
i += 2;
|
|
504
598
|
continue;
|
|
505
599
|
}
|
|
506
|
-
if (
|
|
600
|
+
if (l[i] === `
|
|
507
601
|
`) break;
|
|
508
|
-
if (
|
|
509
|
-
|
|
602
|
+
if (l[i] === c) {
|
|
603
|
+
i++;
|
|
510
604
|
break;
|
|
511
605
|
}
|
|
512
|
-
|
|
606
|
+
i++;
|
|
513
607
|
}
|
|
514
|
-
|
|
608
|
+
a.push({ start: o, end: i, type: "string" }), o = i;
|
|
515
609
|
continue;
|
|
516
610
|
}
|
|
517
611
|
if (c === "`") {
|
|
518
|
-
let
|
|
519
|
-
for (;
|
|
520
|
-
if (
|
|
521
|
-
|
|
612
|
+
let i = o + 1;
|
|
613
|
+
for (; i < n; ) {
|
|
614
|
+
if (l[i] === "\\") {
|
|
615
|
+
i += 2;
|
|
522
616
|
continue;
|
|
523
617
|
}
|
|
524
|
-
if (
|
|
525
|
-
|
|
618
|
+
if (l[i] === "`") {
|
|
619
|
+
i++;
|
|
526
620
|
break;
|
|
527
621
|
}
|
|
528
|
-
|
|
622
|
+
i++;
|
|
529
623
|
}
|
|
530
|
-
|
|
624
|
+
a.push({ start: o, end: i, type: "template" }), o = i;
|
|
531
625
|
continue;
|
|
532
626
|
}
|
|
533
627
|
if (/[0-9]/.test(c) || c === "." && /[0-9]/.test(u ?? "")) {
|
|
534
|
-
let
|
|
535
|
-
for (;
|
|
536
|
-
|
|
628
|
+
let i = o + 1;
|
|
629
|
+
for (; i < n && /[\w.]/.test(l[i]); ) i++;
|
|
630
|
+
a.push({ start: o, end: i, type: "number" }), o = i;
|
|
537
631
|
continue;
|
|
538
632
|
}
|
|
539
|
-
if (
|
|
540
|
-
let
|
|
541
|
-
for (;
|
|
542
|
-
const f =
|
|
543
|
-
|
|
633
|
+
if (Fe.test(c)) {
|
|
634
|
+
let i = o + 1;
|
|
635
|
+
for (; i < n && Bt.test(l[i]); ) i++;
|
|
636
|
+
const f = l.slice(o, i), _ = r.keywords.has(f) ? "keyword" : r.builtins.has(f) ? "builtin" : "identifier";
|
|
637
|
+
a.push({ start: o, end: i, type: _ }), o = i;
|
|
544
638
|
continue;
|
|
545
639
|
}
|
|
546
|
-
let d =
|
|
640
|
+
let d = o + 1;
|
|
547
641
|
for (; d < n; ) {
|
|
548
|
-
const
|
|
549
|
-
if (
|
|
642
|
+
const i = l[d];
|
|
643
|
+
if (Ve.test(i) || Fe.test(i) || /[0-9]/.test(i) || i === '"' || i === "'" || i === "`" || i === "/") break;
|
|
550
644
|
d++;
|
|
551
645
|
}
|
|
552
|
-
|
|
646
|
+
a.push({ start: o, end: d, type: "punctuation" }), o = d;
|
|
553
647
|
}
|
|
554
|
-
return
|
|
648
|
+
return a;
|
|
555
649
|
}
|
|
556
|
-
const
|
|
650
|
+
const Lt = {
|
|
557
651
|
"&": "&",
|
|
558
652
|
"<": "<",
|
|
559
653
|
">": ">"
|
|
560
654
|
};
|
|
561
|
-
function
|
|
562
|
-
return
|
|
655
|
+
function Y(l) {
|
|
656
|
+
return l.replace(/[&<>]/g, (r) => Lt[r] ?? r);
|
|
563
657
|
}
|
|
564
|
-
function
|
|
565
|
-
let n = "",
|
|
658
|
+
function se(l, r, a = 0) {
|
|
659
|
+
let n = "", o = 0;
|
|
566
660
|
for (const c of r) {
|
|
567
|
-
c.start >
|
|
568
|
-
const u =
|
|
569
|
-
n += `<span class="tok-${c.type}" data-start="${c.start +
|
|
661
|
+
c.start > o && (n += Y(l.slice(o, c.start)));
|
|
662
|
+
const u = Y(l.slice(c.start, c.end));
|
|
663
|
+
n += `<span class="tok-${c.type}" data-start="${c.start + a}" data-end="${c.end + a}">${u}</span>`, o = c.end;
|
|
570
664
|
}
|
|
571
|
-
return
|
|
665
|
+
return o < l.length && (n += Y(l.slice(o))), n;
|
|
572
666
|
}
|
|
573
|
-
function
|
|
574
|
-
if (!
|
|
575
|
-
let
|
|
576
|
-
for (; c <
|
|
577
|
-
const u =
|
|
667
|
+
function Ot(l, r, a, n) {
|
|
668
|
+
if (!a || !n) return se(l, ae(l, r));
|
|
669
|
+
let o = "", c = 0;
|
|
670
|
+
for (; c < l.length; ) {
|
|
671
|
+
const u = l.indexOf(a, c);
|
|
578
672
|
if (u === -1) {
|
|
579
|
-
|
|
673
|
+
o += Y(l.slice(c));
|
|
580
674
|
break;
|
|
581
675
|
}
|
|
582
|
-
|
|
583
|
-
const d =
|
|
584
|
-
|
|
676
|
+
o += Y(l.slice(c, u));
|
|
677
|
+
const d = l.indexOf(n, u + a.length), i = d === -1 ? l.length : d, f = l.slice(u + a.length, i);
|
|
678
|
+
o += `<span class="tok-brace">${Y(a)}</span>`, o += se(f, ae(f, r), u + a.length), d === -1 ? c = i : (o += `<span class="tok-brace">${Y(n)}</span>`, c = d + n.length);
|
|
585
679
|
}
|
|
586
|
-
return
|
|
680
|
+
return o;
|
|
587
681
|
}
|
|
588
|
-
const
|
|
682
|
+
const Nt = {
|
|
589
683
|
key: 0,
|
|
590
684
|
class: "gutter",
|
|
591
685
|
"aria-hidden": "true"
|
|
592
|
-
},
|
|
686
|
+
}, jt = ["innerHTML"], zt = ["value", "readonly", "placeholder"], Dt = ["onMouseenter", "onClick"], Wt = { class: "popup-label" }, Pt = {
|
|
593
687
|
key: 0,
|
|
594
688
|
class: "popup-detail"
|
|
595
|
-
},
|
|
689
|
+
}, Ft = { class: "hover-head" }, Vt = { class: "hover-name" }, Kt = {
|
|
596
690
|
key: 0,
|
|
597
691
|
class: "hover-colon"
|
|
598
|
-
},
|
|
692
|
+
}, Zt = {
|
|
599
693
|
key: 0,
|
|
600
694
|
class: "hover-type"
|
|
601
|
-
},
|
|
695
|
+
}, qt = {
|
|
602
696
|
key: 0,
|
|
603
697
|
class: "hover-doc"
|
|
604
|
-
},
|
|
698
|
+
}, Ut = {
|
|
605
699
|
key: 1,
|
|
606
700
|
class: "hover-def"
|
|
607
|
-
},
|
|
701
|
+
}, Yt = ["innerHTML"], Jt = ["title", "aria-label"], Gt = {
|
|
608
702
|
key: 0,
|
|
609
703
|
viewBox: "0 0 16 16",
|
|
610
704
|
width: "14",
|
|
611
705
|
height: "14",
|
|
612
706
|
"aria-hidden": "true"
|
|
613
|
-
},
|
|
707
|
+
}, Xt = {
|
|
614
708
|
key: 1,
|
|
615
709
|
viewBox: "0 0 16 16",
|
|
616
710
|
width: "14",
|
|
617
711
|
height: "14",
|
|
618
712
|
"aria-hidden": "true"
|
|
619
|
-
},
|
|
713
|
+
}, Qt = /* @__PURE__ */ bt({
|
|
620
714
|
__name: "CodeEditor",
|
|
621
715
|
props: {
|
|
622
716
|
modelValue: {},
|
|
@@ -639,8 +733,8 @@ const Bt = {
|
|
|
639
733
|
minHeight: { default: "260px" }
|
|
640
734
|
},
|
|
641
735
|
emits: ["update:modelValue", "change", "expand", "collapse"],
|
|
642
|
-
setup(
|
|
643
|
-
const n =
|
|
736
|
+
setup(l, { expose: r, emit: a }) {
|
|
737
|
+
const n = l, o = a, c = {
|
|
644
738
|
variable: "变量",
|
|
645
739
|
function: "函数",
|
|
646
740
|
property: "属性",
|
|
@@ -661,90 +755,90 @@ const Bt = {
|
|
|
661
755
|
"End",
|
|
662
756
|
"PageUp",
|
|
663
757
|
"PageDown"
|
|
664
|
-
]),
|
|
665
|
-
() => n.tsTypes ?
|
|
666
|
-
),
|
|
667
|
-
...
|
|
668
|
-
...
|
|
758
|
+
]), i = C(n.modelValue), f = C(), _ = C(), W = C(), g = C(), b = C(), H = C(), O = C(), A = C([]), k = C(0), w = C(!1), E = C({ start: 0, end: 0 }), v = C({}), $ = C(null), be = C({}), Ye = V(
|
|
759
|
+
() => n.tsTypes ? At(n.tsTypes) : []
|
|
760
|
+
), ge = V(() => [
|
|
761
|
+
...wt,
|
|
762
|
+
...Ye.value,
|
|
669
763
|
...n.completions
|
|
670
|
-
]),
|
|
671
|
-
() => n.mode === "template" ? [...n.templateCompletions, ...
|
|
672
|
-
),
|
|
764
|
+
]), re = V(
|
|
765
|
+
() => n.mode === "template" ? [...n.templateCompletions, ...ge.value] : ge.value
|
|
766
|
+
), Je = V(() => {
|
|
673
767
|
const e = {
|
|
674
768
|
keywords: Le(n.language),
|
|
675
|
-
builtins: new Set(
|
|
769
|
+
builtins: new Set(re.value.map((t) => t.label))
|
|
676
770
|
};
|
|
677
|
-
return n.mode === "template" ? `${
|
|
678
|
-
` : `${
|
|
771
|
+
return n.mode === "template" ? `${Ot(i.value, e, n.templateOpen, n.templateClose)}
|
|
772
|
+
` : `${se(i.value, ae(i.value, e))}
|
|
679
773
|
`;
|
|
680
|
-
}),
|
|
681
|
-
`).length),
|
|
682
|
-
() =>
|
|
774
|
+
}), Ge = V(() => i.value.split(`
|
|
775
|
+
`).length), z = C(n.defaultExpanded), J = V(() => n.collapsible && !z.value), Xe = V(() => J.value ? { "--ce-collapsed-height": n.collapsedHeight } : { height: n.minHeight }), Qe = V(
|
|
776
|
+
() => J.value ? { height: n.collapsedHeight } : {}
|
|
683
777
|
);
|
|
684
|
-
let
|
|
685
|
-
function
|
|
686
|
-
if (
|
|
778
|
+
let ve = 0;
|
|
779
|
+
function ye(e) {
|
|
780
|
+
if (z.value === e) return;
|
|
687
781
|
const t = f.value;
|
|
688
|
-
e && t && (
|
|
689
|
-
if (
|
|
782
|
+
e && t && (ve = t.scrollTop), z.value = e, o(e ? "expand" : "collapse"), R(), L(), j(() => {
|
|
783
|
+
if (ce(), !z.value && t) {
|
|
690
784
|
const s = Math.max(0, t.scrollHeight - t.clientHeight);
|
|
691
|
-
t.scrollTop = Math.max(0, Math.min(
|
|
785
|
+
t.scrollTop = Math.max(0, Math.min(ve, s)), N(!0), document.activeElement === t && X();
|
|
692
786
|
return;
|
|
693
787
|
}
|
|
694
|
-
|
|
788
|
+
N(!0), e && n.collapseOnBlur && t && document.activeElement !== t && t.focus();
|
|
695
789
|
});
|
|
696
790
|
}
|
|
697
|
-
function
|
|
698
|
-
|
|
791
|
+
function et() {
|
|
792
|
+
ye(!z.value);
|
|
699
793
|
}
|
|
700
|
-
|
|
794
|
+
Me(
|
|
701
795
|
() => n.modelValue,
|
|
702
796
|
(e) => {
|
|
703
|
-
e !==
|
|
797
|
+
e !== i.value && (i.value = e, R());
|
|
704
798
|
}
|
|
705
|
-
),
|
|
706
|
-
|
|
799
|
+
), Me(i, () => {
|
|
800
|
+
j(() => N(!0));
|
|
707
801
|
});
|
|
708
|
-
function
|
|
802
|
+
function ke(e) {
|
|
709
803
|
return c[e];
|
|
710
804
|
}
|
|
711
|
-
function
|
|
712
|
-
return e ?
|
|
805
|
+
function tt(e) {
|
|
806
|
+
return e ? se(
|
|
713
807
|
e,
|
|
714
|
-
|
|
808
|
+
ae(e, { keywords: Le("typescript"), builtins: /* @__PURE__ */ new Set() })
|
|
715
809
|
) : "";
|
|
716
810
|
}
|
|
717
|
-
let
|
|
718
|
-
function
|
|
811
|
+
let G = { top: 14, bottom: 14, lineHeight: 22 };
|
|
812
|
+
function ce() {
|
|
719
813
|
const e = f.value;
|
|
720
814
|
if (!e) return;
|
|
721
815
|
const t = window.getComputedStyle(e);
|
|
722
|
-
|
|
816
|
+
G = {
|
|
723
817
|
top: parseFloat(t.paddingTop) || 0,
|
|
724
818
|
bottom: parseFloat(t.paddingBottom) || 0,
|
|
725
819
|
lineHeight: parseFloat(t.lineHeight) || 22
|
|
726
820
|
};
|
|
727
821
|
}
|
|
728
|
-
function
|
|
822
|
+
function N(e = !1) {
|
|
729
823
|
const t = f.value;
|
|
730
824
|
if (!t) return;
|
|
731
|
-
const s =
|
|
732
|
-
if (s && (s.style.transform = `translate(${-t.scrollLeft}px, ${-t.scrollTop}px)`),
|
|
733
|
-
const m = `${
|
|
734
|
-
m !==
|
|
825
|
+
const s = g.value;
|
|
826
|
+
if (s && (s.style.transform = `translate(${-t.scrollLeft}px, ${-t.scrollTop}px)`), b.value && (b.value.style.transform = `translateY(${-t.scrollTop}px)`), e) {
|
|
827
|
+
const m = `${i.value}|${n.mode}|${t.clientWidth}|${t.clientHeight}`;
|
|
828
|
+
m !== xe && (xe = m, nt());
|
|
735
829
|
}
|
|
736
830
|
}
|
|
737
|
-
function
|
|
831
|
+
function X() {
|
|
738
832
|
const e = f.value;
|
|
739
|
-
if (!e || !
|
|
740
|
-
const t =
|
|
833
|
+
if (!e || !J.value) return;
|
|
834
|
+
const t = $e();
|
|
741
835
|
if (!t) return;
|
|
742
|
-
const s = e.clientHeight -
|
|
743
|
-
Math.abs(
|
|
836
|
+
const s = e.clientHeight - G.top - G.bottom, h = t.top + e.scrollTop - G.top - Math.max(0, (s - t.lineHeight) / 2), p = Math.max(0, e.scrollHeight - e.clientHeight), x = Math.max(0, Math.min(h, p));
|
|
837
|
+
Math.abs(x - e.scrollTop) > 0.5 && (e.scrollTop = x, N());
|
|
744
838
|
}
|
|
745
|
-
let
|
|
746
|
-
function
|
|
747
|
-
const e = f.value, t =
|
|
839
|
+
let we = [], xe = "", ne = 0, ue = -1, de = -1, fe = { x: 0, y: 0 };
|
|
840
|
+
function nt() {
|
|
841
|
+
const e = f.value, t = W.value;
|
|
748
842
|
if (!e || !t) return;
|
|
749
843
|
const s = e.getBoundingClientRect(), m = [];
|
|
750
844
|
t.querySelectorAll("[data-start]").forEach((h) => {
|
|
@@ -757,63 +851,63 @@ const Bt = {
|
|
|
757
851
|
top: p.top - s.top + e.scrollTop,
|
|
758
852
|
bottom: p.bottom - s.top + e.scrollTop
|
|
759
853
|
});
|
|
760
|
-
}),
|
|
854
|
+
}), we = m;
|
|
761
855
|
}
|
|
762
|
-
function
|
|
763
|
-
for (const s of
|
|
856
|
+
function lt(e, t) {
|
|
857
|
+
for (const s of we)
|
|
764
858
|
if (e >= s.left - 1 && e <= s.right + 1 && t >= s.top && t <= s.bottom)
|
|
765
859
|
return s;
|
|
766
860
|
return null;
|
|
767
861
|
}
|
|
768
|
-
function
|
|
769
|
-
|
|
862
|
+
function L() {
|
|
863
|
+
$.value = null, ne = 0, ue = -1, de = -1;
|
|
770
864
|
}
|
|
771
|
-
function
|
|
772
|
-
const t =
|
|
865
|
+
function ot(e) {
|
|
866
|
+
const t = O.value, s = f.value;
|
|
773
867
|
if (!t || !s) return;
|
|
774
|
-
const m = s.getBoundingClientRect(), h = m.left + e.left - s.scrollLeft, p = m.left + e.right - s.scrollLeft,
|
|
775
|
-
let
|
|
776
|
-
|
|
868
|
+
const m = s.getBoundingClientRect(), h = m.left + e.left - s.scrollLeft, p = m.left + e.right - s.scrollLeft, x = m.top + e.top - s.scrollTop, y = m.top + e.bottom - s.scrollTop, I = 12, B = 8, P = t.offsetWidth, ee = t.offsetHeight;
|
|
869
|
+
let F = h, q = y + B;
|
|
870
|
+
F + P > window.innerWidth - I && (F = p - P), q + ee > window.innerHeight - I && (q = x - ee - B), F = Math.max(I, Math.min(F, window.innerWidth - I - P)), q = Math.max(I, q), be.value = { left: `${F}px`, top: `${q}px` };
|
|
777
871
|
}
|
|
778
|
-
function
|
|
872
|
+
function it(e, t) {
|
|
779
873
|
const s = f.value;
|
|
780
|
-
if (!s || n.readonly || !n.hover ||
|
|
781
|
-
|
|
874
|
+
if (!s || n.readonly || !n.hover || w.value) {
|
|
875
|
+
L();
|
|
782
876
|
return;
|
|
783
877
|
}
|
|
784
878
|
if (s.selectionStart !== s.selectionEnd) {
|
|
785
|
-
|
|
879
|
+
L();
|
|
786
880
|
return;
|
|
787
881
|
}
|
|
788
|
-
const m =
|
|
789
|
-
if (
|
|
790
|
-
const
|
|
791
|
-
if (e >=
|
|
882
|
+
const m = O.value;
|
|
883
|
+
if ($.value && m) {
|
|
884
|
+
const y = m.getBoundingClientRect();
|
|
885
|
+
if (e >= y.left && e <= y.right && t >= y.top && t <= y.bottom)
|
|
792
886
|
return;
|
|
793
887
|
}
|
|
794
|
-
const h = s.getBoundingClientRect(), p =
|
|
888
|
+
const h = s.getBoundingClientRect(), p = lt(e - h.left + s.scrollLeft, t - h.top + s.scrollTop);
|
|
795
889
|
if (!p) {
|
|
796
|
-
|
|
890
|
+
L();
|
|
797
891
|
return;
|
|
798
892
|
}
|
|
799
|
-
if (
|
|
893
|
+
if ($.value && ue === p.start && de === p.end)
|
|
800
894
|
return;
|
|
801
|
-
const
|
|
802
|
-
completions:
|
|
803
|
-
declared:
|
|
895
|
+
const x = Mt(s.value, p.start, p.end, {
|
|
896
|
+
completions: re.value,
|
|
897
|
+
declared: Ne(s.value, p.start)
|
|
804
898
|
});
|
|
805
|
-
if (!
|
|
806
|
-
|
|
899
|
+
if (!x) {
|
|
900
|
+
L();
|
|
807
901
|
return;
|
|
808
902
|
}
|
|
809
|
-
|
|
903
|
+
$.value = x, ue = p.start, de = p.end, j(() => ot(p));
|
|
810
904
|
}
|
|
811
|
-
function
|
|
812
|
-
|
|
813
|
-
|
|
905
|
+
function at(e) {
|
|
906
|
+
fe = { x: e.clientX, y: e.clientY }, !ne && (ne = requestAnimationFrame(() => {
|
|
907
|
+
ne = 0, it(fe.x, fe.y);
|
|
814
908
|
}));
|
|
815
909
|
}
|
|
816
|
-
function
|
|
910
|
+
function $e() {
|
|
817
911
|
const e = f.value;
|
|
818
912
|
if (!e) return null;
|
|
819
913
|
const t = window.getComputedStyle(e), s = document.createElement("div"), m = parseFloat(t.paddingLeft) || 0, h = parseFloat(t.paddingRight) || 0, p = e.getBoundingClientRect();
|
|
@@ -844,161 +938,161 @@ const Bt = {
|
|
|
844
938
|
textTransform: t.textTransform,
|
|
845
939
|
tabSize: t.tabSize
|
|
846
940
|
}), s.textContent = e.value.slice(0, e.selectionStart);
|
|
847
|
-
const
|
|
848
|
-
|
|
849
|
-
const
|
|
941
|
+
const x = document.createElement("span");
|
|
942
|
+
x.textContent = "", s.appendChild(x), document.body.appendChild(s);
|
|
943
|
+
const y = x.getBoundingClientRect();
|
|
850
944
|
document.body.removeChild(s);
|
|
851
|
-
const
|
|
945
|
+
const I = parseFloat(t.lineHeight) || 22, B = y.height, P = B > 0 && B < I ? (I - B) / 2 : 0;
|
|
852
946
|
return {
|
|
853
|
-
left:
|
|
854
|
-
top:
|
|
855
|
-
lineHeight:
|
|
947
|
+
left: y.left - p.left - e.scrollLeft,
|
|
948
|
+
top: y.top - p.top - e.scrollTop - P,
|
|
949
|
+
lineHeight: I
|
|
856
950
|
};
|
|
857
951
|
}
|
|
858
|
-
async function
|
|
859
|
-
await
|
|
860
|
-
const e =
|
|
952
|
+
async function st() {
|
|
953
|
+
await j();
|
|
954
|
+
const e = _.value, t = H.value, s = $e();
|
|
861
955
|
if (!e || !t || !s) return;
|
|
862
|
-
const m = 4, h = 8, p = window.innerWidth,
|
|
863
|
-
let
|
|
864
|
-
|
|
865
|
-
left: `${
|
|
866
|
-
top: `${
|
|
867
|
-
maxHeight: `${
|
|
956
|
+
const m = 4, h = 8, p = window.innerWidth, x = window.innerHeight, y = e.getBoundingClientRect(), I = t.scrollHeight, B = x - (y.top + s.top + s.lineHeight) - m - h, P = y.top + s.top - m - h, ee = B >= Math.min(I, 180) || B >= P, F = Math.min(248, Math.max(ee ? B : P, 96)), q = Math.min(I, F), Ie = t.offsetWidth || 280;
|
|
957
|
+
let te = s.left;
|
|
958
|
+
y.left + te + Ie > p - h && (te = p - h - Ie - y.left), te = Math.max(te, h - y.left), v.value = {
|
|
959
|
+
left: `${te}px`,
|
|
960
|
+
top: `${ee ? s.top + s.lineHeight + m : s.top - m - q}px`,
|
|
961
|
+
maxHeight: `${F}px`
|
|
868
962
|
};
|
|
869
963
|
}
|
|
870
|
-
function
|
|
871
|
-
|
|
964
|
+
function R() {
|
|
965
|
+
w.value = !1, A.value = [], k.value = 0, L();
|
|
872
966
|
}
|
|
873
|
-
function
|
|
967
|
+
function Q(e = !1) {
|
|
874
968
|
const t = f.value;
|
|
875
969
|
if (!t || n.readonly) return;
|
|
876
970
|
if (t.selectionStart !== t.selectionEnd) {
|
|
877
|
-
|
|
971
|
+
R();
|
|
878
972
|
return;
|
|
879
973
|
}
|
|
880
974
|
const s = t.selectionStart;
|
|
881
975
|
let m = !e;
|
|
882
976
|
if (n.mode === "template") {
|
|
883
|
-
const p =
|
|
977
|
+
const p = he(
|
|
884
978
|
t.value,
|
|
885
979
|
s,
|
|
886
980
|
n.templateOpen,
|
|
887
981
|
n.templateClose
|
|
888
982
|
);
|
|
889
983
|
if (!p) {
|
|
890
|
-
|
|
984
|
+
R();
|
|
891
985
|
return;
|
|
892
986
|
}
|
|
893
987
|
e && t.value.slice(p.start, s).trim() === "" && (m = !0);
|
|
894
988
|
}
|
|
895
|
-
const h =
|
|
989
|
+
const h = Rt(t.value, s, {
|
|
896
990
|
language: n.language,
|
|
897
|
-
completions:
|
|
898
|
-
declared:
|
|
991
|
+
completions: re.value,
|
|
992
|
+
declared: Ne(t.value, s),
|
|
899
993
|
auto: !m
|
|
900
994
|
});
|
|
901
995
|
if (!h) {
|
|
902
|
-
|
|
996
|
+
R();
|
|
903
997
|
return;
|
|
904
998
|
}
|
|
905
|
-
|
|
999
|
+
A.value = h.items, E.value = { start: h.start, end: h.end }, k.value = 0, w.value = !0, st();
|
|
906
1000
|
}
|
|
907
|
-
function
|
|
908
|
-
|
|
1001
|
+
function rt(e) {
|
|
1002
|
+
i.value = e, o("update:modelValue", e), o("change", e);
|
|
909
1003
|
}
|
|
910
|
-
function
|
|
1004
|
+
function le(e, t, s, m = e + s.length) {
|
|
911
1005
|
const h = f.value;
|
|
912
1006
|
if (!h) return;
|
|
913
1007
|
const p = h.value.slice(0, e) + s + h.value.slice(t);
|
|
914
|
-
|
|
915
|
-
h.value = p, h.setSelectionRange(m, m), h.focus(),
|
|
1008
|
+
rt(p), R(), j(() => {
|
|
1009
|
+
h.value = p, h.setSelectionRange(m, m), h.focus(), N(!0), X();
|
|
916
1010
|
});
|
|
917
1011
|
}
|
|
918
|
-
function
|
|
1012
|
+
function Ce(e = A.value[k.value]) {
|
|
919
1013
|
if (!e) return;
|
|
920
1014
|
const t = e.insertText ?? e.label;
|
|
921
|
-
|
|
1015
|
+
le(E.value.start, E.value.end, t), R();
|
|
922
1016
|
}
|
|
923
1017
|
function Te(e) {
|
|
924
|
-
const t =
|
|
925
|
-
t && (
|
|
1018
|
+
const t = A.value.length;
|
|
1019
|
+
t && (k.value = (k.value + e + t) % t, j(() => {
|
|
926
1020
|
var s, m;
|
|
927
|
-
(m = (s =
|
|
1021
|
+
(m = (s = H.value) == null ? void 0 : s.querySelector(".is-active")) == null || m.scrollIntoView({ block: "nearest" });
|
|
928
1022
|
}));
|
|
929
1023
|
}
|
|
930
|
-
function
|
|
1024
|
+
function ct(e) {
|
|
931
1025
|
const t = e.target;
|
|
932
|
-
|
|
1026
|
+
i.value = t.value, o("update:modelValue", t.value), o("change", t.value), L(), N(), j(X), Q(!0);
|
|
933
1027
|
}
|
|
934
|
-
function
|
|
935
|
-
if (
|
|
1028
|
+
function ut(e) {
|
|
1029
|
+
if (R(), L(), !n.collapsible || !n.collapseOnBlur || !z.value) return;
|
|
936
1030
|
const t = e.relatedTarget;
|
|
937
|
-
t && t.closest(".expand-toggle") ||
|
|
1031
|
+
t && t.closest(".expand-toggle") || ye(!1);
|
|
938
1032
|
}
|
|
939
|
-
function
|
|
940
|
-
|
|
1033
|
+
function dt() {
|
|
1034
|
+
Se(), X();
|
|
941
1035
|
}
|
|
942
|
-
function
|
|
1036
|
+
function Se() {
|
|
943
1037
|
const e = f.value;
|
|
944
1038
|
if (!e || n.readonly) return;
|
|
945
1039
|
if (e.selectionStart !== e.selectionEnd) {
|
|
946
|
-
|
|
1040
|
+
R();
|
|
947
1041
|
return;
|
|
948
1042
|
}
|
|
949
1043
|
const t = e.selectionStart;
|
|
950
1044
|
if (t > 0 && e.value[t - 1] === ".") {
|
|
951
|
-
|
|
1045
|
+
Q(!0);
|
|
952
1046
|
return;
|
|
953
1047
|
}
|
|
954
1048
|
if (n.mode === "template") {
|
|
955
|
-
const s =
|
|
1049
|
+
const s = he(
|
|
956
1050
|
e.value,
|
|
957
1051
|
t,
|
|
958
1052
|
n.templateOpen,
|
|
959
1053
|
n.templateClose
|
|
960
1054
|
);
|
|
961
1055
|
if (s && e.value.slice(s.start, t).trim() === "") {
|
|
962
|
-
|
|
1056
|
+
Q(!0);
|
|
963
1057
|
return;
|
|
964
1058
|
}
|
|
965
1059
|
}
|
|
966
|
-
|
|
1060
|
+
R();
|
|
967
1061
|
}
|
|
968
|
-
let
|
|
969
|
-
function
|
|
970
|
-
window.clearTimeout(
|
|
971
|
-
|
|
1062
|
+
let pe = 0;
|
|
1063
|
+
function Ee() {
|
|
1064
|
+
window.clearTimeout(pe), pe = window.setTimeout(() => {
|
|
1065
|
+
pe = 0, Se(), X();
|
|
972
1066
|
}, 0);
|
|
973
1067
|
}
|
|
974
|
-
function
|
|
975
|
-
e.target !== f.value &&
|
|
1068
|
+
function _e(e) {
|
|
1069
|
+
e.target !== f.value && w.value && R();
|
|
976
1070
|
}
|
|
977
|
-
function
|
|
978
|
-
|
|
1071
|
+
function ft() {
|
|
1072
|
+
L(), N(), J.value && pt();
|
|
979
1073
|
}
|
|
980
|
-
let
|
|
981
|
-
function
|
|
982
|
-
window.clearTimeout(
|
|
983
|
-
|
|
1074
|
+
let me = 0;
|
|
1075
|
+
function pt() {
|
|
1076
|
+
window.clearTimeout(me), me = window.setTimeout(() => {
|
|
1077
|
+
me = 0, mt();
|
|
984
1078
|
}, 120);
|
|
985
1079
|
}
|
|
986
|
-
function
|
|
1080
|
+
function mt() {
|
|
987
1081
|
const e = f.value;
|
|
988
1082
|
if (!e) return;
|
|
989
|
-
const t =
|
|
990
|
-
Math.abs(m - s) < 0.5 || (e.scrollTop = m,
|
|
1083
|
+
const t = G.lineHeight, s = e.scrollTop, m = Math.round(s / t) * t;
|
|
1084
|
+
Math.abs(m - s) < 0.5 || (e.scrollTop = m, N());
|
|
991
1085
|
}
|
|
992
|
-
function
|
|
1086
|
+
function ht(e) {
|
|
993
1087
|
var h;
|
|
994
1088
|
const t = f.value;
|
|
995
1089
|
if (!t) return;
|
|
996
1090
|
const s = e.metaKey || e.ctrlKey, m = d.has(e.key);
|
|
997
1091
|
if (e.key === " " && s) {
|
|
998
|
-
e.preventDefault(),
|
|
1092
|
+
e.preventDefault(), Q(!1);
|
|
999
1093
|
return;
|
|
1000
1094
|
}
|
|
1001
|
-
if (
|
|
1095
|
+
if (w.value) {
|
|
1002
1096
|
if (e.key === "ArrowDown") {
|
|
1003
1097
|
e.preventDefault(), Te(1);
|
|
1004
1098
|
return;
|
|
@@ -1008,172 +1102,172 @@ const Bt = {
|
|
|
1008
1102
|
return;
|
|
1009
1103
|
}
|
|
1010
1104
|
if (e.key === "Enter" || e.key === "Tab") {
|
|
1011
|
-
e.preventDefault(),
|
|
1105
|
+
e.preventDefault(), Ce();
|
|
1012
1106
|
return;
|
|
1013
1107
|
}
|
|
1014
1108
|
if (e.key === "Escape") {
|
|
1015
|
-
e.preventDefault(),
|
|
1109
|
+
e.preventDefault(), R();
|
|
1016
1110
|
return;
|
|
1017
1111
|
}
|
|
1018
1112
|
if (m || s) {
|
|
1019
|
-
|
|
1113
|
+
R(), m && !s && Ee();
|
|
1020
1114
|
return;
|
|
1021
1115
|
}
|
|
1022
1116
|
}
|
|
1023
1117
|
if (m && !s) {
|
|
1024
|
-
|
|
1118
|
+
Ee();
|
|
1025
1119
|
return;
|
|
1026
1120
|
}
|
|
1027
1121
|
if (e.key === "Enter" && !s && !e.shiftKey) {
|
|
1028
1122
|
const p = t.selectionStart;
|
|
1029
1123
|
if (p !== t.selectionEnd) return;
|
|
1030
|
-
const
|
|
1031
|
-
`, p - 1) + 1,
|
|
1032
|
-
e.preventDefault(),
|
|
1033
|
-
${
|
|
1124
|
+
const x = t.value.lastIndexOf(`
|
|
1125
|
+
`, p - 1) + 1, y = t.value.slice(x, p), I = ((h = y.match(/^[ \t]*/)) == null ? void 0 : h[0]) ?? "", B = /[{[(]$/.test(y.trimEnd()) ? " " : "";
|
|
1126
|
+
e.preventDefault(), le(p, p, `
|
|
1127
|
+
${I}${B}`);
|
|
1034
1128
|
return;
|
|
1035
1129
|
}
|
|
1036
1130
|
if (e.key === "Tab") {
|
|
1037
|
-
e.preventDefault(),
|
|
1131
|
+
e.preventDefault(), le(t.selectionStart, t.selectionEnd, " ");
|
|
1038
1132
|
return;
|
|
1039
1133
|
}
|
|
1040
1134
|
if (e.key.length === 1 && !s && !e.altKey && u[e.key]) {
|
|
1041
1135
|
if (t.selectionStart !== t.selectionEnd) return;
|
|
1042
|
-
const p = t.selectionStart,
|
|
1043
|
-
if ((e.key === '"' || e.key === "'") &&
|
|
1044
|
-
e.preventDefault(),
|
|
1136
|
+
const p = t.selectionStart, x = t.value[p - 1], y = t.value[p];
|
|
1137
|
+
if ((e.key === '"' || e.key === "'") && x && /[\w$]/.test(x) || y !== void 0 && !/[\s)\]},;:]/.test(y)) return;
|
|
1138
|
+
e.preventDefault(), le(p, p, e.key + u[e.key], p + 1), n.mode === "template" && j(() => Q(!0));
|
|
1045
1139
|
}
|
|
1046
1140
|
}
|
|
1047
|
-
function
|
|
1048
|
-
|
|
1049
|
-
|
|
1141
|
+
function Re() {
|
|
1142
|
+
w.value && R(), L(), j(() => {
|
|
1143
|
+
ce(), N(!0);
|
|
1050
1144
|
});
|
|
1051
1145
|
}
|
|
1052
|
-
return
|
|
1053
|
-
window.addEventListener("resize",
|
|
1054
|
-
|
|
1146
|
+
return gt(() => {
|
|
1147
|
+
window.addEventListener("resize", Re), window.addEventListener("scroll", _e, !0), j(() => {
|
|
1148
|
+
ce(), N(!0);
|
|
1055
1149
|
});
|
|
1056
|
-
}),
|
|
1057
|
-
window.removeEventListener("resize",
|
|
1150
|
+
}), vt(() => {
|
|
1151
|
+
window.removeEventListener("resize", Re), window.removeEventListener("scroll", _e, !0);
|
|
1058
1152
|
}), r({ focus: () => {
|
|
1059
1153
|
var e;
|
|
1060
1154
|
return (e = f.value) == null ? void 0 : e.focus();
|
|
1061
|
-
} }), (e, t) => (T(),
|
|
1062
|
-
class:
|
|
1063
|
-
"is-readonly":
|
|
1064
|
-
"is-dark":
|
|
1065
|
-
"is-collapsed":
|
|
1155
|
+
} }), (e, t) => (T(), S("div", {
|
|
1156
|
+
class: ie(["code-editor", {
|
|
1157
|
+
"is-readonly": l.readonly,
|
|
1158
|
+
"is-dark": l.theme === "dark",
|
|
1159
|
+
"is-collapsed": J.value
|
|
1066
1160
|
}]),
|
|
1067
|
-
style:
|
|
1161
|
+
style: oe(Xe.value)
|
|
1068
1162
|
}, [
|
|
1069
|
-
|
|
1070
|
-
|
|
1163
|
+
l.lineNumbers && !J.value ? (T(), S("div", Nt, [
|
|
1164
|
+
M("div", {
|
|
1071
1165
|
ref_key: "gutterInner",
|
|
1072
|
-
ref:
|
|
1166
|
+
ref: b,
|
|
1073
1167
|
class: "gutter-inner code-font"
|
|
1074
1168
|
}, [
|
|
1075
|
-
(T(!0),
|
|
1169
|
+
(T(!0), S(He, null, Ae(Ge.value, (s) => (T(), S("div", {
|
|
1076
1170
|
key: s,
|
|
1077
1171
|
class: "gutter-line"
|
|
1078
|
-
},
|
|
1172
|
+
}, K(s), 1))), 128))
|
|
1079
1173
|
], 512)
|
|
1080
|
-
])) :
|
|
1081
|
-
|
|
1174
|
+
])) : D("", !0),
|
|
1175
|
+
M("div", {
|
|
1082
1176
|
ref_key: "stage",
|
|
1083
|
-
ref:
|
|
1177
|
+
ref: _,
|
|
1084
1178
|
class: "stage",
|
|
1085
|
-
style:
|
|
1179
|
+
style: oe(Qe.value)
|
|
1086
1180
|
}, [
|
|
1087
|
-
|
|
1181
|
+
M("div", {
|
|
1088
1182
|
ref_key: "highlightLayer",
|
|
1089
|
-
ref:
|
|
1183
|
+
ref: W,
|
|
1090
1184
|
class: "highlight code-font"
|
|
1091
1185
|
}, [
|
|
1092
|
-
|
|
1186
|
+
M("pre", {
|
|
1093
1187
|
ref_key: "highlightInner",
|
|
1094
|
-
ref:
|
|
1188
|
+
ref: g,
|
|
1095
1189
|
class: "code-font"
|
|
1096
1190
|
}, [
|
|
1097
|
-
|
|
1191
|
+
M("code", { innerHTML: Je.value }, null, 8, jt)
|
|
1098
1192
|
], 512)
|
|
1099
1193
|
], 512),
|
|
1100
|
-
|
|
1194
|
+
M("textarea", {
|
|
1101
1195
|
ref_key: "textarea",
|
|
1102
1196
|
ref: f,
|
|
1103
1197
|
class: "code-font input",
|
|
1104
|
-
value:
|
|
1105
|
-
readonly:
|
|
1106
|
-
placeholder:
|
|
1198
|
+
value: i.value,
|
|
1199
|
+
readonly: l.readonly,
|
|
1200
|
+
placeholder: l.placeholder,
|
|
1107
1201
|
spellcheck: "false",
|
|
1108
1202
|
autocomplete: "off",
|
|
1109
1203
|
autocapitalize: "off",
|
|
1110
1204
|
autocorrect: "off",
|
|
1111
1205
|
wrap: "soft",
|
|
1112
|
-
onInput:
|
|
1113
|
-
onKeydown:
|
|
1114
|
-
onScroll:
|
|
1115
|
-
onClick:
|
|
1116
|
-
onMousemove:
|
|
1117
|
-
onMouseleave:
|
|
1118
|
-
onBlur:
|
|
1119
|
-
}, null, 40,
|
|
1120
|
-
|
|
1206
|
+
onInput: ct,
|
|
1207
|
+
onKeydown: ht,
|
|
1208
|
+
onScroll: ft,
|
|
1209
|
+
onClick: dt,
|
|
1210
|
+
onMousemove: at,
|
|
1211
|
+
onMouseleave: L,
|
|
1212
|
+
onBlur: ut
|
|
1213
|
+
}, null, 40, zt),
|
|
1214
|
+
w.value ? (T(), S("ul", {
|
|
1121
1215
|
key: 0,
|
|
1122
1216
|
ref_key: "popup",
|
|
1123
|
-
ref:
|
|
1217
|
+
ref: H,
|
|
1124
1218
|
class: "popup",
|
|
1125
|
-
style:
|
|
1126
|
-
onMousedown: t[0] || (t[0] =
|
|
1219
|
+
style: oe(v.value),
|
|
1220
|
+
onMousedown: t[0] || (t[0] = yt(() => {
|
|
1127
1221
|
}, ["prevent"]))
|
|
1128
1222
|
}, [
|
|
1129
|
-
(T(!0),
|
|
1223
|
+
(T(!0), S(He, null, Ae(A.value, (s, m) => (T(), S("li", {
|
|
1130
1224
|
key: `${s.label}-${m}`,
|
|
1131
|
-
class:
|
|
1132
|
-
onMouseenter: (h) =>
|
|
1133
|
-
onClick: (h) =>
|
|
1225
|
+
class: ie(["popup-item", { "is-active": m === k.value }]),
|
|
1226
|
+
onMouseenter: (h) => k.value = m,
|
|
1227
|
+
onClick: (h) => Ce(s)
|
|
1134
1228
|
}, [
|
|
1135
|
-
|
|
1136
|
-
class:
|
|
1137
|
-
},
|
|
1138
|
-
|
|
1139
|
-
s.detail ? (T(),
|
|
1140
|
-
], 42,
|
|
1141
|
-
], 36)) :
|
|
1142
|
-
|
|
1229
|
+
M("span", {
|
|
1230
|
+
class: ie(["badge", `badge-${s.kind}`])
|
|
1231
|
+
}, K(ke(s.kind)), 3),
|
|
1232
|
+
M("span", Wt, K(s.label), 1),
|
|
1233
|
+
s.detail ? (T(), S("span", Pt, K(s.detail), 1)) : D("", !0)
|
|
1234
|
+
], 42, Dt))), 128))
|
|
1235
|
+
], 36)) : D("", !0),
|
|
1236
|
+
$.value ? (T(), S("div", {
|
|
1143
1237
|
key: 1,
|
|
1144
1238
|
ref_key: "hoverCard",
|
|
1145
|
-
ref:
|
|
1239
|
+
ref: O,
|
|
1146
1240
|
class: "hover-card",
|
|
1147
|
-
style:
|
|
1241
|
+
style: oe(be.value)
|
|
1148
1242
|
}, [
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
class:
|
|
1152
|
-
},
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1243
|
+
M("div", Ft, [
|
|
1244
|
+
M("span", {
|
|
1245
|
+
class: ie(["badge", `badge-${$.value.kind}`])
|
|
1246
|
+
}, K(ke($.value.kind)), 3),
|
|
1247
|
+
M("span", Vt, [
|
|
1248
|
+
kt(K($.value.label), 1),
|
|
1249
|
+
$.value.detail ? (T(), S("span", Kt, ":")) : D("", !0)
|
|
1156
1250
|
]),
|
|
1157
|
-
|
|
1251
|
+
$.value.detail ? (T(), S("span", Zt, K($.value.detail), 1)) : D("", !0)
|
|
1158
1252
|
]),
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
innerHTML:
|
|
1163
|
-
}, null, 8,
|
|
1164
|
-
])) :
|
|
1165
|
-
], 4)) :
|
|
1253
|
+
$.value.documentation ? (T(), S("p", qt, K($.value.documentation), 1)) : D("", !0),
|
|
1254
|
+
$.value.type ? (T(), S("pre", Ut, [
|
|
1255
|
+
M("code", {
|
|
1256
|
+
innerHTML: tt($.value.type)
|
|
1257
|
+
}, null, 8, Yt)
|
|
1258
|
+
])) : D("", !0)
|
|
1259
|
+
], 4)) : D("", !0)
|
|
1166
1260
|
], 4),
|
|
1167
|
-
|
|
1261
|
+
l.collapsible ? (T(), S("button", {
|
|
1168
1262
|
key: 1,
|
|
1169
1263
|
type: "button",
|
|
1170
1264
|
class: "expand-toggle",
|
|
1171
|
-
title:
|
|
1172
|
-
"aria-label":
|
|
1173
|
-
onClick:
|
|
1265
|
+
title: z.value ? "收起" : "展开",
|
|
1266
|
+
"aria-label": z.value ? "收起编辑器" : "展开编辑器",
|
|
1267
|
+
onClick: et
|
|
1174
1268
|
}, [
|
|
1175
|
-
|
|
1176
|
-
|
|
1269
|
+
z.value ? (T(), S("svg", Xt, [...t[2] || (t[2] = [
|
|
1270
|
+
M("path", {
|
|
1177
1271
|
d: "M11 2 5 8 11 14",
|
|
1178
1272
|
fill: "none",
|
|
1179
1273
|
stroke: "currentColor",
|
|
@@ -1181,8 +1275,8 @@ ${R}${M}`);
|
|
|
1181
1275
|
"stroke-linecap": "round",
|
|
1182
1276
|
"stroke-linejoin": "round"
|
|
1183
1277
|
}, null, -1)
|
|
1184
|
-
])])) : (T(),
|
|
1185
|
-
|
|
1278
|
+
])])) : (T(), S("svg", Gt, [...t[1] || (t[1] = [
|
|
1279
|
+
M("path", {
|
|
1186
1280
|
d: "M6 2 12 8 6 14",
|
|
1187
1281
|
fill: "none",
|
|
1188
1282
|
stroke: "currentColor",
|
|
@@ -1191,32 +1285,32 @@ ${R}${M}`);
|
|
|
1191
1285
|
"stroke-linejoin": "round"
|
|
1192
1286
|
}, null, -1)
|
|
1193
1287
|
])]))
|
|
1194
|
-
], 8,
|
|
1288
|
+
], 8, Jt)) : D("", !0)
|
|
1195
1289
|
], 6));
|
|
1196
1290
|
}
|
|
1197
|
-
}),
|
|
1198
|
-
const
|
|
1199
|
-
for (const [n,
|
|
1200
|
-
|
|
1201
|
-
return
|
|
1202
|
-
},
|
|
1203
|
-
install(
|
|
1204
|
-
|
|
1291
|
+
}), en = (l, r) => {
|
|
1292
|
+
const a = l.__vccOpts || l;
|
|
1293
|
+
for (const [n, o] of r)
|
|
1294
|
+
a[n] = o;
|
|
1295
|
+
return a;
|
|
1296
|
+
}, tn = /* @__PURE__ */ en(Qt, [["__scopeId", "data-v-dc3651c9"]]), on = {
|
|
1297
|
+
install(l) {
|
|
1298
|
+
l.component("CodeInput", tn);
|
|
1205
1299
|
}
|
|
1206
1300
|
};
|
|
1207
1301
|
export {
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1302
|
+
tn as CodeEditor,
|
|
1303
|
+
Rt as collectCompletions,
|
|
1304
|
+
on as default,
|
|
1305
|
+
wt as defaultCompletions,
|
|
1306
|
+
he as findTemplateRange,
|
|
1213
1307
|
Le as getKeywordSet,
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1308
|
+
Ke as getKeywords,
|
|
1309
|
+
se as highlight,
|
|
1310
|
+
Ot as highlightTemplate,
|
|
1311
|
+
ln as isInsideTemplate,
|
|
1312
|
+
At as parseTsCompletions,
|
|
1313
|
+
Mt as resolveHoverItem,
|
|
1314
|
+
Ne as scanDeclarations,
|
|
1315
|
+
ae as tokenize
|
|
1222
1316
|
};
|