@simon_he/vue-tui 1.1.3 → 1.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{TMermaidText-frVr8Ysb.js → TMermaidText-wLnMMvVS.js} +1 -1
- package/dist/{TSelect-Dx34M1pF.js → TSelect-CMBOOFwK.js} +5 -5
- package/dist/{TTree-DdAjCPHu.js → TTree-kk8ntrpg.js} +6 -5
- package/dist/agent/mermaid.d.cts +2 -2
- package/dist/agent/mermaid.d.ts +2 -2
- package/dist/agent.cjs +538 -266
- package/dist/agent.js +25 -82
- package/dist/{block-source-Crro3mxi.js → block-source-D3YGTErb.js} +299 -239
- package/dist/cli.cjs +52 -15
- package/dist/cli.js +69 -14
- package/dist/core.js +3 -3
- package/dist/{hyperlink-_1FAj7Wq.js → create-terminal-Db_-UGVQ.js} +474 -102
- package/dist/{dom-renderer-DXx8fWzD.js → dom-renderer-BfwAEQMf.js} +3 -2
- package/dist/experimental.cjs +99 -66
- package/dist/experimental.js +20 -74
- package/dist/hyperlink-clbb_ha_.js +100 -0
- package/dist/index.js +8 -8
- package/dist/{linkify-BjI4zVfY.js → linkify-CL9wwnZN.js} +3 -3
- package/dist/markdown.cjs +521 -212
- package/dist/markdown.d.cts +3 -0
- package/dist/markdown.d.ts +3 -0
- package/dist/markdown.js +75 -8
- package/dist/math-image-BZhmfUeu.js +308 -0
- package/dist/mermaid-uEfRItDe.js +1205 -0
- package/dist/mermaid.cjs +1089 -3
- package/dist/mermaid.d.cts +4 -0
- package/dist/mermaid.d.ts +4 -0
- package/dist/mermaid.js +7 -5
- package/dist/{rect-DUpeDfBg.js → rect-JzWMJxxc.js} +1 -1
- package/dist/renderer/cli/stdout-renderer.d.ts +44 -0
- package/dist/renderer/terminal-graphics.d.ts +44 -0
- package/dist/renderer-dom.js +4 -4
- package/dist/{terminal-graphics-Bbe83wSr.js → terminal-graphics-DWZrl3oh.js} +85 -2
- package/dist/{tlog-theme-i6S_Oftd.js → tlog-theme-DqnF_zNe.js} +5 -4
- package/dist/vue/components/TAgentTerminalGraphic.d.ts +1 -1
- package/dist/vue/components/TMarkdownText.d.ts +70 -2
- package/dist/vue/components/TMermaidImage.d.ts +733 -0
- package/dist/vue/components/TMermaidText.d.ts +2 -2
- package/dist/vue/components/TVirtualMarkdown.d.ts +70 -2
- package/dist/vue/markdown/ast.d.ts +5 -0
- package/dist/vue/markdown/document.d.ts +3 -0
- package/dist/vue/markdown/math-image.d.ts +68 -0
- package/dist/vue/markdown/theme.d.ts +12 -0
- package/dist/vue/markdown/types.d.ts +12 -2
- package/dist/vue/mermaid/beautiful-mermaid.d.ts +4 -4
- package/dist/vue/mermaid/mermaid-image.d.ts +65 -0
- package/dist/vue.js +9 -9
- package/package.json +14 -1
- package/dist/mermaid-BNhM1jAZ.js +0 -123
- package/dist/width-GqllnV8C.js +0 -474
- /package/dist/{ansi-palette-CH6jc2Z7.js → ansi-palette-BHF1rN7R.js} +0 -0
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { charCellWidth, segmentedGraphemes } from "./width-GqllnV8C.js";
|
|
2
|
-
|
|
3
1
|
//#region src/core/render-plane.ts
|
|
4
2
|
const TERMINAL_RENDER_PLANES = [
|
|
5
3
|
"default",
|
|
@@ -8,6 +6,94 @@ const TERMINAL_RENDER_PLANES = [
|
|
|
8
6
|
"overlay"
|
|
9
7
|
];
|
|
10
8
|
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region src/utils/grapheme.ts
|
|
11
|
+
let graphemeSegmenter = null;
|
|
12
|
+
try {
|
|
13
|
+
const Segmenter = typeof Intl !== "undefined" ? Intl.Segmenter : void 0;
|
|
14
|
+
graphemeSegmenter = Segmenter ? new Segmenter(void 0, { granularity: "grapheme" }) : null;
|
|
15
|
+
} catch {
|
|
16
|
+
graphemeSegmenter = null;
|
|
17
|
+
}
|
|
18
|
+
let unicodeMarkRe = null;
|
|
19
|
+
try {
|
|
20
|
+
unicodeMarkRe = new RegExp("\\p{Mark}", "u");
|
|
21
|
+
} catch {
|
|
22
|
+
unicodeMarkRe = null;
|
|
23
|
+
}
|
|
24
|
+
function needsGraphemeSegmentation(text) {
|
|
25
|
+
for (const ch of text) {
|
|
26
|
+
const cp = ch.codePointAt(0);
|
|
27
|
+
if (cp === 8205) return true;
|
|
28
|
+
if (cp >= 65024 && cp <= 65039 || cp >= 917760 && cp <= 917999) return true;
|
|
29
|
+
if (isCombiningMark(cp)) return true;
|
|
30
|
+
if (cp >= 127995 && cp <= 127999) return true;
|
|
31
|
+
if (cp >= 127462 && cp <= 127487) return true;
|
|
32
|
+
if (cp >= 917504 && cp <= 917631) return true;
|
|
33
|
+
}
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
function isVariationSelector(codePoint) {
|
|
37
|
+
return codePoint >= 65024 && codePoint <= 65039 || codePoint >= 917760 && codePoint <= 917999;
|
|
38
|
+
}
|
|
39
|
+
function isCombiningMark(codePoint) {
|
|
40
|
+
return codePoint >= 768 && codePoint <= 879 || codePoint >= 6832 && codePoint <= 6911 || codePoint >= 7616 && codePoint <= 7679 || codePoint >= 8400 && codePoint <= 8447 || codePoint >= 65056 && codePoint <= 65071 || isDevanagariMark(codePoint) || unicodeMarkRe?.test(String.fromCodePoint(codePoint)) === true;
|
|
41
|
+
}
|
|
42
|
+
function isDevanagariMark(codePoint) {
|
|
43
|
+
return codePoint >= 2304 && codePoint <= 2307 || codePoint >= 2362 && codePoint <= 2364 || codePoint >= 2366 && codePoint <= 2383 || codePoint >= 2385 && codePoint <= 2391 || codePoint >= 2402 && codePoint <= 2403;
|
|
44
|
+
}
|
|
45
|
+
function isVirama(codePoint) {
|
|
46
|
+
return codePoint === 2381;
|
|
47
|
+
}
|
|
48
|
+
function isEmojiModifier(codePoint) {
|
|
49
|
+
return codePoint >= 127995 && codePoint <= 127999;
|
|
50
|
+
}
|
|
51
|
+
function isRegionalIndicator(codePoint) {
|
|
52
|
+
return codePoint >= 127462 && codePoint <= 127487;
|
|
53
|
+
}
|
|
54
|
+
function isEmojiTag(codePoint) {
|
|
55
|
+
return codePoint >= 917504 && codePoint <= 917631;
|
|
56
|
+
}
|
|
57
|
+
function fallbackGraphemeSegments(text) {
|
|
58
|
+
const out = [];
|
|
59
|
+
let segment = "";
|
|
60
|
+
let segmentStart = 0;
|
|
61
|
+
let pos = 0;
|
|
62
|
+
let regionalIndicators = 0;
|
|
63
|
+
let joinNext = false;
|
|
64
|
+
const pushSegment = () => {
|
|
65
|
+
if (segment) out.push({
|
|
66
|
+
segment,
|
|
67
|
+
index: segmentStart
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
for (const ch of text) {
|
|
71
|
+
const codePoint = ch.codePointAt(0);
|
|
72
|
+
const chStart = pos;
|
|
73
|
+
pos += ch.length;
|
|
74
|
+
const attach = segment !== "" && (joinNext || codePoint === 8205 || isVariationSelector(codePoint) || isCombiningMark(codePoint) || isEmojiModifier(codePoint) || isEmojiTag(codePoint) || isRegionalIndicator(codePoint) && regionalIndicators === 1);
|
|
75
|
+
if (!attach) {
|
|
76
|
+
pushSegment();
|
|
77
|
+
segment = ch;
|
|
78
|
+
segmentStart = chStart;
|
|
79
|
+
regionalIndicators = isRegionalIndicator(codePoint) ? 1 : 0;
|
|
80
|
+
} else {
|
|
81
|
+
segment += ch;
|
|
82
|
+
if (isRegionalIndicator(codePoint)) regionalIndicators++;
|
|
83
|
+
else if (!isVariationSelector(codePoint) && !isCombiningMark(codePoint)) regionalIndicators = 0;
|
|
84
|
+
}
|
|
85
|
+
if (codePoint === 8205 || isVirama(codePoint)) joinNext = true;
|
|
86
|
+
else if (joinNext && !isVariationSelector(codePoint) && !isCombiningMark(codePoint)) joinNext = false;
|
|
87
|
+
}
|
|
88
|
+
pushSegment();
|
|
89
|
+
return out;
|
|
90
|
+
}
|
|
91
|
+
function segmentedGraphemes(text) {
|
|
92
|
+
if (!needsGraphemeSegmentation(text)) return null;
|
|
93
|
+
if (graphemeSegmenter) return graphemeSegmenter.segment(text);
|
|
94
|
+
return fallbackGraphemeSegments(text);
|
|
95
|
+
}
|
|
96
|
+
|
|
11
97
|
//#endregion
|
|
12
98
|
//#region src/core/ansi/sgr.ts
|
|
13
99
|
const ESC = "\x1B";
|
|
@@ -311,6 +397,391 @@ function parseAnsiSgr(input, baseStyle = {}) {
|
|
|
311
397
|
return segments;
|
|
312
398
|
}
|
|
313
399
|
|
|
400
|
+
//#endregion
|
|
401
|
+
//#region src/core/buffer/eaw-ranges-unicode-17.ts
|
|
402
|
+
const fullWidthRanges = [
|
|
403
|
+
[4352, 4447],
|
|
404
|
+
[8986, 8987],
|
|
405
|
+
[9001, 9002],
|
|
406
|
+
[9193, 9196],
|
|
407
|
+
[9200, 9200],
|
|
408
|
+
[9203, 9203],
|
|
409
|
+
[9725, 9726],
|
|
410
|
+
[9748, 9749],
|
|
411
|
+
[9776, 9783],
|
|
412
|
+
[9800, 9811],
|
|
413
|
+
[9855, 9855],
|
|
414
|
+
[9866, 9871],
|
|
415
|
+
[9875, 9875],
|
|
416
|
+
[9889, 9889],
|
|
417
|
+
[9898, 9899],
|
|
418
|
+
[9917, 9918],
|
|
419
|
+
[9924, 9925],
|
|
420
|
+
[9934, 9934],
|
|
421
|
+
[9940, 9940],
|
|
422
|
+
[9962, 9962],
|
|
423
|
+
[9970, 9971],
|
|
424
|
+
[9973, 9973],
|
|
425
|
+
[9978, 9978],
|
|
426
|
+
[9981, 9981],
|
|
427
|
+
[9989, 9989],
|
|
428
|
+
[9994, 9995],
|
|
429
|
+
[10024, 10024],
|
|
430
|
+
[10060, 10060],
|
|
431
|
+
[10062, 10062],
|
|
432
|
+
[10067, 10069],
|
|
433
|
+
[10071, 10071],
|
|
434
|
+
[10133, 10135],
|
|
435
|
+
[10160, 10160],
|
|
436
|
+
[10175, 10175],
|
|
437
|
+
[11035, 11036],
|
|
438
|
+
[11088, 11088],
|
|
439
|
+
[11093, 11093],
|
|
440
|
+
[11904, 11929],
|
|
441
|
+
[11931, 12019],
|
|
442
|
+
[12032, 12245],
|
|
443
|
+
[12272, 12350],
|
|
444
|
+
[12353, 12438],
|
|
445
|
+
[12441, 12543],
|
|
446
|
+
[12549, 12591],
|
|
447
|
+
[12593, 12686],
|
|
448
|
+
[12688, 12773],
|
|
449
|
+
[12783, 12830],
|
|
450
|
+
[12832, 12871],
|
|
451
|
+
[12880, 42124],
|
|
452
|
+
[42128, 42182],
|
|
453
|
+
[43360, 43388],
|
|
454
|
+
[44032, 55203],
|
|
455
|
+
[63744, 64255],
|
|
456
|
+
[65040, 65049],
|
|
457
|
+
[65072, 65106],
|
|
458
|
+
[65108, 65126],
|
|
459
|
+
[65128, 65131],
|
|
460
|
+
[65281, 65376],
|
|
461
|
+
[65504, 65510],
|
|
462
|
+
[94176, 94180],
|
|
463
|
+
[94192, 94198],
|
|
464
|
+
[94208, 101589],
|
|
465
|
+
[101631, 101662],
|
|
466
|
+
[101760, 101874],
|
|
467
|
+
[110576, 110579],
|
|
468
|
+
[110581, 110587],
|
|
469
|
+
[110589, 110590],
|
|
470
|
+
[110592, 110882],
|
|
471
|
+
[110898, 110898],
|
|
472
|
+
[110928, 110930],
|
|
473
|
+
[110933, 110933],
|
|
474
|
+
[110948, 110951],
|
|
475
|
+
[110960, 111355],
|
|
476
|
+
[119552, 119638],
|
|
477
|
+
[119648, 119670],
|
|
478
|
+
[126980, 126980],
|
|
479
|
+
[127183, 127183],
|
|
480
|
+
[127374, 127374],
|
|
481
|
+
[127377, 127386],
|
|
482
|
+
[127488, 127490],
|
|
483
|
+
[127504, 127547],
|
|
484
|
+
[127552, 127560],
|
|
485
|
+
[127568, 127569],
|
|
486
|
+
[127584, 127589],
|
|
487
|
+
[127744, 127776],
|
|
488
|
+
[127789, 127797],
|
|
489
|
+
[127799, 127868],
|
|
490
|
+
[127870, 127891],
|
|
491
|
+
[127904, 127946],
|
|
492
|
+
[127951, 127955],
|
|
493
|
+
[127968, 127984],
|
|
494
|
+
[127988, 127988],
|
|
495
|
+
[127992, 128062],
|
|
496
|
+
[128064, 128064],
|
|
497
|
+
[128066, 128252],
|
|
498
|
+
[128255, 128317],
|
|
499
|
+
[128331, 128334],
|
|
500
|
+
[128336, 128359],
|
|
501
|
+
[128378, 128378],
|
|
502
|
+
[128405, 128406],
|
|
503
|
+
[128420, 128420],
|
|
504
|
+
[128507, 128591],
|
|
505
|
+
[128640, 128709],
|
|
506
|
+
[128716, 128716],
|
|
507
|
+
[128720, 128722],
|
|
508
|
+
[128725, 128728],
|
|
509
|
+
[128732, 128735],
|
|
510
|
+
[128747, 128748],
|
|
511
|
+
[128756, 128764],
|
|
512
|
+
[128992, 129003],
|
|
513
|
+
[129008, 129008],
|
|
514
|
+
[129292, 129338],
|
|
515
|
+
[129340, 129349],
|
|
516
|
+
[129351, 129535],
|
|
517
|
+
[129648, 129660],
|
|
518
|
+
[129664, 129674],
|
|
519
|
+
[129678, 129734],
|
|
520
|
+
[129736, 129736],
|
|
521
|
+
[129741, 129756],
|
|
522
|
+
[129759, 129770],
|
|
523
|
+
[129775, 129784],
|
|
524
|
+
[131072, 196605],
|
|
525
|
+
[196608, 262141]
|
|
526
|
+
];
|
|
527
|
+
const ambiguousWidthRanges = [
|
|
528
|
+
[161, 161],
|
|
529
|
+
[164, 164],
|
|
530
|
+
[167, 168],
|
|
531
|
+
[170, 170],
|
|
532
|
+
[173, 174],
|
|
533
|
+
[176, 180],
|
|
534
|
+
[182, 186],
|
|
535
|
+
[188, 191],
|
|
536
|
+
[198, 198],
|
|
537
|
+
[208, 208],
|
|
538
|
+
[215, 216],
|
|
539
|
+
[222, 225],
|
|
540
|
+
[230, 230],
|
|
541
|
+
[232, 234],
|
|
542
|
+
[236, 237],
|
|
543
|
+
[240, 240],
|
|
544
|
+
[242, 243],
|
|
545
|
+
[247, 250],
|
|
546
|
+
[252, 252],
|
|
547
|
+
[254, 254],
|
|
548
|
+
[257, 257],
|
|
549
|
+
[273, 273],
|
|
550
|
+
[275, 275],
|
|
551
|
+
[283, 283],
|
|
552
|
+
[294, 295],
|
|
553
|
+
[299, 299],
|
|
554
|
+
[305, 307],
|
|
555
|
+
[312, 312],
|
|
556
|
+
[319, 322],
|
|
557
|
+
[324, 324],
|
|
558
|
+
[328, 331],
|
|
559
|
+
[333, 333],
|
|
560
|
+
[338, 339],
|
|
561
|
+
[358, 359],
|
|
562
|
+
[363, 363],
|
|
563
|
+
[462, 462],
|
|
564
|
+
[464, 464],
|
|
565
|
+
[466, 466],
|
|
566
|
+
[468, 468],
|
|
567
|
+
[470, 470],
|
|
568
|
+
[472, 472],
|
|
569
|
+
[474, 474],
|
|
570
|
+
[476, 476],
|
|
571
|
+
[593, 593],
|
|
572
|
+
[609, 609],
|
|
573
|
+
[708, 708],
|
|
574
|
+
[711, 711],
|
|
575
|
+
[713, 715],
|
|
576
|
+
[717, 717],
|
|
577
|
+
[720, 720],
|
|
578
|
+
[728, 731],
|
|
579
|
+
[733, 733],
|
|
580
|
+
[735, 735],
|
|
581
|
+
[768, 879],
|
|
582
|
+
[913, 929],
|
|
583
|
+
[931, 937],
|
|
584
|
+
[945, 961],
|
|
585
|
+
[963, 969],
|
|
586
|
+
[1025, 1025],
|
|
587
|
+
[1040, 1103],
|
|
588
|
+
[1105, 1105],
|
|
589
|
+
[8208, 8208],
|
|
590
|
+
[8211, 8214],
|
|
591
|
+
[8216, 8217],
|
|
592
|
+
[8220, 8221],
|
|
593
|
+
[8224, 8226],
|
|
594
|
+
[8228, 8231],
|
|
595
|
+
[8240, 8240],
|
|
596
|
+
[8242, 8243],
|
|
597
|
+
[8245, 8245],
|
|
598
|
+
[8251, 8251],
|
|
599
|
+
[8254, 8254],
|
|
600
|
+
[8308, 8308],
|
|
601
|
+
[8319, 8319],
|
|
602
|
+
[8321, 8324],
|
|
603
|
+
[8364, 8364],
|
|
604
|
+
[8451, 8451],
|
|
605
|
+
[8453, 8453],
|
|
606
|
+
[8457, 8457],
|
|
607
|
+
[8467, 8467],
|
|
608
|
+
[8470, 8470],
|
|
609
|
+
[8481, 8482],
|
|
610
|
+
[8486, 8486],
|
|
611
|
+
[8491, 8491],
|
|
612
|
+
[8531, 8532],
|
|
613
|
+
[8539, 8542],
|
|
614
|
+
[8544, 8555],
|
|
615
|
+
[8560, 8569],
|
|
616
|
+
[8585, 8585],
|
|
617
|
+
[8592, 8601],
|
|
618
|
+
[8632, 8633],
|
|
619
|
+
[8658, 8658],
|
|
620
|
+
[8660, 8660],
|
|
621
|
+
[8679, 8679],
|
|
622
|
+
[8704, 8704],
|
|
623
|
+
[8706, 8707],
|
|
624
|
+
[8711, 8712],
|
|
625
|
+
[8715, 8715],
|
|
626
|
+
[8719, 8719],
|
|
627
|
+
[8721, 8721],
|
|
628
|
+
[8725, 8725],
|
|
629
|
+
[8730, 8730],
|
|
630
|
+
[8733, 8736],
|
|
631
|
+
[8739, 8739],
|
|
632
|
+
[8741, 8741],
|
|
633
|
+
[8743, 8748],
|
|
634
|
+
[8750, 8750],
|
|
635
|
+
[8756, 8759],
|
|
636
|
+
[8764, 8765],
|
|
637
|
+
[8776, 8776],
|
|
638
|
+
[8780, 8780],
|
|
639
|
+
[8786, 8786],
|
|
640
|
+
[8800, 8801],
|
|
641
|
+
[8804, 8807],
|
|
642
|
+
[8810, 8811],
|
|
643
|
+
[8814, 8815],
|
|
644
|
+
[8834, 8835],
|
|
645
|
+
[8838, 8839],
|
|
646
|
+
[8853, 8853],
|
|
647
|
+
[8857, 8857],
|
|
648
|
+
[8869, 8869],
|
|
649
|
+
[8895, 8895],
|
|
650
|
+
[8978, 8978],
|
|
651
|
+
[9312, 9449],
|
|
652
|
+
[9451, 9547],
|
|
653
|
+
[9552, 9587],
|
|
654
|
+
[9600, 9615],
|
|
655
|
+
[9618, 9621],
|
|
656
|
+
[9632, 9633],
|
|
657
|
+
[9635, 9641],
|
|
658
|
+
[9650, 9651],
|
|
659
|
+
[9654, 9655],
|
|
660
|
+
[9660, 9661],
|
|
661
|
+
[9664, 9665],
|
|
662
|
+
[9670, 9672],
|
|
663
|
+
[9675, 9675],
|
|
664
|
+
[9678, 9681],
|
|
665
|
+
[9698, 9701],
|
|
666
|
+
[9711, 9711],
|
|
667
|
+
[9733, 9734],
|
|
668
|
+
[9737, 9737],
|
|
669
|
+
[9742, 9743],
|
|
670
|
+
[9756, 9756],
|
|
671
|
+
[9758, 9758],
|
|
672
|
+
[9792, 9792],
|
|
673
|
+
[9794, 9794],
|
|
674
|
+
[9824, 9825],
|
|
675
|
+
[9827, 9829],
|
|
676
|
+
[9831, 9834],
|
|
677
|
+
[9836, 9837],
|
|
678
|
+
[9839, 9839],
|
|
679
|
+
[9886, 9887],
|
|
680
|
+
[9919, 9919],
|
|
681
|
+
[9926, 9933],
|
|
682
|
+
[9935, 9939],
|
|
683
|
+
[9941, 9953],
|
|
684
|
+
[9955, 9955],
|
|
685
|
+
[9960, 9961],
|
|
686
|
+
[9963, 9969],
|
|
687
|
+
[9972, 9972],
|
|
688
|
+
[9974, 9977],
|
|
689
|
+
[9979, 9980],
|
|
690
|
+
[9982, 9983],
|
|
691
|
+
[10045, 10045],
|
|
692
|
+
[10102, 10111],
|
|
693
|
+
[11094, 11097],
|
|
694
|
+
[12872, 12879],
|
|
695
|
+
[57344, 63743],
|
|
696
|
+
[65024, 65039],
|
|
697
|
+
[65533, 65533],
|
|
698
|
+
[127232, 127242],
|
|
699
|
+
[127248, 127277],
|
|
700
|
+
[127280, 127337],
|
|
701
|
+
[127344, 127373],
|
|
702
|
+
[127375, 127376],
|
|
703
|
+
[127387, 127404],
|
|
704
|
+
[917760, 917999],
|
|
705
|
+
[983040, 1048573],
|
|
706
|
+
[1048576, 1114109]
|
|
707
|
+
];
|
|
708
|
+
|
|
709
|
+
//#endregion
|
|
710
|
+
//#region src/core/buffer/width.ts
|
|
711
|
+
function isFullWidthCodePoint(codePoint) {
|
|
712
|
+
if (codePoint < 4352) return false;
|
|
713
|
+
for (const [start, end] of fullWidthRanges) {
|
|
714
|
+
if (codePoint < start) return false;
|
|
715
|
+
if (codePoint <= end) return true;
|
|
716
|
+
}
|
|
717
|
+
return false;
|
|
718
|
+
}
|
|
719
|
+
function isAmbiguousWidthCodePoint(codePoint) {
|
|
720
|
+
const first = ambiguousWidthRanges[0];
|
|
721
|
+
const last = ambiguousWidthRanges[ambiguousWidthRanges.length - 1];
|
|
722
|
+
if (!first || !last) return false;
|
|
723
|
+
if (codePoint < first[0] || codePoint > last[1]) return false;
|
|
724
|
+
for (const [start, end] of ambiguousWidthRanges) {
|
|
725
|
+
if (codePoint < start) return false;
|
|
726
|
+
if (codePoint <= end) return true;
|
|
727
|
+
}
|
|
728
|
+
return false;
|
|
729
|
+
}
|
|
730
|
+
function isVariationSelectorCodePoint(codePoint) {
|
|
731
|
+
return codePoint >= 65024 && codePoint <= 65039 || codePoint >= 917760 && codePoint <= 917999;
|
|
732
|
+
}
|
|
733
|
+
function isCombiningMarkCodePoint(codePoint) {
|
|
734
|
+
return codePoint >= 768 && codePoint <= 879 || codePoint >= 6832 && codePoint <= 6911 || codePoint >= 7616 && codePoint <= 7679 || codePoint >= 8400 && codePoint <= 8447 || codePoint >= 65056 && codePoint <= 65071 || codePoint >= 12330 && codePoint <= 12335 || codePoint >= 12441 && codePoint <= 12442 || codePoint === 94180;
|
|
735
|
+
}
|
|
736
|
+
function isEmojiLike(codePoint) {
|
|
737
|
+
return codePoint >= 127744 && codePoint <= 129791 || codePoint >= 127462 && codePoint <= 127487;
|
|
738
|
+
}
|
|
739
|
+
let extendedPictographicRe = null;
|
|
740
|
+
try {
|
|
741
|
+
extendedPictographicRe = new RegExp("\\p{Extended_Pictographic}", "u");
|
|
742
|
+
} catch {
|
|
743
|
+
extendedPictographicRe = null;
|
|
744
|
+
}
|
|
745
|
+
let emojiPresentationRe = null;
|
|
746
|
+
try {
|
|
747
|
+
emojiPresentationRe = new RegExp("\\p{Emoji_Presentation}", "u");
|
|
748
|
+
} catch {
|
|
749
|
+
emojiPresentationRe = null;
|
|
750
|
+
}
|
|
751
|
+
let emojiRe = null;
|
|
752
|
+
try {
|
|
753
|
+
emojiRe = new RegExp("\\p{Emoji}", "u");
|
|
754
|
+
} catch {
|
|
755
|
+
emojiRe = null;
|
|
756
|
+
}
|
|
757
|
+
function normalizeCustomWidth(width) {
|
|
758
|
+
return width === 2 ? 2 : 1;
|
|
759
|
+
}
|
|
760
|
+
function charCellWidth(text, provider = "default") {
|
|
761
|
+
if (!text) return 1;
|
|
762
|
+
if (typeof provider === "function") return normalizeCustomWidth(provider(text));
|
|
763
|
+
if (provider !== "cjk" && text.length === 1) {
|
|
764
|
+
const code = text.charCodeAt(0);
|
|
765
|
+
if (code < 4352) return 1;
|
|
766
|
+
}
|
|
767
|
+
const codePoint = text.codePointAt(0);
|
|
768
|
+
if (codePoint == null) return 1;
|
|
769
|
+
const hasVs16 = text.includes("️");
|
|
770
|
+
if (isVariationSelectorCodePoint(codePoint) || isCombiningMarkCodePoint(codePoint)) return 1;
|
|
771
|
+
if (codePoint >= 9472 && codePoint <= 9599) return 1;
|
|
772
|
+
if (isFullWidthCodePoint(codePoint)) return 2;
|
|
773
|
+
if (provider === "cjk" && isAmbiguousWidthCodePoint(codePoint)) return 2;
|
|
774
|
+
if (isEmojiLike(codePoint)) return 2;
|
|
775
|
+
if (emojiPresentationRe?.test(text)) return 2;
|
|
776
|
+
if (text.includes("⃣")) return 2;
|
|
777
|
+
if (hasVs16 && emojiRe?.test(text)) return 2;
|
|
778
|
+
if (extendedPictographicRe?.test(text)) {
|
|
779
|
+
if (codePoint <= 65535) return hasVs16 ? 2 : 1;
|
|
780
|
+
return 2;
|
|
781
|
+
}
|
|
782
|
+
return 1;
|
|
783
|
+
}
|
|
784
|
+
|
|
314
785
|
//#endregion
|
|
315
786
|
//#region src/core/buffer/buffer.ts
|
|
316
787
|
const DEFAULT_STYLE = Object.freeze({});
|
|
@@ -1768,103 +2239,4 @@ function createTerminal(opts) {
|
|
|
1768
2239
|
}
|
|
1769
2240
|
|
|
1770
2241
|
//#endregion
|
|
1771
|
-
|
|
1772
|
-
const ENCODED_ASCII_CONTROL_RE = /%(?:0[0-9a-f]|1[0-9a-f]|7f)/i;
|
|
1773
|
-
function hasControlCodePoint(value) {
|
|
1774
|
-
for (let i = 0; i < value.length; i++) {
|
|
1775
|
-
const code = value.charCodeAt(i);
|
|
1776
|
-
if (code <= 31 || code >= 127 && code <= 159) return true;
|
|
1777
|
-
}
|
|
1778
|
-
return false;
|
|
1779
|
-
}
|
|
1780
|
-
function hasEncodedControl(value) {
|
|
1781
|
-
let current = String(value ?? "");
|
|
1782
|
-
for (let depth = 0; depth < 3; depth++) {
|
|
1783
|
-
if (ENCODED_ASCII_CONTROL_RE.test(current)) return true;
|
|
1784
|
-
let decoded;
|
|
1785
|
-
try {
|
|
1786
|
-
decoded = decodeURIComponent(current);
|
|
1787
|
-
} catch {
|
|
1788
|
-
return true;
|
|
1789
|
-
}
|
|
1790
|
-
if (hasControlCodePoint(decoded)) return true;
|
|
1791
|
-
if (decoded === current) return false;
|
|
1792
|
-
current = decoded;
|
|
1793
|
-
}
|
|
1794
|
-
return ENCODED_ASCII_CONTROL_RE.test(current) || hasControlCodePoint(current);
|
|
1795
|
-
}
|
|
1796
|
-
|
|
1797
|
-
//#endregion
|
|
1798
|
-
//#region src/core/hyperlink.ts
|
|
1799
|
-
const SCHEME_RE = /^[a-z][a-z0-9+.-]*:/i;
|
|
1800
|
-
const BLOCKED_SCHEME_RE = /^(?:javascript|data|vbscript):/i;
|
|
1801
|
-
const SAFE_RELATIVE_HREF_RE = /^(?:[A-Za-z0-9._~!$&()*+,;=:@/?#-]|%[0-9A-Fa-f]{2})+$/u;
|
|
1802
|
-
function normalizeRawHref(value) {
|
|
1803
|
-
if (typeof value !== "string") return null;
|
|
1804
|
-
const raw = value.trim();
|
|
1805
|
-
if (!raw) return null;
|
|
1806
|
-
if (raw !== value) return null;
|
|
1807
|
-
for (let i = 0; i < value.length; i++) {
|
|
1808
|
-
const code = value.charCodeAt(i);
|
|
1809
|
-
if (code <= 31 || code >= 127 && code <= 159) return null;
|
|
1810
|
-
}
|
|
1811
|
-
if (/\s/u.test(raw)) return null;
|
|
1812
|
-
if (raw.startsWith("//")) return null;
|
|
1813
|
-
if (BLOCKED_SCHEME_RE.test(raw)) return null;
|
|
1814
|
-
if (hasEncodedControl(raw)) return null;
|
|
1815
|
-
return raw;
|
|
1816
|
-
}
|
|
1817
|
-
function hrefScheme(raw) {
|
|
1818
|
-
return raw.match(SCHEME_RE)?.[0].toLowerCase() ?? null;
|
|
1819
|
-
}
|
|
1820
|
-
function parseSafeAbsoluteUrl(raw) {
|
|
1821
|
-
if (raw.includes("\\")) return null;
|
|
1822
|
-
try {
|
|
1823
|
-
return new URL(raw);
|
|
1824
|
-
} catch {
|
|
1825
|
-
return null;
|
|
1826
|
-
}
|
|
1827
|
-
}
|
|
1828
|
-
function sanitizeAbsoluteHref(raw, options = {}) {
|
|
1829
|
-
const url = parseSafeAbsoluteUrl(raw);
|
|
1830
|
-
if (!url) return null;
|
|
1831
|
-
if (url.protocol === "http:" || url.protocol === "https:") {
|
|
1832
|
-
if (!/^https?:\/\//i.test(raw)) return null;
|
|
1833
|
-
return options.preserveHttpHref ? raw : url.toString();
|
|
1834
|
-
}
|
|
1835
|
-
if (url.protocol === "mailto:") return raw;
|
|
1836
|
-
return null;
|
|
1837
|
-
}
|
|
1838
|
-
function isSafeNormalizedRelativeHref(raw) {
|
|
1839
|
-
if (raw.includes("\\")) return false;
|
|
1840
|
-
if (raw.startsWith("//")) return false;
|
|
1841
|
-
if (SCHEME_RE.test(raw)) return false;
|
|
1842
|
-
if (hasEncodedControl(raw)) return false;
|
|
1843
|
-
if (!SAFE_RELATIVE_HREF_RE.test(raw)) return false;
|
|
1844
|
-
return raw.startsWith("#") || raw.startsWith("?") || raw.startsWith("/") || raw.startsWith("./") || raw.startsWith("../") || /^[A-Za-z0-9._~-]/u.test(raw);
|
|
1845
|
-
}
|
|
1846
|
-
function isSafeRelativeHref(value) {
|
|
1847
|
-
const raw = normalizeRawHref(value);
|
|
1848
|
-
return raw != null && isSafeNormalizedRelativeHref(raw);
|
|
1849
|
-
}
|
|
1850
|
-
function sanitizeTerminalHref(value, options = {}) {
|
|
1851
|
-
const raw = normalizeRawHref(value);
|
|
1852
|
-
if (!raw) return null;
|
|
1853
|
-
const sanitized = sanitizeAbsoluteHref(raw, { preserveHttpHref: true });
|
|
1854
|
-
if (sanitized) return sanitized;
|
|
1855
|
-
if (options.allowFileUrls) {
|
|
1856
|
-
const url = parseSafeAbsoluteUrl(raw);
|
|
1857
|
-
if (url?.protocol === "file:") return url.toString();
|
|
1858
|
-
}
|
|
1859
|
-
return null;
|
|
1860
|
-
}
|
|
1861
|
-
function sanitizeDomHref(value, options = {}) {
|
|
1862
|
-
const raw = normalizeRawHref(value);
|
|
1863
|
-
if (!raw) return null;
|
|
1864
|
-
const scheme = hrefScheme(raw);
|
|
1865
|
-
if (!scheme) return options.allowRelative !== false && isSafeNormalizedRelativeHref(raw) ? raw : null;
|
|
1866
|
-
return sanitizeAbsoluteHref(raw);
|
|
1867
|
-
}
|
|
1868
|
-
|
|
1869
|
-
//#endregion
|
|
1870
|
-
export { TERMINAL_RENDER_PLANES, applyAnsiSgrStyle, createTerminal, getPlaneTerminal, getRootTerminal, hasEncodedControl, isSafeRelativeHref, parseAnsiSgr, resetPlaneRowsForRender, sanitizeDomHref, sanitizeTerminalHref, scrollPlaneRows };
|
|
2242
|
+
export { TERMINAL_RENDER_PLANES, applyAnsiSgrStyle, charCellWidth, createTerminal, getPlaneTerminal, getRootTerminal, parseAnsiSgr, resetPlaneRowsForRender, scrollPlaneRows, segmentedGraphemes };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { TERMINAL_RENDER_PLANES, getPlaneTerminal
|
|
2
|
-
import { ansiColorHex, ansiCssVar, installAnsiPaletteCssVars, isAnsiColorName } from "./ansi-palette-
|
|
1
|
+
import { TERMINAL_RENDER_PLANES, getPlaneTerminal } from "./create-terminal-Db_-UGVQ.js";
|
|
2
|
+
import { ansiColorHex, ansiCssVar, installAnsiPaletteCssVars, isAnsiColorName } from "./ansi-palette-BHF1rN7R.js";
|
|
3
|
+
import { sanitizeDomHref } from "./hyperlink-clbb_ha_.js";
|
|
3
4
|
|
|
4
5
|
//#region src/renderer/capabilities.ts
|
|
5
6
|
const DOM_RENDERER_CAPABILITIES = Object.freeze({
|