@trismegisto/terminal 3.3.14 → 4.0.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/LICENSE +56 -56
- package/MIGRATION.md +831 -0
- package/NOTICE +7 -39
- package/README.md +55 -16
- package/dist/core/attributes.d.ts +53 -0
- package/dist/core/attributes.js +75 -0
- package/dist/core/attributes.js.map +1 -0
- package/dist/core/buffer-line.d.ts +55 -0
- package/dist/core/buffer-line.js +242 -0
- package/dist/core/buffer-line.js.map +1 -0
- package/dist/core/buffer.d.ts +74 -0
- package/dist/core/buffer.js +277 -0
- package/dist/core/buffer.js.map +1 -0
- package/dist/core/charsets.d.ts +8 -0
- package/dist/core/charsets.js +79 -0
- package/dist/core/charsets.js.map +1 -0
- package/dist/core/circular-list.d.ts +22 -0
- package/dist/core/circular-list.js +84 -0
- package/dist/core/circular-list.js.map +1 -0
- package/dist/core/colors.d.ts +32 -0
- package/dist/core/colors.js +123 -0
- package/dist/core/colors.js.map +1 -0
- package/dist/core/event.d.ts +23 -0
- package/dist/core/event.js +41 -0
- package/dist/core/event.js.map +1 -0
- package/dist/core/index.d.ts +11 -0
- package/dist/core/index.js +13 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/keyboard.d.ts +76 -0
- package/dist/core/keyboard.js +248 -0
- package/dist/core/keyboard.js.map +1 -0
- package/dist/core/parser.d.ts +73 -0
- package/dist/core/parser.js +482 -0
- package/dist/core/parser.js.map +1 -0
- package/dist/core/terminal-core.d.ts +322 -0
- package/dist/core/terminal-core.js +1512 -0
- package/dist/core/terminal-core.js.map +1 -0
- package/dist/core/unicode.d.ts +35 -0
- package/dist/core/unicode.js +185 -0
- package/dist/core/unicode.js.map +1 -0
- package/dist/features/clipboard.d.ts +31 -0
- package/dist/features/clipboard.js +77 -0
- package/dist/features/clipboard.js.map +1 -0
- package/dist/features/connect.d.ts +16 -0
- package/dist/features/connect.js +58 -0
- package/dist/features/connect.js.map +1 -0
- package/dist/features/fit.d.ts +22 -0
- package/dist/features/fit.js +98 -0
- package/dist/features/fit.js.map +1 -0
- package/dist/features/gpu/atlas.d.ts +57 -0
- package/dist/features/gpu/atlas.js +90 -0
- package/dist/features/gpu/atlas.js.map +1 -0
- package/dist/features/gpu/box.d.ts +12 -0
- package/dist/features/gpu/box.js +105 -0
- package/dist/features/gpu/box.js.map +1 -0
- package/dist/features/gpu/frame-model.d.ts +28 -0
- package/dist/features/gpu/frame-model.js +105 -0
- package/dist/features/gpu/frame-model.js.map +1 -0
- package/dist/features/gpu/gl-renderer.d.ts +24 -0
- package/dist/features/gpu/gl-renderer.js +211 -0
- package/dist/features/gpu/gl-renderer.js.map +1 -0
- package/dist/features/gpu/index.d.ts +31 -0
- package/dist/features/gpu/index.js +158 -0
- package/dist/features/gpu/index.js.map +1 -0
- package/dist/features/image/graphics-protocol.d.ts +57 -0
- package/dist/features/image/graphics-protocol.js +91 -0
- package/dist/features/image/graphics-protocol.js.map +1 -0
- package/dist/features/image/iip.d.ts +38 -0
- package/dist/features/image/iip.js +158 -0
- package/dist/features/image/iip.js.map +1 -0
- package/dist/features/image/index.d.ts +100 -0
- package/dist/features/image/index.js +783 -0
- package/dist/features/image/index.js.map +1 -0
- package/dist/features/image/qoi.d.ts +5 -0
- package/dist/features/image/qoi.js +70 -0
- package/dist/features/image/qoi.js.map +1 -0
- package/dist/features/image/sixel.d.ts +30 -0
- package/dist/features/image/sixel.js +251 -0
- package/dist/features/image/sixel.js.map +1 -0
- package/dist/features/image/storage.d.ts +68 -0
- package/dist/features/image/storage.js +87 -0
- package/dist/features/image/storage.js.map +1 -0
- package/dist/features/ligatures.d.ts +17 -0
- package/dist/features/ligatures.js +65 -0
- package/dist/features/ligatures.js.map +1 -0
- package/dist/features/links.d.ts +24 -0
- package/dist/features/links.js +86 -0
- package/dist/features/links.js.map +1 -0
- package/dist/features/program-status.d.ts +32 -0
- package/dist/features/program-status.js +196 -0
- package/dist/features/program-status.js.map +1 -0
- package/dist/features/progress.d.ts +21 -0
- package/dist/features/progress.js +55 -0
- package/dist/features/progress.js.map +1 -0
- package/dist/features/search.d.ts +47 -0
- package/dist/features/search.js +188 -0
- package/dist/features/search.js.map +1 -0
- package/dist/features/serialize.d.ts +33 -0
- package/dist/features/serialize.js +301 -0
- package/dist/features/serialize.js.map +1 -0
- package/dist/features/unicode.d.ts +22 -0
- package/dist/features/unicode.js +39 -0
- package/dist/features/unicode.js.map +1 -0
- package/dist/features/web-fonts.d.ts +22 -0
- package/dist/features/web-fonts.js +90 -0
- package/dist/features/web-fonts.js.map +1 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/dist/terminal/api.d.ts +488 -0
- package/dist/terminal/api.js +2 -0
- package/dist/terminal/api.js.map +1 -0
- package/dist/terminal/create-terminal.d.ts +12 -0
- package/dist/terminal/create-terminal.js +17 -0
- package/dist/terminal/create-terminal.js.map +1 -0
- package/dist/terminal/engine.d.ts +219 -0
- package/dist/terminal/engine.js +1654 -0
- package/dist/terminal/engine.js.map +1 -0
- package/dist/terminal/glyphs.d.ts +7 -0
- package/dist/terminal/glyphs.js +135 -0
- package/dist/terminal/glyphs.js.map +1 -0
- package/dist/terminal/i18n/terminal-catalogs.d.ts +15 -0
- package/dist/terminal/i18n/terminal-catalogs.js +22 -0
- package/dist/terminal/i18n/terminal-catalogs.js.map +1 -0
- package/dist/terminal/i18n/terminal-messages.d.ts +32 -0
- package/dist/terminal/i18n/terminal-messages.en.d.ts +2 -0
- package/dist/terminal/i18n/terminal-messages.en.js +23 -0
- package/dist/terminal/i18n/terminal-messages.en.js.map +1 -0
- package/dist/terminal/i18n/terminal-messages.es.d.ts +2 -0
- package/dist/terminal/i18n/terminal-messages.es.js +23 -0
- package/dist/terminal/i18n/terminal-messages.es.js.map +1 -0
- package/dist/terminal/i18n/terminal-messages.js +23 -0
- package/dist/terminal/i18n/terminal-messages.js.map +1 -0
- package/dist/terminal/renderer.d.ts +120 -0
- package/dist/terminal/renderer.js +585 -0
- package/dist/terminal/renderer.js.map +1 -0
- package/dist/terminal/screen.d.ts +18 -0
- package/dist/terminal/screen.js +132 -0
- package/dist/terminal/screen.js.map +1 -0
- package/dist/terminal/styles.d.ts +2 -0
- package/dist/terminal/styles.js +117 -0
- package/dist/terminal/styles.js.map +1 -0
- package/dist/terminal/terminal-messages.d.ts +2 -0
- package/dist/terminal/terminal-messages.js +5 -0
- package/dist/terminal/terminal-messages.js.map +1 -0
- package/dist/terminal/terminal-view.d.ts +116 -0
- package/dist/terminal/terminal-view.js +362 -0
- package/dist/terminal/terminal-view.js.map +1 -0
- package/dist/terminal/token-theme.d.ts +12 -0
- package/dist/terminal/token-theme.js +66 -0
- package/dist/terminal/token-theme.js.map +1 -0
- package/package.json +39 -30
- package/fesm2022/trismegisto-terminal.mjs +0 -9717
- package/fesm2022/trismegisto-terminal.mjs.map +0 -1
- package/types/trismegisto-terminal.d.ts +0 -1952
- package/types/trismegisto-terminal.d.ts.map +0 -1
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
// Leitura da tela para a API pública: `ScreenBuffer`, `ScreenLine` e `ScreenCell` sobre o buffer do núcleo.
|
|
2
|
+
import { ColorMode, Flags, UnderlineStyle, colorMode, colorValue } from '../core/attributes';
|
|
3
|
+
import { emptyCell } from '../core/buffer-line';
|
|
4
|
+
const UNDERLINES = {
|
|
5
|
+
[UnderlineStyle.SINGLE]: 'single',
|
|
6
|
+
[UnderlineStyle.DOUBLE]: 'double',
|
|
7
|
+
[UnderlineStyle.CURLY]: 'curly',
|
|
8
|
+
[UnderlineStyle.DOTTED]: 'dotted',
|
|
9
|
+
[UnderlineStyle.DASHED]: 'dashed',
|
|
10
|
+
};
|
|
11
|
+
function cellColor(packed) {
|
|
12
|
+
const mode = colorMode(packed);
|
|
13
|
+
if (mode === ColorMode.DEFAULT)
|
|
14
|
+
return { kind: 'default' };
|
|
15
|
+
if (mode === ColorMode.RGB)
|
|
16
|
+
return { kind: 'rgb', value: colorValue(packed) };
|
|
17
|
+
return { kind: 'palette', index: colorValue(packed) };
|
|
18
|
+
}
|
|
19
|
+
/** Cópia de uma célula; guarda a célula crua para comparar estilos sem recalcular. */
|
|
20
|
+
class CellSnapshot {
|
|
21
|
+
raw;
|
|
22
|
+
text;
|
|
23
|
+
width;
|
|
24
|
+
foreground;
|
|
25
|
+
background;
|
|
26
|
+
underlineColor;
|
|
27
|
+
underline;
|
|
28
|
+
bold;
|
|
29
|
+
dim;
|
|
30
|
+
italic;
|
|
31
|
+
blink;
|
|
32
|
+
inverse;
|
|
33
|
+
invisible;
|
|
34
|
+
strikethrough;
|
|
35
|
+
overline;
|
|
36
|
+
constructor(raw) {
|
|
37
|
+
this.raw = raw;
|
|
38
|
+
const f = raw.flags;
|
|
39
|
+
this.text = raw.width === 0 ? '' : raw.chars;
|
|
40
|
+
this.width = raw.width;
|
|
41
|
+
this.foreground = cellColor(raw.fg);
|
|
42
|
+
this.background = cellColor(raw.bg);
|
|
43
|
+
this.underlineColor = cellColor(raw.extended.underlineColor);
|
|
44
|
+
this.underline = f & Flags.UNDERLINE ? (UNDERLINES[Math.max(1, raw.extended.underlineStyle)] ?? 'single') : 'none';
|
|
45
|
+
this.bold = !!(f & Flags.BOLD);
|
|
46
|
+
this.dim = !!(f & Flags.DIM);
|
|
47
|
+
this.italic = !!(f & Flags.ITALIC);
|
|
48
|
+
this.blink = !!(f & Flags.BLINK);
|
|
49
|
+
this.inverse = !!(f & Flags.INVERSE);
|
|
50
|
+
this.invisible = !!(f & Flags.INVISIBLE);
|
|
51
|
+
this.strikethrough = !!(f & Flags.STRIKETHROUGH);
|
|
52
|
+
this.overline = !!(f & Flags.OVERLINE);
|
|
53
|
+
}
|
|
54
|
+
sameStyle(other) {
|
|
55
|
+
if (other instanceof CellSnapshot) {
|
|
56
|
+
const a = this.raw;
|
|
57
|
+
const b = other.raw;
|
|
58
|
+
return (a.fg === b.fg && a.bg === b.bg && a.flags === b.flags &&
|
|
59
|
+
a.extended.underlineStyle === b.extended.underlineStyle && a.extended.underlineColor === b.extended.underlineColor);
|
|
60
|
+
}
|
|
61
|
+
const same = (x, y) => JSON.stringify(x) === JSON.stringify(y);
|
|
62
|
+
return (same(this.foreground, other.foreground) && same(this.background, other.background) &&
|
|
63
|
+
same(this.underlineColor, other.underlineColor) && this.underline === other.underline &&
|
|
64
|
+
this.bold === other.bold && this.dim === other.dim && this.italic === other.italic && this.blink === other.blink &&
|
|
65
|
+
this.inverse === other.inverse && this.invisible === other.invisible &&
|
|
66
|
+
this.strikethrough === other.strikethrough && this.overline === other.overline);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
class LineView {
|
|
70
|
+
line;
|
|
71
|
+
constructor(line) {
|
|
72
|
+
this.line = line;
|
|
73
|
+
}
|
|
74
|
+
get wrapped() {
|
|
75
|
+
return this.line.isWrapped;
|
|
76
|
+
}
|
|
77
|
+
get length() {
|
|
78
|
+
return this.line.length;
|
|
79
|
+
}
|
|
80
|
+
cell(col) {
|
|
81
|
+
if (col < 0 || col >= this.line.length)
|
|
82
|
+
return undefined;
|
|
83
|
+
return new CellSnapshot(this.line.loadCell(col, emptyCell()));
|
|
84
|
+
}
|
|
85
|
+
text(trimEnd = false, start = 0, end = this.line.length) {
|
|
86
|
+
return this.line.translateToString(trimEnd, start, end);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
/** Vista de uma das telas; `resolve` acha o buffer na hora (ele é trocado no RIS e no redimensionamento). */
|
|
90
|
+
export class ScreenView {
|
|
91
|
+
resolve;
|
|
92
|
+
constructor(resolve) {
|
|
93
|
+
this.resolve = resolve;
|
|
94
|
+
}
|
|
95
|
+
get b() {
|
|
96
|
+
return this.resolve();
|
|
97
|
+
}
|
|
98
|
+
get kind() {
|
|
99
|
+
return this.b.type;
|
|
100
|
+
}
|
|
101
|
+
get lineCount() {
|
|
102
|
+
return this.b.lines.length;
|
|
103
|
+
}
|
|
104
|
+
get screenTop() {
|
|
105
|
+
return this.b.ybase;
|
|
106
|
+
}
|
|
107
|
+
get viewportTop() {
|
|
108
|
+
return this.b.ydisp;
|
|
109
|
+
}
|
|
110
|
+
get cursor() {
|
|
111
|
+
return { col: this.b.x, row: this.b.y };
|
|
112
|
+
}
|
|
113
|
+
line(row) {
|
|
114
|
+
const line = this.b.lines.get(row);
|
|
115
|
+
return line ? new LineView(line) : undefined;
|
|
116
|
+
}
|
|
117
|
+
text() {
|
|
118
|
+
const lines = this.b.lines;
|
|
119
|
+
const out = [];
|
|
120
|
+
for (let y = 0; y < lines.length; y++) {
|
|
121
|
+
const line = lines.get(y);
|
|
122
|
+
// A linha que continua embaixo vai inteira (os brancos do fim fazem parte do texto).
|
|
123
|
+
const text = line.translateToString(!lines.get(y + 1)?.isWrapped);
|
|
124
|
+
if (line.isWrapped && out.length)
|
|
125
|
+
out[out.length - 1] += text;
|
|
126
|
+
else
|
|
127
|
+
out.push(text);
|
|
128
|
+
}
|
|
129
|
+
return out.join('\n').replace(/\s+$/, '');
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
//# sourceMappingURL=screen.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"screen.js","sourceRoot":"","sources":["../../src/terminal/screen.ts"],"names":[],"mappings":"AAAA,4GAA4G;AAC5G,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAE7F,OAAO,EAAE,SAAS,EAAkC,MAAM,qBAAqB,CAAC;AAGhF,MAAM,UAAU,GAAkC;IAChD,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,QAAQ;IACjC,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,QAAQ;IACjC,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,OAAO;IAC/B,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,QAAQ;IACjC,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,QAAQ;CAClC,CAAC;AAE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AC,GAAG,CAAC,GAAG,CAAC,CAAC;QACnC,OAAO,IAAI,CAAC,CAAC,CAAC,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC/C,CAAC;IACD,IAAI;QACF,MAAM,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;QAC3B,MAAM,GAAG,GAAa,EAAE,CAAC;QACzB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACtC,MAAM,IAAI,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,CAAE,CAAC;YAC3B,qFAAqF;YACrF,MAAM,IAAI,GAAG,IAAI,CAAC,iBAAiB,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC;YAClE,IAAI,IAAI,CAAC,SAAS,IAAI,GAAG,CAAC,MAAM;gBAAE,GAAG,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,IAAI,CAAC;;gBACzD,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACtB,CAAC;QACD,OAAO,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAC5C,CAAC;CACF"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const TERMINAL_CSS = "\n.hmt {\n position: relative;\n overflow: hidden;\n block-size: 100%;\n inline-size: 100%;\n background: var(--hmt-background, #000);\n color: var(--hmt-foreground, #fff);\n cursor: text;\n user-select: none;\n -webkit-user-select: none;\n contain: strict;\n}\n.hmt.hmt-link-hover { cursor: pointer; }\n.hmt-viewport {\n position: absolute;\n inset: 0;\n /* A barra s\u00F3 aparece com hist\u00F3rico para rolar (auto), e sobre ela vale o cursor padr\u00E3o, n\u00E3o o de texto. */\n overflow-y: auto;\n overflow-x: hidden;\n cursor: default;\n background: transparent;\n scrollbar-color: var(--hmt-scrollbar, rgba(127, 127, 127, 0.5)) transparent;\n}\n.hmt-scroll-area { inline-size: 1px; }\n.hmt-screen {\n position: absolute;\n inset-block-start: 0;\n inset-inline-start: 0;\n white-space: pre;\n font-kerning: none;\n font-variant-ligatures: none;\n line-height: var(--hmt-cell-height);\n}\n.hmt-rows, .hmt-selection, .hmt-links, .hmt-decorations { position: absolute; inset: 0; pointer-events: none; }\n.hmt-row { display: block; overflow: hidden; white-space: pre; line-height: var(--hmt-cell-height); }\n.hmt-row span { display: inline; }\n.hmt-glyph { display: inline-block !important; inline-size: var(--hmt-cell-width); block-size: var(--hmt-cell-height); vertical-align: top; }\n.hmt-wide { display: inline-block !important; inline-size: calc(var(--hmt-cell-width) * 2); text-align: center; }\n.hmt-bold { font-weight: var(--hmt-font-weight-bold, bold); }\n.hmt-dim { opacity: 0.5; }\n.hmt-italic { font-style: italic; }\n.hmt-blink { animation: hmt-blink var(--hmt-blink-duration, 1s) step-end infinite; }\n.hmt-blink-off .hmt-blink { animation: none; }\n.hmt-joined { display: inline-block !important; white-space: pre; overflow: visible; vertical-align: top; }\n.hmt-rescaled { display: inline-block !important; inline-size: var(--hmt-cell-width); white-space: pre; transform-origin: left center; vertical-align: top; }\n.hmt-no-scrollbar .hmt-viewport { scrollbar-width: none; }\n.hmt-no-scrollbar .hmt-viewport::-webkit-scrollbar { display: none; }\n.hmt-scrollbar-sized .hmt-viewport::-webkit-scrollbar { inline-size: var(--hmt-scrollbar-width); }\n.hmt-scrollbar-sized .hmt-viewport::-webkit-scrollbar-thumb { background: var(--hmt-scrollbar, rgba(127, 127, 127, 0.5)); border-radius: 4px; }\n.hmt-scrollbar-arrows .hmt-viewport::-webkit-scrollbar-button:single-button { display: block; block-size: var(--hmt-scrollbar-width, 12px); }\n.hmt-overview-ruler { position: absolute; inset-block: 0; inset-inline-end: 0; inline-size: var(--hmt-scrollbar-width, 14px); pointer-events: none; z-index: 1; }\n.hmt-overview-ruler .hmt-ruler-mark { position: absolute; min-block-size: 2px; }\n.hmt-overview-ruler.hmt-ruler-top { border-block-start: 1px solid var(--hmt-ruler-border, transparent); }\n.hmt-overview-ruler.hmt-ruler-bottom { border-block-end: 1px solid var(--hmt-ruler-border, transparent); }\n.hmt-hyperlink { text-decoration-line: underline; text-decoration-style: dashed; text-underline-offset: 2px; }\n.hmt-selection-range { position: absolute; }\n.hmt-link-underline { position: absolute; border-block-end: 1px solid currentColor; box-sizing: border-box; color: var(--hmt-foreground, #fff); }\n.hmt-decoration { position: absolute; pointer-events: auto; }\n.hmt-cursor {\n position: absolute;\n pointer-events: none;\n box-sizing: border-box;\n overflow: hidden;\n text-align: center;\n line-height: var(--hmt-cell-height);\n}\n.hmt-cursor-block.hmt-cursor-focus { color: var(--hmt-background, #000); }\n.hmt-cursor-block:not(.hmt-cursor-focus), .hmt-cursor-outline { outline: 1px solid var(--hmt-cursor-color); outline-offset: -1px; }\n.hmt-cursor-underline { box-shadow: inset 0 -2px 0 var(--hmt-cursor-color); }\n.hmt-cursor-bar { background-color: var(--hmt-cursor-color); }\n.hmt-cursor-blink { animation: hmt-blink 1s step-end infinite; }\n@keyframes hmt-blink { 50% { opacity: 0; } }\n@media (prefers-reduced-motion: reduce) { .hmt-cursor-blink, .hmt-blink { animation: none; } }\n.hmt-helper-textarea {\n position: absolute;\n inset-block-start: 0;\n inset-inline-start: -9999em;\n inline-size: 0;\n block-size: 0;\n opacity: 0;\n padding: 0;\n border: 0;\n resize: none;\n overflow: hidden;\n white-space: nowrap;\n z-index: -5;\n}\n.hmt-measure {\n position: absolute;\n inset-block-start: 0;\n inset-inline-start: -9999em;\n visibility: hidden;\n white-space: pre;\n line-height: normal;\n}\n.hmt-a11y-tree, .hmt-a11y-live {\n position: absolute;\n inline-size: 1px;\n block-size: 1px;\n overflow: hidden;\n clip-path: inset(50%);\n white-space: pre;\n}\n";
|
|
2
|
+
export declare function ensureStyles(doc: Document): void;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
// CSS do terminal, posto uma vez por documento (quem usa a classe sem Angular não precisa importar folha de estilo).
|
|
2
|
+
// As cores vêm do tema (variáveis `--hmt-*` no elemento); as medidas, da célula medida.
|
|
3
|
+
const STYLE_ID = 'hmt-styles';
|
|
4
|
+
export const TERMINAL_CSS = `
|
|
5
|
+
.hmt {
|
|
6
|
+
position: relative;
|
|
7
|
+
overflow: hidden;
|
|
8
|
+
block-size: 100%;
|
|
9
|
+
inline-size: 100%;
|
|
10
|
+
background: var(--hmt-background, #000);
|
|
11
|
+
color: var(--hmt-foreground, #fff);
|
|
12
|
+
cursor: text;
|
|
13
|
+
user-select: none;
|
|
14
|
+
-webkit-user-select: none;
|
|
15
|
+
contain: strict;
|
|
16
|
+
}
|
|
17
|
+
.hmt.hmt-link-hover { cursor: pointer; }
|
|
18
|
+
.hmt-viewport {
|
|
19
|
+
position: absolute;
|
|
20
|
+
inset: 0;
|
|
21
|
+
/* A barra só aparece com histórico para rolar (auto), e sobre ela vale o cursor padrão, não o de texto. */
|
|
22
|
+
overflow-y: auto;
|
|
23
|
+
overflow-x: hidden;
|
|
24
|
+
cursor: default;
|
|
25
|
+
background: transparent;
|
|
26
|
+
scrollbar-color: var(--hmt-scrollbar, rgba(127, 127, 127, 0.5)) transparent;
|
|
27
|
+
}
|
|
28
|
+
.hmt-scroll-area { inline-size: 1px; }
|
|
29
|
+
.hmt-screen {
|
|
30
|
+
position: absolute;
|
|
31
|
+
inset-block-start: 0;
|
|
32
|
+
inset-inline-start: 0;
|
|
33
|
+
white-space: pre;
|
|
34
|
+
font-kerning: none;
|
|
35
|
+
font-variant-ligatures: none;
|
|
36
|
+
line-height: var(--hmt-cell-height);
|
|
37
|
+
}
|
|
38
|
+
.hmt-rows, .hmt-selection, .hmt-links, .hmt-decorations { position: absolute; inset: 0; pointer-events: none; }
|
|
39
|
+
.hmt-row { display: block; overflow: hidden; white-space: pre; line-height: var(--hmt-cell-height); }
|
|
40
|
+
.hmt-row span { display: inline; }
|
|
41
|
+
.hmt-glyph { display: inline-block !important; inline-size: var(--hmt-cell-width); block-size: var(--hmt-cell-height); vertical-align: top; }
|
|
42
|
+
.hmt-wide { display: inline-block !important; inline-size: calc(var(--hmt-cell-width) * 2); text-align: center; }
|
|
43
|
+
.hmt-bold { font-weight: var(--hmt-font-weight-bold, bold); }
|
|
44
|
+
.hmt-dim { opacity: 0.5; }
|
|
45
|
+
.hmt-italic { font-style: italic; }
|
|
46
|
+
.hmt-blink { animation: hmt-blink var(--hmt-blink-duration, 1s) step-end infinite; }
|
|
47
|
+
.hmt-blink-off .hmt-blink { animation: none; }
|
|
48
|
+
.hmt-joined { display: inline-block !important; white-space: pre; overflow: visible; vertical-align: top; }
|
|
49
|
+
.hmt-rescaled { display: inline-block !important; inline-size: var(--hmt-cell-width); white-space: pre; transform-origin: left center; vertical-align: top; }
|
|
50
|
+
.hmt-no-scrollbar .hmt-viewport { scrollbar-width: none; }
|
|
51
|
+
.hmt-no-scrollbar .hmt-viewport::-webkit-scrollbar { display: none; }
|
|
52
|
+
.hmt-scrollbar-sized .hmt-viewport::-webkit-scrollbar { inline-size: var(--hmt-scrollbar-width); }
|
|
53
|
+
.hmt-scrollbar-sized .hmt-viewport::-webkit-scrollbar-thumb { background: var(--hmt-scrollbar, rgba(127, 127, 127, 0.5)); border-radius: 4px; }
|
|
54
|
+
.hmt-scrollbar-arrows .hmt-viewport::-webkit-scrollbar-button:single-button { display: block; block-size: var(--hmt-scrollbar-width, 12px); }
|
|
55
|
+
.hmt-overview-ruler { position: absolute; inset-block: 0; inset-inline-end: 0; inline-size: var(--hmt-scrollbar-width, 14px); pointer-events: none; z-index: 1; }
|
|
56
|
+
.hmt-overview-ruler .hmt-ruler-mark { position: absolute; min-block-size: 2px; }
|
|
57
|
+
.hmt-overview-ruler.hmt-ruler-top { border-block-start: 1px solid var(--hmt-ruler-border, transparent); }
|
|
58
|
+
.hmt-overview-ruler.hmt-ruler-bottom { border-block-end: 1px solid var(--hmt-ruler-border, transparent); }
|
|
59
|
+
.hmt-hyperlink { text-decoration-line: underline; text-decoration-style: dashed; text-underline-offset: 2px; }
|
|
60
|
+
.hmt-selection-range { position: absolute; }
|
|
61
|
+
.hmt-link-underline { position: absolute; border-block-end: 1px solid currentColor; box-sizing: border-box; color: var(--hmt-foreground, #fff); }
|
|
62
|
+
.hmt-decoration { position: absolute; pointer-events: auto; }
|
|
63
|
+
.hmt-cursor {
|
|
64
|
+
position: absolute;
|
|
65
|
+
pointer-events: none;
|
|
66
|
+
box-sizing: border-box;
|
|
67
|
+
overflow: hidden;
|
|
68
|
+
text-align: center;
|
|
69
|
+
line-height: var(--hmt-cell-height);
|
|
70
|
+
}
|
|
71
|
+
.hmt-cursor-block.hmt-cursor-focus { color: var(--hmt-background, #000); }
|
|
72
|
+
.hmt-cursor-block:not(.hmt-cursor-focus), .hmt-cursor-outline { outline: 1px solid var(--hmt-cursor-color); outline-offset: -1px; }
|
|
73
|
+
.hmt-cursor-underline { box-shadow: inset 0 -2px 0 var(--hmt-cursor-color); }
|
|
74
|
+
.hmt-cursor-bar { background-color: var(--hmt-cursor-color); }
|
|
75
|
+
.hmt-cursor-blink { animation: hmt-blink 1s step-end infinite; }
|
|
76
|
+
@keyframes hmt-blink { 50% { opacity: 0; } }
|
|
77
|
+
@media (prefers-reduced-motion: reduce) { .hmt-cursor-blink, .hmt-blink { animation: none; } }
|
|
78
|
+
.hmt-helper-textarea {
|
|
79
|
+
position: absolute;
|
|
80
|
+
inset-block-start: 0;
|
|
81
|
+
inset-inline-start: -9999em;
|
|
82
|
+
inline-size: 0;
|
|
83
|
+
block-size: 0;
|
|
84
|
+
opacity: 0;
|
|
85
|
+
padding: 0;
|
|
86
|
+
border: 0;
|
|
87
|
+
resize: none;
|
|
88
|
+
overflow: hidden;
|
|
89
|
+
white-space: nowrap;
|
|
90
|
+
z-index: -5;
|
|
91
|
+
}
|
|
92
|
+
.hmt-measure {
|
|
93
|
+
position: absolute;
|
|
94
|
+
inset-block-start: 0;
|
|
95
|
+
inset-inline-start: -9999em;
|
|
96
|
+
visibility: hidden;
|
|
97
|
+
white-space: pre;
|
|
98
|
+
line-height: normal;
|
|
99
|
+
}
|
|
100
|
+
.hmt-a11y-tree, .hmt-a11y-live {
|
|
101
|
+
position: absolute;
|
|
102
|
+
inline-size: 1px;
|
|
103
|
+
block-size: 1px;
|
|
104
|
+
overflow: hidden;
|
|
105
|
+
clip-path: inset(50%);
|
|
106
|
+
white-space: pre;
|
|
107
|
+
}
|
|
108
|
+
`;
|
|
109
|
+
export function ensureStyles(doc) {
|
|
110
|
+
if (doc.getElementById(STYLE_ID))
|
|
111
|
+
return;
|
|
112
|
+
const style = doc.createElement('style');
|
|
113
|
+
style.id = STYLE_ID;
|
|
114
|
+
style.textContent = TERMINAL_CSS;
|
|
115
|
+
doc.head.appendChild(style);
|
|
116
|
+
}
|
|
117
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../src/terminal/styles.ts"],"names":[],"mappings":"AAAA,qHAAqH;AACrH,wFAAwF;AACxF,MAAM,QAAQ,GAAG,YAAY,CAAC;AAE9B,MAAM,CAAC,MAAM,YAAY,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwG3B,CAAC;AAEF,MAAM,UAAU,YAAY,CAAC,GAAa;IACxC,IAAI,GAAG,CAAC,cAAc,CAAC,QAAQ,CAAC;QAAE,OAAO;IACzC,MAAM,KAAK,GAAG,GAAG,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IACzC,KAAK,CAAC,EAAE,GAAG,QAAQ,CAAC;IACpB,KAAK,CAAC,WAAW,GAAG,YAAY,CAAC;IACjC,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;AAC9B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"terminal-messages.js","sourceRoot":"","sources":["../../src/terminal/terminal-messages.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,wBAAwB,GAAoB;IACvD,WAAW,EAAE,qBAAqB;IAClC,aAAa,EAAE,+EAA+E;CAC/F,CAAC"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import type { SearchOptions } from '../features/search';
|
|
2
|
+
import type { TerminalHandle, TerminalOptions } from './api';
|
|
3
|
+
import type { TerminalMessages } from './i18n/terminal-messages';
|
|
4
|
+
/** As entradas do componente que viram opções do terminal. */
|
|
5
|
+
export interface TerminalViewSettings {
|
|
6
|
+
readonly scrollback: number;
|
|
7
|
+
readonly cursorShape: 'block' | 'underline' | 'bar';
|
|
8
|
+
readonly cursorBlink: boolean;
|
|
9
|
+
readonly lineFeedAsNewline: boolean;
|
|
10
|
+
readonly readOnly: boolean;
|
|
11
|
+
readonly screenReader: boolean;
|
|
12
|
+
/** Tamanho da fonte em px; `null` usa `--hm-terminal-font-size`. */
|
|
13
|
+
readonly fontSize: number | null;
|
|
14
|
+
readonly lineHeight: number;
|
|
15
|
+
/** Opções avançadas do terminal, recursos incluídos (ganham das acima). */
|
|
16
|
+
readonly options: TerminalOptions;
|
|
17
|
+
}
|
|
18
|
+
export declare const DEFAULT_TERMINAL_VIEW_SETTINGS: TerminalViewSettings;
|
|
19
|
+
/** Opções do terminal a partir das entradas (as `options` avançadas ganham; sem `fontSize`, fica a dos tokens). */
|
|
20
|
+
export declare function resolveTerminalOptions(settings: TerminalViewSettings): TerminalOptions;
|
|
21
|
+
export type TerminalSearchToggle = 'case' | 'word' | 'regex';
|
|
22
|
+
/** Estado da barra de busca (imutável: cada mudança gera um objeto novo). */
|
|
23
|
+
export interface TerminalSearchState {
|
|
24
|
+
readonly open: boolean;
|
|
25
|
+
readonly query: string;
|
|
26
|
+
readonly caseSensitive: boolean;
|
|
27
|
+
readonly wholeWord: boolean;
|
|
28
|
+
readonly regex: boolean;
|
|
29
|
+
/** Posição (base 0) e total de resultados; `null` antes de procurar. */
|
|
30
|
+
readonly results: {
|
|
31
|
+
readonly index: number;
|
|
32
|
+
readonly count: number;
|
|
33
|
+
} | null;
|
|
34
|
+
}
|
|
35
|
+
export declare const INITIAL_TERMINAL_SEARCH_STATE: TerminalSearchState;
|
|
36
|
+
/** Opções de `handle.search` a partir do estado, com as marcas nos tokens do terminal. */
|
|
37
|
+
export declare function terminalSearchOptions(state: TerminalSearchState, incremental?: boolean): SearchOptions;
|
|
38
|
+
/** Texto da posição ("1 de 2", "Nenhum resultado" ou vazio). */
|
|
39
|
+
export declare function terminalSearchStatus(state: TerminalSearchState, text: TerminalMessages['search']): string;
|
|
40
|
+
/** O que uma tecla no campo de busca faz: Enter procura (Shift+Enter para trás), Esc fecha. */
|
|
41
|
+
export declare function terminalSearchKeyAction(e: Pick<KeyboardEvent, 'key' | 'shiftKey'>): 'next' | 'previous' | 'close' | null;
|
|
42
|
+
/** Atalho do componente antes do terminal: Ctrl+Shift+F abre a busca, Ctrl+Shift+C copia; `null` passa ao terminal. */
|
|
43
|
+
export declare function terminalShortcut(e: Pick<KeyboardEvent, 'type' | 'key' | 'ctrlKey' | 'shiftKey' | 'altKey'>, searchable: boolean): 'search' | 'copy' | null;
|
|
44
|
+
export interface TerminalViewOptions {
|
|
45
|
+
/** O elemento `hm-terminal` (onde os tokens são resolvidos e o tamanho é observado). */
|
|
46
|
+
readonly host: HTMLElement;
|
|
47
|
+
readonly settings?: TerminalViewSettings;
|
|
48
|
+
/** Nome acessível do campo de entrada. */
|
|
49
|
+
readonly label?: string;
|
|
50
|
+
/** URLs escritas viram links. */
|
|
51
|
+
readonly links?: boolean;
|
|
52
|
+
readonly searchable?: boolean;
|
|
53
|
+
readonly autoFit?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Envolve cada aviso para a casca (no Angular, `zone.run`). Os observadores e o quadro de animação rodam fora dele.
|
|
56
|
+
*/
|
|
57
|
+
readonly run?: (fn: () => void) => void;
|
|
58
|
+
readonly onUserInput?: (data: string) => void;
|
|
59
|
+
readonly onBinaryInput?: (data: string) => void;
|
|
60
|
+
readonly onResize?: (size: {
|
|
61
|
+
cols: number;
|
|
62
|
+
rows: number;
|
|
63
|
+
}) => void;
|
|
64
|
+
readonly onTitleChange?: (title: string) => void;
|
|
65
|
+
readonly onBell?: () => void;
|
|
66
|
+
/** Ctrl+Shift+F: a casca abre a busca e foca o campo depois de renderizar. Sem ela, só abre o estado. */
|
|
67
|
+
readonly onSearchRequest?: () => void;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Comportamento do `hm-terminal` sem framework. Crie com o host, ligue `subscribe` ao estado da busca e chame `mount`
|
|
71
|
+
* com o elemento da tela depois do primeiro render no navegador; `dispose` ao destruir.
|
|
72
|
+
*/
|
|
73
|
+
export declare class TerminalView {
|
|
74
|
+
#private;
|
|
75
|
+
readonly config: TerminalViewOptions;
|
|
76
|
+
constructor(config: TerminalViewOptions);
|
|
77
|
+
/** O terminal (depois de `mount`). */
|
|
78
|
+
get terminal(): TerminalHandle | undefined;
|
|
79
|
+
get searchState(): TerminalSearchState;
|
|
80
|
+
/** Avisa a cada mudança do estado da busca. Devolve a função que cancela. */
|
|
81
|
+
subscribe(listener: (state: TerminalSearchState) => void): () => void;
|
|
82
|
+
/** Monta o terminal na tela (filho do host). Escreve o que chegou antes e faz o primeiro ajuste. */
|
|
83
|
+
mount(screen: HTMLElement): TerminalHandle;
|
|
84
|
+
/** Relê tema e tipografia dos tokens (a fonte só quando o app não fixou o tamanho) e reajusta. */
|
|
85
|
+
refreshFromTokens(): void;
|
|
86
|
+
setSettings(settings: TerminalViewSettings): void;
|
|
87
|
+
setLabel(label: string): void;
|
|
88
|
+
setLinks(enabled: boolean): void;
|
|
89
|
+
setSearchable(searchable: boolean): void;
|
|
90
|
+
setAutoFit(autoFit: boolean): void;
|
|
91
|
+
/** Ajusta no próximo quadro (junta várias mudanças num ajuste só), se o ajuste automático estiver ligado. */
|
|
92
|
+
scheduleFit(): void;
|
|
93
|
+
/** Ajusta agora, se o ajuste automático estiver ligado. */
|
|
94
|
+
fitNow(): void;
|
|
95
|
+
/** Ajusta agora, mesmo com o ajuste automático desligado. */
|
|
96
|
+
fitToContainer(): void;
|
|
97
|
+
/** Escreve a saída do processo. Antes de montar, guarda e escreve depois. */
|
|
98
|
+
write(data: string | Uint8Array): void;
|
|
99
|
+
writeLine(data: string): void;
|
|
100
|
+
clear(): void;
|
|
101
|
+
reset(): void;
|
|
102
|
+
focus(): void;
|
|
103
|
+
/** Abre a barra (se a busca estiver ligada), com a seleção de uma linha como consulta. Devolve se abriu. */
|
|
104
|
+
openSearch(): boolean;
|
|
105
|
+
closeSearch(): void;
|
|
106
|
+
/** A pessoa digitou no campo: procura enquanto digita; campo vazio limpa as marcas. */
|
|
107
|
+
setQuery(value: string): void;
|
|
108
|
+
toggleSearchOption(which: TerminalSearchToggle): void;
|
|
109
|
+
findNext(): void;
|
|
110
|
+
findPrevious(): void;
|
|
111
|
+
/** Teclado do campo de busca (Enter, Shift+Enter, Esc). */
|
|
112
|
+
handleSearchKeydown(e: KeyboardEvent): void;
|
|
113
|
+
/** Esc em qualquer ponto do componente fecha a busca aberta. */
|
|
114
|
+
handleHostKeydown(e: KeyboardEvent): void;
|
|
115
|
+
dispose(): void;
|
|
116
|
+
}
|