@simon_he/vue-tui 1.1.3 → 1.1.5

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.
Files changed (52) hide show
  1. package/README.md +18 -18
  2. package/dist/{TMermaidText-frVr8Ysb.js → TMermaidText-wLnMMvVS.js} +1 -1
  3. package/dist/{TSelect-Dx34M1pF.js → TSelect-CMBOOFwK.js} +5 -5
  4. package/dist/{TTree-DdAjCPHu.js → TTree-kk8ntrpg.js} +6 -5
  5. package/dist/agent/mermaid.d.cts +2 -2
  6. package/dist/agent/mermaid.d.ts +2 -2
  7. package/dist/agent.cjs +542 -266
  8. package/dist/agent.js +25 -82
  9. package/dist/{block-source-Crro3mxi.js → block-source-DhzajB9H.js} +299 -239
  10. package/dist/cli.cjs +57 -16
  11. package/dist/cli.js +70 -15
  12. package/dist/core.js +3 -3
  13. package/dist/{hyperlink-_1FAj7Wq.js → create-terminal-Db_-UGVQ.js} +474 -102
  14. package/dist/{dom-renderer-DXx8fWzD.js → dom-renderer-BfwAEQMf.js} +3 -2
  15. package/dist/experimental.cjs +103 -66
  16. package/dist/experimental.js +20 -74
  17. package/dist/hyperlink-clbb_ha_.js +100 -0
  18. package/dist/index.js +8 -8
  19. package/dist/{linkify-BjI4zVfY.js → linkify-CL9wwnZN.js} +3 -3
  20. package/dist/markdown.cjs +521 -212
  21. package/dist/markdown.d.cts +3 -0
  22. package/dist/markdown.d.ts +3 -0
  23. package/dist/markdown.js +75 -8
  24. package/dist/math-image-BZhmfUeu.js +308 -0
  25. package/dist/mermaid-N3kGTHFy.js +1697 -0
  26. package/dist/mermaid.cjs +1460 -6
  27. package/dist/mermaid.d.cts +4 -0
  28. package/dist/mermaid.d.ts +4 -0
  29. package/dist/mermaid.js +7 -5
  30. package/dist/{rect-DUpeDfBg.js → rect-JzWMJxxc.js} +1 -1
  31. package/dist/renderer/cli/stdout-renderer.d.ts +44 -0
  32. package/dist/renderer/terminal-graphics.d.ts +61 -0
  33. package/dist/renderer-dom.js +4 -4
  34. package/dist/{terminal-graphics-Bbe83wSr.js → terminal-graphics-2FTRg9x3.js} +90 -2
  35. package/dist/{tlog-theme-i6S_Oftd.js → tlog-theme-B91Wv7Zj.js} +5 -4
  36. package/dist/vue/components/TAgentTerminalGraphic.d.ts +1 -1
  37. package/dist/vue/components/TMarkdownText.d.ts +70 -2
  38. package/dist/vue/components/TMermaidImage.d.ts +920 -0
  39. package/dist/vue/components/TMermaidText.d.ts +2 -2
  40. package/dist/vue/components/TVirtualMarkdown.d.ts +70 -2
  41. package/dist/vue/markdown/ast.d.ts +5 -0
  42. package/dist/vue/markdown/document.d.ts +3 -0
  43. package/dist/vue/markdown/math-image.d.ts +68 -0
  44. package/dist/vue/markdown/theme.d.ts +12 -0
  45. package/dist/vue/markdown/types.d.ts +12 -2
  46. package/dist/vue/mermaid/beautiful-mermaid.d.ts +284 -240
  47. package/dist/vue/mermaid/mermaid-image.d.ts +73 -0
  48. package/dist/vue.js +9 -9
  49. package/package.json +24 -10
  50. package/dist/mermaid-BNhM1jAZ.js +0 -123
  51. package/dist/width-GqllnV8C.js +0 -474
  52. /package/dist/{ansi-palette-CH6jc2Z7.js → ansi-palette-BHF1rN7R.js} +0 -0
package/dist/cli.cjs CHANGED
@@ -7869,7 +7869,28 @@ function createStdoutRenderer(terminal, options) {
7869
7869
  let output = (options == null ? void 0 : options.output) ?? import_node_process6.default.stdout;
7870
7870
  if (!output)
7871
7871
  throw new Error("createStdoutRenderer requires a Node stdout-like output");
7872
- let out = output, outputFd = Number(out.fd), canUseSyncStdout = (options == null ? void 0 : options.output) == null && Number.isInteger(outputFd) && outputFd === 1, fingerprintOwner = Symbol("stdout-renderer"), ownsFingerprintFn = !1, fingerprintTerminal = terminal, canInstallTerminalFingerprintFn = () => typeof fingerprintTerminal.setFingerprintFn == "function" && typeof fingerprintTerminal.getRowFingerprints == "function", outputIsTTY = !!out.isTTY, outputAllowsOsc8Links = out.isTTY !== !1, clear = (options == null ? void 0 : options.clear) ?? !0, hideCursor = (options == null ? void 0 : options.hideCursor) ?? !0, altScreen = (options == null ? void 0 : options.altScreen) ?? outputIsTTY, keepLineWrapDisabled = altScreen && outputIsTTY, defaultBg = (options == null ? void 0 : options.defaultBg) == null || (options == null ? void 0 : options.defaultBg) === "transparent" ? void 0 : (options == null ? void 0 : options.defaultBg) ?? "black", palette = (options == null ? void 0 : options.palette) ?? null, trackResize = (options == null ? void 0 : options.trackResize) ?? !0, getImeAnchor = options == null ? void 0 : options.getImeAnchor, allowFileUrls = (options == null ? void 0 : options.allowFileUrls) ?? !1, cliLatency = getCliLatencyProfiler(), profiler = createTuiProfiler("stdout-renderer", {
7872
+ let out = output, outputFd = Number(out.fd), canUseSyncStdout = (options == null ? void 0 : options.output) == null && Number.isInteger(outputFd) && outputFd === 1, fingerprintOwner = Symbol("stdout-renderer"), ownsFingerprintFn = !1, fingerprintTerminal = terminal, canInstallTerminalFingerprintFn = () => typeof fingerprintTerminal.setFingerprintFn == "function" && typeof fingerprintTerminal.getRowFingerprints == "function", outputIsTTY = !!out.isTTY, outputAllowsOsc8Links = out.isTTY !== !1, clear = (options == null ? void 0 : options.clear) ?? !0, hideCursor = (options == null ? void 0 : options.hideCursor) ?? !0, altScreen = (options == null ? void 0 : options.altScreen) ?? outputIsTTY, keepLineWrapDisabled = altScreen && outputIsTTY, defaultBg = (options == null ? void 0 : options.defaultBg) == null || (options == null ? void 0 : options.defaultBg) === "transparent" ? void 0 : (options == null ? void 0 : options.defaultBg) ?? "black", palette = (options == null ? void 0 : options.palette) ?? null, trackResize = (options == null ? void 0 : options.trackResize) ?? !0, getImeAnchor = options == null ? void 0 : options.getImeAnchor, anchorMode = (options == null ? void 0 : options.anchor) === "bottom" ? "bottom" : "top", screenRowsFn = typeof (options == null ? void 0 : options.screenRows) == "function" ? options.screenRows : void 0, rawBarGap = Math.floor(Number((options == null ? void 0 : options.barGap) ?? 0)), barGap = Number.isFinite(rawBarGap) ? Math.max(0, rawBarGap) : 0, rowOffset = 0, scrollRegionBottom = 0, bottomRegionInitialized = !1, resolveScreenRows = () => {
7873
+ var _a2;
7874
+ let rows = 0;
7875
+ if (screenRowsFn) {
7876
+ let v = Math.floor(Number(screenRowsFn()));
7877
+ Number.isFinite(v) && v > 0 && (rows = v);
7878
+ }
7879
+ if (!rows) {
7880
+ let v = Math.floor(Number(out.rows));
7881
+ Number.isFinite(v) && v > 0 && (rows = v);
7882
+ }
7883
+ if (!rows) {
7884
+ let v = Math.floor(Number((_a2 = import_node_process6.default.stdout) == null ? void 0 : _a2.rows));
7885
+ Number.isFinite(v) && v > 0 && (rows = v);
7886
+ }
7887
+ return rows;
7888
+ }, computeRowOffset = (bufferRows) => {
7889
+ if (anchorMode !== "bottom")
7890
+ return 0;
7891
+ let offset = resolveScreenRows() - bufferRows;
7892
+ return Number.isFinite(offset) && offset > 0 ? offset : 0;
7893
+ }, allowFileUrls = (options == null ? void 0 : options.allowFileUrls) ?? !1, cliLatency = getCliLatencyProfiler(), profiler = createTuiProfiler("stdout-renderer", {
7873
7894
  fileWriter: (options == null ? void 0 : options.profileFileWriter) ?? nodeProfilerFileWriter,
7874
7895
  defaultLogDest: "file",
7875
7896
  defaultLogPath: defaultVueTuiProfileLogPath()
@@ -8319,7 +8340,11 @@ function createStdoutRenderer(terminal, options) {
8319
8340
  clearSequence,
8320
8341
  fallbackText: frame.fallbackText,
8321
8342
  resizeRedraw: !0,
8322
- placementMoveWithoutClear: !1
8343
+ // Preserve the caller's opt-in: when the placement moves (e.g.
8344
+ // interactive wheel zoom) the render pass can replace the kitty
8345
+ // placement in place and keep the original transmission sequence,
8346
+ // so subsequent resizes stay on the cheap path.
8347
+ placementMoveWithoutClear: !!normalized.placementMoveWithoutClear
8323
8348
  }), pendingGraphicSignatures.set(frame.id, signature), recordTerminalGraphicTrace({
8324
8349
  type: "queue",
8325
8350
  id: frame.id,
@@ -8426,7 +8451,7 @@ function createStdoutRenderer(terminal, options) {
8426
8451
  function clearGraphicRect(rect) {
8427
8452
  let blank = " ".repeat(Math.max(0, rect.w)), out2 = "";
8428
8453
  for (let row = 0; row < rect.h; row++)
8429
- out2 += `\x1B[${rect.y + row + 1};${rect.x + 1}H${blank}`;
8454
+ out2 += `\x1B[${rect.y + row + 1 + rowOffset};${rect.x + 1}H${blank}`;
8430
8455
  return out2;
8431
8456
  }
8432
8457
  function sameGraphicRect(a, b) {
@@ -8887,7 +8912,7 @@ function createStdoutRenderer(terminal, options) {
8887
8912
  let start = rowCursorToCol1.length;
8888
8913
  rowCursorToCol1.length = rows, rowClearToEol.length = rows;
8889
8914
  for (let y = start; y < rows; y++)
8890
- rowCursorToCol1[y] = `\x1B[${y + 1};1H`, rowClearToEol[y] = `\x1B[${y + 1};1H\x1B[K`;
8915
+ rowCursorToCol1[y] = `\x1B[${y + 1 + rowOffset};1H`, rowClearToEol[y] = `\x1B[${y + 1 + rowOffset};1H\x1B[K`;
8891
8916
  }, rowHasNonDefaultBlankCell = (sourceFP, sourceTextIds, sourceHrefIds, y, cols) => {
8892
8917
  if (!fpCols || y < 0 || y >= fpRows)
8893
8918
  return !1;
@@ -9106,6 +9131,21 @@ function createStdoutRenderer(terminal, options) {
9106
9131
  `doRender state: size=${size.cols}x${size.rows}, dirtyRows=${(dirtyRows == null ? void 0 : dirtyRows.length) ?? "null"}, scrollOps=${(scrollOperations == null ? void 0 : scrollOperations.length) ?? 0}, rowsOnlyBaseline=${rowsOnlyResizeBaseline ? "true" : "false"}, allowGraphicsOnlyWithoutBaseline=${allowGraphicsOnlyWithoutBaseline ? "true" : "false"}, activeGraphics=${activeGraphics.size}, pendingGraphics=${graphicsToRender.length}, pendingGraphicClears=${graphicsClearsToRender.length}`
9107
9132
  );
9108
9133
  let terminalGraphicsBlockScrollRegions = !1;
9134
+ if (anchorMode === "bottom") {
9135
+ dirtyRows = null, scrollOperations = null;
9136
+ let nextRowOffset = computeRowOffset(size.rows);
9137
+ nextRowOffset !== rowOffset && (rowOffset = nextRowOffset, rowCursorToCol1.length = 0, rowClearToEol.length = 0);
9138
+ let nextRegionBottom = Math.max(1, nextRowOffset - barGap);
9139
+ if (outputIsTTY && !bottomRegionInitialized) {
9140
+ let screenRows = resolveScreenRows();
9141
+ if (screenRows > 0 && nextRowOffset > 0) {
9142
+ let reservedRows = Math.max(0, screenRows - nextRegionBottom), scrollCount = Math.min(screenRows, reservedRows + 1);
9143
+ out.write(`\x1B[r\x1B[${screenRows};1H${`
9144
+ `.repeat(scrollCount)}`), bottomRegionInitialized = !0;
9145
+ }
9146
+ }
9147
+ outputIsTTY && nextRegionBottom !== scrollRegionBottom && (scrollRegionBottom = nextRegionBottom, out.write(`\x1B[1;${nextRegionBottom}r`));
9148
+ }
9109
9149
  ensureRowEscapes(Math.max(size.rows, lastRenderedRows)), ensureFingerprints(size.cols, size.rows);
9110
9150
  let bgSeq = openBg(defaultBg), bgOnlyStyle = { bg: defaultBg }, bgKey = styleKeyFromParts({ bg: defaultBg }), blankFP = cellFingerprintFromStyleKey(" ", bgKey);
9111
9151
  if (rowsOnlyResizeBaseline && rowsOnlyResizeBaseline.cols === size.cols) {
@@ -9276,7 +9316,7 @@ function createStdoutRenderer(terminal, options) {
9276
9316
  }
9277
9317
  })(), fpPrevValid && rowsToRender && (currentFP.set(prevFP), currentHrefIds.set(prevHrefIds), currentTextIds.set(prevTextIds));
9278
9318
  let frameHasTerminalGraphics = activeGraphics.size > 0 || graphicsClearsToRender.length > 0 || graphicsToRender.length > 0, useFrameSyncOutput = useSyncOutput || isGhostty && frameHasTerminalGraphics, frameParts = [];
9279
- frameParts.push(useFrameSyncOutput ? SYNC_START : ""), frameParts.push(allowGraphicsOnlyWithoutBaseline || keepLineWrapDisabled ? "" : "\x1B[?7l"), frameParts.push(SGR_RESET, bgSeq), hideCursor && !getImeAnchor && frameParts.push(CURSOR_HOME);
9319
+ frameParts.push(useFrameSyncOutput ? SYNC_START : ""), frameParts.push(allowGraphicsOnlyWithoutBaseline || keepLineWrapDisabled ? "" : "\x1B[?7l"), frameParts.push(SGR_RESET, bgSeq), hideCursor && !getImeAnchor && frameParts.push(rowOffset > 0 ? `\x1B[${rowOffset + 1}H` : CURSOR_HOME);
9280
9320
  let lastRenderedY = -1, lastRenderWasFullRow = !1, hasFrameOutput = !1, activeStyleKey = null, activeStyle = {
9281
9321
  fg: null,
9282
9322
  bg: defaultBg,
@@ -9316,11 +9356,11 @@ function createStdoutRenderer(terminal, options) {
9316
9356
  hasFrameOutput = !0;
9317
9357
  let pushCursorFixAfterCell = (parts, cellX, cell) => {
9318
9358
  let afterX = cellX + (cell.width ?? 1);
9319
- afterX >= size.cols || parts.push(`\x1B[${y + 1};${afterX + 1}H`);
9359
+ afterX >= size.cols || parts.push(`\x1B[${y + 1 + rowOffset};${afterX + 1}H`);
9320
9360
  };
9321
9361
  disableCursorPos || (closeActiveHrefBeforeCursorMove(), spanStart === 0 && lastRenderWasFullRow && y === lastRenderedY + 1 ? frameParts.push(`\r
9322
9362
  `) : frameParts.push(
9323
- spanStart === 0 ? rowCursorToCol1[y] : `\x1B[${y + 1};${spanStart + 1}H`
9363
+ spanStart === 0 ? rowCursorToCol1[y] : `\x1B[${y + 1 + rowOffset};${spanStart + 1}H`
9324
9364
  ));
9325
9365
  let currentKey = null, currentStyle = null, currentTextParts = rowTextPartsScratch;
9326
9366
  currentTextParts.length = 0;
@@ -9666,7 +9706,7 @@ function createStdoutRenderer(terminal, options) {
9666
9706
  fingerprintRow(row, y, size.cols), renderRowPreservingTerminalGraphics(y, row);
9667
9707
  }
9668
9708
  }
9669
- if (!rowsToRender && lastRenderedRows > size.rows && !rowsOnlyResizeBaseline) {
9709
+ if (!rowsToRender && lastRenderedRows > size.rows && !rowsOnlyResizeBaseline && anchorMode !== "bottom") {
9670
9710
  let extraRows = lastRenderedRows - size.rows;
9671
9711
  activeStyleKey !== bgKey && (frameParts.push(SGR_RESET, bgSeq), activeStyleKey = bgKey);
9672
9712
  for (let i = 0; i < extraRows; i++)
@@ -9688,7 +9728,7 @@ function createStdoutRenderer(terminal, options) {
9688
9728
  let erase = `\x1B[${Math.max(0, rect.w)}X`, clearStyle = bgSeq, out2 = "";
9689
9729
  for (let row = 0; row < rect.h; row++) {
9690
9730
  let y = rect.y + row, spans = terminalGraphicTextPreserveSpans.get(y), preservedGraphicSpan = !(overlayTouchedRowSet != null && overlayTouchedRowSet.has(y)) && !!(spans != null && spans.some((span) => span.start < rect.x + rect.w && span.end > rect.x));
9691
- (!rowsToRender || rowWasPaintedByTextRenderer(y)) && !preservedGraphicSpan || (out2 += `\x1B[${y + 1};${rect.x + 1}H${clearStyle}${erase}${SGR_RESET}`);
9731
+ (!rowsToRender || rowWasPaintedByTextRenderer(y)) && !preservedGraphicSpan || (out2 += `\x1B[${y + 1 + rowOffset};${rect.x + 1}H${clearStyle}${erase}${SGR_RESET}`);
9692
9732
  }
9693
9733
  return out2;
9694
9734
  }, commitTerminalGraphicsState = null, restoreTerminalGraphicsAfterWriteFailure = null, terminalGraphicsMetrics = null;
@@ -9708,7 +9748,7 @@ function createStdoutRenderer(terminal, options) {
9708
9748
  return !1;
9709
9749
  let cell = rect ? { x: rect.x, y: rect.y } : clampCellToViewport(fallbackCell, size);
9710
9750
  return frameParts.push(
9711
- countGraphicsBytes(`\x1B[${cell.y + 1};${cell.x + 1}H`),
9751
+ countGraphicsBytes(`\x1B[${cell.y + 1 + rowOffset};${cell.x + 1}H`),
9712
9752
  countGraphicsBytes(maybeWrapTerminalGraphic(sequence)),
9713
9753
  countGraphicsBytes(SGR_RESET)
9714
9754
  ), !0;
@@ -9854,14 +9894,14 @@ function createStdoutRenderer(terminal, options) {
9854
9894
  let anchor = getImeAnchor();
9855
9895
  if (anchor) {
9856
9896
  let { x, y } = clampCellToViewport(anchor, size);
9857
- (hasFrameOutput || x !== lastCursorX || y !== lastCursorY) && (hasFrameOutput = !0, emittedCursorPos = { x, y }, closeActiveHrefBeforeCursorMove(), frameParts.push(`\x1B[${y + 1};${x + 1}H`));
9897
+ (hasFrameOutput || x !== lastCursorX || y !== lastCursorY) && (hasFrameOutput = !0, emittedCursorPos = { x, y }, closeActiveHrefBeforeCursorMove(), frameParts.push(`\x1B[${y + 1 + rowOffset};${x + 1}H`));
9858
9898
  }
9859
9899
  }
9860
9900
  if (!hasFrameOutput) {
9861
9901
  commitRenderBaseline(), isDebugEnabled() && getDebugLog().render(" No-op frame skipped"), cliLatency == null || cliLatency.recordStdoutNoOutput();
9862
9902
  return;
9863
9903
  }
9864
- enableOsc8Links && activeStyle.href && frameParts.push(OSC8_CLOSE), frameParts.push(SGR_RESET), hideCursor && !getImeAnchor && frameParts.push(CURSOR_HOME), frameParts.push(allowGraphicsOnlyWithoutBaseline || keepLineWrapDisabled ? "" : "\x1B[?7h"), frameParts.push(useFrameSyncOutput ? SYNC_END : "");
9904
+ enableOsc8Links && activeStyle.href && frameParts.push(OSC8_CLOSE), frameParts.push(SGR_RESET), hideCursor && !getImeAnchor && frameParts.push(rowOffset > 0 ? `\x1B[${rowOffset + 1}H` : CURSOR_HOME), frameParts.push(allowGraphicsOnlyWithoutBaseline || keepLineWrapDisabled ? "" : "\x1B[?7h"), frameParts.push(useFrameSyncOutput ? SYNC_END : "");
9865
9905
  let frame = frameParts.join(""), frameBytes = import_node_buffer3.Buffer.byteLength(frame, "utf8");
9866
9906
  if (profiler && profiler.recordRender({
9867
9907
  durationMs: profiler.now() - renderStart,
@@ -10172,7 +10212,7 @@ function createStdoutRenderer(terminal, options) {
10172
10212
  rowsOnlyResizeRepaintTimer = null, repaintRowsAfterRowsOnlyResize();
10173
10213
  }, ROWS_ONLY_RESIZE_REPAINT_DELAY_MS);
10174
10214
  }
10175
- altScreen && outputIsTTY && out.write("\x1B[?1049h"), keepLineWrapDisabled && out.write("\x1B[?7l"), hideCursor && out.write("\x1B[?25l"), clear && out.write(`${SGR_RESET}${openBg(defaultBg)}\x1B[2J\x1B[H${SGR_RESET}`);
10215
+ altScreen && outputIsTTY && out.write("\x1B[?1049h"), keepLineWrapDisabled && out.write("\x1B[?7l"), hideCursor && out.write("\x1B[?25l"), clear && anchorMode !== "bottom" && out.write(`${SGR_RESET}${openBg(defaultBg)}\x1B[2J\x1B[H${SGR_RESET}`);
10176
10216
  let off = terminal.on("commit", ({ dirtyRows, scrollOperations, sync }) => {
10177
10217
  if (suppressNextResizeCommitRender)
10178
10218
  return;
@@ -10225,7 +10265,7 @@ function createStdoutRenderer(terminal, options) {
10225
10265
  { cellX: x, cellY: y },
10226
10266
  { cols: size.cols, rows: size.rows }
10227
10267
  );
10228
- out.write(`\x1B[${cy + 1};${cx + 1}H`), lastCursorX = cx, lastCursorY = cy;
10268
+ out.write(`\x1B[${cy + 1 + rowOffset};${cx + 1}H`), lastCursorX = cx, lastCursorY = cy;
10229
10269
  }
10230
10270
  function showCursor(visible) {
10231
10271
  disposed || out.write(visible ? "\x1B[?25h" : "\x1B[?25l");
@@ -10244,7 +10284,7 @@ function createStdoutRenderer(terminal, options) {
10244
10284
  if (visibleRect && (clearParts.push(clearGraphicRect(visibleRect)), wroteClear = !0), active.clearSequence && (visibleRect || !clearSequenceNeedsVisibleCell(active.clearSequence, active.protocol))) {
10245
10285
  let cell = visibleRect ? { x: visibleRect.x, y: visibleRect.y } : clampCellToViewport({ cellX: active.x, cellY: active.y }, size);
10246
10286
  clearParts.push(
10247
- `\x1B[${cell.y + 1};${cell.x + 1}H`,
10287
+ `\x1B[${cell.y + 1 + rowOffset};${cell.x + 1}H`,
10248
10288
  maybeWrapTerminalGraphic(active.clearSequence)
10249
10289
  ), wroteClear = !0;
10250
10290
  }
@@ -10274,7 +10314,7 @@ function createStdoutRenderer(terminal, options) {
10274
10314
  } catch {
10275
10315
  }
10276
10316
  try {
10277
- keepLineWrapDisabled && out.write("\x1B[?7h"), hideCursor && out.write("\x1B[?25h"), altScreen && outputIsTTY && out.write("\x1B[?1049l");
10317
+ keepLineWrapDisabled && out.write("\x1B[?7h"), hideCursor && out.write("\x1B[?25h"), altScreen && outputIsTTY && out.write("\x1B[?1049l"), anchorMode === "bottom" && outputIsTTY && scrollRegionBottom > 0 && out.write("\x1B[r");
10278
10318
  } catch (err) {
10279
10319
  disposeError == null && (disposeError = err);
10280
10320
  }
@@ -10285,6 +10325,7 @@ function createStdoutRenderer(terminal, options) {
10285
10325
  capabilities: STDOUT_RENDERER_CAPABILITIES,
10286
10326
  graphicsCapabilities,
10287
10327
  render,
10328
+ forceRender: () => render(void 0, !0),
10288
10329
  dispose,
10289
10330
  setCursor,
10290
10331
  showCursor,
package/dist/cli.js CHANGED
@@ -9919,6 +9919,35 @@ function createStdoutRenderer(terminal, options) {
9919
9919
  let palette = (options === null || options === void 0 ? void 0 : options.palette) ?? null;
9920
9920
  const trackResize = (options === null || options === void 0 ? void 0 : options.trackResize) ?? true;
9921
9921
  const getImeAnchor = options === null || options === void 0 ? void 0 : options.getImeAnchor;
9922
+ const anchorMode = (options === null || options === void 0 ? void 0 : options.anchor) === "bottom" ? "bottom" : "top";
9923
+ const screenRowsFn = typeof (options === null || options === void 0 ? void 0 : options.screenRows) === "function" ? options.screenRows : void 0;
9924
+ const rawBarGap = Math.floor(Number((options === null || options === void 0 ? void 0 : options.barGap) ?? 0));
9925
+ const barGap = Number.isFinite(rawBarGap) ? Math.max(0, rawBarGap) : 0;
9926
+ let rowOffset = 0;
9927
+ let scrollRegionBottom = 0;
9928
+ let bottomRegionInitialized = false;
9929
+ const resolveScreenRows = () => {
9930
+ let rows = 0;
9931
+ if (screenRowsFn) {
9932
+ const v = Math.floor(Number(screenRowsFn()));
9933
+ if (Number.isFinite(v) && v > 0) rows = v;
9934
+ }
9935
+ if (!rows) {
9936
+ const v = Math.floor(Number(out.rows));
9937
+ if (Number.isFinite(v) && v > 0) rows = v;
9938
+ }
9939
+ if (!rows) {
9940
+ var _stdout;
9941
+ const v = Math.floor(Number((_stdout = process.stdout) === null || _stdout === void 0 ? void 0 : _stdout.rows));
9942
+ if (Number.isFinite(v) && v > 0) rows = v;
9943
+ }
9944
+ return rows;
9945
+ };
9946
+ const computeRowOffset = (bufferRows) => {
9947
+ if (anchorMode !== "bottom") return 0;
9948
+ const offset = resolveScreenRows() - bufferRows;
9949
+ return Number.isFinite(offset) && offset > 0 ? offset : 0;
9950
+ };
9922
9951
  const allowFileUrls = (options === null || options === void 0 ? void 0 : options.allowFileUrls) ?? false;
9923
9952
  const cliLatency = getCliLatencyProfiler();
9924
9953
  const profiler = createTuiProfiler("stdout-renderer", {
@@ -10453,7 +10482,7 @@ function createStdoutRenderer(terminal, options) {
10453
10482
  clearSequence,
10454
10483
  fallbackText: frame.fallbackText,
10455
10484
  resizeRedraw: true,
10456
- placementMoveWithoutClear: false
10485
+ placementMoveWithoutClear: Boolean(normalized.placementMoveWithoutClear)
10457
10486
  });
10458
10487
  pendingGraphicSignatures.set(frame.id, signature);
10459
10488
  recordTerminalGraphicTrace({
@@ -10617,7 +10646,7 @@ function createStdoutRenderer(terminal, options) {
10617
10646
  function clearGraphicRect(rect) {
10618
10647
  const blank = " ".repeat(Math.max(0, rect.w));
10619
10648
  let out$1 = "";
10620
- for (let row = 0; row < rect.h; row++) out$1 += `\u001B[${rect.y + row + 1};${rect.x + 1}H${blank}`;
10649
+ for (let row = 0; row < rect.h; row++) out$1 += `\u001B[${rect.y + row + 1 + rowOffset};${rect.x + 1}H${blank}`;
10621
10650
  return out$1;
10622
10651
  }
10623
10652
  function sameGraphicRect(a, b) {
@@ -11238,8 +11267,8 @@ function createStdoutRenderer(terminal, options) {
11238
11267
  rowCursorToCol1.length = rows;
11239
11268
  rowClearToEol.length = rows;
11240
11269
  for (let y = start; y < rows; y++) {
11241
- rowCursorToCol1[y] = `\u001B[${y + 1};1H`;
11242
- rowClearToEol[y] = `\u001B[${y + 1};1H\u001B[K`;
11270
+ rowCursorToCol1[y] = `\u001B[${y + 1 + rowOffset};1H`;
11271
+ rowClearToEol[y] = `\u001B[${y + 1 + rowOffset};1H\u001B[K`;
11243
11272
  }
11244
11273
  };
11245
11274
  const rowHasNonDefaultBlankCell = (sourceFP, sourceTextIds, sourceHrefIds, y, cols) => {
@@ -11549,6 +11578,30 @@ function createStdoutRenderer(terminal, options) {
11549
11578
  allowNextGraphicsOnlyRenderWithoutBaseline = false;
11550
11579
  if (isDebugEnabled()) getDebugLog().render(`doRender state: size=${size.cols}x${size.rows}, dirtyRows=${(dirtyRows === null || dirtyRows === void 0 ? void 0 : dirtyRows.length) ?? "null"}, scrollOps=${(scrollOperations === null || scrollOperations === void 0 ? void 0 : scrollOperations.length) ?? 0}, rowsOnlyBaseline=${rowsOnlyResizeBaseline ? "true" : "false"}, allowGraphicsOnlyWithoutBaseline=${allowGraphicsOnlyWithoutBaseline ? "true" : "false"}, activeGraphics=${activeGraphics.size}, pendingGraphics=${graphicsToRender.length}, pendingGraphicClears=${graphicsClearsToRender.length}`);
11551
11580
  let terminalGraphicsBlockScrollRegions = false;
11581
+ if (anchorMode === "bottom") {
11582
+ dirtyRows = null;
11583
+ scrollOperations = null;
11584
+ const nextRowOffset = computeRowOffset(size.rows);
11585
+ if (nextRowOffset !== rowOffset) {
11586
+ rowOffset = nextRowOffset;
11587
+ rowCursorToCol1.length = 0;
11588
+ rowClearToEol.length = 0;
11589
+ }
11590
+ const nextRegionBottom = Math.max(1, nextRowOffset - barGap);
11591
+ if (outputIsTTY && !bottomRegionInitialized) {
11592
+ const screenRows = resolveScreenRows();
11593
+ if (screenRows > 0 && nextRowOffset > 0) {
11594
+ const reservedRows = Math.max(0, screenRows - nextRegionBottom);
11595
+ const scrollCount = Math.min(screenRows, reservedRows + 1);
11596
+ out.write(`\u001B[r\u001B[${screenRows};1H${"\n".repeat(scrollCount)}`);
11597
+ bottomRegionInitialized = true;
11598
+ }
11599
+ }
11600
+ if (outputIsTTY && nextRegionBottom !== scrollRegionBottom) {
11601
+ scrollRegionBottom = nextRegionBottom;
11602
+ out.write(`\u001B[1;${nextRegionBottom}r`);
11603
+ }
11604
+ }
11552
11605
  ensureRowEscapes(Math.max(size.rows, lastRenderedRows));
11553
11606
  ensureFingerprints(size.cols, size.rows);
11554
11607
  const bgSeq = openBg(defaultBg);
@@ -11806,7 +11859,7 @@ function createStdoutRenderer(terminal, options) {
11806
11859
  frameParts.push(useFrameSyncOutput ? SYNC_START : "");
11807
11860
  frameParts.push(allowGraphicsOnlyWithoutBaseline || keepLineWrapDisabled ? "" : "\x1B[?7l");
11808
11861
  frameParts.push(SGR_RESET, bgSeq);
11809
- if (hideCursor && !getImeAnchor) frameParts.push(CURSOR_HOME);
11862
+ if (hideCursor && !getImeAnchor) frameParts.push(rowOffset > 0 ? `\u001B[${rowOffset + 1}H` : CURSOR_HOME);
11810
11863
  let lastRenderedY = -1;
11811
11864
  let lastRenderWasFullRow = false;
11812
11865
  let hasFrameOutput = false;
@@ -11876,12 +11929,12 @@ function createStdoutRenderer(terminal, options) {
11876
11929
  const pushCursorFixAfterCell = (parts, cellX, cell) => {
11877
11930
  const afterX = cellX + (cell.width ?? 1);
11878
11931
  if (afterX >= size.cols) return;
11879
- parts.push(`\u001B[${y + 1};${afterX + 1}H`);
11932
+ parts.push(`\u001B[${y + 1 + rowOffset};${afterX + 1}H`);
11880
11933
  };
11881
11934
  if (!disableCursorPos) {
11882
11935
  closeActiveHrefBeforeCursorMove();
11883
11936
  if (spanStart === 0 && lastRenderWasFullRow && y === lastRenderedY + 1) frameParts.push("\r\n");
11884
- else frameParts.push(spanStart === 0 ? rowCursorToCol1[y] : `\u001B[${y + 1};${spanStart + 1}H`);
11937
+ else frameParts.push(spanStart === 0 ? rowCursorToCol1[y] : `\u001B[${y + 1 + rowOffset};${spanStart + 1}H`);
11885
11938
  }
11886
11939
  let currentKey = null;
11887
11940
  let currentStyle = null;
@@ -12313,7 +12366,7 @@ function createStdoutRenderer(terminal, options) {
12313
12366
  renderDirtySpans(y, row, spans, rewriteTail);
12314
12367
  }
12315
12368
  }
12316
- if (!rowsToRender && lastRenderedRows > size.rows && !rowsOnlyResizeBaseline) {
12369
+ if (!rowsToRender && lastRenderedRows > size.rows && !rowsOnlyResizeBaseline && anchorMode !== "bottom") {
12317
12370
  const extraRows = lastRenderedRows - size.rows;
12318
12371
  if (activeStyleKey !== bgKey) {
12319
12372
  frameParts.push(SGR_RESET, bgSeq);
@@ -12364,7 +12417,7 @@ function createStdoutRenderer(terminal, options) {
12364
12417
  const spans = terminalGraphicTextPreserveSpans.get(y);
12365
12418
  const preservedGraphicSpan = !(overlayTouchedRowSet === null || overlayTouchedRowSet === void 0 ? void 0 : overlayTouchedRowSet.has(y)) && Boolean(spans === null || spans === void 0 ? void 0 : spans.some((span) => span.start < rect.x + rect.w && span.end > rect.x));
12366
12419
  if ((!rowsToRender || rowWasPaintedByTextRenderer(y)) && !preservedGraphicSpan) continue;
12367
- out$1 += `\u001B[${y + 1};${rect.x + 1}H${clearStyle}${erase}${SGR_RESET}`;
12420
+ out$1 += `\u001B[${y + 1 + rowOffset};${rect.x + 1}H${clearStyle}${erase}${SGR_RESET}`;
12368
12421
  }
12369
12422
  return out$1;
12370
12423
  };
@@ -12410,7 +12463,7 @@ function createStdoutRenderer(terminal, options) {
12410
12463
  x: rect.x,
12411
12464
  y: rect.y
12412
12465
  } : clampCellToViewport(fallbackCell, size);
12413
- frameParts.push(countGraphicsBytes(`\u001B[${cell.y + 1};${cell.x + 1}H`), countGraphicsBytes(maybeWrapTerminalGraphic(sequence)), countGraphicsBytes(SGR_RESET));
12466
+ frameParts.push(countGraphicsBytes(`\u001B[${cell.y + 1 + rowOffset};${cell.x + 1}H`), countGraphicsBytes(maybeWrapTerminalGraphic(sequence)), countGraphicsBytes(SGR_RESET));
12414
12467
  return true;
12415
12468
  };
12416
12469
  const appendActiveGraphicProtocolClear = (active, rect) => {
@@ -12586,7 +12639,7 @@ function createStdoutRenderer(terminal, options) {
12586
12639
  y
12587
12640
  };
12588
12641
  closeActiveHrefBeforeCursorMove();
12589
- frameParts.push(`\u001B[${y + 1};${x + 1}H`);
12642
+ frameParts.push(`\u001B[${y + 1 + rowOffset};${x + 1}H`);
12590
12643
  }
12591
12644
  }
12592
12645
  }
@@ -12598,7 +12651,7 @@ function createStdoutRenderer(terminal, options) {
12598
12651
  }
12599
12652
  if (enableOsc8Links && activeStyle.href) frameParts.push(OSC8_CLOSE);
12600
12653
  frameParts.push(SGR_RESET);
12601
- if (hideCursor && !getImeAnchor) frameParts.push(CURSOR_HOME);
12654
+ if (hideCursor && !getImeAnchor) frameParts.push(rowOffset > 0 ? `\u001B[${rowOffset + 1}H` : CURSOR_HOME);
12602
12655
  frameParts.push(allowGraphicsOnlyWithoutBaseline || keepLineWrapDisabled ? "" : "\x1B[?7h");
12603
12656
  frameParts.push(useFrameSyncOutput ? SYNC_END : "");
12604
12657
  const frame = frameParts.join("");
@@ -13039,7 +13092,7 @@ function createStdoutRenderer(terminal, options) {
13039
13092
  if (altScreen && outputIsTTY) out.write("\x1B[?1049h");
13040
13093
  if (keepLineWrapDisabled) out.write("\x1B[?7l");
13041
13094
  if (hideCursor) out.write("\x1B[?25l");
13042
- if (clear) out.write(`${SGR_RESET}${openBg(defaultBg)}\u001B[2J\u001B[H${SGR_RESET}`);
13095
+ if (clear && anchorMode !== "bottom") out.write(`${SGR_RESET}${openBg(defaultBg)}\u001B[2J\u001B[H${SGR_RESET}`);
13043
13096
  const off = terminal.on("commit", ({ dirtyRows, scrollOperations, sync }) => {
13044
13097
  if (suppressNextResizeCommitRender) return;
13045
13098
  const deferRowsOnlyResizeCommit = rowsOnlyResizeRepaintTimer && (dirtyRows == null || dirtyRows.length >= terminal.size().rows);
@@ -13121,7 +13174,7 @@ function createStdoutRenderer(terminal, options) {
13121
13174
  cols: size.cols,
13122
13175
  rows: size.rows
13123
13176
  });
13124
- out.write(`\u001B[${cy + 1};${cx + 1}H`);
13177
+ out.write(`\u001B[${cy + 1 + rowOffset};${cx + 1}H`);
13125
13178
  lastCursorX = cx;
13126
13179
  lastCursorY = cy;
13127
13180
  }
@@ -13175,7 +13228,7 @@ function createStdoutRenderer(terminal, options) {
13175
13228
  cellX: active.x,
13176
13229
  cellY: active.y
13177
13230
  }, size);
13178
- clearParts.push(`\u001B[${cell.y + 1};${cell.x + 1}H`, maybeWrapTerminalGraphic(active.clearSequence));
13231
+ clearParts.push(`\u001B[${cell.y + 1 + rowOffset};${cell.x + 1}H`, maybeWrapTerminalGraphic(active.clearSequence));
13179
13232
  wroteClear = true;
13180
13233
  }
13181
13234
  if (wroteClear) terminalGraphicsClears++;
@@ -13211,6 +13264,7 @@ function createStdoutRenderer(terminal, options) {
13211
13264
  if (keepLineWrapDisabled) out.write("\x1B[?7h");
13212
13265
  if (hideCursor) out.write("\x1B[?25h");
13213
13266
  if (altScreen && outputIsTTY) out.write("\x1B[?1049l");
13267
+ if (anchorMode === "bottom" && outputIsTTY && scrollRegionBottom > 0) out.write("\x1B[r");
13214
13268
  } catch (err) {
13215
13269
  if (disposeError == null) disposeError = err;
13216
13270
  }
@@ -13237,6 +13291,7 @@ function createStdoutRenderer(terminal, options) {
13237
13291
  capabilities: STDOUT_RENDERER_CAPABILITIES,
13238
13292
  graphicsCapabilities,
13239
13293
  render,
13294
+ forceRender: () => render(void 0, true),
13240
13295
  dispose,
13241
13296
  setCursor,
13242
13297
  showCursor,
package/dist/core.js CHANGED
@@ -1,6 +1,6 @@
1
- import { TERMINAL_RENDER_PLANES, createTerminal, isSafeRelativeHref, parseAnsiSgr, sanitizeDomHref, sanitizeTerminalHref } from "./hyperlink-_1FAj7Wq.js";
2
- import { charCellWidth } from "./width-GqllnV8C.js";
3
- import { ansiColorRgb } from "./ansi-palette-CH6jc2Z7.js";
1
+ import { TERMINAL_RENDER_PLANES, charCellWidth, createTerminal, parseAnsiSgr } from "./create-terminal-Db_-UGVQ.js";
2
+ import { ansiColorRgb } from "./ansi-palette-BHF1rN7R.js";
3
+ import { isSafeRelativeHref, sanitizeDomHref, sanitizeTerminalHref } from "./hyperlink-clbb_ha_.js";
4
4
  import { firstNonEmptyEnv } from "./env-Cl8qmNFN.js";
5
5
  import { normalizeNewlines } from "./path-mnSgEpCm.js";
6
6
  import { parsePathQuery, resolveUserPath, suggestParentHint, suggestPaths } from "./path-suggest-Dndu4dTi.js";