@alchemy.run/sigil 0.0.0-alpha.6 → 0.0.0-alpha.8
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 +1 -1
- package/dist/{Text-BobFKi74.d.ts → Text-DV9CuzAT.d.ts} +1 -1
- package/dist/ansi.d.ts +1 -1
- package/dist/ansi.js +2 -2
- package/dist/capabilities.d.ts +4 -4
- package/dist/capabilities.js +2 -2
- package/dist/{color-policy-BMzMwV7Q.d.ts → color-policy-CCxuHIdD.d.ts} +2 -2
- package/dist/{color-policy-SVj1pYTA.js → color-policy-DlrZXC0f.js} +31 -13
- package/dist/{color-profile-u0Nhe9Nv.d.ts → color-profile-CyeHnG1T.d.ts} +1 -1
- package/dist/color.d.ts +2 -2
- package/dist/{detect-BuTXtY6e.js → detect-B3dL4Q11.js} +3 -2
- package/dist/{detect-Bh4yGP6w.d.ts → detect-Db6GbKOm.d.ts} +9 -0
- package/dist/{index-DZ88EXJv.d.ts → index-D48vQhhe.d.ts} +2 -2
- package/dist/index.d.ts +10 -6
- package/dist/index.js +68 -60
- package/dist/{osc-CCH7xDoS.js → osc-BFKKSqpg.js} +1 -1
- package/dist/{paint-C19minOS.d.ts → paint-Cx-zC_sX.d.ts} +2 -2
- package/dist/{query-vaIeGOkH.d.ts → query-BNc2B8GD.d.ts} +1 -1
- package/dist/router.d.ts +1 -1
- package/dist/router.js +1 -1
- package/dist/{screen-BOSLQ8fF.d.ts → screen-CgC2WlVM.d.ts} +1 -1
- package/dist/screen.d.ts +3 -3
- package/dist/{session-aZr9O8h3.js → session-Cg6STjFV.js} +42 -7
- package/dist/{store-CgrG9K4y.d.ts → store-C1P5fOUi.d.ts} +1 -1
- package/dist/terminal.d.ts +8 -5
- package/dist/terminal.js +1 -1
- package/dist/{use-focus-BzqAJi0n.js → use-focus-BNG0xsb7.js} +1 -1
- package/package.json +1 -1
- package/src/capabilities/detect.ts +15 -1
- package/src/capabilities/store.ts +17 -2
- package/src/components/App.tsx +10 -1
- package/src/hooks/use-window-size.ts +8 -19
- package/src/ink.tsx +93 -23
- package/src/terminal/screen-presenter.ts +58 -4
- package/src/terminal/session.ts +3 -2
- package/src/testing/terminal.ts +15 -3
- package/src/utils.ts +0 -40
package/src/utils.ts
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import type { OutputStream } from "#/stream.ts";
|
|
2
|
-
import { terminalSize } from "#/terminal-size.ts";
|
|
3
|
-
|
|
4
|
-
const resolveDimension = (
|
|
5
|
-
value: number | undefined,
|
|
6
|
-
fallback: number | undefined,
|
|
7
|
-
defaultValue: number,
|
|
8
|
-
): number => {
|
|
9
|
-
if (value !== undefined && value > 0) {
|
|
10
|
-
return value;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
if (fallback !== undefined && fallback > 0) {
|
|
14
|
-
return fallback;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
return defaultValue;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
Get the effective terminal dimensions from the given stdout stream.
|
|
22
|
-
|
|
23
|
-
Falls back to `terminal-size` for columns in piped processes where `stdout.columns` is 0, and uses standard defaults (80×24) when dimensions cannot be determined.
|
|
24
|
-
*/
|
|
25
|
-
export const getWindowSize = (stdout: OutputStream): { columns: number; rows: number } => {
|
|
26
|
-
// `stdout.columns`/`rows` can be 0 or undefined in non-TTY environments.
|
|
27
|
-
const columns = stdout.columns ?? 0;
|
|
28
|
-
const rows = stdout.rows ?? 0;
|
|
29
|
-
|
|
30
|
-
if (columns && rows) {
|
|
31
|
-
return { columns, rows };
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const fallbackSize = terminalSize();
|
|
35
|
-
|
|
36
|
-
return {
|
|
37
|
-
columns: resolveDimension(columns, fallbackSize.columns, 80),
|
|
38
|
-
rows: resolveDimension(rows, fallbackSize.rows, 24),
|
|
39
|
-
};
|
|
40
|
-
};
|