@onerjs/code-input 0.1.8 → 0.2.0
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 +3 -1
- package/dist/code-input.cjs +16 -16
- package/dist/code-input.es.js +800 -704
- package/dist/components/CodeEditor.vue.d.ts +2 -0
- package/dist/core/builtins.d.ts +2 -0
- package/dist/core/completion.d.ts +1 -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 zt, ref as E, computed as K, watch as Ue, nextTick as V, onMounted as Vt, onBeforeUnmount as Kt, openBlock as I, createElementBlock as L, normalizeStyle as be, normalizeClass as le, createElementVNode as A, withModifiers as Ye, Fragment as Ge, renderList as Xe, toDisplayString as Y, createCommentVNode as q, createTextVNode as qt } from "vue";
|
|
2
|
+
const Je = [
|
|
3
3
|
{
|
|
4
4
|
label: "Math",
|
|
5
5
|
kind: "class",
|
|
@@ -134,51 +134,122 @@ const Vt = [
|
|
|
134
134
|
kind: "function",
|
|
135
135
|
detail: "(id: number) => void"
|
|
136
136
|
}
|
|
137
|
-
],
|
|
138
|
-
function
|
|
137
|
+
], Zt = [
|
|
138
|
+
{ label: "toFixed", kind: "function", detail: "(fractionDigits?: number) => string" },
|
|
139
|
+
{ label: "toPrecision", kind: "function", detail: "(precision?: number) => string" },
|
|
140
|
+
{ label: "toExponential", kind: "function", detail: "(fractionDigits?: number) => string" },
|
|
141
|
+
{ label: "toLocaleString", kind: "function", detail: "(locales?: string) => string" },
|
|
142
|
+
{ label: "toString", kind: "function", detail: "(radix?: number) => string" },
|
|
143
|
+
{ label: "valueOf", kind: "function", detail: "() => number" }
|
|
144
|
+
], Ut = [
|
|
145
|
+
{ label: "length", kind: "property", detail: "number" },
|
|
146
|
+
{ label: "charAt", kind: "function", detail: "(index: number) => string" },
|
|
147
|
+
{ label: "charCodeAt", kind: "function", detail: "(index: number) => number" },
|
|
148
|
+
{ label: "includes", kind: "function", detail: "(search: string, start?: number) => boolean" },
|
|
149
|
+
{ label: "indexOf", kind: "function", detail: "(search: string, from?: number) => number" },
|
|
150
|
+
{ label: "lastIndexOf", kind: "function", detail: "(search: string) => number" },
|
|
151
|
+
{ label: "slice", kind: "function", detail: "(start?: number, end?: number) => string" },
|
|
152
|
+
{ label: "substring", kind: "function", detail: "(start: number, end?: number) => string" },
|
|
153
|
+
{ label: "split", kind: "function", detail: "(separator?: string) => string[]" },
|
|
154
|
+
{ label: "replace", kind: "function", detail: "(search: string | RegExp, replace: string) => string" },
|
|
155
|
+
{ label: "replaceAll", kind: "function", detail: "(search: string, replace: string) => string" },
|
|
156
|
+
{ label: "match", kind: "function", detail: "(regexp: RegExp) => RegExpMatchArray | null" },
|
|
157
|
+
{ label: "startsWith", kind: "function", detail: "(search: string) => boolean" },
|
|
158
|
+
{ label: "endsWith", kind: "function", detail: "(search: string) => boolean" },
|
|
159
|
+
{ label: "padStart", kind: "function", detail: "(length: number, pad?: string) => string" },
|
|
160
|
+
{ label: "padEnd", kind: "function", detail: "(length: number, pad?: string) => string" },
|
|
161
|
+
{ label: "repeat", kind: "function", detail: "(count: number) => string" },
|
|
162
|
+
{ label: "trim", kind: "function", detail: "() => string" },
|
|
163
|
+
{ label: "trimStart", kind: "function", detail: "() => string" },
|
|
164
|
+
{ label: "trimEnd", kind: "function", detail: "() => string" },
|
|
165
|
+
{ label: "toUpperCase", kind: "function", detail: "() => string" },
|
|
166
|
+
{ label: "toLowerCase", kind: "function", detail: "() => string" },
|
|
167
|
+
{ label: "concat", kind: "function", detail: "(...strings: string[]) => string" }
|
|
168
|
+
], Yt = [
|
|
169
|
+
{ label: "toString", kind: "function", detail: "() => string" },
|
|
170
|
+
{ label: "valueOf", kind: "function", detail: "() => boolean" }
|
|
171
|
+
], Gt = [
|
|
172
|
+
{ label: "length", kind: "property", detail: "number" },
|
|
173
|
+
{ label: "push", kind: "function", detail: "(...items: any[]) => number" },
|
|
174
|
+
{ label: "pop", kind: "function", detail: "() => any" },
|
|
175
|
+
{ label: "shift", kind: "function", detail: "() => any" },
|
|
176
|
+
{ label: "unshift", kind: "function", detail: "(...items: any[]) => number" },
|
|
177
|
+
{ label: "slice", kind: "function", detail: "(start?: number, end?: number) => any[]" },
|
|
178
|
+
{ label: "splice", kind: "function", detail: "(start: number, deleteCount?: number) => any[]" },
|
|
179
|
+
{ label: "concat", kind: "function", detail: "(...items: any[]) => any[]" },
|
|
180
|
+
{ label: "join", kind: "function", detail: "(separator?: string) => string" },
|
|
181
|
+
{ label: "indexOf", kind: "function", detail: "(search: any, from?: number) => number" },
|
|
182
|
+
{ label: "includes", kind: "function", detail: "(search: any, from?: number) => boolean" },
|
|
183
|
+
{ label: "find", kind: "function", detail: "(predicate: Function) => any" },
|
|
184
|
+
{ label: "findIndex", kind: "function", detail: "(predicate: Function) => number" },
|
|
185
|
+
{ label: "filter", kind: "function", detail: "(predicate: Function) => any[]" },
|
|
186
|
+
{ label: "map", kind: "function", detail: "(callback: Function) => any[]" },
|
|
187
|
+
{ label: "forEach", kind: "function", detail: "(callback: Function) => void" },
|
|
188
|
+
{ label: "reduce", kind: "function", detail: "(callback: Function, initial?: any) => any" },
|
|
189
|
+
{ label: "some", kind: "function", detail: "(predicate: Function) => boolean" },
|
|
190
|
+
{ label: "every", kind: "function", detail: "(predicate: Function) => boolean" },
|
|
191
|
+
{ label: "sort", kind: "function", detail: "(compare?: Function) => any[]" },
|
|
192
|
+
{ label: "reverse", kind: "function", detail: "() => any[]" },
|
|
193
|
+
{ label: "flat", kind: "function", detail: "(depth?: number) => any[]" },
|
|
194
|
+
{ label: "fill", kind: "function", detail: "(value: any) => any[]" }
|
|
195
|
+
], Xt = [
|
|
196
|
+
{ label: "hasOwnProperty", kind: "function", detail: "(key: string) => boolean" },
|
|
197
|
+
{ label: "isPrototypeOf", kind: "function", detail: "(value: object) => boolean" },
|
|
198
|
+
{ label: "propertyIsEnumerable", kind: "function", detail: "(key: string) => boolean" },
|
|
199
|
+
{ label: "toString", kind: "function", detail: "() => string" },
|
|
200
|
+
{ label: "valueOf", kind: "function", detail: "() => object" },
|
|
201
|
+
{ label: "toLocaleString", kind: "function", detail: "() => string" }
|
|
202
|
+
], Jt = {
|
|
203
|
+
number: Zt,
|
|
204
|
+
string: Ut,
|
|
205
|
+
boolean: Yt,
|
|
206
|
+
array: Gt,
|
|
207
|
+
object: Xt
|
|
208
|
+
}, Qt = /[\w$]/;
|
|
209
|
+
function en(n, a) {
|
|
139
210
|
const o = [];
|
|
140
211
|
let e = null;
|
|
141
|
-
for (let
|
|
142
|
-
const
|
|
212
|
+
for (let C = 0; C < a; C++) {
|
|
213
|
+
const g = n[C];
|
|
143
214
|
if (e) {
|
|
144
|
-
|
|
215
|
+
g === e && n[C - 1] !== "\\" && (e = null);
|
|
145
216
|
continue;
|
|
146
217
|
}
|
|
147
|
-
if (
|
|
148
|
-
e =
|
|
218
|
+
if (g === "'" || g === '"' || g === "`") {
|
|
219
|
+
e = g;
|
|
149
220
|
continue;
|
|
150
221
|
}
|
|
151
|
-
if (
|
|
152
|
-
o.push({ index:
|
|
222
|
+
if (g === "(") {
|
|
223
|
+
o.push({ index: C, commas: 0 });
|
|
153
224
|
continue;
|
|
154
225
|
}
|
|
155
|
-
if (
|
|
226
|
+
if (g === ")") {
|
|
156
227
|
o.pop();
|
|
157
228
|
continue;
|
|
158
229
|
}
|
|
159
|
-
|
|
230
|
+
g === "," && o.length && o[o.length - 1].commas++;
|
|
160
231
|
}
|
|
161
|
-
const
|
|
162
|
-
if (!
|
|
163
|
-
let
|
|
164
|
-
for (;
|
|
165
|
-
const
|
|
166
|
-
for (;
|
|
167
|
-
const u = n.slice(
|
|
232
|
+
const l = o[o.length - 1];
|
|
233
|
+
if (!l) return null;
|
|
234
|
+
let s = l.index - 1;
|
|
235
|
+
for (; s >= 0 && /\s/.test(n[s]); ) s--;
|
|
236
|
+
const d = s;
|
|
237
|
+
for (; s >= 0 && Qt.test(n[s]); ) s--;
|
|
238
|
+
const u = n.slice(s + 1, d + 1);
|
|
168
239
|
if (!u) return null;
|
|
169
|
-
let
|
|
170
|
-
for (;
|
|
171
|
-
const
|
|
172
|
-
let T =
|
|
173
|
-
return
|
|
240
|
+
let r = a;
|
|
241
|
+
for (; r > 0 && /[\w$'"]/.test(n[r - 1]); ) r--;
|
|
242
|
+
const f = n.slice(r, a);
|
|
243
|
+
let T = f, j = null;
|
|
244
|
+
return f && (f[0] === "'" || f[0] === '"') && (j = f[0], T = f.slice(1)), {
|
|
174
245
|
functionName: u,
|
|
175
|
-
paramIndex:
|
|
246
|
+
paramIndex: l.commas,
|
|
176
247
|
prefix: T,
|
|
177
|
-
replaceStart:
|
|
178
|
-
quote:
|
|
248
|
+
replaceStart: r,
|
|
249
|
+
quote: j
|
|
179
250
|
};
|
|
180
251
|
}
|
|
181
|
-
const
|
|
252
|
+
const Qe = [
|
|
182
253
|
"break",
|
|
183
254
|
"case",
|
|
184
255
|
"catch",
|
|
@@ -223,7 +294,7 @@ const Je = [
|
|
|
223
294
|
"undefined",
|
|
224
295
|
"NaN",
|
|
225
296
|
"Infinity"
|
|
226
|
-
],
|
|
297
|
+
], tn = [
|
|
227
298
|
"abstract",
|
|
228
299
|
"any",
|
|
229
300
|
"as",
|
|
@@ -253,590 +324,615 @@ const Je = [
|
|
|
253
324
|
"type",
|
|
254
325
|
"unknown"
|
|
255
326
|
];
|
|
256
|
-
function
|
|
257
|
-
return n === "typescript" ? [...
|
|
327
|
+
function Ie(n) {
|
|
328
|
+
return n === "typescript" ? [...Qe, ...tn] : Qe;
|
|
329
|
+
}
|
|
330
|
+
function et(n) {
|
|
331
|
+
return new Set(Ie(n));
|
|
258
332
|
}
|
|
259
|
-
|
|
260
|
-
|
|
333
|
+
const dt = "[A-Za-z_$][\\w$]*", nn = `(?:${dt}|\\([^()]*\\)|['"\`][^'"\`]*['"\`])`, ln = new RegExp(`((?:${nn}\\??\\.)*)(${dt})?$`), tt = /\(([^()]*)\)|(['"`][^'"`]*['"`])|([A-Za-z_$][\w$]*)/g, nt = /\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g, on = /^[A-Za-z_$]/;
|
|
334
|
+
function an(n) {
|
|
335
|
+
const a = n.trim();
|
|
336
|
+
return /^-?\d+(\.\d+)?$/.test(a) || /^-?\.\d+$/.test(a) ? "number" : /^(['"`])[\s\S]*\1$/.test(a) ? "string" : a === "true" || a === "false" ? "boolean" : /^\[[\s\S]*\]$/.test(a) ? "array" : /^\{[\s\S]*\}$/.test(a) ? "object" : null;
|
|
261
337
|
}
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
const o = n.slice(0, s), e = Ut.exec(o);
|
|
338
|
+
function ft(n, a) {
|
|
339
|
+
const o = n.slice(0, a), e = ln.exec(o);
|
|
265
340
|
if (!e) return { prefix: "", chain: [] };
|
|
266
|
-
const
|
|
267
|
-
|
|
341
|
+
const l = e[1] ?? "", s = e[2] ?? "", d = [];
|
|
342
|
+
tt.lastIndex = 0;
|
|
343
|
+
let u;
|
|
344
|
+
for (; u = tt.exec(l); ) {
|
|
345
|
+
if (u[2]) {
|
|
346
|
+
d.push(u[2]);
|
|
347
|
+
continue;
|
|
348
|
+
}
|
|
349
|
+
const r = u[1] ?? u[3] ?? "";
|
|
350
|
+
for (const f of r.split(".")) {
|
|
351
|
+
const T = f.replace(/\?$/, "");
|
|
352
|
+
T && d.push(T);
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
return { prefix: s, chain: d };
|
|
268
356
|
}
|
|
269
|
-
function
|
|
357
|
+
function it(n, a) {
|
|
270
358
|
const o = [], e = /* @__PURE__ */ new Set();
|
|
271
|
-
let
|
|
272
|
-
for (
|
|
273
|
-
const
|
|
274
|
-
if (e.has(
|
|
275
|
-
e.add(
|
|
276
|
-
const
|
|
359
|
+
let l;
|
|
360
|
+
for (nt.lastIndex = 0; (l = nt.exec(n)) && !(l.index >= a); ) {
|
|
361
|
+
const s = l[1];
|
|
362
|
+
if (e.has(s)) continue;
|
|
363
|
+
e.add(s);
|
|
364
|
+
const d = l[0].slice(0, l[0].indexOf(s)).trim();
|
|
277
365
|
o.push({
|
|
278
|
-
label:
|
|
279
|
-
kind:
|
|
366
|
+
label: s,
|
|
367
|
+
kind: d === "function" ? "function" : d === "class" ? "class" : "variable",
|
|
280
368
|
detail: "当前文件"
|
|
281
369
|
});
|
|
282
370
|
}
|
|
283
371
|
return o;
|
|
284
372
|
}
|
|
285
|
-
function
|
|
286
|
-
let o =
|
|
373
|
+
function pt(n, a) {
|
|
374
|
+
let o = a;
|
|
287
375
|
for (const e of n) {
|
|
288
376
|
if (!o) return null;
|
|
289
|
-
const
|
|
290
|
-
if (
|
|
291
|
-
|
|
377
|
+
const l = o.find((d) => d.label === e);
|
|
378
|
+
if (l) {
|
|
379
|
+
o = l.members ?? [];
|
|
380
|
+
continue;
|
|
381
|
+
}
|
|
382
|
+
const s = an(e);
|
|
383
|
+
if (s) {
|
|
384
|
+
o = Jt[s];
|
|
385
|
+
continue;
|
|
386
|
+
}
|
|
387
|
+
return null;
|
|
292
388
|
}
|
|
293
389
|
return o;
|
|
294
390
|
}
|
|
295
|
-
function
|
|
296
|
-
const o = n.toLowerCase(), e =
|
|
297
|
-
if (
|
|
298
|
-
if (
|
|
299
|
-
let
|
|
300
|
-
for (let
|
|
301
|
-
o[
|
|
302
|
-
return
|
|
391
|
+
function rn(n, a) {
|
|
392
|
+
const o = n.toLowerCase(), e = a.toLowerCase(), l = o.indexOf(e);
|
|
393
|
+
if (l === 0) return 1e3 - o.length;
|
|
394
|
+
if (l > 0) return 800 - l;
|
|
395
|
+
let s = 0, d = 0, u = -1;
|
|
396
|
+
for (let r = 0; r < o.length && s < e.length; r++)
|
|
397
|
+
o[r] === e[s] && (u >= 0 && (d += r - u - 1), u = r, s++);
|
|
398
|
+
return s !== e.length ? null : 400 - d - o.length;
|
|
303
399
|
}
|
|
304
|
-
function
|
|
305
|
-
if (!
|
|
400
|
+
function mt(n, a) {
|
|
401
|
+
if (!a) return n;
|
|
306
402
|
const o = [];
|
|
307
403
|
for (const e of n) {
|
|
308
|
-
const
|
|
309
|
-
|
|
404
|
+
const l = rn(e.label, a);
|
|
405
|
+
l !== null && o.push({ item: e, score: l });
|
|
310
406
|
}
|
|
311
|
-
return o.sort((e,
|
|
407
|
+
return o.sort((e, l) => l.score - e.score || e.item.label.localeCompare(l.item.label)), o.map((e) => e.item);
|
|
312
408
|
}
|
|
313
|
-
function
|
|
314
|
-
const
|
|
409
|
+
function sn(n) {
|
|
410
|
+
const a = /* @__PURE__ */ new Set(), o = [];
|
|
315
411
|
for (const e of n)
|
|
316
|
-
|
|
412
|
+
a.has(e.label) || (a.add(e.label), o.push(e));
|
|
317
413
|
return o;
|
|
318
414
|
}
|
|
319
|
-
function
|
|
320
|
-
const { prefix: e, chain:
|
|
321
|
-
if (o.auto && (!e &&
|
|
415
|
+
function cn(n, a, o) {
|
|
416
|
+
const { prefix: e, chain: l } = ft(n, a);
|
|
417
|
+
if (o.auto && (!e && l.length === 0 || e && !on.test(e)))
|
|
322
418
|
return null;
|
|
323
|
-
const
|
|
419
|
+
const s = o.declared ?? [], d = [...s, ...o.completions];
|
|
324
420
|
let u;
|
|
325
|
-
if (
|
|
326
|
-
const
|
|
327
|
-
if (!
|
|
328
|
-
u =
|
|
421
|
+
if (l.length > 0) {
|
|
422
|
+
const f = pt(l, d);
|
|
423
|
+
if (!f || f.length === 0) return null;
|
|
424
|
+
u = f;
|
|
329
425
|
} else
|
|
330
426
|
u = [
|
|
331
427
|
...o.completions,
|
|
332
|
-
...
|
|
333
|
-
...
|
|
334
|
-
label:
|
|
428
|
+
...s,
|
|
429
|
+
...(o.keywords ?? Ie(o.language)).map((f) => ({
|
|
430
|
+
label: f,
|
|
335
431
|
kind: "keyword"
|
|
336
432
|
}))
|
|
337
433
|
];
|
|
338
|
-
const
|
|
339
|
-
return
|
|
340
|
-
items:
|
|
341
|
-
start:
|
|
342
|
-
end:
|
|
434
|
+
const r = mt(sn(u), e);
|
|
435
|
+
return r.length === 0 ? null : {
|
|
436
|
+
items: r,
|
|
437
|
+
start: a - e.length,
|
|
438
|
+
end: a
|
|
343
439
|
};
|
|
344
440
|
}
|
|
345
|
-
const
|
|
346
|
-
function
|
|
347
|
-
const
|
|
348
|
-
if (!
|
|
349
|
-
const
|
|
350
|
-
if (
|
|
351
|
-
const u =
|
|
352
|
-
if (
|
|
441
|
+
const un = /([A-Za-z_$][\w$]*(?:\??\.[A-Za-z_$][\w$]*)*)\??\.\s*$/;
|
|
442
|
+
function dn(n, a, o, e) {
|
|
443
|
+
const l = n.slice(a, o);
|
|
444
|
+
if (!l) return null;
|
|
445
|
+
const s = [...e.declared ?? [], ...e.completions], d = un.exec(n.slice(0, a));
|
|
446
|
+
if (d) {
|
|
447
|
+
const u = d[1].split(".").filter(Boolean).map((T) => T.replace(/\?$/, "")), r = pt(u, s), f = r == null ? void 0 : r.find((T) => T.label === l);
|
|
448
|
+
if (f) return f;
|
|
353
449
|
}
|
|
354
|
-
return
|
|
450
|
+
return s.find((u) => u.label === l) ?? null;
|
|
355
451
|
}
|
|
356
|
-
const Z = "[A-Za-z_$][\\w$]*",
|
|
357
|
-
function
|
|
358
|
-
let o = 0, e = !1,
|
|
359
|
-
for (let
|
|
360
|
-
const
|
|
361
|
-
for (let u = 0; u <
|
|
362
|
-
const
|
|
363
|
-
|
|
452
|
+
const Z = "[A-Za-z_$][\\w$]*", lt = "(?:readonly\\s+|public\\s+|private\\s+|protected\\s+|static\\s+|abstract\\s+)*";
|
|
453
|
+
function ot(n, a) {
|
|
454
|
+
let o = 0, e = !1, l = a;
|
|
455
|
+
for (let s = a; s < n.length; s++) {
|
|
456
|
+
const d = n[s];
|
|
457
|
+
for (let u = 0; u < d.length; u++) {
|
|
458
|
+
const r = d[u];
|
|
459
|
+
r === "{" ? (o++, e = !0) : r === "}" && o--;
|
|
364
460
|
}
|
|
365
461
|
if (e && o <= 0) {
|
|
366
|
-
|
|
462
|
+
l = s;
|
|
367
463
|
break;
|
|
368
464
|
}
|
|
369
465
|
}
|
|
370
|
-
return { end:
|
|
466
|
+
return { end: l, body: n.slice(a + 1, l) };
|
|
371
467
|
}
|
|
372
|
-
function
|
|
468
|
+
function at(n) {
|
|
373
469
|
return n.trim().replace(/[,;]$/, "").trim();
|
|
374
470
|
}
|
|
375
|
-
function
|
|
471
|
+
function fn(n) {
|
|
376
472
|
return /^(?:export\s+)?(?:declare\s+)?(?:abstract\s+)?(?:interface|class|type|function|const|let|var|namespace|enum)\b/.test(
|
|
377
473
|
n
|
|
378
474
|
);
|
|
379
475
|
}
|
|
380
|
-
function oe(n,
|
|
381
|
-
const o = n[
|
|
476
|
+
function oe(n, a) {
|
|
477
|
+
const o = n[a];
|
|
382
478
|
let e = o.lastIndexOf("}");
|
|
383
|
-
const
|
|
384
|
-
if (
|
|
385
|
-
const
|
|
386
|
-
!
|
|
479
|
+
const l = o.lastIndexOf(";");
|
|
480
|
+
if (l > e && (e = l), e === -1) return;
|
|
481
|
+
const s = o.slice(e + 1).replace(/^[\s;]+/, "").trim();
|
|
482
|
+
!s || !fn(s) || (n[a] = o.slice(0, e + 1), n.splice(a + 1, 0, s));
|
|
387
483
|
}
|
|
388
|
-
function
|
|
484
|
+
function X(n) {
|
|
389
485
|
return n.length ? n.join(`
|
|
390
486
|
`).replace(/^\s*\/\*\*?/, "").replace(/\*\/\s*$/, "").split(`
|
|
391
|
-
`).map((
|
|
487
|
+
`).map((a) => a.replace(/^\s*\*+\s?/, "").replace(/^\s*\/\/\s?/, "")).join(`
|
|
392
488
|
`).replace(/\n{3,}/g, `
|
|
393
489
|
|
|
394
490
|
`).trim() : "";
|
|
395
491
|
}
|
|
396
|
-
function
|
|
492
|
+
function rt(n) {
|
|
397
493
|
return n.split(`
|
|
398
|
-
`).filter((
|
|
494
|
+
`).filter((a) => !/^\s*(\/\/|\/\*|\*)/.test(a)).join(`
|
|
399
495
|
`).replace(/\n{2,}/g, `
|
|
400
496
|
`).trim();
|
|
401
497
|
}
|
|
402
|
-
function
|
|
403
|
-
const
|
|
404
|
-
let
|
|
498
|
+
function st(n) {
|
|
499
|
+
const a = [], o = /* @__PURE__ */ new Set(), e = new RegExp(`^${lt}(${Z})(\\?)?\\s*\\((.*)\\)\\s*:\\s*(.+?);?$`), l = new RegExp(`^${lt}(${Z})(\\?)?\\s*:\\s*(.+?);?$`);
|
|
500
|
+
let s = [], d = !1;
|
|
405
501
|
for (const u of n) {
|
|
406
|
-
const
|
|
407
|
-
if (
|
|
408
|
-
|
|
502
|
+
const r = u.trim();
|
|
503
|
+
if (d) {
|
|
504
|
+
s.push(r), r.includes("*/") && (d = !1);
|
|
409
505
|
continue;
|
|
410
506
|
}
|
|
411
|
-
if (
|
|
412
|
-
|
|
507
|
+
if (r.startsWith("/*")) {
|
|
508
|
+
s.push(r), r.includes("*/") || (d = !0);
|
|
413
509
|
continue;
|
|
414
510
|
}
|
|
415
|
-
if (
|
|
416
|
-
|
|
511
|
+
if (r.startsWith("//")) {
|
|
512
|
+
s.push(r);
|
|
417
513
|
continue;
|
|
418
514
|
}
|
|
419
|
-
if (!
|
|
420
|
-
|
|
515
|
+
if (!r || r.startsWith("}") || r.startsWith("[")) {
|
|
516
|
+
s = [];
|
|
421
517
|
continue;
|
|
422
518
|
}
|
|
423
|
-
const
|
|
424
|
-
if (
|
|
425
|
-
const
|
|
426
|
-
|
|
427
|
-
const
|
|
428
|
-
if (o.has(
|
|
429
|
-
o.add(
|
|
430
|
-
label:
|
|
519
|
+
const f = e.exec(r);
|
|
520
|
+
if (f) {
|
|
521
|
+
const j = X(s);
|
|
522
|
+
s = [];
|
|
523
|
+
const C = f[1];
|
|
524
|
+
if (o.has(C)) continue;
|
|
525
|
+
o.add(C), a.push({
|
|
526
|
+
label: C,
|
|
431
527
|
kind: "function",
|
|
432
|
-
detail: `(${
|
|
433
|
-
documentation:
|
|
528
|
+
detail: `(${f[3].trim()}) => ${at(f[4])}`,
|
|
529
|
+
documentation: j || void 0
|
|
434
530
|
});
|
|
435
531
|
continue;
|
|
436
532
|
}
|
|
437
|
-
const T =
|
|
533
|
+
const T = l.exec(r);
|
|
438
534
|
if (T) {
|
|
439
|
-
const
|
|
440
|
-
|
|
441
|
-
const
|
|
442
|
-
if (o.has(
|
|
443
|
-
o.add(
|
|
444
|
-
const
|
|
445
|
-
|
|
446
|
-
label:
|
|
447
|
-
kind:
|
|
448
|
-
detail:
|
|
449
|
-
documentation:
|
|
535
|
+
const j = X(s);
|
|
536
|
+
s = [];
|
|
537
|
+
const C = T[1];
|
|
538
|
+
if (o.has(C)) continue;
|
|
539
|
+
o.add(C);
|
|
540
|
+
const g = at(T[3]), k = /^\(|=>/.test(g) ? "function" : "property";
|
|
541
|
+
a.push({
|
|
542
|
+
label: C,
|
|
543
|
+
kind: k,
|
|
544
|
+
detail: g,
|
|
545
|
+
documentation: j || void 0
|
|
450
546
|
});
|
|
451
547
|
}
|
|
452
548
|
}
|
|
453
|
-
return
|
|
549
|
+
return a;
|
|
454
550
|
}
|
|
455
|
-
function
|
|
456
|
-
const
|
|
551
|
+
function bt(n) {
|
|
552
|
+
const a = [], o = /(['"])((?:\\.|(?!\1).)*)\1/g;
|
|
457
553
|
let e;
|
|
458
554
|
for (; e = o.exec(n); )
|
|
459
|
-
|
|
460
|
-
return
|
|
555
|
+
a.push(e[2]);
|
|
556
|
+
return a;
|
|
461
557
|
}
|
|
462
|
-
function
|
|
558
|
+
function pn(n, a) {
|
|
463
559
|
const o = [];
|
|
464
|
-
let e = 0,
|
|
465
|
-
for (let
|
|
466
|
-
const u = n[
|
|
467
|
-
if (
|
|
468
|
-
|
|
560
|
+
let e = 0, l = "", s = null;
|
|
561
|
+
for (let d = 0; d < n.length; d++) {
|
|
562
|
+
const u = n[d];
|
|
563
|
+
if (s) {
|
|
564
|
+
l += u, u === s && n[d - 1] !== "\\" && (s = null);
|
|
469
565
|
continue;
|
|
470
566
|
}
|
|
471
567
|
if (u === "'" || u === '"' || u === "`") {
|
|
472
|
-
|
|
568
|
+
s = u, l += u;
|
|
473
569
|
continue;
|
|
474
570
|
}
|
|
475
|
-
if (u === "(" || u === "<" || u === "[" || u === "{" ? e++ : (u === ")" || u === ">" || u === "]" || u === "}") && e--, u ===
|
|
476
|
-
o.push(
|
|
571
|
+
if (u === "(" || u === "<" || u === "[" || u === "{" ? e++ : (u === ")" || u === ">" || u === "]" || u === "}") && e--, u === a && e === 0) {
|
|
572
|
+
o.push(l), l = "";
|
|
477
573
|
continue;
|
|
478
574
|
}
|
|
479
|
-
|
|
575
|
+
l += u;
|
|
480
576
|
}
|
|
481
|
-
return o.push(
|
|
577
|
+
return o.push(l), o;
|
|
482
578
|
}
|
|
483
|
-
function
|
|
484
|
-
const o = n.trim(), e =
|
|
579
|
+
function mn(n, a) {
|
|
580
|
+
const o = n.trim(), e = bt(o);
|
|
485
581
|
if (e.length) return e;
|
|
486
|
-
const
|
|
487
|
-
return (
|
|
582
|
+
const l = a.get(o.replace(/\[\]$/, ""));
|
|
583
|
+
return (l == null ? void 0 : l.literals) ?? [];
|
|
488
584
|
}
|
|
489
|
-
function
|
|
585
|
+
function bn(n, a) {
|
|
490
586
|
const o = n.trim();
|
|
491
|
-
return o ?
|
|
492
|
-
const
|
|
493
|
-
if (!
|
|
587
|
+
return o ? pn(o, ",").map((e) => {
|
|
588
|
+
const l = new RegExp(`^\\s*(${Z})\\s*(\\?)?\\s*:\\s*(.+)$`).exec(e);
|
|
589
|
+
if (!l)
|
|
494
590
|
return { name: e.trim(), type: "", optional: !1, literals: [] };
|
|
495
|
-
const
|
|
591
|
+
const s = l[3].replace(/\s*=\s*[^=]*$/, "").trim();
|
|
496
592
|
return {
|
|
497
|
-
name:
|
|
498
|
-
optional: !!
|
|
499
|
-
type:
|
|
500
|
-
literals:
|
|
593
|
+
name: l[1],
|
|
594
|
+
optional: !!l[2],
|
|
595
|
+
type: s,
|
|
596
|
+
literals: mn(s, a)
|
|
501
597
|
};
|
|
502
598
|
}) : [];
|
|
503
599
|
}
|
|
504
|
-
function
|
|
505
|
-
const
|
|
600
|
+
function ht(n) {
|
|
601
|
+
const a = n.replace(/\[\]/g, "").replace(/<[^>]*>/g, "").replace(/\s*\|\s*null\s*/g, "").trim(), o = new RegExp(`^(${Z})$`).exec(a);
|
|
506
602
|
return o ? o[1] : null;
|
|
507
603
|
}
|
|
508
|
-
function
|
|
509
|
-
const
|
|
510
|
-
if (!
|
|
511
|
-
const o = (
|
|
512
|
-
return /[|&,(<]\s*$/.test(
|
|
604
|
+
function hn(n) {
|
|
605
|
+
const a = n.trim();
|
|
606
|
+
if (!a || a.endsWith(";")) return !1;
|
|
607
|
+
const o = (a.match(/[(<[{]/g) ?? []).length, e = (a.match(/[)>\]}]/g) ?? []).length;
|
|
608
|
+
return /[|&,(<]\s*$/.test(a) || o > e;
|
|
513
609
|
}
|
|
514
|
-
function
|
|
515
|
-
return e > 6 ? n : n.map((
|
|
516
|
-
if (
|
|
517
|
-
const
|
|
518
|
-
if (!
|
|
610
|
+
function gt(n, a, o, e = 0) {
|
|
611
|
+
return e > 6 ? n : n.map((l) => {
|
|
612
|
+
if (l.kind !== "property" || !l.detail) return l;
|
|
613
|
+
const s = ht(l.detail), d = s ? a.get(s) : void 0;
|
|
614
|
+
if (!d || o.has(d.label)) return l;
|
|
519
615
|
const u = new Set(o);
|
|
520
|
-
return u.add(
|
|
521
|
-
...
|
|
522
|
-
type:
|
|
523
|
-
members:
|
|
616
|
+
return u.add(d.label), {
|
|
617
|
+
...l,
|
|
618
|
+
type: d.type,
|
|
619
|
+
members: gt(d.members, a, u, e + 1)
|
|
524
620
|
};
|
|
525
621
|
});
|
|
526
622
|
}
|
|
527
|
-
const
|
|
528
|
-
function
|
|
529
|
-
if (!n || !n.trim()) return
|
|
530
|
-
const
|
|
531
|
-
if (
|
|
532
|
-
const o =
|
|
533
|
-
if (ae.size >=
|
|
623
|
+
const gn = 50, ae = /* @__PURE__ */ new Map(), vn = { items: [], signatures: /* @__PURE__ */ new Map() };
|
|
624
|
+
function vt(n) {
|
|
625
|
+
if (!n || !n.trim()) return vn;
|
|
626
|
+
const a = ae.get(n);
|
|
627
|
+
if (a) return a;
|
|
628
|
+
const o = wn(n);
|
|
629
|
+
if (ae.size >= gn) {
|
|
534
630
|
const e = ae.keys().next().value;
|
|
535
631
|
e !== void 0 && ae.delete(e);
|
|
536
632
|
}
|
|
537
633
|
return ae.set(n, o), o;
|
|
538
634
|
}
|
|
539
|
-
function
|
|
540
|
-
return
|
|
635
|
+
function kn(n) {
|
|
636
|
+
return vt(n).items;
|
|
541
637
|
}
|
|
542
|
-
function
|
|
543
|
-
return
|
|
638
|
+
function yn(n) {
|
|
639
|
+
return vt(n).signatures;
|
|
544
640
|
}
|
|
545
|
-
function
|
|
546
|
-
const
|
|
547
|
-
`), o = /* @__PURE__ */ new Map(), e = /* @__PURE__ */ new Map(),
|
|
548
|
-
let u = [],
|
|
549
|
-
for (let
|
|
550
|
-
const
|
|
551
|
-
if (
|
|
552
|
-
u.push(
|
|
641
|
+
function wn(n) {
|
|
642
|
+
const a = n.split(`
|
|
643
|
+
`), o = /* @__PURE__ */ new Map(), e = /* @__PURE__ */ new Map(), l = new RegExp(`^(?:export\\s+)?(?:declare\\s+)?interface\\s+(${Z})`), s = new RegExp(`^(?:export\\s+)?(?:declare\\s+)?(?:abstract\\s+)?class\\s+(${Z})`), d = new RegExp(`^(?:export\\s+)?(?:declare\\s+)?type\\s+(${Z})\\s*=`);
|
|
644
|
+
let u = [], r = !1;
|
|
645
|
+
for (let g = 0; g < a.length; g++) {
|
|
646
|
+
const k = a[g].trim();
|
|
647
|
+
if (r) {
|
|
648
|
+
u.push(k), k.includes("*/") && (r = !1);
|
|
553
649
|
continue;
|
|
554
650
|
}
|
|
555
|
-
if (
|
|
556
|
-
u.push(
|
|
651
|
+
if (k.startsWith("/*")) {
|
|
652
|
+
u.push(k), k.includes("*/") || (r = !0);
|
|
557
653
|
continue;
|
|
558
654
|
}
|
|
559
|
-
if (
|
|
560
|
-
u.push(
|
|
655
|
+
if (k.startsWith("//")) {
|
|
656
|
+
u.push(k);
|
|
561
657
|
continue;
|
|
562
658
|
}
|
|
563
|
-
if (!
|
|
659
|
+
if (!k) {
|
|
564
660
|
u = [];
|
|
565
661
|
continue;
|
|
566
662
|
}
|
|
567
|
-
const
|
|
568
|
-
if (
|
|
569
|
-
const w =
|
|
663
|
+
const N = l.exec(k);
|
|
664
|
+
if (N && k.includes("{")) {
|
|
665
|
+
const w = X(u);
|
|
570
666
|
u = [];
|
|
571
|
-
const { end: $, body:
|
|
572
|
-
o.set(
|
|
573
|
-
label:
|
|
574
|
-
type:
|
|
575
|
-
|
|
667
|
+
const { end: $, body: H } = ot(a, g), h = N[1];
|
|
668
|
+
o.set(h, {
|
|
669
|
+
label: h,
|
|
670
|
+
type: rt(
|
|
671
|
+
a.slice(g, $ + 1).join(`
|
|
576
672
|
`).replace(/^\s*export\s+/, "")
|
|
577
673
|
),
|
|
578
|
-
members:
|
|
674
|
+
members: st(H),
|
|
579
675
|
kind: "interface",
|
|
580
676
|
documentation: w || void 0
|
|
581
|
-
}), oe(
|
|
677
|
+
}), oe(a, $), g = $;
|
|
582
678
|
continue;
|
|
583
679
|
}
|
|
584
|
-
const
|
|
585
|
-
if (
|
|
586
|
-
const w =
|
|
680
|
+
const F = s.exec(k);
|
|
681
|
+
if (F && k.includes("{")) {
|
|
682
|
+
const w = X(u);
|
|
587
683
|
u = [];
|
|
588
|
-
const { end: $, body:
|
|
589
|
-
o.set(
|
|
590
|
-
label:
|
|
591
|
-
type:
|
|
592
|
-
|
|
684
|
+
const { end: $, body: H } = ot(a, g), h = F[1];
|
|
685
|
+
o.set(h, {
|
|
686
|
+
label: h,
|
|
687
|
+
type: rt(
|
|
688
|
+
a.slice(g, $ + 1).join(`
|
|
593
689
|
`).replace(/^\s*export\s+/, "")
|
|
594
690
|
),
|
|
595
|
-
members:
|
|
691
|
+
members: st(H),
|
|
596
692
|
kind: "class",
|
|
597
693
|
documentation: w || void 0
|
|
598
|
-
}), oe(
|
|
694
|
+
}), oe(a, $), g = $;
|
|
599
695
|
continue;
|
|
600
696
|
}
|
|
601
|
-
const
|
|
602
|
-
if (
|
|
603
|
-
const w =
|
|
697
|
+
const M = d.exec(k);
|
|
698
|
+
if (M) {
|
|
699
|
+
const w = X(u);
|
|
604
700
|
u = [];
|
|
605
|
-
const $ = [
|
|
606
|
-
let
|
|
607
|
-
for (;
|
|
608
|
-
`)) &&
|
|
609
|
-
|
|
610
|
-
const
|
|
701
|
+
const $ = [a[g]];
|
|
702
|
+
let H = g;
|
|
703
|
+
for (; hn($.join(`
|
|
704
|
+
`)) && H + 1 < a.length; )
|
|
705
|
+
H++, $.push(a[H]);
|
|
706
|
+
const h = $.join(`
|
|
611
707
|
`).replace(/^\s*export\s+/, "").replace(/;\s*$/, "").trim();
|
|
612
|
-
o.set(
|
|
613
|
-
label:
|
|
614
|
-
type:
|
|
708
|
+
o.set(M[1], {
|
|
709
|
+
label: M[1],
|
|
710
|
+
type: h,
|
|
615
711
|
members: [],
|
|
616
712
|
kind: "type",
|
|
617
713
|
documentation: w || void 0,
|
|
618
|
-
literals:
|
|
619
|
-
}), oe(
|
|
714
|
+
literals: bt(h)
|
|
715
|
+
}), oe(a, H), g = H;
|
|
620
716
|
continue;
|
|
621
717
|
}
|
|
622
718
|
u = [];
|
|
623
719
|
}
|
|
624
|
-
const
|
|
720
|
+
const f = [], T = /* @__PURE__ */ new Set(), j = new RegExp(
|
|
625
721
|
`^(?:export\\s+)?(?:declare\\s+)?function\\s+(${Z})\\s*\\(([^)]*)\\)\\s*:\\s*([^;{]+)`
|
|
626
|
-
),
|
|
722
|
+
), C = new RegExp(
|
|
627
723
|
`^(?:export\\s+)?(?:declare\\s+)?(?:const|let|var)\\s+(${Z})\\s*:\\s*([^=;]+)`
|
|
628
724
|
);
|
|
629
|
-
u = [],
|
|
630
|
-
for (let
|
|
631
|
-
const
|
|
632
|
-
if (
|
|
633
|
-
u.push(
|
|
725
|
+
u = [], r = !1;
|
|
726
|
+
for (let g = 0; g < a.length; g++) {
|
|
727
|
+
const k = a[g].trim();
|
|
728
|
+
if (r) {
|
|
729
|
+
u.push(k), k.includes("*/") && (r = !1);
|
|
634
730
|
continue;
|
|
635
731
|
}
|
|
636
|
-
if (
|
|
637
|
-
u.push(
|
|
732
|
+
if (k.startsWith("/*")) {
|
|
733
|
+
u.push(k), k.includes("*/") || (r = !0);
|
|
638
734
|
continue;
|
|
639
735
|
}
|
|
640
|
-
if (
|
|
641
|
-
u.push(
|
|
736
|
+
if (k.startsWith("//")) {
|
|
737
|
+
u.push(k);
|
|
642
738
|
continue;
|
|
643
739
|
}
|
|
644
|
-
if (!
|
|
740
|
+
if (!k) {
|
|
645
741
|
u = [];
|
|
646
742
|
continue;
|
|
647
743
|
}
|
|
648
|
-
const
|
|
649
|
-
if (
|
|
650
|
-
oe(
|
|
651
|
-
const
|
|
744
|
+
const N = j.exec(k);
|
|
745
|
+
if (N) {
|
|
746
|
+
oe(a, g);
|
|
747
|
+
const M = X(u);
|
|
652
748
|
u = [];
|
|
653
|
-
const w =
|
|
654
|
-
T.has(w) || (T.add(w),
|
|
749
|
+
const w = N[1];
|
|
750
|
+
T.has(w) || (T.add(w), f.push({
|
|
655
751
|
label: w,
|
|
656
752
|
kind: "function",
|
|
657
|
-
detail: `(${
|
|
658
|
-
documentation:
|
|
659
|
-
})), e.set(w, { name: w, params:
|
|
753
|
+
detail: `(${N[2].trim()}) => ${N[3].trim()}`,
|
|
754
|
+
documentation: M || void 0
|
|
755
|
+
})), e.set(w, { name: w, params: bn(N[2], o) });
|
|
660
756
|
continue;
|
|
661
757
|
}
|
|
662
|
-
const
|
|
663
|
-
if (
|
|
664
|
-
oe(
|
|
665
|
-
const
|
|
758
|
+
const F = C.exec(k);
|
|
759
|
+
if (F) {
|
|
760
|
+
oe(a, g);
|
|
761
|
+
const M = X(u);
|
|
666
762
|
u = [];
|
|
667
|
-
const w =
|
|
763
|
+
const w = F[1];
|
|
668
764
|
if (T.has(w)) continue;
|
|
669
765
|
T.add(w);
|
|
670
|
-
const $ =
|
|
671
|
-
|
|
766
|
+
const $ = F[2].trim(), H = ht($), h = H ? o.get(H) : void 0, re = (h == null ? void 0 : h.kind) === "class" ? "class" : /^\(|=>/.test($) ? "function" : "variable";
|
|
767
|
+
f.push({
|
|
672
768
|
label: w,
|
|
673
|
-
kind:
|
|
769
|
+
kind: re,
|
|
674
770
|
detail: $,
|
|
675
|
-
type:
|
|
676
|
-
documentation:
|
|
677
|
-
members:
|
|
771
|
+
type: h == null ? void 0 : h.type,
|
|
772
|
+
documentation: M || (h == null ? void 0 : h.documentation) || void 0,
|
|
773
|
+
members: h ? gt(h.members, o, /* @__PURE__ */ new Set([h.label])) : void 0
|
|
678
774
|
});
|
|
679
775
|
continue;
|
|
680
776
|
}
|
|
681
777
|
u = [];
|
|
682
778
|
}
|
|
683
|
-
return { items:
|
|
779
|
+
return { items: f, signatures: e };
|
|
684
780
|
}
|
|
685
|
-
function
|
|
781
|
+
function Re(n, a, o, e) {
|
|
686
782
|
if (!o || !e) return null;
|
|
687
|
-
const
|
|
688
|
-
if (
|
|
689
|
-
const u = n.indexOf(e,
|
|
783
|
+
const l = Math.max(0, a - 1), s = n.lastIndexOf(o, l);
|
|
784
|
+
if (s === -1 || n.lastIndexOf(e, l) > s) return null;
|
|
785
|
+
const u = n.indexOf(e, s + o.length);
|
|
690
786
|
return {
|
|
691
|
-
start:
|
|
787
|
+
start: s + o.length,
|
|
692
788
|
end: u === -1 ? n.length : u
|
|
693
789
|
};
|
|
694
790
|
}
|
|
695
|
-
function
|
|
696
|
-
return
|
|
791
|
+
function Kn(n, a, o, e) {
|
|
792
|
+
return Re(n, a, o, e) !== null;
|
|
697
793
|
}
|
|
698
|
-
const
|
|
699
|
-
function
|
|
794
|
+
const ct = /[A-Za-z_$]/, xn = /[\w$]/, ut = /\s/;
|
|
795
|
+
function he(n, a) {
|
|
700
796
|
const o = [], e = n.length;
|
|
701
|
-
let
|
|
702
|
-
for (;
|
|
703
|
-
const
|
|
704
|
-
if (
|
|
705
|
-
|
|
797
|
+
let l = 0;
|
|
798
|
+
for (; l < e; ) {
|
|
799
|
+
const s = n[l], d = n[l + 1];
|
|
800
|
+
if (ut.test(s)) {
|
|
801
|
+
l++;
|
|
706
802
|
continue;
|
|
707
803
|
}
|
|
708
|
-
if (
|
|
709
|
-
let
|
|
710
|
-
`,
|
|
711
|
-
|
|
804
|
+
if (s === "/" && d === "/") {
|
|
805
|
+
let r = n.indexOf(`
|
|
806
|
+
`, l);
|
|
807
|
+
r === -1 && (r = e), o.push({ start: l, end: r, type: "comment" }), l = r;
|
|
712
808
|
continue;
|
|
713
809
|
}
|
|
714
|
-
if (
|
|
715
|
-
const
|
|
716
|
-
o.push({ start:
|
|
810
|
+
if (s === "/" && d === "*") {
|
|
811
|
+
const r = n.indexOf("*/", l + 2), f = r === -1 ? e : r + 2;
|
|
812
|
+
o.push({ start: l, end: f, type: "comment" }), l = f;
|
|
717
813
|
continue;
|
|
718
814
|
}
|
|
719
|
-
if (
|
|
720
|
-
let
|
|
721
|
-
for (;
|
|
722
|
-
if (n[
|
|
723
|
-
|
|
815
|
+
if (s === '"' || s === "'") {
|
|
816
|
+
let r = l + 1;
|
|
817
|
+
for (; r < e; ) {
|
|
818
|
+
if (n[r] === "\\") {
|
|
819
|
+
r += 2;
|
|
724
820
|
continue;
|
|
725
821
|
}
|
|
726
|
-
if (n[
|
|
822
|
+
if (n[r] === `
|
|
727
823
|
`) break;
|
|
728
|
-
if (n[
|
|
729
|
-
|
|
824
|
+
if (n[r] === s) {
|
|
825
|
+
r++;
|
|
730
826
|
break;
|
|
731
827
|
}
|
|
732
|
-
|
|
828
|
+
r++;
|
|
733
829
|
}
|
|
734
|
-
o.push({ start:
|
|
830
|
+
o.push({ start: l, end: r, type: "string" }), l = r;
|
|
735
831
|
continue;
|
|
736
832
|
}
|
|
737
|
-
if (
|
|
738
|
-
let
|
|
739
|
-
for (;
|
|
740
|
-
if (n[
|
|
741
|
-
|
|
833
|
+
if (s === "`") {
|
|
834
|
+
let r = l + 1;
|
|
835
|
+
for (; r < e; ) {
|
|
836
|
+
if (n[r] === "\\") {
|
|
837
|
+
r += 2;
|
|
742
838
|
continue;
|
|
743
839
|
}
|
|
744
|
-
if (n[
|
|
745
|
-
|
|
840
|
+
if (n[r] === "`") {
|
|
841
|
+
r++;
|
|
746
842
|
break;
|
|
747
843
|
}
|
|
748
|
-
|
|
844
|
+
r++;
|
|
749
845
|
}
|
|
750
|
-
o.push({ start:
|
|
846
|
+
o.push({ start: l, end: r, type: "template" }), l = r;
|
|
751
847
|
continue;
|
|
752
848
|
}
|
|
753
|
-
if (/[0-9]/.test(
|
|
754
|
-
let
|
|
755
|
-
for (;
|
|
756
|
-
o.push({ start:
|
|
849
|
+
if (/[0-9]/.test(s) || s === "." && /[0-9]/.test(d ?? "")) {
|
|
850
|
+
let r = l + 1;
|
|
851
|
+
for (; r < e && /[\w.]/.test(n[r]); ) r++;
|
|
852
|
+
o.push({ start: l, end: r, type: "number" }), l = r;
|
|
757
853
|
continue;
|
|
758
854
|
}
|
|
759
|
-
if (
|
|
760
|
-
let
|
|
761
|
-
for (;
|
|
762
|
-
const
|
|
763
|
-
o.push({ start:
|
|
855
|
+
if (ct.test(s)) {
|
|
856
|
+
let r = l + 1;
|
|
857
|
+
for (; r < e && xn.test(n[r]); ) r++;
|
|
858
|
+
const f = n.slice(l, r), T = a.keywords.has(f) ? "keyword" : a.builtins.has(f) ? "builtin" : "identifier";
|
|
859
|
+
o.push({ start: l, end: r, type: T }), l = r;
|
|
764
860
|
continue;
|
|
765
861
|
}
|
|
766
|
-
let u =
|
|
862
|
+
let u = l + 1;
|
|
767
863
|
for (; u < e; ) {
|
|
768
|
-
const
|
|
769
|
-
if (
|
|
864
|
+
const r = n[u];
|
|
865
|
+
if (ut.test(r) || ct.test(r) || /[0-9]/.test(r) || r === '"' || r === "'" || r === "`" || r === "/") break;
|
|
770
866
|
u++;
|
|
771
867
|
}
|
|
772
|
-
o.push({ start:
|
|
868
|
+
o.push({ start: l, end: u, type: "punctuation" }), l = u;
|
|
773
869
|
}
|
|
774
870
|
return o;
|
|
775
871
|
}
|
|
776
|
-
const
|
|
872
|
+
const Tn = {
|
|
777
873
|
"&": "&",
|
|
778
874
|
"<": "<",
|
|
779
875
|
">": ">"
|
|
780
876
|
};
|
|
781
|
-
function
|
|
782
|
-
return n.replace(/[&<>]/g, (
|
|
877
|
+
function J(n) {
|
|
878
|
+
return n.replace(/[&<>]/g, (a) => Tn[a] ?? a);
|
|
783
879
|
}
|
|
784
|
-
function
|
|
785
|
-
let e = "",
|
|
786
|
-
for (const
|
|
787
|
-
|
|
788
|
-
const
|
|
789
|
-
e += `<span class="tok-${
|
|
880
|
+
function ge(n, a, o = 0) {
|
|
881
|
+
let e = "", l = 0;
|
|
882
|
+
for (const s of a) {
|
|
883
|
+
s.start > l && (e += J(n.slice(l, s.start)));
|
|
884
|
+
const d = J(n.slice(s.start, s.end));
|
|
885
|
+
e += `<span class="tok-${s.type}" data-start="${s.start + o}" data-end="${s.end + o}">${d}</span>`, l = s.end;
|
|
790
886
|
}
|
|
791
|
-
return
|
|
887
|
+
return l < n.length && (e += J(n.slice(l))), e;
|
|
792
888
|
}
|
|
793
|
-
function
|
|
794
|
-
if (!o || !e) return
|
|
795
|
-
let
|
|
796
|
-
for (;
|
|
797
|
-
const
|
|
798
|
-
if (
|
|
799
|
-
|
|
889
|
+
function $n(n, a, o, e) {
|
|
890
|
+
if (!o || !e) return ge(n, he(n, a));
|
|
891
|
+
let l = "", s = 0;
|
|
892
|
+
for (; s < n.length; ) {
|
|
893
|
+
const d = n.indexOf(o, s);
|
|
894
|
+
if (d === -1) {
|
|
895
|
+
l += J(n.slice(s));
|
|
800
896
|
break;
|
|
801
897
|
}
|
|
802
|
-
|
|
803
|
-
const u = n.indexOf(e,
|
|
804
|
-
|
|
898
|
+
l += J(n.slice(s, d));
|
|
899
|
+
const u = n.indexOf(e, d + o.length), r = u === -1 ? n.length : u, f = n.slice(d + o.length, r);
|
|
900
|
+
l += `<span class="tok-brace">${J(o)}</span>`, l += ge(f, he(f, a), d + o.length), u === -1 ? s = r : (l += `<span class="tok-brace">${J(e)}</span>`, s = u + e.length);
|
|
805
901
|
}
|
|
806
|
-
return
|
|
902
|
+
return l;
|
|
807
903
|
}
|
|
808
|
-
const
|
|
904
|
+
const Sn = {
|
|
809
905
|
key: 0,
|
|
810
906
|
class: "gutter",
|
|
811
907
|
"aria-hidden": "true"
|
|
812
|
-
},
|
|
908
|
+
}, Cn = ["innerHTML"], En = ["value", "readonly", "placeholder"], Mn = ["onMouseenter", "onClick"], Rn = { class: "popup-label" }, In = {
|
|
813
909
|
key: 0,
|
|
814
910
|
class: "popup-detail"
|
|
815
|
-
},
|
|
911
|
+
}, Ln = { class: "hover-head" }, Hn = { class: "hover-name" }, _n = {
|
|
816
912
|
key: 0,
|
|
817
913
|
class: "hover-colon"
|
|
818
|
-
},
|
|
914
|
+
}, An = {
|
|
819
915
|
key: 0,
|
|
820
916
|
class: "hover-type"
|
|
821
|
-
},
|
|
917
|
+
}, Bn = {
|
|
822
918
|
key: 0,
|
|
823
919
|
class: "hover-doc"
|
|
824
|
-
},
|
|
920
|
+
}, On = {
|
|
825
921
|
key: 1,
|
|
826
922
|
class: "hover-def"
|
|
827
|
-
},
|
|
923
|
+
}, Fn = ["innerHTML"], Nn = ["title", "aria-label"], Wn = {
|
|
828
924
|
key: 0,
|
|
829
925
|
viewBox: "0 0 16 16",
|
|
830
926
|
width: "14",
|
|
831
927
|
height: "14",
|
|
832
928
|
"aria-hidden": "true"
|
|
833
|
-
},
|
|
929
|
+
}, jn = {
|
|
834
930
|
key: 1,
|
|
835
931
|
viewBox: "0 0 16 16",
|
|
836
932
|
width: "14",
|
|
837
933
|
height: "14",
|
|
838
934
|
"aria-hidden": "true"
|
|
839
|
-
},
|
|
935
|
+
}, Dn = /* @__PURE__ */ zt({
|
|
840
936
|
__name: "CodeEditor",
|
|
841
937
|
props: {
|
|
842
938
|
modelValue: {},
|
|
@@ -845,6 +941,8 @@ const hn = {
|
|
|
845
941
|
completions: { default: () => [] },
|
|
846
942
|
tsTypes: { default: "" },
|
|
847
943
|
completionFilter: {},
|
|
944
|
+
allowedKeywords: {},
|
|
945
|
+
allowedBuiltins: {},
|
|
848
946
|
templateCompletions: { default: () => [] },
|
|
849
947
|
templateOpen: { default: "{{" },
|
|
850
948
|
templateClose: { default: "}}" },
|
|
@@ -863,15 +961,15 @@ const hn = {
|
|
|
863
961
|
minHeight: { default: "260px" }
|
|
864
962
|
},
|
|
865
963
|
emits: ["update:modelValue", "change", "expand", "collapse"],
|
|
866
|
-
setup(n, { expose:
|
|
867
|
-
const e = n,
|
|
964
|
+
setup(n, { expose: a, emit: o }) {
|
|
965
|
+
const e = n, l = o, s = {
|
|
868
966
|
variable: "变量",
|
|
869
967
|
function: "函数",
|
|
870
968
|
property: "属性",
|
|
871
969
|
class: "对象",
|
|
872
970
|
keyword: "关键字",
|
|
873
971
|
value: "值"
|
|
874
|
-
},
|
|
972
|
+
}, d = {
|
|
875
973
|
"(": ")",
|
|
876
974
|
"[": "]",
|
|
877
975
|
"{": "}",
|
|
@@ -886,189 +984,185 @@ const hn = {
|
|
|
886
984
|
"End",
|
|
887
985
|
"PageUp",
|
|
888
986
|
"PageDown"
|
|
889
|
-
]),
|
|
890
|
-
() => e.tsTypes ?
|
|
891
|
-
),
|
|
892
|
-
() => e.tsTypes ?
|
|
893
|
-
),
|
|
894
|
-
...
|
|
895
|
-
|
|
896
|
-
...e.completions
|
|
897
|
-
]), ve = q(
|
|
898
|
-
() => e.mode === "template" ? [...e.templateCompletions, ...Ie.value] : Ie.value
|
|
899
|
-
), vt = q(() => {
|
|
987
|
+
]), r = E(e.modelValue), f = E(), T = E(), j = E(), C = E(), g = E(), k = E(), N = E(), F = E([]), M = E(0), w = E(!1), $ = E({ start: 0, end: 0 }), H = E({}), h = E(null), re = E({}), kt = K(
|
|
988
|
+
() => e.tsTypes ? kn(e.tsTypes) : []
|
|
989
|
+
), yt = K(
|
|
990
|
+
() => e.tsTypes ? yn(e.tsTypes) : /* @__PURE__ */ new Map()
|
|
991
|
+
), Le = K(() => [...e.allowedBuiltins ? Je.filter((i) => e.allowedBuiltins.includes(i.label)) : Je, ...kt.value, ...e.completions]), ve = K(
|
|
992
|
+
() => e.mode === "template" ? [...e.templateCompletions, ...Le.value] : Le.value
|
|
993
|
+
), wt = K(() => {
|
|
900
994
|
const t = {
|
|
901
|
-
keywords:
|
|
902
|
-
builtins: new Set(ve.value.map((
|
|
995
|
+
keywords: et(e.language),
|
|
996
|
+
builtins: new Set(ve.value.map((i) => i.label))
|
|
903
997
|
};
|
|
904
|
-
return e.mode === "template" ? `${
|
|
905
|
-
` : `${
|
|
998
|
+
return e.mode === "template" ? `${$n(r.value, t, e.templateOpen, e.templateClose)}
|
|
999
|
+
` : `${ge(r.value, he(r.value, t))}
|
|
906
1000
|
`;
|
|
907
|
-
}),
|
|
908
|
-
`).length),
|
|
1001
|
+
}), xt = K(() => r.value.split(`
|
|
1002
|
+
`).length), z = E(e.defaultExpanded), ke = E(!1), se = K(() => e.collapsible && !z.value), Tt = K(() => {
|
|
909
1003
|
const t = {};
|
|
910
1004
|
return e.collapsible && (t.height = e.collapsedHeight), t;
|
|
911
|
-
}),
|
|
1005
|
+
}), $t = K(() => {
|
|
912
1006
|
const t = {
|
|
913
1007
|
"--ce-radius": e.borderRadius,
|
|
914
1008
|
"--ce-collapsed-height": e.collapsedHeight
|
|
915
1009
|
};
|
|
916
|
-
return e.background && (t["--ce-bg"] = e.background), e.borderColor && (t["--ce-border"] = e.borderColor), e.collapsible ? { ...t, height:
|
|
1010
|
+
return e.background && (t["--ce-bg"] = e.background), e.borderColor && (t["--ce-border"] = e.borderColor), e.collapsible ? { ...t, height: z.value ? e.minHeight : e.collapsedHeight } : { ...t, height: e.minHeight };
|
|
917
1011
|
});
|
|
918
1012
|
let He = 0;
|
|
919
|
-
function
|
|
920
|
-
if (
|
|
921
|
-
const
|
|
922
|
-
t &&
|
|
923
|
-
if (
|
|
924
|
-
const c = Math.max(0,
|
|
925
|
-
|
|
1013
|
+
function _e(t) {
|
|
1014
|
+
if (z.value === t) return;
|
|
1015
|
+
const i = f.value;
|
|
1016
|
+
t && i && (He = i.scrollTop), z.value = t, e.collapsible && (ke.value = !0), l(t ? "expand" : "collapse"), _(), P(), V(() => {
|
|
1017
|
+
if (ye(), !z.value && i) {
|
|
1018
|
+
const c = Math.max(0, i.scrollHeight - i.clientHeight);
|
|
1019
|
+
i.scrollTop = Math.max(0, Math.min(He, c)), D(!0), document.activeElement === i && G();
|
|
926
1020
|
return;
|
|
927
1021
|
}
|
|
928
|
-
|
|
1022
|
+
D(!0), t && e.collapseOnBlur && i && document.activeElement !== i && i.focus();
|
|
929
1023
|
});
|
|
930
1024
|
}
|
|
931
|
-
function
|
|
932
|
-
|
|
1025
|
+
function St() {
|
|
1026
|
+
ke.value = !1;
|
|
933
1027
|
}
|
|
934
|
-
function
|
|
935
|
-
|
|
1028
|
+
function Ct() {
|
|
1029
|
+
_e(!z.value);
|
|
936
1030
|
}
|
|
937
|
-
|
|
1031
|
+
Ue(
|
|
938
1032
|
() => e.modelValue,
|
|
939
1033
|
(t) => {
|
|
940
|
-
t !==
|
|
1034
|
+
t !== r.value && (r.value = t, _());
|
|
941
1035
|
}
|
|
942
|
-
),
|
|
943
|
-
V(() =>
|
|
1036
|
+
), Ue(r, () => {
|
|
1037
|
+
V(() => D(!0));
|
|
944
1038
|
});
|
|
945
|
-
function
|
|
946
|
-
return
|
|
1039
|
+
function Ae(t) {
|
|
1040
|
+
return s[t];
|
|
947
1041
|
}
|
|
948
|
-
function
|
|
949
|
-
return t ?
|
|
1042
|
+
function Et(t) {
|
|
1043
|
+
return t ? ge(
|
|
950
1044
|
t,
|
|
951
|
-
|
|
1045
|
+
he(t, { keywords: et("typescript"), builtins: /* @__PURE__ */ new Set() })
|
|
952
1046
|
) : "";
|
|
953
1047
|
}
|
|
954
|
-
let
|
|
955
|
-
function
|
|
956
|
-
const t =
|
|
1048
|
+
let Q = { top: 14, bottom: 14, left: 16, right: 16, lineHeight: 22 };
|
|
1049
|
+
function ye() {
|
|
1050
|
+
const t = f.value;
|
|
957
1051
|
if (!t) return;
|
|
958
|
-
const
|
|
959
|
-
|
|
960
|
-
top: parseFloat(
|
|
961
|
-
bottom: parseFloat(
|
|
962
|
-
left: parseFloat(
|
|
963
|
-
right: parseFloat(
|
|
964
|
-
lineHeight: parseFloat(
|
|
1052
|
+
const i = window.getComputedStyle(t);
|
|
1053
|
+
Q = {
|
|
1054
|
+
top: parseFloat(i.paddingTop) || 0,
|
|
1055
|
+
bottom: parseFloat(i.paddingBottom) || 0,
|
|
1056
|
+
left: parseFloat(i.paddingLeft) || 0,
|
|
1057
|
+
right: parseFloat(i.paddingRight) || 0,
|
|
1058
|
+
lineHeight: parseFloat(i.lineHeight) || 22
|
|
965
1059
|
};
|
|
966
1060
|
}
|
|
967
|
-
function
|
|
968
|
-
const
|
|
969
|
-
if (!
|
|
970
|
-
const c =
|
|
971
|
-
if (c && (c.style.transform = `translate(${-
|
|
972
|
-
const p = `${
|
|
973
|
-
p !==
|
|
1061
|
+
function D(t = !1) {
|
|
1062
|
+
const i = f.value;
|
|
1063
|
+
if (!i) return;
|
|
1064
|
+
const c = C.value;
|
|
1065
|
+
if (c && (c.style.transform = `translate(${-i.scrollLeft}px, ${-i.scrollTop}px)`), g.value && (g.value.style.transform = `translateY(${-i.scrollTop}px)`), t) {
|
|
1066
|
+
const p = `${r.value}|${e.mode}|${i.clientWidth}|${i.clientHeight}`;
|
|
1067
|
+
p !== Oe && (Oe = p, Mt());
|
|
974
1068
|
}
|
|
975
1069
|
}
|
|
976
|
-
function
|
|
977
|
-
const t =
|
|
1070
|
+
function G() {
|
|
1071
|
+
const t = f.value;
|
|
978
1072
|
if (!t) return;
|
|
979
|
-
const
|
|
980
|
-
if (!
|
|
981
|
-
const c = t.getBoundingClientRect(), p = t.offsetWidth ? c.width / t.offsetWidth : 1,
|
|
982
|
-
let
|
|
983
|
-
if (
|
|
984
|
-
const me = m - x -
|
|
985
|
-
|
|
1073
|
+
const i = Fe();
|
|
1074
|
+
if (!i) return;
|
|
1075
|
+
const c = t.getBoundingClientRect(), p = t.offsetWidth ? c.width / t.offsetWidth : 1, b = t.offsetHeight ? c.height / t.offsetHeight : 1, m = t.clientHeight * b, x = Q.top * b, y = Q.bottom * b, v = i.lineHeight * b, S = t.scrollTop * b, B = Math.max(0, t.scrollHeight * b - m), W = (se.value ? 8 : 14) * b;
|
|
1076
|
+
let R = t.scrollTop;
|
|
1077
|
+
if (se.value) {
|
|
1078
|
+
const me = m - x - y, ie = i.top + S - x - Math.max(0, (me - v) / 2);
|
|
1079
|
+
R = Math.max(0, Math.min(ie, B)) / b;
|
|
986
1080
|
} else {
|
|
987
|
-
const me = x, Ee = m -
|
|
988
|
-
let
|
|
989
|
-
|
|
1081
|
+
const me = x, Ee = m - y, ie = i.top, Ze = ie + v;
|
|
1082
|
+
let Me = S;
|
|
1083
|
+
ie < me + W ? Me = S + (ie - me - W) : Ze > Ee - W && (Me = S + (Ze - Ee + W)), R = Math.max(0, Math.min(Me, B)) / b;
|
|
990
1084
|
}
|
|
991
|
-
const O = t.clientWidth * p, te =
|
|
1085
|
+
const O = t.clientWidth * p, te = Q.left * p, U = Q.right * p, Ce = t.scrollLeft * p, de = i.left + Ce, Dt = Ce + te, Pt = Ce + O - U, fe = 8 * p;
|
|
992
1086
|
let pe = t.scrollLeft;
|
|
993
|
-
de <
|
|
994
|
-
const
|
|
995
|
-
!
|
|
996
|
-
}
|
|
997
|
-
let
|
|
998
|
-
function
|
|
999
|
-
const t =
|
|
1000
|
-
if (!t || !
|
|
1087
|
+
de < Dt + fe ? pe = Math.max(0, (de - te - fe) / p) : de > Pt - fe && (pe = Math.max(0, (de - te - O + U + fe) / p));
|
|
1088
|
+
const Ke = Math.abs(R - t.scrollTop) > 0.5, qe = Math.abs(pe - t.scrollLeft) > 0.5;
|
|
1089
|
+
!Ke && !qe || (Ke && (t.scrollTop = R), qe && (t.scrollLeft = pe), D());
|
|
1090
|
+
}
|
|
1091
|
+
let Be = [], Oe = "", ce = 0, we = -1, xe = -1, Te = { x: 0, y: 0 };
|
|
1092
|
+
function Mt() {
|
|
1093
|
+
const t = f.value, i = j.value;
|
|
1094
|
+
if (!t || !i) return;
|
|
1001
1095
|
const c = t.getBoundingClientRect(), p = [];
|
|
1002
|
-
|
|
1003
|
-
const m =
|
|
1096
|
+
i.querySelectorAll("[data-start]").forEach((b) => {
|
|
1097
|
+
const m = b.getBoundingClientRect();
|
|
1004
1098
|
p.push({
|
|
1005
|
-
start: Number(
|
|
1006
|
-
end: Number(
|
|
1099
|
+
start: Number(b.dataset.start),
|
|
1100
|
+
end: Number(b.dataset.end),
|
|
1007
1101
|
left: m.left - c.left + t.scrollLeft,
|
|
1008
1102
|
right: m.right - c.left + t.scrollLeft,
|
|
1009
1103
|
top: m.top - c.top + t.scrollTop,
|
|
1010
1104
|
bottom: m.bottom - c.top + t.scrollTop
|
|
1011
1105
|
});
|
|
1012
|
-
}),
|
|
1106
|
+
}), Be = p;
|
|
1013
1107
|
}
|
|
1014
|
-
function
|
|
1015
|
-
for (const c of
|
|
1016
|
-
if (t >= c.left - 1 && t <= c.right + 1 &&
|
|
1108
|
+
function Rt(t, i) {
|
|
1109
|
+
for (const c of Be)
|
|
1110
|
+
if (t >= c.left - 1 && t <= c.right + 1 && i >= c.top && i <= c.bottom)
|
|
1017
1111
|
return c;
|
|
1018
1112
|
return null;
|
|
1019
1113
|
}
|
|
1020
|
-
function
|
|
1021
|
-
|
|
1114
|
+
function P() {
|
|
1115
|
+
h.value = null, ce = 0, we = -1, xe = -1;
|
|
1022
1116
|
}
|
|
1023
|
-
function
|
|
1024
|
-
const
|
|
1025
|
-
if (!
|
|
1026
|
-
const p = c.getBoundingClientRect(),
|
|
1027
|
-
let
|
|
1028
|
-
|
|
1029
|
-
}
|
|
1030
|
-
function
|
|
1031
|
-
const c =
|
|
1117
|
+
function It(t) {
|
|
1118
|
+
const i = N.value, c = f.value;
|
|
1119
|
+
if (!i || !c) return;
|
|
1120
|
+
const p = c.getBoundingClientRect(), b = p.left + t.left - c.scrollLeft, m = p.left + t.right - c.scrollLeft, x = p.top + t.top - c.scrollTop, y = p.top + t.bottom - c.scrollTop, v = 12, S = 8, B = i.offsetWidth, W = i.offsetHeight;
|
|
1121
|
+
let R = b, O = y + S;
|
|
1122
|
+
R + B > window.innerWidth - v && (R = m - B), O + W > window.innerHeight - v && (O = x - W - S), R = Math.max(v, Math.min(R, window.innerWidth - v - B)), O = Math.max(v, O), re.value = { left: `${R}px`, top: `${O}px` };
|
|
1123
|
+
}
|
|
1124
|
+
function Lt(t, i) {
|
|
1125
|
+
const c = f.value;
|
|
1032
1126
|
if (!c || e.readonly || !e.hover || w.value) {
|
|
1033
|
-
|
|
1127
|
+
P();
|
|
1034
1128
|
return;
|
|
1035
1129
|
}
|
|
1036
1130
|
if (c.selectionStart !== c.selectionEnd) {
|
|
1037
|
-
|
|
1131
|
+
P();
|
|
1038
1132
|
return;
|
|
1039
1133
|
}
|
|
1040
|
-
const p =
|
|
1041
|
-
if (
|
|
1042
|
-
const
|
|
1043
|
-
if (t >=
|
|
1134
|
+
const p = N.value;
|
|
1135
|
+
if (h.value && p) {
|
|
1136
|
+
const y = p.getBoundingClientRect();
|
|
1137
|
+
if (t >= y.left && t <= y.right && i >= y.top && i <= y.bottom)
|
|
1044
1138
|
return;
|
|
1045
1139
|
}
|
|
1046
|
-
const
|
|
1140
|
+
const b = c.getBoundingClientRect(), m = Rt(t - b.left + c.scrollLeft, i - b.top + c.scrollTop);
|
|
1047
1141
|
if (!m) {
|
|
1048
|
-
|
|
1142
|
+
P();
|
|
1049
1143
|
return;
|
|
1050
1144
|
}
|
|
1051
|
-
if (
|
|
1145
|
+
if (h.value && we === m.start && xe === m.end)
|
|
1052
1146
|
return;
|
|
1053
|
-
const x =
|
|
1147
|
+
const x = dn(c.value, m.start, m.end, {
|
|
1054
1148
|
completions: ve.value,
|
|
1055
|
-
declared:
|
|
1149
|
+
declared: it(c.value, m.start)
|
|
1056
1150
|
});
|
|
1057
1151
|
if (!x) {
|
|
1058
|
-
|
|
1152
|
+
P();
|
|
1059
1153
|
return;
|
|
1060
1154
|
}
|
|
1061
|
-
|
|
1155
|
+
h.value = x, we = m.start, xe = m.end, V(() => It(m));
|
|
1062
1156
|
}
|
|
1063
|
-
function
|
|
1157
|
+
function Ht(t) {
|
|
1064
1158
|
Te = { x: t.clientX, y: t.clientY }, !ce && (ce = requestAnimationFrame(() => {
|
|
1065
|
-
ce = 0,
|
|
1159
|
+
ce = 0, Lt(Te.x, Te.y);
|
|
1066
1160
|
}));
|
|
1067
1161
|
}
|
|
1068
|
-
function
|
|
1069
|
-
const t =
|
|
1162
|
+
function Fe() {
|
|
1163
|
+
const t = f.value;
|
|
1070
1164
|
if (!t) return null;
|
|
1071
|
-
const
|
|
1165
|
+
const i = window.getComputedStyle(t), c = document.createElement("div"), p = parseFloat(i.paddingLeft) || 0, b = parseFloat(i.paddingRight) || 0, m = t.getBoundingClientRect();
|
|
1072
1166
|
Object.assign(c.style, {
|
|
1073
1167
|
position: "fixed",
|
|
1074
1168
|
left: `${m.left}px`,
|
|
@@ -1076,99 +1170,100 @@ const hn = {
|
|
|
1076
1170
|
visibility: "hidden",
|
|
1077
1171
|
pointerEvents: "none",
|
|
1078
1172
|
zIndex: "-1",
|
|
1079
|
-
whiteSpace:
|
|
1080
|
-
overflowWrap:
|
|
1081
|
-
wordBreak:
|
|
1173
|
+
whiteSpace: i.whiteSpace,
|
|
1174
|
+
overflowWrap: i.overflowWrap,
|
|
1175
|
+
wordBreak: i.wordBreak,
|
|
1082
1176
|
boxSizing: "content-box",
|
|
1083
|
-
width: `${t.clientWidth - p -
|
|
1084
|
-
paddingTop:
|
|
1085
|
-
paddingRight:
|
|
1086
|
-
paddingBottom:
|
|
1087
|
-
paddingLeft:
|
|
1177
|
+
width: `${t.clientWidth - p - b}px`,
|
|
1178
|
+
paddingTop: i.paddingTop,
|
|
1179
|
+
paddingRight: i.paddingRight,
|
|
1180
|
+
paddingBottom: i.paddingBottom,
|
|
1181
|
+
paddingLeft: i.paddingLeft,
|
|
1088
1182
|
border: "0",
|
|
1089
|
-
fontFamily:
|
|
1090
|
-
fontSize:
|
|
1091
|
-
fontWeight:
|
|
1092
|
-
fontStyle:
|
|
1093
|
-
fontVariant:
|
|
1094
|
-
letterSpacing:
|
|
1095
|
-
lineHeight:
|
|
1096
|
-
textTransform:
|
|
1097
|
-
tabSize:
|
|
1183
|
+
fontFamily: i.fontFamily,
|
|
1184
|
+
fontSize: i.fontSize,
|
|
1185
|
+
fontWeight: i.fontWeight,
|
|
1186
|
+
fontStyle: i.fontStyle,
|
|
1187
|
+
fontVariant: i.fontVariant,
|
|
1188
|
+
letterSpacing: i.letterSpacing,
|
|
1189
|
+
lineHeight: i.lineHeight,
|
|
1190
|
+
textTransform: i.textTransform,
|
|
1191
|
+
tabSize: i.tabSize
|
|
1098
1192
|
}), c.textContent = t.value.slice(0, t.selectionStart);
|
|
1099
1193
|
const x = document.createElement("span");
|
|
1100
1194
|
x.textContent = "", c.appendChild(x), document.body.appendChild(c);
|
|
1101
|
-
const
|
|
1195
|
+
const y = x.getBoundingClientRect();
|
|
1102
1196
|
document.body.removeChild(c);
|
|
1103
|
-
const
|
|
1197
|
+
const v = parseFloat(i.lineHeight) || 22, S = y.height, B = S > 0 && S < v ? (v - S) / 2 : 0;
|
|
1104
1198
|
return {
|
|
1105
|
-
left:
|
|
1106
|
-
top:
|
|
1107
|
-
lineHeight:
|
|
1199
|
+
left: y.left - m.left - t.scrollLeft,
|
|
1200
|
+
top: y.top - m.top - t.scrollTop - B,
|
|
1201
|
+
lineHeight: v
|
|
1108
1202
|
};
|
|
1109
1203
|
}
|
|
1110
1204
|
async function Ne() {
|
|
1111
1205
|
await V();
|
|
1112
|
-
const t = T.value,
|
|
1113
|
-
if (!t || !
|
|
1114
|
-
const p = 4,
|
|
1206
|
+
const t = T.value, i = k.value, c = Fe();
|
|
1207
|
+
if (!t || !i || !c) return;
|
|
1208
|
+
const p = 4, b = 8, m = window.innerWidth, x = window.innerHeight, y = t.getBoundingClientRect(), v = i.scrollHeight, S = x - (y.top + c.top + c.lineHeight) - p - b, B = y.top + c.top - p - b, W = S >= Math.min(v, 180) || S >= B, R = Math.min(248, Math.max(W ? S : B, 96)), O = Math.min(v, R), te = i.offsetWidth || 280;
|
|
1115
1209
|
let U = c.left;
|
|
1116
|
-
|
|
1210
|
+
y.left + U + te > m - b && (U = m - b - te - y.left), U = Math.max(U, b - y.left), H.value = {
|
|
1117
1211
|
left: `${U}px`,
|
|
1118
|
-
top: `${
|
|
1119
|
-
maxHeight: `${
|
|
1212
|
+
top: `${W ? c.top + c.lineHeight + p : c.top - p - O}px`,
|
|
1213
|
+
maxHeight: `${R}px`
|
|
1120
1214
|
};
|
|
1121
1215
|
}
|
|
1122
1216
|
function _() {
|
|
1123
|
-
w.value = !1,
|
|
1217
|
+
w.value = !1, F.value = [], M.value = 0, P();
|
|
1124
1218
|
}
|
|
1125
1219
|
function ne(t = !1) {
|
|
1126
|
-
var
|
|
1127
|
-
const
|
|
1128
|
-
if (!
|
|
1129
|
-
if (
|
|
1220
|
+
var y;
|
|
1221
|
+
const i = f.value;
|
|
1222
|
+
if (!i || e.readonly) return;
|
|
1223
|
+
if (i.selectionStart !== i.selectionEnd) {
|
|
1130
1224
|
_();
|
|
1131
1225
|
return;
|
|
1132
1226
|
}
|
|
1133
|
-
const c =
|
|
1227
|
+
const c = i.selectionStart;
|
|
1134
1228
|
let p = !t;
|
|
1135
|
-
const
|
|
1136
|
-
if (
|
|
1137
|
-
const
|
|
1138
|
-
if (
|
|
1139
|
-
const B =
|
|
1229
|
+
const b = en(i.value, c);
|
|
1230
|
+
if (b) {
|
|
1231
|
+
const v = (y = yt.value.get(b.functionName)) == null ? void 0 : y.params[b.paramIndex], S = (v == null ? void 0 : v.literals) ?? [];
|
|
1232
|
+
if (S.length) {
|
|
1233
|
+
const B = b.quote, W = S.map((O) => ({
|
|
1140
1234
|
label: `'${O}'`,
|
|
1141
1235
|
kind: "value",
|
|
1142
|
-
detail:
|
|
1236
|
+
detail: v == null ? void 0 : v.type,
|
|
1143
1237
|
insertText: B ? O : `'${O}'`
|
|
1144
|
-
})),
|
|
1145
|
-
if (
|
|
1146
|
-
|
|
1147
|
-
start: B ?
|
|
1238
|
+
})), R = mt(W, b.prefix);
|
|
1239
|
+
if (R.length) {
|
|
1240
|
+
F.value = R, $.value = {
|
|
1241
|
+
start: B ? b.replaceStart + 1 : b.replaceStart,
|
|
1148
1242
|
end: c
|
|
1149
|
-
},
|
|
1243
|
+
}, M.value = 0, w.value = !0, Ne();
|
|
1150
1244
|
return;
|
|
1151
1245
|
}
|
|
1152
1246
|
}
|
|
1153
1247
|
}
|
|
1154
1248
|
if (e.mode === "template") {
|
|
1155
|
-
const
|
|
1156
|
-
|
|
1249
|
+
const v = Re(
|
|
1250
|
+
i.value,
|
|
1157
1251
|
c,
|
|
1158
1252
|
e.templateOpen,
|
|
1159
1253
|
e.templateClose
|
|
1160
1254
|
);
|
|
1161
|
-
if (!
|
|
1255
|
+
if (!v) {
|
|
1162
1256
|
_();
|
|
1163
1257
|
return;
|
|
1164
1258
|
}
|
|
1165
|
-
t &&
|
|
1259
|
+
t && i.value.slice(v.start, c).trim() === "" && (p = !0);
|
|
1166
1260
|
}
|
|
1167
|
-
const m =
|
|
1261
|
+
const m = cn(i.value, c, {
|
|
1168
1262
|
language: e.language,
|
|
1169
1263
|
completions: ve.value,
|
|
1170
|
-
declared:
|
|
1171
|
-
auto: !p
|
|
1264
|
+
declared: it(i.value, c),
|
|
1265
|
+
auto: !p,
|
|
1266
|
+
keywords: e.allowedKeywords ? Ie(e.language).filter((v) => e.allowedKeywords.includes(v)) : void 0
|
|
1172
1267
|
});
|
|
1173
1268
|
if (!m) {
|
|
1174
1269
|
_();
|
|
@@ -1176,11 +1271,11 @@ const hn = {
|
|
|
1176
1271
|
}
|
|
1177
1272
|
let x = m.items;
|
|
1178
1273
|
if (e.completionFilter) {
|
|
1179
|
-
const
|
|
1274
|
+
const v = ft(i.value, c);
|
|
1180
1275
|
if (x = e.completionFilter(x, {
|
|
1181
|
-
prefix:
|
|
1182
|
-
chain:
|
|
1183
|
-
text:
|
|
1276
|
+
prefix: v.prefix,
|
|
1277
|
+
chain: v.chain,
|
|
1278
|
+
text: i.value,
|
|
1184
1279
|
position: c,
|
|
1185
1280
|
mode: e.mode,
|
|
1186
1281
|
language: e.language
|
|
@@ -1189,63 +1284,63 @@ const hn = {
|
|
|
1189
1284
|
return;
|
|
1190
1285
|
}
|
|
1191
1286
|
}
|
|
1192
|
-
|
|
1287
|
+
F.value = x, $.value = { start: m.start, end: m.end }, M.value = 0, w.value = !0, Ne();
|
|
1193
1288
|
}
|
|
1194
|
-
function
|
|
1195
|
-
|
|
1196
|
-
}
|
|
1197
|
-
function ue(t,
|
|
1198
|
-
const
|
|
1199
|
-
if (!
|
|
1200
|
-
const m =
|
|
1201
|
-
|
|
1202
|
-
|
|
1289
|
+
function _t(t) {
|
|
1290
|
+
r.value = t, l("update:modelValue", t), l("change", t);
|
|
1291
|
+
}
|
|
1292
|
+
function ue(t, i, c, p = t + c.length) {
|
|
1293
|
+
const b = f.value;
|
|
1294
|
+
if (!b) return;
|
|
1295
|
+
const m = b.value.slice(0, t) + c + b.value.slice(i);
|
|
1296
|
+
_t(m), _(), V(() => {
|
|
1297
|
+
b.value = m, b.setSelectionRange(p, p), b.focus(), D(!0), G();
|
|
1203
1298
|
});
|
|
1204
1299
|
}
|
|
1205
|
-
function We(t =
|
|
1300
|
+
function We(t = F.value[M.value]) {
|
|
1206
1301
|
if (!t) return;
|
|
1207
|
-
const
|
|
1208
|
-
ue($.value.start, $.value.end,
|
|
1302
|
+
const i = t.insertText ?? t.label;
|
|
1303
|
+
ue($.value.start, $.value.end, i), _();
|
|
1209
1304
|
}
|
|
1210
|
-
function
|
|
1211
|
-
const
|
|
1212
|
-
|
|
1305
|
+
function je(t) {
|
|
1306
|
+
const i = F.value.length;
|
|
1307
|
+
i && (M.value = (M.value + t + i) % i, V(() => {
|
|
1213
1308
|
var c, p;
|
|
1214
|
-
(p = (c =
|
|
1309
|
+
(p = (c = k.value) == null ? void 0 : c.querySelector(".is-active")) == null || p.scrollIntoView({ block: "nearest" });
|
|
1215
1310
|
}));
|
|
1216
1311
|
}
|
|
1217
|
-
function
|
|
1218
|
-
const
|
|
1219
|
-
|
|
1312
|
+
function At(t) {
|
|
1313
|
+
const i = t.target;
|
|
1314
|
+
r.value = i.value, l("update:modelValue", i.value), l("change", i.value), P(), D(), G(), V(G), ne(!0);
|
|
1220
1315
|
}
|
|
1221
|
-
function
|
|
1222
|
-
if (_(),
|
|
1223
|
-
const
|
|
1224
|
-
|
|
1316
|
+
function Bt(t) {
|
|
1317
|
+
if (_(), P(), !e.collapsible || !e.collapseOnBlur || !z.value) return;
|
|
1318
|
+
const i = t.relatedTarget;
|
|
1319
|
+
i && i.closest(".expand-toggle") || _e(!1);
|
|
1225
1320
|
}
|
|
1226
|
-
function
|
|
1227
|
-
De(),
|
|
1321
|
+
function Ot() {
|
|
1322
|
+
De(), G();
|
|
1228
1323
|
}
|
|
1229
1324
|
function De() {
|
|
1230
|
-
const t =
|
|
1325
|
+
const t = f.value;
|
|
1231
1326
|
if (!t || e.readonly) return;
|
|
1232
1327
|
if (t.selectionStart !== t.selectionEnd) {
|
|
1233
1328
|
_();
|
|
1234
1329
|
return;
|
|
1235
1330
|
}
|
|
1236
|
-
const
|
|
1237
|
-
if (
|
|
1331
|
+
const i = t.selectionStart;
|
|
1332
|
+
if (i > 0 && t.value[i - 1] === ".") {
|
|
1238
1333
|
ne(!0);
|
|
1239
1334
|
return;
|
|
1240
1335
|
}
|
|
1241
1336
|
if (e.mode === "template") {
|
|
1242
|
-
const c =
|
|
1337
|
+
const c = Re(
|
|
1243
1338
|
t.value,
|
|
1244
|
-
|
|
1339
|
+
i,
|
|
1245
1340
|
e.templateOpen,
|
|
1246
1341
|
e.templateClose
|
|
1247
1342
|
);
|
|
1248
|
-
if (c && t.value.slice(c.start,
|
|
1343
|
+
if (c && t.value.slice(c.start, i).trim() === "") {
|
|
1249
1344
|
ne(!0);
|
|
1250
1345
|
return;
|
|
1251
1346
|
}
|
|
@@ -1253,33 +1348,33 @@ const hn = {
|
|
|
1253
1348
|
_();
|
|
1254
1349
|
}
|
|
1255
1350
|
let $e = 0;
|
|
1256
|
-
function
|
|
1351
|
+
function Pe() {
|
|
1257
1352
|
window.clearTimeout($e), $e = window.setTimeout(() => {
|
|
1258
|
-
$e = 0, De(),
|
|
1353
|
+
$e = 0, De(), G();
|
|
1259
1354
|
}, 0);
|
|
1260
1355
|
}
|
|
1261
|
-
function
|
|
1262
|
-
t.target !==
|
|
1356
|
+
function ze(t) {
|
|
1357
|
+
t.target !== f.value && w.value && _();
|
|
1263
1358
|
}
|
|
1264
|
-
function
|
|
1265
|
-
|
|
1359
|
+
function Ft() {
|
|
1360
|
+
P(), D(), se.value && Nt();
|
|
1266
1361
|
}
|
|
1267
|
-
let
|
|
1268
|
-
function
|
|
1269
|
-
window.clearTimeout(
|
|
1270
|
-
|
|
1362
|
+
let Se = 0;
|
|
1363
|
+
function Nt() {
|
|
1364
|
+
window.clearTimeout(Se), Se = window.setTimeout(() => {
|
|
1365
|
+
Se = 0, Wt();
|
|
1271
1366
|
}, 120);
|
|
1272
1367
|
}
|
|
1273
|
-
function
|
|
1274
|
-
const t =
|
|
1368
|
+
function Wt() {
|
|
1369
|
+
const t = f.value;
|
|
1275
1370
|
if (!t) return;
|
|
1276
|
-
const
|
|
1277
|
-
Math.abs(p - c) < 0.5 || (t.scrollTop = p,
|
|
1371
|
+
const i = Q.lineHeight, c = t.scrollTop, p = Math.round(c / i) * i;
|
|
1372
|
+
Math.abs(p - c) < 0.5 || (t.scrollTop = p, D());
|
|
1278
1373
|
}
|
|
1279
|
-
function
|
|
1280
|
-
var
|
|
1281
|
-
const
|
|
1282
|
-
if (!
|
|
1374
|
+
function jt(t) {
|
|
1375
|
+
var b;
|
|
1376
|
+
const i = f.value;
|
|
1377
|
+
if (!i) return;
|
|
1283
1378
|
const c = t.metaKey || t.ctrlKey, p = u.has(t.key);
|
|
1284
1379
|
if (t.key === " " && c) {
|
|
1285
1380
|
t.preventDefault(), ne(!1);
|
|
@@ -1287,11 +1382,11 @@ const hn = {
|
|
|
1287
1382
|
}
|
|
1288
1383
|
if (w.value) {
|
|
1289
1384
|
if (t.key === "ArrowDown") {
|
|
1290
|
-
t.preventDefault(),
|
|
1385
|
+
t.preventDefault(), je(1);
|
|
1291
1386
|
return;
|
|
1292
1387
|
}
|
|
1293
1388
|
if (t.key === "ArrowUp") {
|
|
1294
|
-
t.preventDefault(),
|
|
1389
|
+
t.preventDefault(), je(-1);
|
|
1295
1390
|
return;
|
|
1296
1391
|
}
|
|
1297
1392
|
if (t.key === "Enter" || t.key === "Tab") {
|
|
@@ -1303,77 +1398,77 @@ const hn = {
|
|
|
1303
1398
|
return;
|
|
1304
1399
|
}
|
|
1305
1400
|
if (p || c) {
|
|
1306
|
-
_(), p && !c &&
|
|
1401
|
+
_(), p && !c && Pe();
|
|
1307
1402
|
return;
|
|
1308
1403
|
}
|
|
1309
1404
|
}
|
|
1310
1405
|
if (p && !c) {
|
|
1311
|
-
|
|
1406
|
+
Pe();
|
|
1312
1407
|
return;
|
|
1313
1408
|
}
|
|
1314
1409
|
if (t.key === "Enter" && !c && !t.shiftKey) {
|
|
1315
|
-
const m =
|
|
1316
|
-
if (m !==
|
|
1317
|
-
const x =
|
|
1318
|
-
`, m - 1) + 1,
|
|
1410
|
+
const m = i.selectionStart;
|
|
1411
|
+
if (m !== i.selectionEnd) return;
|
|
1412
|
+
const x = i.value.lastIndexOf(`
|
|
1413
|
+
`, m - 1) + 1, y = i.value.slice(x, m), v = ((b = y.match(/^[ \t]*/)) == null ? void 0 : b[0]) ?? "", S = /[{[(]$/.test(y.trimEnd()) ? " " : "";
|
|
1319
1414
|
t.preventDefault(), ue(m, m, `
|
|
1320
|
-
${
|
|
1415
|
+
${v}${S}`);
|
|
1321
1416
|
return;
|
|
1322
1417
|
}
|
|
1323
1418
|
if (t.key === "Tab") {
|
|
1324
|
-
t.preventDefault(), ue(
|
|
1419
|
+
t.preventDefault(), ue(i.selectionStart, i.selectionEnd, " ");
|
|
1325
1420
|
return;
|
|
1326
1421
|
}
|
|
1327
|
-
if (t.key.length === 1 && !c && !t.altKey &&
|
|
1328
|
-
if (
|
|
1329
|
-
const m =
|
|
1330
|
-
if ((t.key === '"' || t.key === "'") && x && /[\w$]/.test(x) ||
|
|
1331
|
-
t.preventDefault(), ue(m, m, t.key +
|
|
1422
|
+
if (t.key.length === 1 && !c && !t.altKey && d[t.key]) {
|
|
1423
|
+
if (i.selectionStart !== i.selectionEnd) return;
|
|
1424
|
+
const m = i.selectionStart, x = i.value[m - 1], y = i.value[m];
|
|
1425
|
+
if ((t.key === '"' || t.key === "'") && x && /[\w$]/.test(x) || y !== void 0 && !/[\s)\]},;:]/.test(y)) return;
|
|
1426
|
+
t.preventDefault(), ue(m, m, t.key + d[t.key], m + 1), V(() => ne(!0));
|
|
1332
1427
|
}
|
|
1333
1428
|
}
|
|
1334
|
-
function
|
|
1335
|
-
w.value && _(),
|
|
1336
|
-
|
|
1429
|
+
function Ve() {
|
|
1430
|
+
w.value && _(), P(), V(() => {
|
|
1431
|
+
ye(), D(!0);
|
|
1337
1432
|
});
|
|
1338
1433
|
}
|
|
1339
1434
|
let ee = null;
|
|
1340
|
-
return
|
|
1341
|
-
window.addEventListener("resize",
|
|
1342
|
-
|
|
1343
|
-
}), typeof ResizeObserver < "u" &&
|
|
1344
|
-
|
|
1345
|
-
}), ee.observe(
|
|
1346
|
-
}),
|
|
1347
|
-
window.removeEventListener("resize",
|
|
1348
|
-
}),
|
|
1435
|
+
return Vt(() => {
|
|
1436
|
+
window.addEventListener("resize", Ve), window.addEventListener("scroll", ze, !0), V(() => {
|
|
1437
|
+
ye(), D(!0);
|
|
1438
|
+
}), typeof ResizeObserver < "u" && f.value && (ee = new ResizeObserver(() => {
|
|
1439
|
+
D(!0), G();
|
|
1440
|
+
}), ee.observe(f.value));
|
|
1441
|
+
}), Kt(() => {
|
|
1442
|
+
window.removeEventListener("resize", Ve), window.removeEventListener("scroll", ze, !0), ee == null || ee.disconnect(), ee = null;
|
|
1443
|
+
}), a({ focus: () => {
|
|
1349
1444
|
var t;
|
|
1350
|
-
return (t =
|
|
1351
|
-
} }), (t,
|
|
1352
|
-
class:
|
|
1353
|
-
style:
|
|
1445
|
+
return (t = f.value) == null ? void 0 : t.focus();
|
|
1446
|
+
} }), (t, i) => (I(), L("div", {
|
|
1447
|
+
class: le(["code-input", { "is-collapsible": n.collapsible }]),
|
|
1448
|
+
style: be(Tt.value)
|
|
1354
1449
|
}, [
|
|
1355
1450
|
A("div", {
|
|
1356
|
-
class:
|
|
1451
|
+
class: le(["code-editor", {
|
|
1357
1452
|
"is-readonly": n.readonly,
|
|
1358
1453
|
"is-dark": n.theme === "dark",
|
|
1359
|
-
"is-collapsed":
|
|
1360
|
-
"is-expanding":
|
|
1454
|
+
"is-collapsed": se.value,
|
|
1455
|
+
"is-expanding": ke.value
|
|
1361
1456
|
}]),
|
|
1362
|
-
style:
|
|
1363
|
-
onAnimationend:
|
|
1457
|
+
style: be($t.value),
|
|
1458
|
+
onAnimationend: Ye(St, ["self"])
|
|
1364
1459
|
}, [
|
|
1365
|
-
n.lineNumbers ? (I(),
|
|
1460
|
+
n.lineNumbers ? (I(), L("div", Sn, [
|
|
1366
1461
|
A("div", {
|
|
1367
1462
|
ref_key: "gutterInner",
|
|
1368
|
-
ref:
|
|
1463
|
+
ref: g,
|
|
1369
1464
|
class: "gutter-inner code-font"
|
|
1370
1465
|
}, [
|
|
1371
|
-
(I(!0),
|
|
1466
|
+
(I(!0), L(Ge, null, Xe(xt.value, (c) => (I(), L("div", {
|
|
1372
1467
|
key: c,
|
|
1373
1468
|
class: "gutter-line"
|
|
1374
1469
|
}, Y(c), 1))), 128))
|
|
1375
1470
|
], 512)
|
|
1376
|
-
])) :
|
|
1471
|
+
])) : q("", !0),
|
|
1377
1472
|
A("div", {
|
|
1378
1473
|
ref_key: "stage",
|
|
1379
1474
|
ref: T,
|
|
@@ -1381,22 +1476,22 @@ ${y}${C}`);
|
|
|
1381
1476
|
}, [
|
|
1382
1477
|
A("div", {
|
|
1383
1478
|
ref_key: "highlightLayer",
|
|
1384
|
-
ref:
|
|
1479
|
+
ref: j,
|
|
1385
1480
|
class: "highlight code-font"
|
|
1386
1481
|
}, [
|
|
1387
1482
|
A("pre", {
|
|
1388
1483
|
ref_key: "highlightInner",
|
|
1389
|
-
ref:
|
|
1484
|
+
ref: C,
|
|
1390
1485
|
class: "code-font"
|
|
1391
1486
|
}, [
|
|
1392
|
-
A("code", { innerHTML:
|
|
1487
|
+
A("code", { innerHTML: wt.value }, null, 8, Cn)
|
|
1393
1488
|
], 512)
|
|
1394
1489
|
], 512),
|
|
1395
1490
|
A("textarea", {
|
|
1396
1491
|
ref_key: "textarea",
|
|
1397
|
-
ref:
|
|
1492
|
+
ref: f,
|
|
1398
1493
|
class: "code-font input",
|
|
1399
|
-
value:
|
|
1494
|
+
value: r.value,
|
|
1400
1495
|
readonly: n.readonly,
|
|
1401
1496
|
placeholder: n.placeholder,
|
|
1402
1497
|
spellcheck: "false",
|
|
@@ -1404,70 +1499,70 @@ ${y}${C}`);
|
|
|
1404
1499
|
autocapitalize: "off",
|
|
1405
1500
|
autocorrect: "off",
|
|
1406
1501
|
wrap: "off",
|
|
1407
|
-
onInput:
|
|
1408
|
-
onKeydown:
|
|
1409
|
-
onScroll:
|
|
1410
|
-
onClick:
|
|
1411
|
-
onMousemove:
|
|
1412
|
-
onMouseleave:
|
|
1413
|
-
onBlur:
|
|
1414
|
-
}, null, 40,
|
|
1415
|
-
w.value ? (I(),
|
|
1502
|
+
onInput: At,
|
|
1503
|
+
onKeydown: jt,
|
|
1504
|
+
onScroll: Ft,
|
|
1505
|
+
onClick: Ot,
|
|
1506
|
+
onMousemove: Ht,
|
|
1507
|
+
onMouseleave: P,
|
|
1508
|
+
onBlur: Bt
|
|
1509
|
+
}, null, 40, En),
|
|
1510
|
+
w.value ? (I(), L("ul", {
|
|
1416
1511
|
key: 0,
|
|
1417
1512
|
ref_key: "popup",
|
|
1418
|
-
ref:
|
|
1513
|
+
ref: k,
|
|
1419
1514
|
class: "popup",
|
|
1420
|
-
style:
|
|
1421
|
-
onMousedown:
|
|
1515
|
+
style: be(H.value),
|
|
1516
|
+
onMousedown: i[0] || (i[0] = Ye(() => {
|
|
1422
1517
|
}, ["prevent"]))
|
|
1423
1518
|
}, [
|
|
1424
|
-
(I(!0),
|
|
1519
|
+
(I(!0), L(Ge, null, Xe(F.value, (c, p) => (I(), L("li", {
|
|
1425
1520
|
key: `${c.label}-${p}`,
|
|
1426
|
-
class:
|
|
1427
|
-
onMouseenter: (
|
|
1428
|
-
onClick: (
|
|
1521
|
+
class: le(["popup-item", { "is-active": p === M.value }]),
|
|
1522
|
+
onMouseenter: (b) => M.value = p,
|
|
1523
|
+
onClick: (b) => We(c)
|
|
1429
1524
|
}, [
|
|
1430
1525
|
A("span", {
|
|
1431
|
-
class:
|
|
1432
|
-
}, Y(
|
|
1433
|
-
A("span",
|
|
1434
|
-
c.detail ? (I(),
|
|
1435
|
-
], 42,
|
|
1436
|
-
], 36)) :
|
|
1437
|
-
|
|
1526
|
+
class: le(["badge", `badge-${c.kind}`])
|
|
1527
|
+
}, Y(Ae(c.kind)), 3),
|
|
1528
|
+
A("span", Rn, Y(c.label), 1),
|
|
1529
|
+
c.detail ? (I(), L("span", In, Y(c.detail), 1)) : q("", !0)
|
|
1530
|
+
], 42, Mn))), 128))
|
|
1531
|
+
], 36)) : q("", !0),
|
|
1532
|
+
h.value ? (I(), L("div", {
|
|
1438
1533
|
key: 1,
|
|
1439
1534
|
ref_key: "hoverCard",
|
|
1440
|
-
ref:
|
|
1535
|
+
ref: N,
|
|
1441
1536
|
class: "hover-card",
|
|
1442
|
-
style:
|
|
1537
|
+
style: be(re.value)
|
|
1443
1538
|
}, [
|
|
1444
|
-
A("div",
|
|
1539
|
+
A("div", Ln, [
|
|
1445
1540
|
A("span", {
|
|
1446
|
-
class:
|
|
1447
|
-
}, Y(
|
|
1448
|
-
A("span",
|
|
1449
|
-
|
|
1450
|
-
|
|
1541
|
+
class: le(["badge", `badge-${h.value.kind}`])
|
|
1542
|
+
}, Y(Ae(h.value.kind)), 3),
|
|
1543
|
+
A("span", Hn, [
|
|
1544
|
+
qt(Y(h.value.label), 1),
|
|
1545
|
+
h.value.detail ? (I(), L("span", _n, ":")) : q("", !0)
|
|
1451
1546
|
]),
|
|
1452
|
-
|
|
1547
|
+
h.value.detail ? (I(), L("span", An, Y(h.value.detail), 1)) : q("", !0)
|
|
1453
1548
|
]),
|
|
1454
|
-
|
|
1455
|
-
|
|
1549
|
+
h.value.documentation ? (I(), L("p", Bn, Y(h.value.documentation), 1)) : q("", !0),
|
|
1550
|
+
h.value.type ? (I(), L("pre", On, [
|
|
1456
1551
|
A("code", {
|
|
1457
|
-
innerHTML:
|
|
1458
|
-
}, null, 8,
|
|
1459
|
-
])) :
|
|
1460
|
-
], 4)) :
|
|
1552
|
+
innerHTML: Et(h.value.type)
|
|
1553
|
+
}, null, 8, Fn)
|
|
1554
|
+
])) : q("", !0)
|
|
1555
|
+
], 4)) : q("", !0)
|
|
1461
1556
|
], 512),
|
|
1462
|
-
n.collapsible ? (I(),
|
|
1557
|
+
n.collapsible ? (I(), L("button", {
|
|
1463
1558
|
key: 1,
|
|
1464
1559
|
type: "button",
|
|
1465
1560
|
class: "expand-toggle",
|
|
1466
|
-
title:
|
|
1467
|
-
"aria-label":
|
|
1468
|
-
onClick:
|
|
1561
|
+
title: z.value ? "收起" : "展开",
|
|
1562
|
+
"aria-label": z.value ? "收起编辑器" : "展开编辑器",
|
|
1563
|
+
onClick: Ct
|
|
1469
1564
|
}, [
|
|
1470
|
-
|
|
1565
|
+
z.value ? (I(), L("svg", jn, [...i[2] || (i[2] = [
|
|
1471
1566
|
A("path", {
|
|
1472
1567
|
d: "M11 2 5 8 11 14",
|
|
1473
1568
|
fill: "none",
|
|
@@ -1476,7 +1571,7 @@ ${y}${C}`);
|
|
|
1476
1571
|
"stroke-linecap": "round",
|
|
1477
1572
|
"stroke-linejoin": "round"
|
|
1478
1573
|
}, null, -1)
|
|
1479
|
-
])])) : (I(),
|
|
1574
|
+
])])) : (I(), L("svg", Wn, [...i[1] || (i[1] = [
|
|
1480
1575
|
A("path", {
|
|
1481
1576
|
d: "M6 2 12 8 6 14",
|
|
1482
1577
|
fill: "none",
|
|
@@ -1486,35 +1581,36 @@ ${y}${C}`);
|
|
|
1486
1581
|
"stroke-linejoin": "round"
|
|
1487
1582
|
}, null, -1)
|
|
1488
1583
|
])]))
|
|
1489
|
-
], 8,
|
|
1584
|
+
], 8, Nn)) : q("", !0)
|
|
1490
1585
|
], 38)
|
|
1491
1586
|
], 6));
|
|
1492
1587
|
}
|
|
1493
|
-
}),
|
|
1588
|
+
}), Pn = (n, a) => {
|
|
1494
1589
|
const o = n.__vccOpts || n;
|
|
1495
|
-
for (const [e,
|
|
1496
|
-
o[e] =
|
|
1590
|
+
for (const [e, l] of a)
|
|
1591
|
+
o[e] = l;
|
|
1497
1592
|
return o;
|
|
1498
|
-
},
|
|
1593
|
+
}, zn = /* @__PURE__ */ Pn(Dn, [["__scopeId", "data-v-c6879e2c"]]), qn = {
|
|
1499
1594
|
install(n) {
|
|
1500
|
-
n.component("CodeInput",
|
|
1595
|
+
n.component("CodeInput", zn);
|
|
1501
1596
|
}
|
|
1502
1597
|
};
|
|
1503
1598
|
export {
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1599
|
+
zn as CodeEditor,
|
|
1600
|
+
cn as collectCompletions,
|
|
1601
|
+
qn as default,
|
|
1602
|
+
Je as defaultCompletions,
|
|
1603
|
+
en as findArgumentContext,
|
|
1604
|
+
Re as findTemplateRange,
|
|
1605
|
+
et as getKeywordSet,
|
|
1606
|
+
Ie as getKeywords,
|
|
1607
|
+
ge as highlight,
|
|
1608
|
+
$n as highlightTemplate,
|
|
1609
|
+
Kn as isInsideTemplate,
|
|
1610
|
+
Jt as literalMemberSet,
|
|
1611
|
+
kn as parseTsCompletions,
|
|
1612
|
+
yn as parseTsSignatures,
|
|
1613
|
+
dn as resolveHoverItem,
|
|
1614
|
+
it as scanDeclarations,
|
|
1615
|
+
he as tokenize
|
|
1520
1616
|
};
|