@onerjs/code-input 0.1.3 → 0.1.4
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/dist/code-input.cjs +15 -15
- package/dist/code-input.es.js +408 -405
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/code-input.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
const
|
|
1
|
+
import { defineComponent as Et, ref as E, computed as K, watch as Oe, nextTick as V, onMounted as Rt, onBeforeUnmount as Mt, openBlock as I, createElementBlock as L, normalizeStyle as ce, normalizeClass as ne, createElementVNode as A, withModifiers as Ne, Fragment as We, renderList as ze, toDisplayString as Y, createCommentVNode as Z, createTextVNode as It } from "vue";
|
|
2
|
+
const Lt = [
|
|
3
3
|
{
|
|
4
4
|
label: "Math",
|
|
5
5
|
kind: "class",
|
|
@@ -134,8 +134,8 @@ const It = [
|
|
|
134
134
|
kind: "function",
|
|
135
135
|
detail: "(id: number) => void"
|
|
136
136
|
}
|
|
137
|
-
],
|
|
138
|
-
function
|
|
137
|
+
], _t = /[\w$]/;
|
|
138
|
+
function Ht(n, s) {
|
|
139
139
|
const o = [];
|
|
140
140
|
let e = null;
|
|
141
141
|
for (let C = 0; C < s; C++) {
|
|
@@ -162,15 +162,15 @@ function _t(n, s) {
|
|
|
162
162
|
if (!i) return null;
|
|
163
163
|
let r = i.index - 1;
|
|
164
164
|
for (; r >= 0 && /\s/.test(n[r]); ) r--;
|
|
165
|
-
const
|
|
166
|
-
for (; r >= 0 &&
|
|
167
|
-
const u = n.slice(r + 1,
|
|
165
|
+
const f = r;
|
|
166
|
+
for (; r >= 0 && _t.test(n[r]); ) r--;
|
|
167
|
+
const u = n.slice(r + 1, f + 1);
|
|
168
168
|
if (!u) return null;
|
|
169
169
|
let a = s;
|
|
170
170
|
for (; a > 0 && /[\w$'"]/.test(n[a - 1]); ) a--;
|
|
171
|
-
const
|
|
172
|
-
let $ =
|
|
173
|
-
return
|
|
171
|
+
const d = n.slice(a, s);
|
|
172
|
+
let $ = d, z = null;
|
|
173
|
+
return d && (d[0] === "'" || d[0] === '"') && (z = d[0], $ = d.slice(1)), {
|
|
174
174
|
functionName: u,
|
|
175
175
|
paramIndex: i.commas,
|
|
176
176
|
prefix: $,
|
|
@@ -178,7 +178,7 @@ function _t(n, s) {
|
|
|
178
178
|
quote: z
|
|
179
179
|
};
|
|
180
180
|
}
|
|
181
|
-
const
|
|
181
|
+
const De = [
|
|
182
182
|
"break",
|
|
183
183
|
"case",
|
|
184
184
|
"catch",
|
|
@@ -223,7 +223,7 @@ const ze = [
|
|
|
223
223
|
"undefined",
|
|
224
224
|
"NaN",
|
|
225
225
|
"Infinity"
|
|
226
|
-
],
|
|
226
|
+
], At = [
|
|
227
227
|
"abstract",
|
|
228
228
|
"any",
|
|
229
229
|
"as",
|
|
@@ -253,36 +253,36 @@ const ze = [
|
|
|
253
253
|
"type",
|
|
254
254
|
"unknown"
|
|
255
255
|
];
|
|
256
|
-
function
|
|
257
|
-
return n === "typescript" ? [...
|
|
256
|
+
function Xe(n) {
|
|
257
|
+
return n === "typescript" ? [...De, ...At] : De;
|
|
258
258
|
}
|
|
259
|
-
function
|
|
260
|
-
return new Set(
|
|
259
|
+
function je(n) {
|
|
260
|
+
return new Set(Xe(n));
|
|
261
261
|
}
|
|
262
|
-
const
|
|
263
|
-
function
|
|
264
|
-
const o = n.slice(0, s), e =
|
|
262
|
+
const Bt = /((?:[A-Za-z_$][\w$]*\??\.)*)([A-Za-z_$][\w$]*)?$/, Fe = /\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g, Ot = /^[A-Za-z_$]/;
|
|
263
|
+
function Ge(n, s) {
|
|
264
|
+
const o = n.slice(0, s), e = Bt.exec(o);
|
|
265
265
|
if (!e) return { prefix: "", chain: [] };
|
|
266
|
-
const i = e[1] ?? "", r = e[2] ?? "",
|
|
267
|
-
return { prefix: r, chain:
|
|
266
|
+
const i = e[1] ?? "", r = e[2] ?? "", f = i.split(".").filter(Boolean).map((u) => u.replace(/\?$/, ""));
|
|
267
|
+
return { prefix: r, chain: f };
|
|
268
268
|
}
|
|
269
|
-
function
|
|
269
|
+
function Pe(n, s) {
|
|
270
270
|
const o = [], e = /* @__PURE__ */ new Set();
|
|
271
271
|
let i;
|
|
272
|
-
for (
|
|
272
|
+
for (Fe.lastIndex = 0; (i = Fe.exec(n)) && !(i.index >= s); ) {
|
|
273
273
|
const r = i[1];
|
|
274
274
|
if (e.has(r)) continue;
|
|
275
275
|
e.add(r);
|
|
276
|
-
const
|
|
276
|
+
const f = i[0].slice(0, i[0].indexOf(r)).trim();
|
|
277
277
|
o.push({
|
|
278
278
|
label: r,
|
|
279
|
-
kind:
|
|
279
|
+
kind: f === "function" ? "function" : f === "class" ? "class" : "variable",
|
|
280
280
|
detail: "当前文件"
|
|
281
281
|
});
|
|
282
282
|
}
|
|
283
283
|
return o;
|
|
284
284
|
}
|
|
285
|
-
function
|
|
285
|
+
function Qe(n, s) {
|
|
286
286
|
let o = s;
|
|
287
287
|
for (const e of n) {
|
|
288
288
|
if (!o) return null;
|
|
@@ -292,74 +292,74 @@ function Ge(n, s) {
|
|
|
292
292
|
}
|
|
293
293
|
return o;
|
|
294
294
|
}
|
|
295
|
-
function
|
|
295
|
+
function Nt(n, s) {
|
|
296
296
|
const o = n.toLowerCase(), e = s.toLowerCase(), i = o.indexOf(e);
|
|
297
297
|
if (i === 0) return 1e3 - o.length;
|
|
298
298
|
if (i > 0) return 800 - i;
|
|
299
|
-
let r = 0,
|
|
299
|
+
let r = 0, f = 0, u = -1;
|
|
300
300
|
for (let a = 0; a < o.length && r < e.length; a++)
|
|
301
|
-
o[a] === e[r] && (u >= 0 && (
|
|
302
|
-
return r !== e.length ? null : 400 -
|
|
301
|
+
o[a] === e[r] && (u >= 0 && (f += a - u - 1), u = a, r++);
|
|
302
|
+
return r !== e.length ? null : 400 - f - o.length;
|
|
303
303
|
}
|
|
304
|
-
function
|
|
304
|
+
function et(n, s) {
|
|
305
305
|
if (!s) return n;
|
|
306
306
|
const o = [];
|
|
307
307
|
for (const e of n) {
|
|
308
|
-
const i =
|
|
308
|
+
const i = Nt(e.label, s);
|
|
309
309
|
i !== null && o.push({ item: e, score: i });
|
|
310
310
|
}
|
|
311
311
|
return o.sort((e, i) => i.score - e.score || e.item.label.localeCompare(i.item.label)), o.map((e) => e.item);
|
|
312
312
|
}
|
|
313
|
-
function
|
|
313
|
+
function Wt(n) {
|
|
314
314
|
const s = /* @__PURE__ */ new Set(), o = [];
|
|
315
315
|
for (const e of n)
|
|
316
316
|
s.has(e.label) || (s.add(e.label), o.push(e));
|
|
317
317
|
return o;
|
|
318
318
|
}
|
|
319
|
-
function
|
|
320
|
-
const { prefix: e, chain: i } =
|
|
321
|
-
if (o.auto && (!e && i.length === 0 || e && !
|
|
319
|
+
function zt(n, s, o) {
|
|
320
|
+
const { prefix: e, chain: i } = Ge(n, s);
|
|
321
|
+
if (o.auto && (!e && i.length === 0 || e && !Ot.test(e)))
|
|
322
322
|
return null;
|
|
323
|
-
const r = o.declared ?? [],
|
|
323
|
+
const r = o.declared ?? [], f = [...r, ...o.completions];
|
|
324
324
|
let u;
|
|
325
325
|
if (i.length > 0) {
|
|
326
|
-
const
|
|
327
|
-
if (!
|
|
328
|
-
u =
|
|
326
|
+
const d = Qe(i, f);
|
|
327
|
+
if (!d || d.length === 0) return null;
|
|
328
|
+
u = d;
|
|
329
329
|
} else
|
|
330
330
|
u = [
|
|
331
331
|
...o.completions,
|
|
332
332
|
...r,
|
|
333
|
-
...
|
|
334
|
-
label:
|
|
333
|
+
...Xe(o.language).map((d) => ({
|
|
334
|
+
label: d,
|
|
335
335
|
kind: "keyword"
|
|
336
336
|
}))
|
|
337
337
|
];
|
|
338
|
-
const a =
|
|
338
|
+
const a = et(Wt(u), e);
|
|
339
339
|
return a.length === 0 ? null : {
|
|
340
340
|
items: a,
|
|
341
341
|
start: s - e.length,
|
|
342
342
|
end: s
|
|
343
343
|
};
|
|
344
344
|
}
|
|
345
|
-
const
|
|
346
|
-
function
|
|
345
|
+
const Dt = /([A-Za-z_$][\w$]*(?:\??\.[A-Za-z_$][\w$]*)*)\??\.\s*$/;
|
|
346
|
+
function jt(n, s, o, e) {
|
|
347
347
|
const i = n.slice(s, o);
|
|
348
348
|
if (!i) return null;
|
|
349
|
-
const r = [...e.declared ?? [], ...e.completions],
|
|
350
|
-
if (
|
|
351
|
-
const u =
|
|
352
|
-
if (
|
|
349
|
+
const r = [...e.declared ?? [], ...e.completions], f = Dt.exec(n.slice(0, s));
|
|
350
|
+
if (f) {
|
|
351
|
+
const u = f[1].split(".").filter(Boolean).map(($) => $.replace(/\?$/, "")), a = Qe(u, r), d = a == null ? void 0 : a.find(($) => $.label === i);
|
|
352
|
+
if (d) return d;
|
|
353
353
|
}
|
|
354
354
|
return r.find((u) => u.label === i) ?? null;
|
|
355
355
|
}
|
|
356
|
-
const U = "[A-Za-z_$][\\w$]*",
|
|
357
|
-
function
|
|
356
|
+
const U = "[A-Za-z_$][\\w$]*", Ve = "(?:readonly\\s+|public\\s+|private\\s+|protected\\s+|static\\s+|abstract\\s+)*";
|
|
357
|
+
function qe(n, s) {
|
|
358
358
|
let o = 0, e = !1, i = s;
|
|
359
359
|
for (let r = s; r < n.length; r++) {
|
|
360
|
-
const
|
|
361
|
-
for (let u = 0; u <
|
|
362
|
-
const a =
|
|
360
|
+
const f = n[r];
|
|
361
|
+
for (let u = 0; u < f.length; u++) {
|
|
362
|
+
const a = f[u];
|
|
363
363
|
a === "{" ? (o++, e = !0) : a === "}" && o--;
|
|
364
364
|
}
|
|
365
365
|
if (e && o <= 0) {
|
|
@@ -369,23 +369,23 @@ function Ve(n, s) {
|
|
|
369
369
|
}
|
|
370
370
|
return { end: i, body: n.slice(s + 1, i) };
|
|
371
371
|
}
|
|
372
|
-
function
|
|
372
|
+
function Ke(n) {
|
|
373
373
|
return n.trim().replace(/[,;]$/, "").trim();
|
|
374
374
|
}
|
|
375
|
-
function
|
|
375
|
+
function Ft(n) {
|
|
376
376
|
return /^(?:export\s+)?(?:declare\s+)?(?:abstract\s+)?(?:interface|class|type|function|const|let|var|namespace|enum)\b/.test(
|
|
377
377
|
n
|
|
378
378
|
);
|
|
379
379
|
}
|
|
380
|
-
function
|
|
380
|
+
function le(n, s) {
|
|
381
381
|
const o = n[s];
|
|
382
382
|
let e = o.lastIndexOf("}");
|
|
383
383
|
const i = o.lastIndexOf(";");
|
|
384
384
|
if (i > e && (e = i), e === -1) return;
|
|
385
385
|
const r = o.slice(e + 1).replace(/^[\s;]+/, "").trim();
|
|
386
|
-
!r || !
|
|
386
|
+
!r || !Ft(r) || (n[s] = o.slice(0, e + 1), n.splice(s + 1, 0, r));
|
|
387
387
|
}
|
|
388
|
-
function
|
|
388
|
+
function X(n) {
|
|
389
389
|
return n.length ? n.join(`
|
|
390
390
|
`).replace(/^\s*\/\*\*?/, "").replace(/\*\/\s*$/, "").split(`
|
|
391
391
|
`).map((s) => s.replace(/^\s*\*+\s?/, "").replace(/^\s*\/\/\s?/, "")).join(`
|
|
@@ -393,23 +393,23 @@ function J(n) {
|
|
|
393
393
|
|
|
394
394
|
`).trim() : "";
|
|
395
395
|
}
|
|
396
|
-
function
|
|
396
|
+
function Ze(n) {
|
|
397
397
|
return n.split(`
|
|
398
398
|
`).filter((s) => !/^\s*(\/\/|\/\*|\*)/.test(s)).join(`
|
|
399
399
|
`).replace(/\n{2,}/g, `
|
|
400
400
|
`).trim();
|
|
401
401
|
}
|
|
402
|
-
function
|
|
403
|
-
const s = [], o = /* @__PURE__ */ new Set(), e = new RegExp(`^${
|
|
404
|
-
let r = [],
|
|
402
|
+
function Ue(n) {
|
|
403
|
+
const s = [], o = /* @__PURE__ */ new Set(), e = new RegExp(`^${Ve}(${U})(\\?)?\\s*\\((.*)\\)\\s*:\\s*(.+?);?$`), i = new RegExp(`^${Ve}(${U})(\\?)?\\s*:\\s*(.+?);?$`);
|
|
404
|
+
let r = [], f = !1;
|
|
405
405
|
for (const u of n) {
|
|
406
406
|
const a = u.trim();
|
|
407
|
-
if (
|
|
408
|
-
r.push(a), a.includes("*/") && (
|
|
407
|
+
if (f) {
|
|
408
|
+
r.push(a), a.includes("*/") && (f = !1);
|
|
409
409
|
continue;
|
|
410
410
|
}
|
|
411
411
|
if (a.startsWith("/*")) {
|
|
412
|
-
r.push(a), a.includes("*/") || (
|
|
412
|
+
r.push(a), a.includes("*/") || (f = !0);
|
|
413
413
|
continue;
|
|
414
414
|
}
|
|
415
415
|
if (a.startsWith("//")) {
|
|
@@ -420,28 +420,28 @@ function Ze(n) {
|
|
|
420
420
|
r = [];
|
|
421
421
|
continue;
|
|
422
422
|
}
|
|
423
|
-
const
|
|
424
|
-
if (
|
|
425
|
-
const z =
|
|
423
|
+
const d = e.exec(a);
|
|
424
|
+
if (d) {
|
|
425
|
+
const z = X(r);
|
|
426
426
|
r = [];
|
|
427
|
-
const C =
|
|
427
|
+
const C = d[1];
|
|
428
428
|
if (o.has(C)) continue;
|
|
429
429
|
o.add(C), s.push({
|
|
430
430
|
label: C,
|
|
431
431
|
kind: "function",
|
|
432
|
-
detail: `(${
|
|
432
|
+
detail: `(${d[3].trim()}) => ${Ke(d[4])}`,
|
|
433
433
|
documentation: z || void 0
|
|
434
434
|
});
|
|
435
435
|
continue;
|
|
436
436
|
}
|
|
437
437
|
const $ = i.exec(a);
|
|
438
438
|
if ($) {
|
|
439
|
-
const z =
|
|
439
|
+
const z = X(r);
|
|
440
440
|
r = [];
|
|
441
441
|
const C = $[1];
|
|
442
442
|
if (o.has(C)) continue;
|
|
443
443
|
o.add(C);
|
|
444
|
-
const b =
|
|
444
|
+
const b = Ke($[3]), y = /^\(|=>/.test(b) ? "function" : "property";
|
|
445
445
|
s.push({
|
|
446
446
|
label: C,
|
|
447
447
|
kind: y,
|
|
@@ -452,20 +452,20 @@ function Ze(n) {
|
|
|
452
452
|
}
|
|
453
453
|
return s;
|
|
454
454
|
}
|
|
455
|
-
function
|
|
455
|
+
function tt(n) {
|
|
456
456
|
const s = [], o = /(['"])((?:\\.|(?!\1).)*)\1/g;
|
|
457
457
|
let e;
|
|
458
458
|
for (; e = o.exec(n); )
|
|
459
459
|
s.push(e[2]);
|
|
460
460
|
return s;
|
|
461
461
|
}
|
|
462
|
-
function
|
|
462
|
+
function Pt(n, s) {
|
|
463
463
|
const o = [];
|
|
464
464
|
let e = 0, i = "", r = null;
|
|
465
|
-
for (let
|
|
466
|
-
const u = n[
|
|
465
|
+
for (let f = 0; f < n.length; f++) {
|
|
466
|
+
const u = n[f];
|
|
467
467
|
if (r) {
|
|
468
|
-
i += u, u === r && n[
|
|
468
|
+
i += u, u === r && n[f - 1] !== "\\" && (r = null);
|
|
469
469
|
continue;
|
|
470
470
|
}
|
|
471
471
|
if (u === "'" || u === '"' || u === "`") {
|
|
@@ -480,15 +480,15 @@ function Ft(n, s) {
|
|
|
480
480
|
}
|
|
481
481
|
return o.push(i), o;
|
|
482
482
|
}
|
|
483
|
-
function
|
|
484
|
-
const o = n.trim(), e =
|
|
483
|
+
function Vt(n, s) {
|
|
484
|
+
const o = n.trim(), e = tt(o);
|
|
485
485
|
if (e.length) return e;
|
|
486
486
|
const i = s.get(o.replace(/\[\]$/, ""));
|
|
487
487
|
return (i == null ? void 0 : i.literals) ?? [];
|
|
488
488
|
}
|
|
489
|
-
function
|
|
489
|
+
function qt(n, s) {
|
|
490
490
|
const o = n.trim();
|
|
491
|
-
return o ?
|
|
491
|
+
return o ? Pt(o, ",").map((e) => {
|
|
492
492
|
const i = new RegExp(`^\\s*(${U})\\s*(\\?)?\\s*:\\s*(.+)$`).exec(e);
|
|
493
493
|
if (!i)
|
|
494
494
|
return { name: e.trim(), type: "", optional: !1, literals: [] };
|
|
@@ -497,54 +497,54 @@ function Vt(n, s) {
|
|
|
497
497
|
name: i[1],
|
|
498
498
|
optional: !!i[2],
|
|
499
499
|
type: r,
|
|
500
|
-
literals:
|
|
500
|
+
literals: Vt(r, s)
|
|
501
501
|
};
|
|
502
502
|
}) : [];
|
|
503
503
|
}
|
|
504
|
-
function
|
|
504
|
+
function nt(n) {
|
|
505
505
|
const s = n.replace(/\[\]/g, "").replace(/<[^>]*>/g, "").replace(/\s*\|\s*null\s*/g, "").trim(), o = new RegExp(`^(${U})$`).exec(s);
|
|
506
506
|
return o ? o[1] : null;
|
|
507
507
|
}
|
|
508
|
-
function
|
|
508
|
+
function Kt(n) {
|
|
509
509
|
const s = n.trim();
|
|
510
510
|
if (!s || s.endsWith(";")) return !1;
|
|
511
511
|
const o = (s.match(/[(<[{]/g) ?? []).length, e = (s.match(/[)>\]}]/g) ?? []).length;
|
|
512
512
|
return /[|&,(<]\s*$/.test(s) || o > e;
|
|
513
513
|
}
|
|
514
|
-
function
|
|
514
|
+
function lt(n, s, o, e = 0) {
|
|
515
515
|
return e > 6 ? n : n.map((i) => {
|
|
516
516
|
if (i.kind !== "property" || !i.detail) return i;
|
|
517
|
-
const r =
|
|
518
|
-
if (!
|
|
517
|
+
const r = nt(i.detail), f = r ? s.get(r) : void 0;
|
|
518
|
+
if (!f || o.has(f.label)) return i;
|
|
519
519
|
const u = new Set(o);
|
|
520
|
-
return u.add(
|
|
520
|
+
return u.add(f.label), {
|
|
521
521
|
...i,
|
|
522
|
-
type:
|
|
523
|
-
members:
|
|
522
|
+
type: f.type,
|
|
523
|
+
members: lt(f.members, s, u, e + 1)
|
|
524
524
|
};
|
|
525
525
|
});
|
|
526
526
|
}
|
|
527
|
-
const
|
|
528
|
-
function
|
|
529
|
-
if (!n || !n.trim()) return
|
|
530
|
-
const s =
|
|
527
|
+
const Zt = 50, ie = /* @__PURE__ */ new Map(), Ut = { items: [], signatures: /* @__PURE__ */ new Map() };
|
|
528
|
+
function it(n) {
|
|
529
|
+
if (!n || !n.trim()) return Ut;
|
|
530
|
+
const s = ie.get(n);
|
|
531
531
|
if (s) return s;
|
|
532
|
-
const o =
|
|
533
|
-
if (
|
|
534
|
-
const e =
|
|
535
|
-
e !== void 0 &&
|
|
532
|
+
const o = Xt(n);
|
|
533
|
+
if (ie.size >= Zt) {
|
|
534
|
+
const e = ie.keys().next().value;
|
|
535
|
+
e !== void 0 && ie.delete(e);
|
|
536
536
|
}
|
|
537
|
-
return
|
|
538
|
-
}
|
|
539
|
-
function Ut(n) {
|
|
540
|
-
return lt(n).items;
|
|
537
|
+
return ie.set(n, o), o;
|
|
541
538
|
}
|
|
542
539
|
function Yt(n) {
|
|
543
|
-
return
|
|
540
|
+
return it(n).items;
|
|
544
541
|
}
|
|
545
542
|
function Jt(n) {
|
|
543
|
+
return it(n).signatures;
|
|
544
|
+
}
|
|
545
|
+
function Xt(n) {
|
|
546
546
|
const s = n.split(`
|
|
547
|
-
`), o = /* @__PURE__ */ new Map(), e = /* @__PURE__ */ new Map(), i = new RegExp(`^(?:export\\s+)?(?:declare\\s+)?interface\\s+(${U})`), r = new RegExp(`^(?:export\\s+)?(?:declare\\s+)?(?:abstract\\s+)?class\\s+(${U})`),
|
|
547
|
+
`), o = /* @__PURE__ */ new Map(), e = /* @__PURE__ */ new Map(), i = new RegExp(`^(?:export\\s+)?(?:declare\\s+)?interface\\s+(${U})`), r = new RegExp(`^(?:export\\s+)?(?:declare\\s+)?(?:abstract\\s+)?class\\s+(${U})`), f = new RegExp(`^(?:export\\s+)?(?:declare\\s+)?type\\s+(${U})\\s*=`);
|
|
548
548
|
let u = [], a = !1;
|
|
549
549
|
for (let b = 0; b < s.length; b++) {
|
|
550
550
|
const y = s[b].trim();
|
|
@@ -566,62 +566,62 @@ function Jt(n) {
|
|
|
566
566
|
}
|
|
567
567
|
const O = i.exec(y);
|
|
568
568
|
if (O && y.includes("{")) {
|
|
569
|
-
const w =
|
|
569
|
+
const w = X(u);
|
|
570
570
|
u = [];
|
|
571
|
-
const { end: T, body: _ } =
|
|
571
|
+
const { end: T, body: _ } = qe(s, b), g = O[1];
|
|
572
572
|
o.set(g, {
|
|
573
573
|
label: g,
|
|
574
|
-
type:
|
|
574
|
+
type: Ze(
|
|
575
575
|
s.slice(b, T + 1).join(`
|
|
576
576
|
`).replace(/^\s*export\s+/, "")
|
|
577
577
|
),
|
|
578
|
-
members:
|
|
578
|
+
members: Ue(_),
|
|
579
579
|
kind: "interface",
|
|
580
580
|
documentation: w || void 0
|
|
581
|
-
}),
|
|
581
|
+
}), le(s, T), b = T;
|
|
582
582
|
continue;
|
|
583
583
|
}
|
|
584
584
|
const B = r.exec(y);
|
|
585
585
|
if (B && y.includes("{")) {
|
|
586
|
-
const w =
|
|
586
|
+
const w = X(u);
|
|
587
587
|
u = [];
|
|
588
|
-
const { end: T, body: _ } =
|
|
588
|
+
const { end: T, body: _ } = qe(s, b), g = B[1];
|
|
589
589
|
o.set(g, {
|
|
590
590
|
label: g,
|
|
591
|
-
type:
|
|
591
|
+
type: Ze(
|
|
592
592
|
s.slice(b, T + 1).join(`
|
|
593
593
|
`).replace(/^\s*export\s+/, "")
|
|
594
594
|
),
|
|
595
|
-
members:
|
|
595
|
+
members: Ue(_),
|
|
596
596
|
kind: "class",
|
|
597
597
|
documentation: w || void 0
|
|
598
|
-
}),
|
|
598
|
+
}), le(s, T), b = T;
|
|
599
599
|
continue;
|
|
600
600
|
}
|
|
601
|
-
const
|
|
602
|
-
if (
|
|
603
|
-
const w =
|
|
601
|
+
const R = f.exec(y);
|
|
602
|
+
if (R) {
|
|
603
|
+
const w = X(u);
|
|
604
604
|
u = [];
|
|
605
605
|
const T = [s[b]];
|
|
606
606
|
let _ = b;
|
|
607
|
-
for (;
|
|
607
|
+
for (; Kt(T.join(`
|
|
608
608
|
`)) && _ + 1 < s.length; )
|
|
609
609
|
_++, T.push(s[_]);
|
|
610
610
|
const g = T.join(`
|
|
611
611
|
`).replace(/^\s*export\s+/, "").replace(/;\s*$/, "").trim();
|
|
612
|
-
o.set(
|
|
613
|
-
label:
|
|
612
|
+
o.set(R[1], {
|
|
613
|
+
label: R[1],
|
|
614
614
|
type: g,
|
|
615
615
|
members: [],
|
|
616
616
|
kind: "type",
|
|
617
617
|
documentation: w || void 0,
|
|
618
|
-
literals:
|
|
619
|
-
}),
|
|
618
|
+
literals: tt(g)
|
|
619
|
+
}), le(s, _), b = _;
|
|
620
620
|
continue;
|
|
621
621
|
}
|
|
622
622
|
u = [];
|
|
623
623
|
}
|
|
624
|
-
const
|
|
624
|
+
const d = [], $ = /* @__PURE__ */ new Set(), z = new RegExp(
|
|
625
625
|
`^(?:export\\s+)?(?:declare\\s+)?function\\s+(${U})\\s*\\(([^)]*)\\)\\s*:\\s*([^;{]+)`
|
|
626
626
|
), C = new RegExp(
|
|
627
627
|
`^(?:export\\s+)?(?:declare\\s+)?(?:const|let|var)\\s+(${U})\\s*:\\s*([^=;]+)`
|
|
@@ -647,42 +647,42 @@ function Jt(n) {
|
|
|
647
647
|
}
|
|
648
648
|
const O = z.exec(y);
|
|
649
649
|
if (O) {
|
|
650
|
-
|
|
651
|
-
const
|
|
650
|
+
le(s, b);
|
|
651
|
+
const R = X(u);
|
|
652
652
|
u = [];
|
|
653
653
|
const w = O[1];
|
|
654
|
-
$.has(w) || ($.add(w),
|
|
654
|
+
$.has(w) || ($.add(w), d.push({
|
|
655
655
|
label: w,
|
|
656
656
|
kind: "function",
|
|
657
657
|
detail: `(${O[2].trim()}) => ${O[3].trim()}`,
|
|
658
|
-
documentation:
|
|
659
|
-
})), e.set(w, { name: w, params:
|
|
658
|
+
documentation: R || void 0
|
|
659
|
+
})), e.set(w, { name: w, params: qt(O[2], o) });
|
|
660
660
|
continue;
|
|
661
661
|
}
|
|
662
662
|
const B = C.exec(y);
|
|
663
663
|
if (B) {
|
|
664
|
-
|
|
665
|
-
const
|
|
664
|
+
le(s, b);
|
|
665
|
+
const R = X(u);
|
|
666
666
|
u = [];
|
|
667
667
|
const w = B[1];
|
|
668
668
|
if ($.has(w)) continue;
|
|
669
669
|
$.add(w);
|
|
670
|
-
const T = B[2].trim(), _ =
|
|
671
|
-
|
|
670
|
+
const T = B[2].trim(), _ = nt(T), g = _ ? o.get(_) : void 0, oe = (g == null ? void 0 : g.kind) === "class" ? "class" : /^\(|=>/.test(T) ? "function" : "variable";
|
|
671
|
+
d.push({
|
|
672
672
|
label: w,
|
|
673
|
-
kind:
|
|
673
|
+
kind: oe,
|
|
674
674
|
detail: T,
|
|
675
675
|
type: g == null ? void 0 : g.type,
|
|
676
|
-
documentation:
|
|
677
|
-
members: g ?
|
|
676
|
+
documentation: R || (g == null ? void 0 : g.documentation) || void 0,
|
|
677
|
+
members: g ? lt(g.members, o, /* @__PURE__ */ new Set([g.label])) : void 0
|
|
678
678
|
});
|
|
679
679
|
continue;
|
|
680
680
|
}
|
|
681
681
|
u = [];
|
|
682
682
|
}
|
|
683
|
-
return { items:
|
|
683
|
+
return { items: d, signatures: e };
|
|
684
684
|
}
|
|
685
|
-
function
|
|
685
|
+
function we(n, s, o, e) {
|
|
686
686
|
if (!o || !e) return null;
|
|
687
687
|
const i = Math.max(0, s - 1), r = n.lastIndexOf(o, i);
|
|
688
688
|
if (r === -1 || n.lastIndexOf(e, i) > r) return null;
|
|
@@ -692,28 +692,28 @@ function ke(n, s, o, e) {
|
|
|
692
692
|
end: u === -1 ? n.length : u
|
|
693
693
|
};
|
|
694
694
|
}
|
|
695
|
-
function
|
|
696
|
-
return
|
|
695
|
+
function xn(n, s, o, e) {
|
|
696
|
+
return we(n, s, o, e) !== null;
|
|
697
697
|
}
|
|
698
|
-
const
|
|
699
|
-
function
|
|
698
|
+
const Ye = /[A-Za-z_$]/, Gt = /[\w$]/, Je = /\s/;
|
|
699
|
+
function ue(n, s) {
|
|
700
700
|
const o = [], e = n.length;
|
|
701
701
|
let i = 0;
|
|
702
702
|
for (; i < e; ) {
|
|
703
|
-
const r = n[i],
|
|
704
|
-
if (
|
|
703
|
+
const r = n[i], f = n[i + 1];
|
|
704
|
+
if (Je.test(r)) {
|
|
705
705
|
i++;
|
|
706
706
|
continue;
|
|
707
707
|
}
|
|
708
|
-
if (r === "/" &&
|
|
708
|
+
if (r === "/" && f === "/") {
|
|
709
709
|
let a = n.indexOf(`
|
|
710
710
|
`, i);
|
|
711
711
|
a === -1 && (a = e), o.push({ start: i, end: a, type: "comment" }), i = a;
|
|
712
712
|
continue;
|
|
713
713
|
}
|
|
714
|
-
if (r === "/" &&
|
|
715
|
-
const a = n.indexOf("*/", i + 2),
|
|
716
|
-
o.push({ start: i, end:
|
|
714
|
+
if (r === "/" && f === "*") {
|
|
715
|
+
const a = n.indexOf("*/", i + 2), d = a === -1 ? e : a + 2;
|
|
716
|
+
o.push({ start: i, end: d, type: "comment" }), i = d;
|
|
717
717
|
continue;
|
|
718
718
|
}
|
|
719
719
|
if (r === '"' || r === "'") {
|
|
@@ -750,93 +750,93 @@ function ce(n, s) {
|
|
|
750
750
|
o.push({ start: i, end: a, type: "template" }), i = a;
|
|
751
751
|
continue;
|
|
752
752
|
}
|
|
753
|
-
if (/[0-9]/.test(r) || r === "." && /[0-9]/.test(
|
|
753
|
+
if (/[0-9]/.test(r) || r === "." && /[0-9]/.test(f ?? "")) {
|
|
754
754
|
let a = i + 1;
|
|
755
755
|
for (; a < e && /[\w.]/.test(n[a]); ) a++;
|
|
756
756
|
o.push({ start: i, end: a, type: "number" }), i = a;
|
|
757
757
|
continue;
|
|
758
758
|
}
|
|
759
|
-
if (
|
|
759
|
+
if (Ye.test(r)) {
|
|
760
760
|
let a = i + 1;
|
|
761
|
-
for (; a < e &&
|
|
762
|
-
const
|
|
761
|
+
for (; a < e && Gt.test(n[a]); ) a++;
|
|
762
|
+
const d = n.slice(i, a), $ = s.keywords.has(d) ? "keyword" : s.builtins.has(d) ? "builtin" : "identifier";
|
|
763
763
|
o.push({ start: i, end: a, type: $ }), i = a;
|
|
764
764
|
continue;
|
|
765
765
|
}
|
|
766
766
|
let u = i + 1;
|
|
767
767
|
for (; u < e; ) {
|
|
768
768
|
const a = n[u];
|
|
769
|
-
if (
|
|
769
|
+
if (Je.test(a) || Ye.test(a) || /[0-9]/.test(a) || a === '"' || a === "'" || a === "`" || a === "/") break;
|
|
770
770
|
u++;
|
|
771
771
|
}
|
|
772
772
|
o.push({ start: i, end: u, type: "punctuation" }), i = u;
|
|
773
773
|
}
|
|
774
774
|
return o;
|
|
775
775
|
}
|
|
776
|
-
const
|
|
776
|
+
const Qt = {
|
|
777
777
|
"&": "&",
|
|
778
778
|
"<": "<",
|
|
779
779
|
">": ">"
|
|
780
780
|
};
|
|
781
|
-
function
|
|
782
|
-
return n.replace(/[&<>]/g, (s) =>
|
|
781
|
+
function G(n) {
|
|
782
|
+
return n.replace(/[&<>]/g, (s) => Qt[s] ?? s);
|
|
783
783
|
}
|
|
784
|
-
function
|
|
784
|
+
function de(n, s, o = 0) {
|
|
785
785
|
let e = "", i = 0;
|
|
786
786
|
for (const r of s) {
|
|
787
|
-
r.start > i && (e +=
|
|
788
|
-
const
|
|
789
|
-
e += `<span class="tok-${r.type}" data-start="${r.start + o}" data-end="${r.end + o}">${
|
|
787
|
+
r.start > i && (e += G(n.slice(i, r.start)));
|
|
788
|
+
const f = G(n.slice(r.start, r.end));
|
|
789
|
+
e += `<span class="tok-${r.type}" data-start="${r.start + o}" data-end="${r.end + o}">${f}</span>`, i = r.end;
|
|
790
790
|
}
|
|
791
|
-
return i < n.length && (e +=
|
|
791
|
+
return i < n.length && (e += G(n.slice(i))), e;
|
|
792
792
|
}
|
|
793
|
-
function
|
|
794
|
-
if (!o || !e) return
|
|
793
|
+
function en(n, s, o, e) {
|
|
794
|
+
if (!o || !e) return de(n, ue(n, s));
|
|
795
795
|
let i = "", r = 0;
|
|
796
796
|
for (; r < n.length; ) {
|
|
797
|
-
const
|
|
798
|
-
if (
|
|
799
|
-
i +=
|
|
797
|
+
const f = n.indexOf(o, r);
|
|
798
|
+
if (f === -1) {
|
|
799
|
+
i += G(n.slice(r));
|
|
800
800
|
break;
|
|
801
801
|
}
|
|
802
|
-
i +=
|
|
803
|
-
const u = n.indexOf(e,
|
|
804
|
-
i += `<span class="tok-brace">${
|
|
802
|
+
i += G(n.slice(r, f));
|
|
803
|
+
const u = n.indexOf(e, f + o.length), a = u === -1 ? n.length : u, d = n.slice(f + o.length, a);
|
|
804
|
+
i += `<span class="tok-brace">${G(o)}</span>`, i += de(d, ue(d, s), f + o.length), u === -1 ? r = a : (i += `<span class="tok-brace">${G(e)}</span>`, r = u + e.length);
|
|
805
805
|
}
|
|
806
806
|
return i;
|
|
807
807
|
}
|
|
808
|
-
const
|
|
808
|
+
const tn = {
|
|
809
809
|
key: 0,
|
|
810
810
|
class: "gutter",
|
|
811
811
|
"aria-hidden": "true"
|
|
812
|
-
},
|
|
812
|
+
}, nn = ["innerHTML"], ln = ["value", "readonly", "placeholder"], on = ["onMouseenter", "onClick"], an = { class: "popup-label" }, sn = {
|
|
813
813
|
key: 0,
|
|
814
814
|
class: "popup-detail"
|
|
815
|
-
},
|
|
815
|
+
}, rn = { class: "hover-head" }, cn = { class: "hover-name" }, un = {
|
|
816
816
|
key: 0,
|
|
817
817
|
class: "hover-colon"
|
|
818
|
-
},
|
|
818
|
+
}, dn = {
|
|
819
819
|
key: 0,
|
|
820
820
|
class: "hover-type"
|
|
821
|
-
},
|
|
821
|
+
}, fn = {
|
|
822
822
|
key: 0,
|
|
823
823
|
class: "hover-doc"
|
|
824
|
-
},
|
|
824
|
+
}, pn = {
|
|
825
825
|
key: 1,
|
|
826
826
|
class: "hover-def"
|
|
827
|
-
},
|
|
827
|
+
}, mn = ["innerHTML"], hn = ["title", "aria-label"], gn = {
|
|
828
828
|
key: 0,
|
|
829
829
|
viewBox: "0 0 16 16",
|
|
830
830
|
width: "14",
|
|
831
831
|
height: "14",
|
|
832
832
|
"aria-hidden": "true"
|
|
833
|
-
},
|
|
833
|
+
}, bn = {
|
|
834
834
|
key: 1,
|
|
835
835
|
viewBox: "0 0 16 16",
|
|
836
836
|
width: "14",
|
|
837
837
|
height: "14",
|
|
838
838
|
"aria-hidden": "true"
|
|
839
|
-
},
|
|
839
|
+
}, vn = /* @__PURE__ */ Et({
|
|
840
840
|
__name: "CodeEditor",
|
|
841
841
|
props: {
|
|
842
842
|
modelValue: {},
|
|
@@ -871,7 +871,7 @@ const en = {
|
|
|
871
871
|
class: "对象",
|
|
872
872
|
keyword: "关键字",
|
|
873
873
|
value: "值"
|
|
874
|
-
},
|
|
874
|
+
}, f = {
|
|
875
875
|
"(": ")",
|
|
876
876
|
"[": "]",
|
|
877
877
|
"{": "}",
|
|
@@ -886,74 +886,74 @@ const en = {
|
|
|
886
886
|
"End",
|
|
887
887
|
"PageUp",
|
|
888
888
|
"PageDown"
|
|
889
|
-
]), a = E(e.modelValue),
|
|
890
|
-
() => e.tsTypes ?
|
|
891
|
-
),
|
|
892
|
-
() => e.tsTypes ?
|
|
893
|
-
),
|
|
894
|
-
...
|
|
895
|
-
...
|
|
889
|
+
]), a = E(e.modelValue), d = E(), $ = E(), z = E(), C = E(), b = E(), y = E(), O = E(), B = E([]), R = E(0), w = E(!1), T = E({ start: 0, end: 0 }), _ = E({}), g = E(null), oe = E({}), ot = K(
|
|
890
|
+
() => e.tsTypes ? Yt(e.tsTypes) : []
|
|
891
|
+
), at = K(
|
|
892
|
+
() => e.tsTypes ? Jt(e.tsTypes) : /* @__PURE__ */ new Map()
|
|
893
|
+
), xe = K(() => [
|
|
894
|
+
...Lt,
|
|
895
|
+
...ot.value,
|
|
896
896
|
...e.completions
|
|
897
|
-
]),
|
|
898
|
-
() => e.mode === "template" ? [...e.templateCompletions, ...
|
|
899
|
-
),
|
|
897
|
+
]), fe = K(
|
|
898
|
+
() => e.mode === "template" ? [...e.templateCompletions, ...xe.value] : xe.value
|
|
899
|
+
), st = K(() => {
|
|
900
900
|
const t = {
|
|
901
|
-
keywords:
|
|
902
|
-
builtins: new Set(
|
|
901
|
+
keywords: je(e.language),
|
|
902
|
+
builtins: new Set(fe.value.map((l) => l.label))
|
|
903
903
|
};
|
|
904
|
-
return e.mode === "template" ? `${
|
|
905
|
-
` : `${
|
|
904
|
+
return e.mode === "template" ? `${en(a.value, t, e.templateOpen, e.templateClose)}
|
|
905
|
+
` : `${de(a.value, ue(a.value, t))}
|
|
906
906
|
`;
|
|
907
|
-
}),
|
|
908
|
-
`).length),
|
|
907
|
+
}), rt = K(() => a.value.split(`
|
|
908
|
+
`).length), P = E(e.defaultExpanded), pe = E(!1), me = K(() => e.collapsible && !P.value), ct = K(() => {
|
|
909
909
|
const t = {};
|
|
910
910
|
return e.collapsible && (t.height = e.collapsedHeight), t;
|
|
911
|
-
}),
|
|
911
|
+
}), ut = K(() => {
|
|
912
912
|
const t = {
|
|
913
913
|
"--ce-radius": e.borderRadius,
|
|
914
914
|
"--ce-collapsed-height": e.collapsedHeight
|
|
915
915
|
};
|
|
916
|
-
return e.background && (t["--ce-bg"] = e.background), e.borderColor && (t["--ce-border"] = e.borderColor), e.collapsible ? { ...t, height:
|
|
916
|
+
return e.background && (t["--ce-bg"] = e.background), e.borderColor && (t["--ce-border"] = e.borderColor), e.collapsible ? { ...t, height: P.value ? e.minHeight : e.collapsedHeight } : { ...t, height: e.minHeight };
|
|
917
917
|
});
|
|
918
|
-
let
|
|
919
|
-
function
|
|
920
|
-
if (
|
|
921
|
-
const l =
|
|
922
|
-
t && l && (
|
|
923
|
-
if (
|
|
918
|
+
let $e = 0;
|
|
919
|
+
function Te(t) {
|
|
920
|
+
if (P.value === t) return;
|
|
921
|
+
const l = d.value;
|
|
922
|
+
t && l && ($e = l.scrollTop), P.value = t, e.collapsible && (pe.value = !0), i(t ? "expand" : "collapse"), H(), F(), V(() => {
|
|
923
|
+
if (he(), !P.value && l) {
|
|
924
924
|
const c = Math.max(0, l.scrollHeight - l.clientHeight);
|
|
925
|
-
l.scrollTop = Math.max(0, Math.min(
|
|
925
|
+
l.scrollTop = Math.max(0, Math.min($e, c)), j(!0), document.activeElement === l && J();
|
|
926
926
|
return;
|
|
927
927
|
}
|
|
928
|
-
|
|
928
|
+
j(!0), t && e.collapseOnBlur && l && document.activeElement !== l && l.focus();
|
|
929
929
|
});
|
|
930
930
|
}
|
|
931
|
-
function ut() {
|
|
932
|
-
fe.value = !1;
|
|
933
|
-
}
|
|
934
931
|
function dt() {
|
|
935
|
-
|
|
932
|
+
pe.value = !1;
|
|
936
933
|
}
|
|
937
|
-
|
|
934
|
+
function ft() {
|
|
935
|
+
Te(!P.value);
|
|
936
|
+
}
|
|
937
|
+
Oe(
|
|
938
938
|
() => e.modelValue,
|
|
939
939
|
(t) => {
|
|
940
940
|
t !== a.value && (a.value = t, H());
|
|
941
941
|
}
|
|
942
|
-
),
|
|
943
|
-
V(() =>
|
|
942
|
+
), Oe(a, () => {
|
|
943
|
+
V(() => j(!0));
|
|
944
944
|
});
|
|
945
|
-
function
|
|
945
|
+
function Ce(t) {
|
|
946
946
|
return r[t];
|
|
947
947
|
}
|
|
948
|
-
function
|
|
949
|
-
return t ?
|
|
948
|
+
function pt(t) {
|
|
949
|
+
return t ? de(
|
|
950
950
|
t,
|
|
951
|
-
|
|
951
|
+
ue(t, { keywords: je("typescript"), builtins: /* @__PURE__ */ new Set() })
|
|
952
952
|
) : "";
|
|
953
953
|
}
|
|
954
954
|
let D = { top: 14, bottom: 14, left: 16, right: 16, lineHeight: 22 };
|
|
955
|
-
function
|
|
956
|
-
const t =
|
|
955
|
+
function he() {
|
|
956
|
+
const t = d.value;
|
|
957
957
|
if (!t) return;
|
|
958
958
|
const l = window.getComputedStyle(t);
|
|
959
959
|
D = {
|
|
@@ -964,34 +964,34 @@ const en = {
|
|
|
964
964
|
lineHeight: parseFloat(l.lineHeight) || 22
|
|
965
965
|
};
|
|
966
966
|
}
|
|
967
|
-
function
|
|
968
|
-
const l =
|
|
967
|
+
function j(t = !1) {
|
|
968
|
+
const l = d.value;
|
|
969
969
|
if (!l) return;
|
|
970
970
|
const c = C.value;
|
|
971
971
|
if (c && (c.style.transform = `translate(${-l.scrollLeft}px, ${-l.scrollTop}px)`), b.value && (b.value.style.transform = `translateY(${-l.scrollTop}px)`), t) {
|
|
972
972
|
const m = `${a.value}|${e.mode}|${l.clientWidth}|${l.clientHeight}`;
|
|
973
|
-
m !==
|
|
973
|
+
m !== Ee && (Ee = m, mt());
|
|
974
974
|
}
|
|
975
975
|
}
|
|
976
|
-
function
|
|
977
|
-
const t =
|
|
976
|
+
function J() {
|
|
977
|
+
const t = d.value;
|
|
978
978
|
if (!t) return;
|
|
979
|
-
const l =
|
|
979
|
+
const l = Re();
|
|
980
980
|
if (!l) return;
|
|
981
981
|
let c = t.scrollTop;
|
|
982
|
-
if (
|
|
983
|
-
const q = t.clientHeight - D.top - D.bottom, W = l.top + t.scrollTop - D.top - Math.max(0, (q - l.lineHeight) / 2),
|
|
984
|
-
c = Math.max(0, Math.min(W,
|
|
982
|
+
if (me.value) {
|
|
983
|
+
const q = t.clientHeight - D.top - D.bottom, W = l.top + t.scrollTop - D.top - Math.max(0, (q - l.lineHeight) / 2), re = Math.max(0, t.scrollHeight - t.clientHeight);
|
|
984
|
+
c = Math.max(0, Math.min(W, re));
|
|
985
985
|
}
|
|
986
986
|
const m = t.clientWidth - D.left - D.right, h = l.left + t.scrollLeft, p = t.scrollLeft + D.left, x = t.scrollLeft + D.left + m, k = 8;
|
|
987
987
|
let v = t.scrollLeft;
|
|
988
988
|
h < p + k ? v = Math.max(0, h - D.left - k) : h > x - k && (v = Math.max(0, h - D.left - m + k));
|
|
989
|
-
const S = Math.abs(c - t.scrollTop) > 0.5,
|
|
990
|
-
!S && !
|
|
989
|
+
const S = Math.abs(c - t.scrollTop) > 0.5, M = Math.abs(v - t.scrollLeft) > 0.5;
|
|
990
|
+
!S && !M || (S && (t.scrollTop = c), M && (t.scrollLeft = v), j());
|
|
991
991
|
}
|
|
992
|
-
let
|
|
993
|
-
function
|
|
994
|
-
const t =
|
|
992
|
+
let Se = [], Ee = "", ae = 0, ge = -1, be = -1, ve = { x: 0, y: 0 };
|
|
993
|
+
function mt() {
|
|
994
|
+
const t = d.value, l = z.value;
|
|
995
995
|
if (!t || !l) return;
|
|
996
996
|
const c = t.getBoundingClientRect(), m = [];
|
|
997
997
|
l.querySelectorAll("[data-start]").forEach((h) => {
|
|
@@ -1004,32 +1004,32 @@ const en = {
|
|
|
1004
1004
|
top: p.top - c.top + t.scrollTop,
|
|
1005
1005
|
bottom: p.bottom - c.top + t.scrollTop
|
|
1006
1006
|
});
|
|
1007
|
-
}),
|
|
1007
|
+
}), Se = m;
|
|
1008
1008
|
}
|
|
1009
|
-
function
|
|
1010
|
-
for (const c of
|
|
1009
|
+
function ht(t, l) {
|
|
1010
|
+
for (const c of Se)
|
|
1011
1011
|
if (t >= c.left - 1 && t <= c.right + 1 && l >= c.top && l <= c.bottom)
|
|
1012
1012
|
return c;
|
|
1013
1013
|
return null;
|
|
1014
1014
|
}
|
|
1015
|
-
function
|
|
1016
|
-
g.value = null,
|
|
1015
|
+
function F() {
|
|
1016
|
+
g.value = null, ae = 0, ge = -1, be = -1;
|
|
1017
1017
|
}
|
|
1018
|
-
function
|
|
1019
|
-
const l = O.value, c =
|
|
1018
|
+
function gt(t) {
|
|
1019
|
+
const l = O.value, c = d.value;
|
|
1020
1020
|
if (!l || !c) return;
|
|
1021
|
-
const m = c.getBoundingClientRect(), h = m.left + t.left - c.scrollLeft, p = m.left + t.right - c.scrollLeft, x = m.top + t.top - c.scrollTop, k = m.top + t.bottom - c.scrollTop, v = 12, S = 8,
|
|
1021
|
+
const m = c.getBoundingClientRect(), h = m.left + t.left - c.scrollLeft, p = m.left + t.right - c.scrollLeft, x = m.top + t.top - c.scrollTop, k = m.top + t.bottom - c.scrollTop, v = 12, S = 8, M = l.offsetWidth, q = l.offsetHeight;
|
|
1022
1022
|
let N = h, W = k + S;
|
|
1023
|
-
N +
|
|
1023
|
+
N + M > window.innerWidth - v && (N = p - M), W + q > window.innerHeight - v && (W = x - q - S), N = Math.max(v, Math.min(N, window.innerWidth - v - M)), W = Math.max(v, W), oe.value = { left: `${N}px`, top: `${W}px` };
|
|
1024
1024
|
}
|
|
1025
|
-
function
|
|
1026
|
-
const c =
|
|
1025
|
+
function bt(t, l) {
|
|
1026
|
+
const c = d.value;
|
|
1027
1027
|
if (!c || e.readonly || !e.hover || w.value) {
|
|
1028
|
-
|
|
1028
|
+
F();
|
|
1029
1029
|
return;
|
|
1030
1030
|
}
|
|
1031
1031
|
if (c.selectionStart !== c.selectionEnd) {
|
|
1032
|
-
|
|
1032
|
+
F();
|
|
1033
1033
|
return;
|
|
1034
1034
|
}
|
|
1035
1035
|
const m = O.value;
|
|
@@ -1038,30 +1038,30 @@ const en = {
|
|
|
1038
1038
|
if (t >= k.left && t <= k.right && l >= k.top && l <= k.bottom)
|
|
1039
1039
|
return;
|
|
1040
1040
|
}
|
|
1041
|
-
const h = c.getBoundingClientRect(), p =
|
|
1041
|
+
const h = c.getBoundingClientRect(), p = ht(t - h.left + c.scrollLeft, l - h.top + c.scrollTop);
|
|
1042
1042
|
if (!p) {
|
|
1043
|
-
|
|
1043
|
+
F();
|
|
1044
1044
|
return;
|
|
1045
1045
|
}
|
|
1046
|
-
if (g.value &&
|
|
1046
|
+
if (g.value && ge === p.start && be === p.end)
|
|
1047
1047
|
return;
|
|
1048
|
-
const x =
|
|
1049
|
-
completions:
|
|
1050
|
-
declared:
|
|
1048
|
+
const x = jt(c.value, p.start, p.end, {
|
|
1049
|
+
completions: fe.value,
|
|
1050
|
+
declared: Pe(c.value, p.start)
|
|
1051
1051
|
});
|
|
1052
1052
|
if (!x) {
|
|
1053
|
-
|
|
1053
|
+
F();
|
|
1054
1054
|
return;
|
|
1055
1055
|
}
|
|
1056
|
-
g.value = x,
|
|
1056
|
+
g.value = x, ge = p.start, be = p.end, V(() => gt(p));
|
|
1057
1057
|
}
|
|
1058
|
-
function
|
|
1059
|
-
|
|
1060
|
-
|
|
1058
|
+
function vt(t) {
|
|
1059
|
+
ve = { x: t.clientX, y: t.clientY }, !ae && (ae = requestAnimationFrame(() => {
|
|
1060
|
+
ae = 0, bt(ve.x, ve.y);
|
|
1061
1061
|
}));
|
|
1062
1062
|
}
|
|
1063
|
-
function
|
|
1064
|
-
const t =
|
|
1063
|
+
function Re() {
|
|
1064
|
+
const t = d.value;
|
|
1065
1065
|
if (!t) return null;
|
|
1066
1066
|
const l = window.getComputedStyle(t), c = document.createElement("div"), m = parseFloat(l.paddingLeft) || 0, h = parseFloat(l.paddingRight) || 0, p = t.getBoundingClientRect();
|
|
1067
1067
|
Object.assign(c.style, {
|
|
@@ -1095,31 +1095,31 @@ const en = {
|
|
|
1095
1095
|
x.textContent = "", c.appendChild(x), document.body.appendChild(c);
|
|
1096
1096
|
const k = x.getBoundingClientRect();
|
|
1097
1097
|
document.body.removeChild(c);
|
|
1098
|
-
const v = parseFloat(l.lineHeight) || 22, S = k.height,
|
|
1098
|
+
const v = parseFloat(l.lineHeight) || 22, S = k.height, M = S > 0 && S < v ? (v - S) / 2 : 0;
|
|
1099
1099
|
return {
|
|
1100
1100
|
left: k.left - p.left - t.scrollLeft,
|
|
1101
|
-
top: k.top - p.top - t.scrollTop -
|
|
1101
|
+
top: k.top - p.top - t.scrollTop - M,
|
|
1102
1102
|
lineHeight: v
|
|
1103
1103
|
};
|
|
1104
1104
|
}
|
|
1105
1105
|
async function Me() {
|
|
1106
1106
|
await V();
|
|
1107
|
-
const t = $.value, l = y.value, c =
|
|
1107
|
+
const t = $.value, l = y.value, c = Re();
|
|
1108
1108
|
if (!t || !l || !c) return;
|
|
1109
|
-
const m = 4, h = 8, p = window.innerWidth, x = window.innerHeight, k = t.getBoundingClientRect(), v = l.scrollHeight, S = x - (k.top + c.top + c.lineHeight) - m - h,
|
|
1110
|
-
let
|
|
1111
|
-
k.left +
|
|
1112
|
-
left: `${
|
|
1109
|
+
const m = 4, h = 8, p = window.innerWidth, x = window.innerHeight, k = t.getBoundingClientRect(), v = l.scrollHeight, S = x - (k.top + c.top + c.lineHeight) - m - h, M = k.top + c.top - m - h, q = S >= Math.min(v, 180) || S >= M, N = Math.min(248, Math.max(q ? S : M, 96)), W = Math.min(v, N), re = l.offsetWidth || 280;
|
|
1110
|
+
let te = c.left;
|
|
1111
|
+
k.left + te + re > p - h && (te = p - h - re - k.left), te = Math.max(te, h - k.left), _.value = {
|
|
1112
|
+
left: `${te}px`,
|
|
1113
1113
|
top: `${q ? c.top + c.lineHeight + m : c.top - m - W}px`,
|
|
1114
1114
|
maxHeight: `${N}px`
|
|
1115
1115
|
};
|
|
1116
1116
|
}
|
|
1117
1117
|
function H() {
|
|
1118
|
-
w.value = !1, B.value = [],
|
|
1118
|
+
w.value = !1, B.value = [], R.value = 0, F();
|
|
1119
1119
|
}
|
|
1120
|
-
function
|
|
1120
|
+
function ee(t = !1) {
|
|
1121
1121
|
var k;
|
|
1122
|
-
const l =
|
|
1122
|
+
const l = d.value;
|
|
1123
1123
|
if (!l || e.readonly) return;
|
|
1124
1124
|
if (l.selectionStart !== l.selectionEnd) {
|
|
1125
1125
|
H();
|
|
@@ -1127,24 +1127,24 @@ const en = {
|
|
|
1127
1127
|
}
|
|
1128
1128
|
const c = l.selectionStart;
|
|
1129
1129
|
let m = !t;
|
|
1130
|
-
const h =
|
|
1130
|
+
const h = Ht(l.value, c);
|
|
1131
1131
|
if (h) {
|
|
1132
|
-
const v = (k =
|
|
1132
|
+
const v = (k = at.value.get(h.functionName)) == null ? void 0 : k.params[h.paramIndex], S = (v == null ? void 0 : v.literals) ?? [];
|
|
1133
1133
|
if (S.length) {
|
|
1134
|
-
const
|
|
1135
|
-
label: `${
|
|
1134
|
+
const M = h.quote ?? "'", q = S.map((W) => ({
|
|
1135
|
+
label: `${M}${W}${M}`,
|
|
1136
1136
|
kind: "value",
|
|
1137
1137
|
detail: v == null ? void 0 : v.type,
|
|
1138
|
-
insertText: `${
|
|
1139
|
-
})), N =
|
|
1138
|
+
insertText: `${M}${W}${M}`
|
|
1139
|
+
})), N = et(q, h.prefix);
|
|
1140
1140
|
if (N.length) {
|
|
1141
|
-
B.value = N, T.value = { start: h.replaceStart, end: c },
|
|
1141
|
+
B.value = N, T.value = { start: h.replaceStart, end: c }, R.value = 0, w.value = !0, Me();
|
|
1142
1142
|
return;
|
|
1143
1143
|
}
|
|
1144
1144
|
}
|
|
1145
1145
|
}
|
|
1146
1146
|
if (e.mode === "template") {
|
|
1147
|
-
const v =
|
|
1147
|
+
const v = we(
|
|
1148
1148
|
l.value,
|
|
1149
1149
|
c,
|
|
1150
1150
|
e.templateOpen,
|
|
@@ -1156,10 +1156,10 @@ const en = {
|
|
|
1156
1156
|
}
|
|
1157
1157
|
t && l.value.slice(v.start, c).trim() === "" && (m = !0);
|
|
1158
1158
|
}
|
|
1159
|
-
const p =
|
|
1159
|
+
const p = zt(l.value, c, {
|
|
1160
1160
|
language: e.language,
|
|
1161
|
-
completions:
|
|
1162
|
-
declared:
|
|
1161
|
+
completions: fe.value,
|
|
1162
|
+
declared: Pe(l.value, c),
|
|
1163
1163
|
auto: !m
|
|
1164
1164
|
});
|
|
1165
1165
|
if (!p) {
|
|
@@ -1168,7 +1168,7 @@ const en = {
|
|
|
1168
1168
|
}
|
|
1169
1169
|
let x = p.items;
|
|
1170
1170
|
if (e.completionFilter) {
|
|
1171
|
-
const v =
|
|
1171
|
+
const v = Ge(l.value, c);
|
|
1172
1172
|
if (x = e.completionFilter(x, {
|
|
1173
1173
|
prefix: v.prefix,
|
|
1174
1174
|
chain: v.chain,
|
|
@@ -1181,45 +1181,45 @@ const en = {
|
|
|
1181
1181
|
return;
|
|
1182
1182
|
}
|
|
1183
1183
|
}
|
|
1184
|
-
B.value = x, T.value = { start: p.start, end: p.end },
|
|
1184
|
+
B.value = x, T.value = { start: p.start, end: p.end }, R.value = 0, w.value = !0, Me();
|
|
1185
1185
|
}
|
|
1186
|
-
function
|
|
1186
|
+
function yt(t) {
|
|
1187
1187
|
a.value = t, i("update:modelValue", t), i("change", t);
|
|
1188
1188
|
}
|
|
1189
|
-
function
|
|
1190
|
-
const h =
|
|
1189
|
+
function se(t, l, c, m = t + c.length) {
|
|
1190
|
+
const h = d.value;
|
|
1191
1191
|
if (!h) return;
|
|
1192
1192
|
const p = h.value.slice(0, t) + c + h.value.slice(l);
|
|
1193
|
-
|
|
1194
|
-
h.value = p, h.setSelectionRange(m, m), h.focus(),
|
|
1193
|
+
yt(p), H(), V(() => {
|
|
1194
|
+
h.value = p, h.setSelectionRange(m, m), h.focus(), j(!0), J();
|
|
1195
1195
|
});
|
|
1196
1196
|
}
|
|
1197
|
-
function
|
|
1197
|
+
function Ie(t = B.value[R.value]) {
|
|
1198
1198
|
if (!t) return;
|
|
1199
1199
|
const l = t.insertText ?? t.label;
|
|
1200
|
-
|
|
1200
|
+
se(T.value.start, T.value.end, l), H();
|
|
1201
1201
|
}
|
|
1202
|
-
function
|
|
1202
|
+
function Le(t) {
|
|
1203
1203
|
const l = B.value.length;
|
|
1204
|
-
l && (
|
|
1204
|
+
l && (R.value = (R.value + t + l) % l, V(() => {
|
|
1205
1205
|
var c, m;
|
|
1206
1206
|
(m = (c = y.value) == null ? void 0 : c.querySelector(".is-active")) == null || m.scrollIntoView({ block: "nearest" });
|
|
1207
1207
|
}));
|
|
1208
1208
|
}
|
|
1209
|
-
function
|
|
1209
|
+
function kt(t) {
|
|
1210
1210
|
const l = t.target;
|
|
1211
|
-
a.value = l.value, i("update:modelValue", l.value), i("change", l.value), j(),
|
|
1211
|
+
a.value = l.value, i("update:modelValue", l.value), i("change", l.value), F(), j(), J(), V(J), ee(!0);
|
|
1212
1212
|
}
|
|
1213
|
-
function
|
|
1214
|
-
if (H(),
|
|
1213
|
+
function wt(t) {
|
|
1214
|
+
if (H(), F(), !e.collapsible || !e.collapseOnBlur || !P.value) return;
|
|
1215
1215
|
const l = t.relatedTarget;
|
|
1216
|
-
l && l.closest(".expand-toggle") ||
|
|
1216
|
+
l && l.closest(".expand-toggle") || Te(!1);
|
|
1217
1217
|
}
|
|
1218
|
-
function
|
|
1219
|
-
|
|
1218
|
+
function xt() {
|
|
1219
|
+
_e(), J();
|
|
1220
1220
|
}
|
|
1221
|
-
function
|
|
1222
|
-
const t =
|
|
1221
|
+
function _e() {
|
|
1222
|
+
const t = d.value;
|
|
1223
1223
|
if (!t || e.readonly) return;
|
|
1224
1224
|
if (t.selectionStart !== t.selectionEnd) {
|
|
1225
1225
|
H();
|
|
@@ -1227,67 +1227,67 @@ const en = {
|
|
|
1227
1227
|
}
|
|
1228
1228
|
const l = t.selectionStart;
|
|
1229
1229
|
if (l > 0 && t.value[l - 1] === ".") {
|
|
1230
|
-
|
|
1230
|
+
ee(!0);
|
|
1231
1231
|
return;
|
|
1232
1232
|
}
|
|
1233
1233
|
if (e.mode === "template") {
|
|
1234
|
-
const c =
|
|
1234
|
+
const c = we(
|
|
1235
1235
|
t.value,
|
|
1236
1236
|
l,
|
|
1237
1237
|
e.templateOpen,
|
|
1238
1238
|
e.templateClose
|
|
1239
1239
|
);
|
|
1240
1240
|
if (c && t.value.slice(c.start, l).trim() === "") {
|
|
1241
|
-
|
|
1241
|
+
ee(!0);
|
|
1242
1242
|
return;
|
|
1243
1243
|
}
|
|
1244
1244
|
}
|
|
1245
1245
|
H();
|
|
1246
1246
|
}
|
|
1247
|
-
let
|
|
1248
|
-
function
|
|
1249
|
-
window.clearTimeout(
|
|
1250
|
-
|
|
1247
|
+
let ye = 0;
|
|
1248
|
+
function He() {
|
|
1249
|
+
window.clearTimeout(ye), ye = window.setTimeout(() => {
|
|
1250
|
+
ye = 0, _e(), J();
|
|
1251
1251
|
}, 0);
|
|
1252
1252
|
}
|
|
1253
|
-
function
|
|
1254
|
-
t.target !==
|
|
1255
|
-
}
|
|
1256
|
-
function xt() {
|
|
1257
|
-
j(), P(), pe.value && $t();
|
|
1253
|
+
function Ae(t) {
|
|
1254
|
+
t.target !== d.value && w.value && H();
|
|
1258
1255
|
}
|
|
1259
|
-
let ye = 0;
|
|
1260
1256
|
function $t() {
|
|
1261
|
-
|
|
1262
|
-
ye = 0, Tt();
|
|
1263
|
-
}, 120);
|
|
1257
|
+
F(), j(), me.value && Tt();
|
|
1264
1258
|
}
|
|
1259
|
+
let ke = 0;
|
|
1265
1260
|
function Tt() {
|
|
1266
|
-
|
|
1261
|
+
window.clearTimeout(ke), ke = window.setTimeout(() => {
|
|
1262
|
+
ke = 0, Ct();
|
|
1263
|
+
}, 120);
|
|
1264
|
+
}
|
|
1265
|
+
function Ct() {
|
|
1266
|
+
const t = d.value;
|
|
1267
1267
|
if (!t) return;
|
|
1268
1268
|
const l = D.lineHeight, c = t.scrollTop, m = Math.round(c / l) * l;
|
|
1269
|
-
Math.abs(m - c) < 0.5 || (t.scrollTop = m,
|
|
1269
|
+
Math.abs(m - c) < 0.5 || (t.scrollTop = m, j());
|
|
1270
1270
|
}
|
|
1271
|
-
function
|
|
1271
|
+
function St(t) {
|
|
1272
1272
|
var h;
|
|
1273
|
-
const l =
|
|
1273
|
+
const l = d.value;
|
|
1274
1274
|
if (!l) return;
|
|
1275
1275
|
const c = t.metaKey || t.ctrlKey, m = u.has(t.key);
|
|
1276
1276
|
if (t.key === " " && c) {
|
|
1277
|
-
t.preventDefault(),
|
|
1277
|
+
t.preventDefault(), ee(!1);
|
|
1278
1278
|
return;
|
|
1279
1279
|
}
|
|
1280
1280
|
if (w.value) {
|
|
1281
1281
|
if (t.key === "ArrowDown") {
|
|
1282
|
-
t.preventDefault(),
|
|
1282
|
+
t.preventDefault(), Le(1);
|
|
1283
1283
|
return;
|
|
1284
1284
|
}
|
|
1285
1285
|
if (t.key === "ArrowUp") {
|
|
1286
|
-
t.preventDefault(),
|
|
1286
|
+
t.preventDefault(), Le(-1);
|
|
1287
1287
|
return;
|
|
1288
1288
|
}
|
|
1289
1289
|
if (t.key === "Enter" || t.key === "Tab") {
|
|
1290
|
-
t.preventDefault(),
|
|
1290
|
+
t.preventDefault(), Ie();
|
|
1291
1291
|
return;
|
|
1292
1292
|
}
|
|
1293
1293
|
if (t.key === "Escape") {
|
|
@@ -1295,12 +1295,12 @@ const en = {
|
|
|
1295
1295
|
return;
|
|
1296
1296
|
}
|
|
1297
1297
|
if (m || c) {
|
|
1298
|
-
H(), m && !c &&
|
|
1298
|
+
H(), m && !c && He();
|
|
1299
1299
|
return;
|
|
1300
1300
|
}
|
|
1301
1301
|
}
|
|
1302
1302
|
if (m && !c) {
|
|
1303
|
-
|
|
1303
|
+
He();
|
|
1304
1304
|
return;
|
|
1305
1305
|
}
|
|
1306
1306
|
if (t.key === "Enter" && !c && !t.shiftKey) {
|
|
@@ -1308,56 +1308,59 @@ const en = {
|
|
|
1308
1308
|
if (p !== l.selectionEnd) return;
|
|
1309
1309
|
const x = l.value.lastIndexOf(`
|
|
1310
1310
|
`, p - 1) + 1, k = l.value.slice(x, p), v = ((h = k.match(/^[ \t]*/)) == null ? void 0 : h[0]) ?? "", S = /[{[(]$/.test(k.trimEnd()) ? " " : "";
|
|
1311
|
-
t.preventDefault(),
|
|
1311
|
+
t.preventDefault(), se(p, p, `
|
|
1312
1312
|
${v}${S}`);
|
|
1313
1313
|
return;
|
|
1314
1314
|
}
|
|
1315
1315
|
if (t.key === "Tab") {
|
|
1316
|
-
t.preventDefault(),
|
|
1316
|
+
t.preventDefault(), se(l.selectionStart, l.selectionEnd, " ");
|
|
1317
1317
|
return;
|
|
1318
1318
|
}
|
|
1319
|
-
if (t.key.length === 1 && !c && !t.altKey &&
|
|
1319
|
+
if (t.key.length === 1 && !c && !t.altKey && f[t.key]) {
|
|
1320
1320
|
if (l.selectionStart !== l.selectionEnd) return;
|
|
1321
1321
|
const p = l.selectionStart, x = l.value[p - 1], k = l.value[p];
|
|
1322
1322
|
if ((t.key === '"' || t.key === "'") && x && /[\w$]/.test(x) || k !== void 0 && !/[\s)\]},;:]/.test(k)) return;
|
|
1323
|
-
t.preventDefault(),
|
|
1323
|
+
t.preventDefault(), se(p, p, t.key + f[t.key], p + 1), e.mode === "template" && V(() => ee(!0));
|
|
1324
1324
|
}
|
|
1325
1325
|
}
|
|
1326
|
-
function
|
|
1327
|
-
w.value && H(),
|
|
1328
|
-
|
|
1326
|
+
function Be() {
|
|
1327
|
+
w.value && H(), F(), V(() => {
|
|
1328
|
+
he(), j(!0);
|
|
1329
1329
|
});
|
|
1330
1330
|
}
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1331
|
+
let Q = null;
|
|
1332
|
+
return Rt(() => {
|
|
1333
|
+
window.addEventListener("resize", Be), window.addEventListener("scroll", Ae, !0), V(() => {
|
|
1334
|
+
he(), j(!0);
|
|
1335
|
+
}), typeof ResizeObserver < "u" && d.value && (Q = new ResizeObserver(() => {
|
|
1336
|
+
j(!0), J();
|
|
1337
|
+
}), Q.observe(d.value));
|
|
1335
1338
|
}), Mt(() => {
|
|
1336
|
-
window.removeEventListener("resize",
|
|
1339
|
+
window.removeEventListener("resize", Be), window.removeEventListener("scroll", Ae, !0), Q == null || Q.disconnect(), Q = null;
|
|
1337
1340
|
}), s({ focus: () => {
|
|
1338
1341
|
var t;
|
|
1339
|
-
return (t =
|
|
1342
|
+
return (t = d.value) == null ? void 0 : t.focus();
|
|
1340
1343
|
} }), (t, l) => (I(), L("div", {
|
|
1341
|
-
class:
|
|
1342
|
-
style:
|
|
1344
|
+
class: ne(["code-input", { "is-collapsible": n.collapsible }]),
|
|
1345
|
+
style: ce(ct.value)
|
|
1343
1346
|
}, [
|
|
1344
1347
|
A("div", {
|
|
1345
|
-
class:
|
|
1348
|
+
class: ne(["code-editor", {
|
|
1346
1349
|
"is-readonly": n.readonly,
|
|
1347
1350
|
"is-dark": n.theme === "dark",
|
|
1348
|
-
"is-collapsed":
|
|
1349
|
-
"is-expanding":
|
|
1351
|
+
"is-collapsed": me.value,
|
|
1352
|
+
"is-expanding": pe.value
|
|
1350
1353
|
}]),
|
|
1351
|
-
style:
|
|
1352
|
-
onAnimationend:
|
|
1354
|
+
style: ce(ut.value),
|
|
1355
|
+
onAnimationend: Ne(dt, ["self"])
|
|
1353
1356
|
}, [
|
|
1354
|
-
n.lineNumbers ? (I(), L("div",
|
|
1357
|
+
n.lineNumbers ? (I(), L("div", tn, [
|
|
1355
1358
|
A("div", {
|
|
1356
1359
|
ref_key: "gutterInner",
|
|
1357
1360
|
ref: b,
|
|
1358
1361
|
class: "gutter-inner code-font"
|
|
1359
1362
|
}, [
|
|
1360
|
-
(I(!0), L(
|
|
1363
|
+
(I(!0), L(We, null, ze(rt.value, (c) => (I(), L("div", {
|
|
1361
1364
|
key: c,
|
|
1362
1365
|
class: "gutter-line"
|
|
1363
1366
|
}, Y(c), 1))), 128))
|
|
@@ -1378,12 +1381,12 @@ ${v}${S}`);
|
|
|
1378
1381
|
ref: C,
|
|
1379
1382
|
class: "code-font"
|
|
1380
1383
|
}, [
|
|
1381
|
-
A("code", { innerHTML:
|
|
1384
|
+
A("code", { innerHTML: st.value }, null, 8, nn)
|
|
1382
1385
|
], 512)
|
|
1383
1386
|
], 512),
|
|
1384
1387
|
A("textarea", {
|
|
1385
1388
|
ref_key: "textarea",
|
|
1386
|
-
ref:
|
|
1389
|
+
ref: d,
|
|
1387
1390
|
class: "code-font input",
|
|
1388
1391
|
value: a.value,
|
|
1389
1392
|
readonly: n.readonly,
|
|
@@ -1393,58 +1396,58 @@ ${v}${S}`);
|
|
|
1393
1396
|
autocapitalize: "off",
|
|
1394
1397
|
autocorrect: "off",
|
|
1395
1398
|
wrap: "off",
|
|
1396
|
-
onInput:
|
|
1397
|
-
onKeydown:
|
|
1398
|
-
onScroll:
|
|
1399
|
-
onClick:
|
|
1400
|
-
onMousemove:
|
|
1401
|
-
onMouseleave:
|
|
1402
|
-
onBlur:
|
|
1403
|
-
}, null, 40,
|
|
1399
|
+
onInput: kt,
|
|
1400
|
+
onKeydown: St,
|
|
1401
|
+
onScroll: $t,
|
|
1402
|
+
onClick: xt,
|
|
1403
|
+
onMousemove: vt,
|
|
1404
|
+
onMouseleave: F,
|
|
1405
|
+
onBlur: wt
|
|
1406
|
+
}, null, 40, ln),
|
|
1404
1407
|
w.value ? (I(), L("ul", {
|
|
1405
1408
|
key: 0,
|
|
1406
1409
|
ref_key: "popup",
|
|
1407
1410
|
ref: y,
|
|
1408
1411
|
class: "popup",
|
|
1409
|
-
style:
|
|
1410
|
-
onMousedown: l[0] || (l[0] =
|
|
1412
|
+
style: ce(_.value),
|
|
1413
|
+
onMousedown: l[0] || (l[0] = Ne(() => {
|
|
1411
1414
|
}, ["prevent"]))
|
|
1412
1415
|
}, [
|
|
1413
|
-
(I(!0), L(
|
|
1416
|
+
(I(!0), L(We, null, ze(B.value, (c, m) => (I(), L("li", {
|
|
1414
1417
|
key: `${c.label}-${m}`,
|
|
1415
|
-
class:
|
|
1416
|
-
onMouseenter: (h) =>
|
|
1417
|
-
onClick: (h) =>
|
|
1418
|
+
class: ne(["popup-item", { "is-active": m === R.value }]),
|
|
1419
|
+
onMouseenter: (h) => R.value = m,
|
|
1420
|
+
onClick: (h) => Ie(c)
|
|
1418
1421
|
}, [
|
|
1419
1422
|
A("span", {
|
|
1420
|
-
class:
|
|
1421
|
-
}, Y(
|
|
1422
|
-
A("span",
|
|
1423
|
-
c.detail ? (I(), L("span",
|
|
1424
|
-
], 42,
|
|
1423
|
+
class: ne(["badge", `badge-${c.kind}`])
|
|
1424
|
+
}, Y(Ce(c.kind)), 3),
|
|
1425
|
+
A("span", an, Y(c.label), 1),
|
|
1426
|
+
c.detail ? (I(), L("span", sn, Y(c.detail), 1)) : Z("", !0)
|
|
1427
|
+
], 42, on))), 128))
|
|
1425
1428
|
], 36)) : Z("", !0),
|
|
1426
1429
|
g.value ? (I(), L("div", {
|
|
1427
1430
|
key: 1,
|
|
1428
1431
|
ref_key: "hoverCard",
|
|
1429
1432
|
ref: O,
|
|
1430
1433
|
class: "hover-card",
|
|
1431
|
-
style:
|
|
1434
|
+
style: ce(oe.value)
|
|
1432
1435
|
}, [
|
|
1433
|
-
A("div",
|
|
1436
|
+
A("div", rn, [
|
|
1434
1437
|
A("span", {
|
|
1435
|
-
class:
|
|
1436
|
-
}, Y(
|
|
1437
|
-
A("span",
|
|
1438
|
-
|
|
1439
|
-
g.value.detail ? (I(), L("span",
|
|
1438
|
+
class: ne(["badge", `badge-${g.value.kind}`])
|
|
1439
|
+
}, Y(Ce(g.value.kind)), 3),
|
|
1440
|
+
A("span", cn, [
|
|
1441
|
+
It(Y(g.value.label), 1),
|
|
1442
|
+
g.value.detail ? (I(), L("span", un, ":")) : Z("", !0)
|
|
1440
1443
|
]),
|
|
1441
|
-
g.value.detail ? (I(), L("span",
|
|
1444
|
+
g.value.detail ? (I(), L("span", dn, Y(g.value.detail), 1)) : Z("", !0)
|
|
1442
1445
|
]),
|
|
1443
|
-
g.value.documentation ? (I(), L("p",
|
|
1444
|
-
g.value.type ? (I(), L("pre",
|
|
1446
|
+
g.value.documentation ? (I(), L("p", fn, Y(g.value.documentation), 1)) : Z("", !0),
|
|
1447
|
+
g.value.type ? (I(), L("pre", pn, [
|
|
1445
1448
|
A("code", {
|
|
1446
|
-
innerHTML:
|
|
1447
|
-
}, null, 8,
|
|
1449
|
+
innerHTML: pt(g.value.type)
|
|
1450
|
+
}, null, 8, mn)
|
|
1448
1451
|
])) : Z("", !0)
|
|
1449
1452
|
], 4)) : Z("", !0)
|
|
1450
1453
|
], 512),
|
|
@@ -1452,11 +1455,11 @@ ${v}${S}`);
|
|
|
1452
1455
|
key: 1,
|
|
1453
1456
|
type: "button",
|
|
1454
1457
|
class: "expand-toggle",
|
|
1455
|
-
title:
|
|
1456
|
-
"aria-label":
|
|
1457
|
-
onClick:
|
|
1458
|
+
title: P.value ? "收起" : "展开",
|
|
1459
|
+
"aria-label": P.value ? "收起编辑器" : "展开编辑器",
|
|
1460
|
+
onClick: ft
|
|
1458
1461
|
}, [
|
|
1459
|
-
|
|
1462
|
+
P.value ? (I(), L("svg", bn, [...l[2] || (l[2] = [
|
|
1460
1463
|
A("path", {
|
|
1461
1464
|
d: "M11 2 5 8 11 14",
|
|
1462
1465
|
fill: "none",
|
|
@@ -1465,7 +1468,7 @@ ${v}${S}`);
|
|
|
1465
1468
|
"stroke-linecap": "round",
|
|
1466
1469
|
"stroke-linejoin": "round"
|
|
1467
1470
|
}, null, -1)
|
|
1468
|
-
])])) : (I(), L("svg",
|
|
1471
|
+
])])) : (I(), L("svg", gn, [...l[1] || (l[1] = [
|
|
1469
1472
|
A("path", {
|
|
1470
1473
|
d: "M6 2 12 8 6 14",
|
|
1471
1474
|
fill: "none",
|
|
@@ -1475,35 +1478,35 @@ ${v}${S}`);
|
|
|
1475
1478
|
"stroke-linejoin": "round"
|
|
1476
1479
|
}, null, -1)
|
|
1477
1480
|
])]))
|
|
1478
|
-
], 8,
|
|
1481
|
+
], 8, hn)) : Z("", !0)
|
|
1479
1482
|
], 38)
|
|
1480
1483
|
], 6));
|
|
1481
1484
|
}
|
|
1482
|
-
}),
|
|
1485
|
+
}), yn = (n, s) => {
|
|
1483
1486
|
const o = n.__vccOpts || n;
|
|
1484
1487
|
for (const [e, i] of s)
|
|
1485
1488
|
o[e] = i;
|
|
1486
1489
|
return o;
|
|
1487
|
-
},
|
|
1490
|
+
}, kn = /* @__PURE__ */ yn(vn, [["__scopeId", "data-v-d6942e2c"]]), $n = {
|
|
1488
1491
|
install(n) {
|
|
1489
|
-
n.component("CodeInput",
|
|
1492
|
+
n.component("CodeInput", kn);
|
|
1490
1493
|
}
|
|
1491
1494
|
};
|
|
1492
1495
|
export {
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1496
|
+
kn as CodeEditor,
|
|
1497
|
+
zt as collectCompletions,
|
|
1498
|
+
$n as default,
|
|
1499
|
+
Lt as defaultCompletions,
|
|
1500
|
+
Ht as findArgumentContext,
|
|
1501
|
+
we as findTemplateRange,
|
|
1502
|
+
je as getKeywordSet,
|
|
1503
|
+
Xe as getKeywords,
|
|
1504
|
+
de as highlight,
|
|
1505
|
+
en as highlightTemplate,
|
|
1506
|
+
xn as isInsideTemplate,
|
|
1507
|
+
Yt as parseTsCompletions,
|
|
1508
|
+
Jt as parseTsSignatures,
|
|
1509
|
+
jt as resolveHoverItem,
|
|
1510
|
+
Pe as scanDeclarations,
|
|
1511
|
+
ue as tokenize
|
|
1509
1512
|
};
|