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