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