@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/README.md
CHANGED
|
@@ -2254,7 +2254,7 @@ Type: `number`
|
|
|
2254
2254
|
Number of rows (vertical character cells).
|
|
2255
2255
|
|
|
2256
2256
|
> [!NOTE]
|
|
2257
|
-
>
|
|
2257
|
+
> On terminals that send in-band size reports (mode 2048, e.g. Ghostty, kitty, foot) the frame is repainted as soon as the report arrives, since the emulator has already rewrapped by then. Elsewhere the size comes from the PTY, which can run ahead of or behind the emulator, so resize events are coalesced: the frame is erased and repainted about 50 ms after the size stops changing and is briefly absent during a window drag. Painting mid-rewrap is what leaves ghost rows behind.
|
|
2258
2258
|
|
|
2259
2259
|
### useFocus(options?)
|
|
2260
2260
|
|
package/dist/ansi.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as ColorSupportLevel, n as ColorInfo } from "./detect-
|
|
1
|
+
import { i as ColorSupportLevel, n as ColorInfo } from "./detect-Db6GbKOm.js";
|
|
2
2
|
import { A as exitAlternativeScreen, C as enableBracketedPaste, D as eraseLines, E as eraseLine, F as popKittyKeyboard, I as pushKittyKeyboard, L as resetCursorColor, M as link, N as pasteEnd, O as eraseScreen, P as pasteStart, S as disableBracketedPaste, T as eraseEndLine, _ as cursorNextLine, a as CursorShape, b as cursorTo, c as OSC, d as bsu, f as clearTerminal, g as cursorLeft, h as cursorHide, i as CSI, j as kittyQuery, k as esu, l as ST, m as cursorDown, n as C1_CSI, o as DEL, p as cursorColor, r as C1_ST, s as ESC, t as BEL, u as ansiEscapes, v as cursorShape, w as enterAlternativeScreen, x as cursorUp, y as cursorShow } from "./escapes-CB_6CWOE.js";
|
|
3
3
|
import { a as queryClipboard, c as setTerminalProgress, d as tmuxPassthrough, i as notify, l as setWindowTitle, n as TerminalProgressState, o as setClipboard, r as clearClipboard, s as setPointerShape, t as ClipboardSelection, u as setWorkingDirectory } from "./osc-Cn0fw77g.js";
|
|
4
4
|
import { _ as tokenize, a as StyledChar, c as diffAnsiCodes, d as getLinkStartCode, f as isIntensityCode, g as styledCharsToString, h as styledCharsFromTokens, i as ControlToken, l as endCodesSet, m as reduceAnsiCodesIncremental, n as AnsiToken, o as Token, p as reduceAnsiCodes, r as CharToken, s as ansiCodesToString, t as AnsiCode, u as getEndCode, v as undoAnsiCodes } from "./tokenize-Dx1y_l5H.js";
|
package/dist/ansi.js
CHANGED
|
@@ -2,8 +2,8 @@ import { A as cursorShape, B as eraseScreen, C as bsu, D as cursorHide, E as cur
|
|
|
2
2
|
import { A as isFullwidthCodePoint, C as fullwidthRanges, D as halfwidthRanges, E as halfwidthMinimalCodePoint, F as narrowMinimalCodePoint, I as narrowRanges, L as wideMaximumCodePoint, M as isWide, N as isWideNotCJKTNotEmoji, O as isAmbiguous, P as narrowMaximumCodePoint, R as wideMinimalCodePoint, S as fullwidthMinimalCodePoint, T as halfwidthMaximumCodePoint, _ as ambiguousMinimalCodePoint, a as getLinkStartCode, b as eastAsianWidthType, c as reduceAnsiCodesIncremental, d as tokenize, f as undoAnsiCodes, g as ambiguousMaximumCodePoint, i as getEndCode, j as isFullwidthGrapheme, k as isFullWidth, l as styledCharsFromTokens, n as diffAnsiCodes, o as isIntensityCode, r as endCodesSet, s as reduceAnsiCodes, t as ansiCodesToString, u as styledCharsToString, v as ambiguousRanges, w as getCategory, x as fullwidthMaximumCodePoint, y as eastAsianWidth, z as wideRanges } from "./tokenize-AjqbvtiT.js";
|
|
3
3
|
import { n as widestLine, t as stringWidth } from "./string-width-CijQwpIk.js";
|
|
4
4
|
import { n as sliceAnsi, r as wrapAnsi, t as cliTruncate } from "./truncate-D31fhU6i.js";
|
|
5
|
-
import { i as detectHyperlinkSupport, t as createSupportsColor } from "./detect-
|
|
6
|
-
import { a as setPointerShape, c as setWorkingDirectory, i as setClipboard, l as tmuxPassthrough, n as notify, o as setTerminalProgress, r as queryClipboard, s as setWindowTitle, t as clearClipboard, u as cliCursor } from "./osc-
|
|
5
|
+
import { i as detectHyperlinkSupport, t as createSupportsColor } from "./detect-B3dL4Q11.js";
|
|
6
|
+
import { a as setPointerShape, c as setWorkingDirectory, i as setClipboard, l as tmuxPassthrough, n as notify, o as setTerminalProgress, r as queryClipboard, s as setWindowTitle, t as clearClipboard, u as cliCursor } from "./osc-BFKKSqpg.js";
|
|
7
7
|
import { t as stripAnsi } from "./strip-BvU4toXG.js";
|
|
8
8
|
import { isatty } from "node:tty";
|
|
9
9
|
//#region src/ansi/chalk.ts
|
package/dist/capabilities.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as Multiplexer, c as TerminalAppearance, d as detectCapabilities, f as detectColorLevel, h as detectUnicodeSupport, i as ColorSupportLevel, l as TerminalIdentity, m as detectTerminal, n as ColorInfo, o as PixelGeometry, p as detectHyperlinkSupport, r as ColorSupport, s as RgbColor, t as Capabilities, u as createSupportsColor } from "./detect-
|
|
2
|
-
import { a as getTerminalQuery, i as applyTerminalQuery, n as TerminalQueryOptions, o as queryTerminal, r as TerminalQueryResult, s as refreshTerminalQuery, t as PixelSize } from "./query-
|
|
3
|
-
import { n as capabilities, r as getCapabilities, t as CapabilitiesStore } from "./store-
|
|
4
|
-
import { i as resolveColorProfile, n as ColorState, r as colorState, t as ColorPolicy } from "./color-policy-
|
|
1
|
+
import { a as Multiplexer, c as TerminalAppearance, d as detectCapabilities, f as detectColorLevel, h as detectUnicodeSupport, i as ColorSupportLevel, l as TerminalIdentity, m as detectTerminal, n as ColorInfo, o as PixelGeometry, p as detectHyperlinkSupport, r as ColorSupport, s as RgbColor, t as Capabilities, u as createSupportsColor } from "./detect-Db6GbKOm.js";
|
|
2
|
+
import { a as getTerminalQuery, i as applyTerminalQuery, n as TerminalQueryOptions, o as queryTerminal, r as TerminalQueryResult, s as refreshTerminalQuery, t as PixelSize } from "./query-BNc2B8GD.js";
|
|
3
|
+
import { n as capabilities, r as getCapabilities, t as CapabilitiesStore } from "./store-C1P5fOUi.js";
|
|
4
|
+
import { i as resolveColorProfile, n as ColorState, r as colorState, t as ColorPolicy } from "./color-policy-CCxuHIdD.js";
|
|
5
5
|
export { type Capabilities, type CapabilitiesStore, type ColorInfo, type ColorPolicy, type ColorState, type ColorSupport, type ColorSupportLevel, type Multiplexer, type PixelGeometry, type PixelSize, type RgbColor, type TerminalAppearance, type TerminalIdentity, type TerminalQueryOptions, type TerminalQueryResult, applyTerminalQuery, capabilities, colorState, createSupportsColor, detectCapabilities, detectColorLevel, detectHyperlinkSupport, detectTerminal, detectUnicodeSupport, getCapabilities, getTerminalQuery, queryTerminal, refreshTerminalQuery, resolveColorProfile };
|
package/dist/capabilities.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as detectTerminal, i as detectHyperlinkSupport, n as detectCapabilities, o as detectUnicodeSupport, r as detectColorLevel, t as createSupportsColor } from "./detect-
|
|
2
|
-
import { d as queryTerminal, f as refreshTerminalQuery, i as getCapabilities, l as getTerminalQuery, n as resolveColorProfile, r as capabilities, s as applyTerminalQuery, t as colorState } from "./color-policy-
|
|
1
|
+
import { a as detectTerminal, i as detectHyperlinkSupport, n as detectCapabilities, o as detectUnicodeSupport, r as detectColorLevel, t as createSupportsColor } from "./detect-B3dL4Q11.js";
|
|
2
|
+
import { d as queryTerminal, f as refreshTerminalQuery, i as getCapabilities, l as getTerminalQuery, n as resolveColorProfile, r as capabilities, s as applyTerminalQuery, t as colorState } from "./color-policy-DlrZXC0f.js";
|
|
3
3
|
export { applyTerminalQuery, capabilities, colorState, createSupportsColor, detectCapabilities, detectColorLevel, detectHyperlinkSupport, detectTerminal, detectUnicodeSupport, getCapabilities, getTerminalQuery, queryTerminal, refreshTerminalQuery, resolveColorProfile };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as ColorSupportLevel } from "./detect-
|
|
2
|
-
import { t as ColorProfile } from "./color-profile-
|
|
1
|
+
import { i as ColorSupportLevel } from "./detect-Db6GbKOm.js";
|
|
2
|
+
import { t as ColorProfile } from "./color-profile-CyeHnG1T.js";
|
|
3
3
|
//#region src/capabilities/color-policy.d.ts
|
|
4
4
|
/** A user-selected output policy. `auto` follows the target stream. */
|
|
5
5
|
type ColorPolicy = "auto" | ColorProfile;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { _ as CSI, b as OSC } from "./sgr-BhwaWAJB.js";
|
|
2
2
|
import { a as isTty } from "./env-YVw64yZS.js";
|
|
3
|
-
import {
|
|
3
|
+
import { n as detectCapabilities, s as signalExit } from "./detect-B3dL4Q11.js";
|
|
4
4
|
import { t as colorProfileFromLevel } from "./color-profile-DHhQHY55.js";
|
|
5
5
|
//#region src/capabilities/query.ts
|
|
6
6
|
/**
|
|
@@ -373,25 +373,36 @@ const createStore = (stdin, stdout) => {
|
|
|
373
373
|
const listeners = /* @__PURE__ */ new Set();
|
|
374
374
|
let resizeSubscribers = 0;
|
|
375
375
|
let focused;
|
|
376
|
+
let reportedSize;
|
|
376
377
|
let snapshot;
|
|
377
378
|
let snapshotQuery;
|
|
378
379
|
let snapshotColumns;
|
|
379
380
|
let snapshotRows;
|
|
380
381
|
let snapshotFocused;
|
|
382
|
+
let snapshotReportedSize;
|
|
381
383
|
const current = () => {
|
|
382
384
|
const query = getTerminalQuery(stdout);
|
|
383
385
|
const { columns, rows } = stdout;
|
|
384
|
-
if (!snapshot || query !== snapshotQuery || columns !== snapshotColumns || rows !== snapshotRows || focused !== snapshotFocused) {
|
|
386
|
+
if (!snapshot || query !== snapshotQuery || columns !== snapshotColumns || rows !== snapshotRows || focused !== snapshotFocused || reportedSize !== snapshotReportedSize) {
|
|
385
387
|
const detected = detectCapabilities({ stdout });
|
|
386
388
|
const applied = query ? applyTerminalQuery(detected, query) : detected;
|
|
387
|
-
|
|
389
|
+
const sized = reportedSize ? {
|
|
388
390
|
...applied,
|
|
391
|
+
size: {
|
|
392
|
+
...applied.size,
|
|
393
|
+
...reportedSize,
|
|
394
|
+
source: "terminal"
|
|
395
|
+
}
|
|
396
|
+
} : applied;
|
|
397
|
+
snapshot = focused === void 0 ? sized : {
|
|
398
|
+
...sized,
|
|
389
399
|
focused
|
|
390
400
|
};
|
|
391
401
|
snapshotQuery = query;
|
|
392
402
|
snapshotColumns = columns;
|
|
393
403
|
snapshotRows = rows;
|
|
394
404
|
snapshotFocused = focused;
|
|
405
|
+
snapshotReportedSize = reportedSize;
|
|
395
406
|
}
|
|
396
407
|
return snapshot;
|
|
397
408
|
};
|
|
@@ -431,6 +442,7 @@ const createStore = (stdin, stdout) => {
|
|
|
431
442
|
integration?.setReportFeed?.(false);
|
|
432
443
|
removeExitHandler?.();
|
|
433
444
|
removeExitHandler = void 0;
|
|
445
|
+
reportedSize = void 0;
|
|
434
446
|
}
|
|
435
447
|
};
|
|
436
448
|
reportingUpdaters.set(stdout, updateReporting);
|
|
@@ -457,16 +469,22 @@ const createStore = (stdin, stdout) => {
|
|
|
457
469
|
const resize = sequence.match(inBandResizeReport);
|
|
458
470
|
if (resize) {
|
|
459
471
|
const [, rows, columns, pixelHeight, pixelWidth] = resize.map(Number);
|
|
460
|
-
if (columns && rows)
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
472
|
+
if (columns && rows) {
|
|
473
|
+
reportedSize = {
|
|
474
|
+
columns,
|
|
475
|
+
rows
|
|
476
|
+
};
|
|
477
|
+
patchTerminalQuery(stdout, {
|
|
478
|
+
textAreaPixels: pixelWidth && pixelHeight ? {
|
|
479
|
+
width: pixelWidth,
|
|
480
|
+
height: pixelHeight
|
|
481
|
+
} : void 0,
|
|
482
|
+
cellPixels: pixelWidth && pixelHeight ? {
|
|
483
|
+
width: Math.round(pixelWidth / columns),
|
|
484
|
+
height: Math.round(pixelHeight / rows)
|
|
485
|
+
} : void 0
|
|
486
|
+
});
|
|
487
|
+
}
|
|
470
488
|
notify();
|
|
471
489
|
return true;
|
|
472
490
|
}
|
package/dist/color.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as Color, d as RgbColor } from "./color-profile-
|
|
2
|
-
import { _ as perimeterGradient, a as LinearGradient, c as PaintContext, d as adaptive, f as ansi, g as perProfile, h as named, i as InterpolationSpace, l as PerimeterGradient, m as linearGradient, n as ColorInput, o as NamedColor, p as ansi256, r as GradientStop, s as Paint, t as AdaptiveColor, u as ProfileColor, v as rgb } from "./paint-
|
|
1
|
+
import { c as Color, d as RgbColor } from "./color-profile-CyeHnG1T.js";
|
|
2
|
+
import { _ as perimeterGradient, a as LinearGradient, c as PaintContext, d as adaptive, f as ansi, g as perProfile, h as named, i as InterpolationSpace, l as PerimeterGradient, m as linearGradient, n as ColorInput, o as NamedColor, p as ansi256, r as GradientStop, s as Paint, t as AdaptiveColor, u as ProfileColor, v as rgb } from "./paint-Cx-zC_sX.js";
|
|
3
3
|
import { n as Rect } from "./geometry-BxXOzJgo.js";
|
|
4
4
|
//#region src/color/palette.d.ts
|
|
5
5
|
declare const canonicalAnsiPalette: readonly RgbColor[];
|
|
@@ -356,7 +356,8 @@ function detectCapabilities({ stdout = process.stdout } = {}) {
|
|
|
356
356
|
columns: stdout.columns,
|
|
357
357
|
rows: stdout.rows
|
|
358
358
|
} : terminalSize(),
|
|
359
|
-
pixels: void 0
|
|
359
|
+
pixels: void 0,
|
|
360
|
+
source: "pty"
|
|
360
361
|
},
|
|
361
362
|
focused: void 0,
|
|
362
363
|
theme: {
|
|
@@ -370,4 +371,4 @@ function detectCapabilities({ stdout = process.stdout } = {}) {
|
|
|
370
371
|
};
|
|
371
372
|
}
|
|
372
373
|
//#endregion
|
|
373
|
-
export { detectTerminal as a,
|
|
374
|
+
export { detectTerminal as a, detectHyperlinkSupport as i, detectCapabilities as n, detectUnicodeSupport as o, detectColorLevel as r, signalExit as s, createSupportsColor as t };
|
|
@@ -64,11 +64,20 @@ type Capabilities = {
|
|
|
64
64
|
/**
|
|
65
65
|
Current terminal dimensions in cells, plus pixel geometry once the
|
|
66
66
|
terminal has answered the query.
|
|
67
|
+
|
|
68
|
+
`source` tells where the cell dimensions come from. `"pty"` is the
|
|
69
|
+
stream's own `columns`/`rows`, updated by the OS on SIGWINCH — which says
|
|
70
|
+
nothing about whether the emulator has finished rewrapping its screen.
|
|
71
|
+
`"terminal"` is the emulator's in-band size report (mode 2048), which
|
|
72
|
+
arrives in the input stream after the rewrap and so describes the screen
|
|
73
|
+
exactly as later output will find it. While the terminal reports, its
|
|
74
|
+
size wins over the stream's.
|
|
67
75
|
*/
|
|
68
76
|
size: {
|
|
69
77
|
columns: number;
|
|
70
78
|
rows: number;
|
|
71
79
|
pixels: PixelGeometry | undefined;
|
|
80
|
+
source: "pty" | "terminal";
|
|
72
81
|
};
|
|
73
82
|
platform: NodeJS.Platform;
|
|
74
83
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as StyledChar } from "./tokenize-Dx1y_l5H.js";
|
|
2
|
-
import { i as Cell, t as ColorProfile } from "./color-profile-
|
|
3
|
-
import { n as Screen, t as Line } from "./screen-
|
|
2
|
+
import { i as Cell, t as ColorProfile } from "./color-profile-CyeHnG1T.js";
|
|
3
|
+
import { n as Screen, t as Line } from "./screen-CgC2WlVM.js";
|
|
4
4
|
//#region src/screen/ansi.d.ts
|
|
5
5
|
/** Converts the renderer's canonical ANSI state into backend-neutral cells. */
|
|
6
6
|
declare function cellsFromAnsi(text: string): Cell[];
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { a as Multiplexer, c as TerminalAppearance, d as detectCapabilities, f as detectColorLevel, h as detectUnicodeSupport, i as ColorSupportLevel, l as TerminalIdentity, m as detectTerminal, n as ColorInfo, o as PixelGeometry, p as detectHyperlinkSupport, r as ColorSupport, s as RgbColor, t as Capabilities, u as createSupportsColor } from "./detect-
|
|
1
|
+
import { a as Multiplexer, c as TerminalAppearance, d as detectCapabilities, f as detectColorLevel, h as detectUnicodeSupport, i as ColorSupportLevel, l as TerminalIdentity, m as detectTerminal, n as ColorInfo, o as PixelGeometry, p as detectHyperlinkSupport, r as ColorSupport, s as RgbColor, t as Capabilities, u as createSupportsColor } from "./detect-Db6GbKOm.js";
|
|
2
2
|
import { n as TerminalProgressState, t as ClipboardSelection } from "./osc-Cn0fw77g.js";
|
|
3
|
-
import { a as getTerminalQuery, i as applyTerminalQuery, n as TerminalQueryOptions, o as queryTerminal, r as TerminalQueryResult, s as refreshTerminalQuery, t as PixelSize } from "./query-
|
|
4
|
-
import { i as OutputStream, n as capabilities, r as getCapabilities, t as CapabilitiesStore } from "./store-
|
|
5
|
-
import { s as CellStyle, t as ColorProfile } from "./color-profile-
|
|
6
|
-
import { s as Paint } from "./paint-
|
|
7
|
-
import { n as Text, r as Styles, t as Props$8 } from "./Text-
|
|
3
|
+
import { a as getTerminalQuery, i as applyTerminalQuery, n as TerminalQueryOptions, o as queryTerminal, r as TerminalQueryResult, s as refreshTerminalQuery, t as PixelSize } from "./query-BNc2B8GD.js";
|
|
4
|
+
import { i as OutputStream, n as capabilities, r as getCapabilities, t as CapabilitiesStore } from "./store-C1P5fOUi.js";
|
|
5
|
+
import { s as CellStyle, t as ColorProfile } from "./color-profile-CyeHnG1T.js";
|
|
6
|
+
import { s as Paint } from "./paint-Cx-zC_sX.js";
|
|
7
|
+
import { n as Text, r as Styles, t as Props$8 } from "./Text-DV9CuzAT.js";
|
|
8
8
|
import { i as Node } from "./index-DDVME65c.js";
|
|
9
9
|
import { t as CursorPosition } from "./cursor-position-D2LAkRG0.js";
|
|
10
10
|
import { Writable } from "node:stream";
|
|
@@ -1046,6 +1046,10 @@ type WindowSize = {
|
|
|
1046
1046
|
};
|
|
1047
1047
|
/**
|
|
1048
1048
|
A React hook that returns the current terminal window dimensions and re-renders the component whenever the terminal is resized.
|
|
1049
|
+
|
|
1050
|
+
Reads the capabilities store, so on terminals that send in-band size reports
|
|
1051
|
+
(mode 2048) the dimensions are the emulator's own, arriving after it has
|
|
1052
|
+
rewrapped its screen; elsewhere they are the stream's `columns`/`rows`.
|
|
1049
1053
|
*/
|
|
1050
1054
|
declare const useWindowSize: () => WindowSize;
|
|
1051
1055
|
//#endregion
|
package/dist/index.js
CHANGED
|
@@ -2,12 +2,12 @@ import { C as bsu, S as ansiEscapes, V as esu, W as link, _ as CSI } from "./sgr
|
|
|
2
2
|
import { h as tokenizeAnsi, p as graphemes } from "./tokenize-AjqbvtiT.js";
|
|
3
3
|
import { t as stringWidth } from "./string-width-CijQwpIk.js";
|
|
4
4
|
import { n as sliceAnsi, r as wrapAnsi } from "./truncate-D31fhU6i.js";
|
|
5
|
-
import { _ as squashTextNodes, a as reconciler, c as kittyModifiers, d as FocusContext, f as Text, g as transformAnsiLine, h as emitLayoutListeners, i as useStdinContext, l as resolveFlags, m as createNode, n as useInput, o as detectKittySupport, p as addLayoutListener, r as useStdin, s as kittyFlags, t as useFocus, u as StdinContext, v as accessibilityContext } from "./use-focus-
|
|
5
|
+
import { _ as squashTextNodes, a as reconciler, c as kittyModifiers, d as FocusContext, f as Text, g as transformAnsiLine, h as emitLayoutListeners, i as useStdinContext, l as resolveFlags, m as createNode, n as useInput, o as detectKittySupport, p as addLayoutListener, r as useStdin, s as kittyFlags, t as useFocus, u as StdinContext, v as accessibilityContext } from "./use-focus-BNG0xsb7.js";
|
|
6
6
|
import { a as isTty, i as isSigilDev, o as isWindows, r as isScreenReader, t as isInCi } from "./env-YVw64yZS.js";
|
|
7
|
-
import { a as detectTerminal,
|
|
8
|
-
import { u as cliCursor } from "./osc-
|
|
9
|
-
import { a as registerTerminalIntegration, c as ensureTerminalQuery, d as queryTerminal, f as refreshTerminalQuery, i as getCapabilities, l as getTerminalQuery, o as getRawModeStream, r as capabilities, s as applyTerminalQuery, u as getTerminalQueryPromise } from "./color-policy-
|
|
10
|
-
import { a as buildCursorSuffix, c as hideCursorEscape, i as buildCursorOnlySequence, o as buildReturnToBottomPrefix, s as cursorPositionChanged, t as TerminalSession } from "./session-
|
|
7
|
+
import { a as detectTerminal, i as detectHyperlinkSupport, n as detectCapabilities, o as detectUnicodeSupport, r as detectColorLevel, s as signalExit, t as createSupportsColor } from "./detect-B3dL4Q11.js";
|
|
8
|
+
import { u as cliCursor } from "./osc-BFKKSqpg.js";
|
|
9
|
+
import { a as registerTerminalIntegration, c as ensureTerminalQuery, d as queryTerminal, f as refreshTerminalQuery, i as getCapabilities, l as getTerminalQuery, o as getRawModeStream, r as capabilities, s as applyTerminalQuery, u as getTerminalQueryPromise } from "./color-policy-DlrZXC0f.js";
|
|
10
|
+
import { a as buildCursorSuffix, c as hideCursorEscape, i as buildCursorOnlySequence, o as buildReturnToBottomPrefix, s as cursorPositionChanged, t as TerminalSession } from "./session-Cg6STjFV.js";
|
|
11
11
|
import { t as Yoga } from "./yoga-5jKhYCJC.js";
|
|
12
12
|
import { r as createCell, t as cellAttributes } from "./cell-_ZVhbfl0.js";
|
|
13
13
|
import { i as semanticTextStyleToCellStyle, n as mergeSemanticTextStyles, t as emptySemanticTextStyle } from "./semantic-text-style-DIMzC7xt.js";
|
|
@@ -424,6 +424,7 @@ function App({ children, stdin, stdout, stderr, writeToStdout, writeToStderr, ex
|
|
|
424
424
|
const internal_eventEmitter = useRef(new EventEmitter());
|
|
425
425
|
internal_eventEmitter.current.setMaxListeners(Infinity);
|
|
426
426
|
const readableListenerRef = useRef(void 0);
|
|
427
|
+
const isMountedRef = useRef(true);
|
|
427
428
|
const pendingInputFlushRef = useRef(void 0);
|
|
428
429
|
const pendingInputFlushDelayMilliseconds = 20;
|
|
429
430
|
const clearPendingInputFlush = useCallback(() => {
|
|
@@ -614,7 +615,7 @@ function App({ children, stdin, stdout, stderr, writeToStdout, writeToStderr, ex
|
|
|
614
615
|
try {
|
|
615
616
|
return await (refresh ? refreshTerminalQuery(stdin, stdout) : ensureTerminalQuery(stdin, stdout));
|
|
616
617
|
} finally {
|
|
617
|
-
attachReadableListener();
|
|
618
|
+
if (isMountedRef.current) attachReadableListener();
|
|
618
619
|
handleSetRawMode(false);
|
|
619
620
|
}
|
|
620
621
|
}, [
|
|
@@ -817,7 +818,9 @@ function App({ children, stdin, stdout, stderr, writeToStdout, writeToStderr, ex
|
|
|
817
818
|
}));
|
|
818
819
|
}, []);
|
|
819
820
|
useEffect(() => {
|
|
821
|
+
isMountedRef.current = true;
|
|
820
822
|
return () => {
|
|
823
|
+
isMountedRef.current = false;
|
|
821
824
|
const canWriteToStdout = !stdout.destroyed && !stdout.writableEnded;
|
|
822
825
|
if (interactive && canWriteToStdout) cliCursor.show(stdout);
|
|
823
826
|
if (isRawModeSupported && (rawModeEnabledCount.current > 0 || pendingDisableRawModeRef.current)) disableRawMode();
|
|
@@ -1660,31 +1663,6 @@ function createRenderScheduler(render, options) {
|
|
|
1660
1663
|
};
|
|
1661
1664
|
}
|
|
1662
1665
|
//#endregion
|
|
1663
|
-
//#region src/utils.ts
|
|
1664
|
-
const resolveDimension = (value, fallback, defaultValue) => {
|
|
1665
|
-
if (value !== void 0 && value > 0) return value;
|
|
1666
|
-
if (fallback !== void 0 && fallback > 0) return fallback;
|
|
1667
|
-
return defaultValue;
|
|
1668
|
-
};
|
|
1669
|
-
/**
|
|
1670
|
-
Get the effective terminal dimensions from the given stdout stream.
|
|
1671
|
-
|
|
1672
|
-
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.
|
|
1673
|
-
*/
|
|
1674
|
-
const getWindowSize = (stdout) => {
|
|
1675
|
-
const columns = stdout.columns ?? 0;
|
|
1676
|
-
const rows = stdout.rows ?? 0;
|
|
1677
|
-
if (columns && rows) return {
|
|
1678
|
-
columns,
|
|
1679
|
-
rows
|
|
1680
|
-
};
|
|
1681
|
-
const fallbackSize = terminalSize();
|
|
1682
|
-
return {
|
|
1683
|
-
columns: resolveDimension(columns, fallbackSize.columns, 80),
|
|
1684
|
-
rows: resolveDimension(rows, fallbackSize.rows, 24)
|
|
1685
|
-
};
|
|
1686
|
-
};
|
|
1687
|
-
//#endregion
|
|
1688
1666
|
//#region src/ink.tsx
|
|
1689
1667
|
/** @jsxImportSource react */
|
|
1690
1668
|
const noop = () => {};
|
|
@@ -1710,6 +1688,7 @@ function bottomRows(screen, height) {
|
|
|
1710
1688
|
}
|
|
1711
1689
|
return cropped;
|
|
1712
1690
|
}
|
|
1691
|
+
const RESIZE_SETTLE_MS = 50;
|
|
1713
1692
|
const shouldClearTerminalForFrame = ({ isTTY, viewportRows, previousOutputHeight, nextOutputHeight, isUnmounting }) => {
|
|
1714
1693
|
if (!isTTY) return false;
|
|
1715
1694
|
const hadPreviousFrame = previousOutputHeight > 0;
|
|
@@ -1801,8 +1780,10 @@ const createInk = (options) => {
|
|
|
1801
1780
|
let lastOutputToRender = "";
|
|
1802
1781
|
let lastOutputHeight = 0;
|
|
1803
1782
|
let lastScreen;
|
|
1804
|
-
|
|
1805
|
-
let
|
|
1783
|
+
const windowSize = () => capabilitiesStore.current.size;
|
|
1784
|
+
let lastTerminalWidth = windowSize().columns;
|
|
1785
|
+
let lastTerminalHeight = windowSize().rows;
|
|
1786
|
+
let resizeSettle;
|
|
1806
1787
|
let fullStaticOutput = "";
|
|
1807
1788
|
let exitResult;
|
|
1808
1789
|
let unsubscribeBeforeExit;
|
|
@@ -1825,29 +1806,48 @@ const createInk = (options) => {
|
|
|
1825
1806
|
if (isSigilDev) reconciler.injectIntoDevTools();
|
|
1826
1807
|
if (options.patchConsole) installConsolePatch();
|
|
1827
1808
|
if (interactive) {
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1809
|
+
let seenColumns = lastTerminalWidth;
|
|
1810
|
+
let seenRows = lastTerminalHeight;
|
|
1811
|
+
unsubscribeResize = capabilitiesStore.subscribe(({ size }) => {
|
|
1812
|
+
if (size.columns === seenColumns && size.rows === seenRows) return;
|
|
1813
|
+
seenColumns = size.columns;
|
|
1814
|
+
seenRows = size.rows;
|
|
1815
|
+
resized(size.source);
|
|
1816
|
+
});
|
|
1832
1817
|
}
|
|
1833
1818
|
initKittyKeyboard();
|
|
1834
1819
|
const { promise: exitPromise, resolve: resolveExitPromise, reject: rejectExitPromise } = Promise.withResolvers();
|
|
1835
1820
|
exitPromise.catch(noop);
|
|
1836
|
-
function resized() {
|
|
1837
|
-
|
|
1838
|
-
|
|
1821
|
+
function resized(source) {
|
|
1822
|
+
if (resizeSettle !== void 0) {
|
|
1823
|
+
clearTimeout(resizeSettle);
|
|
1824
|
+
resizeSettle = void 0;
|
|
1825
|
+
}
|
|
1826
|
+
if (source === "terminal") {
|
|
1827
|
+
settleResize();
|
|
1828
|
+
return;
|
|
1829
|
+
}
|
|
1830
|
+
resizeSettle = setTimeout(settleResize, RESIZE_SETTLE_MS);
|
|
1831
|
+
}
|
|
1832
|
+
function settleResize() {
|
|
1833
|
+
resizeSettle = void 0;
|
|
1834
|
+
if (isUnmounted || isUnmounting) return;
|
|
1835
|
+
const { columns: currentWidth, rows: currentHeight } = windowSize();
|
|
1839
1836
|
if (currentWidth < lastTerminalWidth || currentHeight !== lastTerminalHeight) {
|
|
1840
|
-
clearLiveOutput();
|
|
1837
|
+
clearLiveOutput(rewrapsOnResize() ? currentWidth : void 0);
|
|
1841
1838
|
resetLiveOutput();
|
|
1842
1839
|
lastOutput = "";
|
|
1843
1840
|
lastOutputToRender = "";
|
|
1844
1841
|
lastOutputHeight = 0;
|
|
1845
1842
|
}
|
|
1843
|
+
lastTerminalWidth = currentWidth;
|
|
1844
|
+
lastTerminalHeight = currentHeight;
|
|
1846
1845
|
calculateLayout();
|
|
1847
1846
|
emitLayoutListeners(rootNode);
|
|
1848
1847
|
onRender();
|
|
1849
|
-
|
|
1850
|
-
|
|
1848
|
+
}
|
|
1849
|
+
function rewrapsOnResize() {
|
|
1850
|
+
return !isWindows && capabilitiesStore.current.terminal.name !== "apple-terminal";
|
|
1851
1851
|
}
|
|
1852
1852
|
function handleAppExit(errorOrResult) {
|
|
1853
1853
|
if (isUnmounted || isUnmounting) return;
|
|
@@ -1872,9 +1872,9 @@ const createInk = (options) => {
|
|
|
1872
1872
|
forceRewrite: true
|
|
1873
1873
|
});
|
|
1874
1874
|
}
|
|
1875
|
-
function clearLiveOutput() {
|
|
1875
|
+
function clearLiveOutput(columns) {
|
|
1876
1876
|
if (isScreenReaderEnabled) accessiblePresenter.clear();
|
|
1877
|
-
else terminal.clearFrame();
|
|
1877
|
+
else terminal.clearFrame({ columns });
|
|
1878
1878
|
}
|
|
1879
1879
|
function finishLiveOutput() {
|
|
1880
1880
|
if (isScreenReaderEnabled) accessiblePresenter.done();
|
|
@@ -1885,7 +1885,7 @@ const createInk = (options) => {
|
|
|
1885
1885
|
else terminal.resetFrame();
|
|
1886
1886
|
}
|
|
1887
1887
|
function calculateLayout() {
|
|
1888
|
-
const terminalWidth =
|
|
1888
|
+
const terminalWidth = windowSize().columns;
|
|
1889
1889
|
rootNode.yogaNode.setWidth(terminalWidth);
|
|
1890
1890
|
rootNode.yogaNode.calculateLayout(void 0, void 0, Yoga.DIRECTION_LTR);
|
|
1891
1891
|
}
|
|
@@ -1902,6 +1902,13 @@ const createInk = (options) => {
|
|
|
1902
1902
|
}
|
|
1903
1903
|
return;
|
|
1904
1904
|
}
|
|
1905
|
+
if (resizeSettle !== void 0 && !isUnmounting) {
|
|
1906
|
+
if (nextRenderCommit) {
|
|
1907
|
+
nextRenderCommit.resolve();
|
|
1908
|
+
nextRenderCommit = void 0;
|
|
1909
|
+
}
|
|
1910
|
+
return;
|
|
1911
|
+
}
|
|
1905
1912
|
if (nextRenderCommit) {
|
|
1906
1913
|
nextRenderCommit.resolve();
|
|
1907
1914
|
nextRenderCommit = void 0;
|
|
@@ -1948,7 +1955,7 @@ const createInk = (options) => {
|
|
|
1948
1955
|
if (sync) options.stdout.write(esu);
|
|
1949
1956
|
return;
|
|
1950
1957
|
}
|
|
1951
|
-
const terminalWidth =
|
|
1958
|
+
const terminalWidth = windowSize().columns;
|
|
1952
1959
|
const wrappedOutput = wrapAnsi(output, terminalWidth, {
|
|
1953
1960
|
trim: false,
|
|
1954
1961
|
hard: true
|
|
@@ -2037,6 +2044,10 @@ const createInk = (options) => {
|
|
|
2037
2044
|
function unmount(error) {
|
|
2038
2045
|
if (isUnmounted || isUnmounting) return;
|
|
2039
2046
|
isUnmounting = true;
|
|
2047
|
+
if (resizeSettle !== void 0) {
|
|
2048
|
+
clearTimeout(resizeSettle);
|
|
2049
|
+
resizeSettle = void 0;
|
|
2050
|
+
}
|
|
2040
2051
|
unsubscribeBeforeExit?.();
|
|
2041
2052
|
unsubscribeBeforeExit = void 0;
|
|
2042
2053
|
const { canWriteToStdout } = getWritableStreamState(options.stdout);
|
|
@@ -2221,7 +2232,7 @@ const createInk = (options) => {
|
|
|
2221
2232
|
if (!screen) return;
|
|
2222
2233
|
const hasStaticOutput = staticOutput !== "";
|
|
2223
2234
|
const isTTY = Boolean(options.stdout.isTTY);
|
|
2224
|
-
const viewportRows = isTTY ?
|
|
2235
|
+
const viewportRows = isTTY ? windowSize().rows : 24;
|
|
2225
2236
|
if (isTTY && outputHeight > viewportRows) {
|
|
2226
2237
|
const lines = output.split("\n");
|
|
2227
2238
|
output = lines.slice(lines.length - viewportRows).join("\n");
|
|
@@ -2907,20 +2918,17 @@ const usePointerShape = (shape) => {
|
|
|
2907
2918
|
//#region src/hooks/use-window-size.ts
|
|
2908
2919
|
/**
|
|
2909
2920
|
A React hook that returns the current terminal window dimensions and re-renders the component whenever the terminal is resized.
|
|
2921
|
+
|
|
2922
|
+
Reads the capabilities store, so on terminals that send in-band size reports
|
|
2923
|
+
(mode 2048) the dimensions are the emulator's own, arriving after it has
|
|
2924
|
+
rewrapped its screen; elsewhere they are the stream's `columns`/`rows`.
|
|
2910
2925
|
*/
|
|
2911
2926
|
const useWindowSize = () => {
|
|
2912
|
-
const {
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
};
|
|
2918
|
-
stdout.on("resize", onResize);
|
|
2919
|
-
return () => {
|
|
2920
|
-
stdout.off("resize", onResize);
|
|
2921
|
-
};
|
|
2922
|
-
}, [stdout]);
|
|
2923
|
-
return size;
|
|
2927
|
+
const { size } = useCapabilities();
|
|
2928
|
+
return useMemo(() => ({
|
|
2929
|
+
columns: size.columns,
|
|
2930
|
+
rows: size.rows
|
|
2931
|
+
}), [size.columns, size.rows]);
|
|
2924
2932
|
};
|
|
2925
2933
|
//#endregion
|
|
2926
2934
|
//#region src/hooks/use-box-metrics.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { D as cursorHide, b as OSC, j as cursorShow, x as ST } from "./sgr-BhwaWAJB.js";
|
|
2
|
-
import {
|
|
2
|
+
import { s as signalExit } from "./detect-B3dL4Q11.js";
|
|
3
3
|
import { pathToFileURL } from "node:url";
|
|
4
4
|
//#region src/ansi/cursor.ts
|
|
5
5
|
let restoreRegistered = false;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as TerminalAppearance } from "./detect-
|
|
2
|
-
import { c as Color, d as RgbColor, t as ColorProfile } from "./color-profile-
|
|
1
|
+
import { c as TerminalAppearance } from "./detect-Db6GbKOm.js";
|
|
2
|
+
import { c as Color, d as RgbColor, t as ColorProfile } from "./color-profile-CyeHnG1T.js";
|
|
3
3
|
//#region src/color/paint.d.ts
|
|
4
4
|
type ColorInput = Color | string;
|
|
5
5
|
type InterpolationSpace = "oklab" | "lab" | "rgb" | "hsv";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as TerminalAppearance, s as RgbColor, t as Capabilities } from "./detect-
|
|
1
|
+
import { c as TerminalAppearance, s as RgbColor, t as Capabilities } from "./detect-Db6GbKOm.js";
|
|
2
2
|
//#region src/capabilities/query.d.ts
|
|
3
3
|
type PixelSize = {
|
|
4
4
|
width: number;
|
package/dist/router.d.ts
CHANGED
package/dist/router.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { f as Text, n as useInput, t as useFocus } from "./use-focus-
|
|
1
|
+
import { f as Text, n as useInput, t as useFocus } from "./use-focus-BNG0xsb7.js";
|
|
2
2
|
import { Children, Fragment, createContext, isValidElement, startTransition, useCallback, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
3
3
|
import { Fragment as Fragment$1, jsx } from "react/jsx-runtime";
|
|
4
4
|
//#region src/router/history.ts
|
package/dist/screen.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { _ as emptyCellStyle, a as CellContent, c as Color, d as RgbColor, f as UnderlineStyle, g as emptyCell, h as createCell, i as Cell, l as Hyperlink, m as cellsEqual, n as colorProfileFromLevel, o as CellPatch, p as cellAttributes, r as quantizeColor, s as CellStyle, t as ColorProfile, u as IndexedColor } from "./color-profile-
|
|
1
|
+
import { _ as emptyCellStyle, a as CellContent, c as Color, d as RgbColor, f as UnderlineStyle, g as emptyCell, h as createCell, i as Cell, l as Hyperlink, m as cellsEqual, n as colorProfileFromLevel, o as CellPatch, p as cellAttributes, r as quantizeColor, s as CellStyle, t as ColorProfile, u as IndexedColor } from "./color-profile-CyeHnG1T.js";
|
|
2
2
|
import { n as Rect, t as Point } from "./geometry-BxXOzJgo.js";
|
|
3
|
-
import { a as cellFromStyledChar, i as styledCharFromCell, n as serializeLine, o as cellsFromAnsi, r as serializeScreen, t as SerializeOptions } from "./index-
|
|
4
|
-
import { n as Screen, t as Line } from "./screen-
|
|
3
|
+
import { a as cellFromStyledChar, i as styledCharFromCell, n as serializeLine, o as cellsFromAnsi, r as serializeScreen, t as SerializeOptions } from "./index-D48vQhhe.js";
|
|
4
|
+
import { n as Screen, t as Line } from "./screen-CgC2WlVM.js";
|
|
5
5
|
export { Cell, CellContent, CellPatch, CellStyle, Color, ColorProfile, Hyperlink, IndexedColor, type Line, Point, Rect, RgbColor, Screen, SerializeOptions, UnderlineStyle, cellAttributes, cellFromStyledChar, cellsEqual, cellsFromAnsi, colorProfileFromLevel, createCell, emptyCell, emptyCellStyle, quantizeColor, serializeLine, serializeScreen, styledCharFromCell };
|