ptywright 0.4.0 → 0.6.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 +38 -31
- package/dist/agent.mjs +2 -2
- package/dist/bin/ptywright.mjs +1 -1
- package/dist/{cli-C40H_ElC.mjs → cli-IXmvK56U.mjs} +2519 -2472
- package/dist/cli.mjs +1 -1
- package/dist/config.mjs +1 -1
- package/dist/data-sdbf3IDh.mjs +18 -0
- package/dist/env-DPYHo-zH.mjs +36 -0
- package/dist/index.mjs +1 -1
- package/dist/manifest_files-DW80c1H7.mjs +77 -0
- package/dist/mcp.mjs +1 -1
- package/dist/pty-cassette.mjs +2 -1
- package/dist/{pty_like-DqCo7XdB.mjs → pty_like-DWIlWGgA.mjs} +4 -20
- package/dist/{runner-zApMYWZx.mjs → runner-BHXXwxYp.mjs} +1578 -1423
- package/dist/{runner-CembqDgJ.mjs → runner-GIEf0C6d.mjs} +2434 -1134
- package/dist/script.mjs +1 -1
- package/dist/{server-h--2U0Ic.mjs → server-ceZ1-s_J.mjs} +2643 -2527
- package/dist/session.mjs +1 -1
- package/dist/style-BtIUv5H0.mjs +65 -0
- package/dist/{terminal_session-DopC7Xg6.mjs → terminal_session-MX_vWpRG.mjs} +322 -364
- package/package.json +2 -1
- package/dist/{config-B0r-JCFI.mjs → config-bGg636EW.mjs} +1 -1
package/dist/session.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as TerminalSession } from "./terminal_session-
|
|
1
|
+
import { t as TerminalSession } from "./terminal_session-MX_vWpRG.mjs";
|
|
2
2
|
export { TerminalSession };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
//#region src/terminal/style.ts
|
|
2
|
+
const DEFAULT_STYLE = {
|
|
3
|
+
fg: { mode: "default" },
|
|
4
|
+
bg: { mode: "default" },
|
|
5
|
+
bold: false,
|
|
6
|
+
dim: false,
|
|
7
|
+
italic: false,
|
|
8
|
+
underline: false,
|
|
9
|
+
inverse: false,
|
|
10
|
+
strikethrough: false
|
|
11
|
+
};
|
|
12
|
+
function extractStyle(cell) {
|
|
13
|
+
const style = {
|
|
14
|
+
fg: extractColor(cell.isFgDefault(), cell.isFgPalette(), cell.isFgRGB(), cell.getFgColor()),
|
|
15
|
+
bg: extractColor(cell.isBgDefault(), cell.isBgPalette(), cell.isBgRGB(), cell.getBgColor()),
|
|
16
|
+
bold: cell.isBold() !== 0,
|
|
17
|
+
dim: cell.isDim() !== 0,
|
|
18
|
+
italic: cell.isItalic() !== 0,
|
|
19
|
+
underline: cell.isUnderline() !== 0,
|
|
20
|
+
inverse: cell.isInverse() !== 0,
|
|
21
|
+
strikethrough: cell.isStrikethrough() !== 0
|
|
22
|
+
};
|
|
23
|
+
return isDefaultStyle(style) ? DEFAULT_STYLE : style;
|
|
24
|
+
}
|
|
25
|
+
function isDefaultStyle(style) {
|
|
26
|
+
return style.fg.mode === "default" && style.bg.mode === "default" && !style.bold && !style.dim && !style.italic && !style.underline && !style.inverse && !style.strikethrough;
|
|
27
|
+
}
|
|
28
|
+
function styleKey(style) {
|
|
29
|
+
return [
|
|
30
|
+
style.fg.mode === "default" ? "d" : `${style.fg.mode}:${style.fg.value}`,
|
|
31
|
+
style.bg.mode === "default" ? "d" : `${style.bg.mode}:${style.bg.value}`,
|
|
32
|
+
style.bold ? "b" : "",
|
|
33
|
+
style.dim ? "d" : "",
|
|
34
|
+
style.italic ? "i" : "",
|
|
35
|
+
style.underline ? "u" : "",
|
|
36
|
+
style.inverse ? "r" : "",
|
|
37
|
+
style.strikethrough ? "s" : ""
|
|
38
|
+
].join("|");
|
|
39
|
+
}
|
|
40
|
+
function findMeaningfulEndCol(line, cols, nullCell) {
|
|
41
|
+
if (!line) return 0;
|
|
42
|
+
for (let x = cols - 1; x >= 0; x -= 1) {
|
|
43
|
+
const cell = line.getCell(x, nullCell);
|
|
44
|
+
if (!cell) continue;
|
|
45
|
+
if (cell.getWidth() === 0) continue;
|
|
46
|
+
const chars = cell.getChars();
|
|
47
|
+
const style = extractStyle(cell);
|
|
48
|
+
if (chars !== "" && chars !== " " || !isDefaultStyle(style)) return x + 1;
|
|
49
|
+
}
|
|
50
|
+
return 0;
|
|
51
|
+
}
|
|
52
|
+
function extractColor(isDefault, isPalette, isRgb, value) {
|
|
53
|
+
if (isDefault) return { mode: "default" };
|
|
54
|
+
if (isRgb) return {
|
|
55
|
+
mode: "rgb",
|
|
56
|
+
value
|
|
57
|
+
};
|
|
58
|
+
if (isPalette) return {
|
|
59
|
+
mode: "palette",
|
|
60
|
+
value
|
|
61
|
+
};
|
|
62
|
+
return { mode: "default" };
|
|
63
|
+
}
|
|
64
|
+
//#endregion
|
|
65
|
+
export { styleKey as a, isDefaultStyle as i, extractStyle as n, findMeaningfulEndCol as r, DEFAULT_STYLE as t };
|