@linxiraos/pi-tui 1.1.6 → 1.1.7

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/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [1.1.7] - 2026-09-01
6
+
7
+ - 同步上游 OMP v18.0.11(`b8ce33a58911c26bed1d84f0db9a5e2e727c49a2`)。
8
+
5
9
  ## [1.1.6] - 2026-08-30
6
10
 
7
11
  - 同步上游 OMP v18.0.10(`33cc6b9a043a`)。
@@ -1,6 +1,13 @@
1
1
  import type { ComposerStyle, EditorBorderStyle } from "./types.js";
2
2
  /** Whether an id names a composer style shipped by pi-tui. */
3
3
  export declare function isBuiltinComposerStyle(id: string): boolean;
4
+ /**
5
+ * Whether a style paints its own row foreground.
6
+ *
7
+ * Extensions registered before `filledSurface` existed received undecorated
8
+ * row text, so an omitted flag remains filled for extension-owned ids.
9
+ */
10
+ export declare function isFilledComposerStyle(style: ComposerStyle): boolean;
4
11
  /**
5
12
  * Register one extension-owned composer style for this process.
6
13
  *
@@ -60,6 +60,12 @@ export interface ComposerRowContext extends ComposerChromeContext {
60
60
  }
61
61
  export interface ComposerStyle {
62
62
  readonly id: EditorBorderStyle;
63
+ /**
64
+ * True when rows paint their own foreground through `surfaceColor`.
65
+ * Built-ins default to transparent; registered extensions that omit this
66
+ * field retain the pre-field behavior and receive undecorated row text.
67
+ */
68
+ readonly filledSurface?: boolean;
63
69
  /** Content rows carry left/right border glyphs; drives the cursor-reserve
64
70
  * column, IME-safe layout, and the right-border scrollbar. */
65
71
  readonly sideBorders: boolean;
@@ -10,6 +10,8 @@ export interface EditorTheme {
10
10
  accentColor?: (str: string) => string;
11
11
  /** Background fill used by filled composer styles. */
12
12
  surfaceColor?: (str: string) => string;
13
+ /** Foreground used when the composer shape leaves its text surface transparent. */
14
+ textColor?: (str: string) => string;
13
15
  selectList: SelectListTheme;
14
16
  symbols: SymbolTheme;
15
17
  editorPaddingX?: number;
@@ -206,6 +206,15 @@ export declare function setTerminalScreenToScrollback(enabled: boolean): void;
206
206
  * capability); tests flip it directly to exercise the scaled-heading path.
207
207
  */
208
208
  export declare function setTerminalTextSizing(enabled: boolean): void;
209
+ /**
210
+ * Override OSC 8 hyperlink capability at runtime. The coding-agent calls this
211
+ * from the `tui.hyperlinks` setting so its resolved policy (`off`/`auto`/`always`)
212
+ * drives every renderer that gates on {@link TERMINAL}`.hyperlinks` — notably the
213
+ * Markdown component's `[text](url)`/bare-URL links — consistently with the
214
+ * path/resource links that already consult the setting directly. Tests flip it
215
+ * to exercise the OSC 8 and plain-text paths deterministically.
216
+ */
217
+ export declare function setTerminalHyperlinks(enabled: boolean): void;
209
218
  export declare function getTerminalInfo(terminalId: TerminalId, platform?: NodeJS.Platform, env?: NodeJS.ProcessEnv): TerminalInfo;
210
219
  export interface CellDimensions {
211
220
  widthPx: number;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@linxiraos/pi-tui",
4
- "version": "1.1.6",
4
+ "version": "1.1.7",
5
5
  "description": "Terminal User Interface library with differential rendering for efficient text-based applications",
6
6
  "homepage": "https://linxira-os.github.io/zeta/",
7
7
  "author": "Stencil Labs, Inc.",
@@ -37,8 +37,8 @@
37
37
  "fmt": "biome format --write ."
38
38
  },
39
39
  "dependencies": {
40
- "@linxiraos/pi-natives": "1.1.6",
41
- "@linxiraos/pi-utils": "1.1.6"
40
+ "@linxiraos/pi-natives": "1.1.7",
41
+ "@linxiraos/pi-utils": "1.1.7"
42
42
  },
43
43
  "devDependencies": {
44
44
  "kitty-vt-wasm": "^0.2.0"
@@ -11,6 +11,7 @@ const RIGHT_CAP = "▌";
11
11
  /** One-row filled field with accent caps. */
12
12
  export const fieldComposerStyle: ComposerStyle = {
13
13
  id: "field",
14
+ filledSurface: true,
14
15
  sideBorders: true,
15
16
  verticalChrome: 0,
16
17
  statusAttachment: "none",
@@ -10,6 +10,7 @@ const ACCENT_RAIL = "▎";
10
10
  /** Filled composer surface anchored by a single left accent rail. */
11
11
  export const railComposerStyle: ComposerStyle = {
12
12
  id: "rail",
13
+ filledSurface: true,
13
14
  sideBorders: true,
14
15
  verticalChrome: 0,
15
16
  statusAttachment: "none",
@@ -25,6 +25,16 @@ export function isBuiltinComposerStyle(id: string): boolean {
25
25
  return Object.hasOwn(BUILTIN_COMPOSER_STYLES, id);
26
26
  }
27
27
 
28
+ /**
29
+ * Whether a style paints its own row foreground.
30
+ *
31
+ * Extensions registered before `filledSurface` existed received undecorated
32
+ * row text, so an omitted flag remains filled for extension-owned ids.
33
+ */
34
+ export function isFilledComposerStyle(style: ComposerStyle): boolean {
35
+ return style.filledSurface ?? !isBuiltinComposerStyle(style.id);
36
+ }
37
+
28
38
  /**
29
39
  * Register one extension-owned composer style for this process.
30
40
  *
@@ -77,6 +77,12 @@ export interface ComposerRowContext extends ComposerChromeContext {
77
77
 
78
78
  export interface ComposerStyle {
79
79
  readonly id: EditorBorderStyle;
80
+ /**
81
+ * True when rows paint their own foreground through `surfaceColor`.
82
+ * Built-ins default to transparent; registered extensions that omit this
83
+ * field retain the pre-field behavior and receive undecorated row text.
84
+ */
85
+ readonly filledSurface?: boolean;
80
86
  /** Content rows carry left/right border glyphs; drives the cursor-reserve
81
87
  * column, IME-safe layout, and the right-border scrollbar. */
82
88
  readonly sideBorders: boolean;
@@ -32,6 +32,7 @@ import {
32
32
  type EditorBorderStyle,
33
33
  type EditorTopBorder,
34
34
  getComposerStyle,
35
+ isFilledComposerStyle,
35
36
  } from "./composer";
36
37
 
37
38
  export type { EditorBorderStyle, EditorTopBorder };
@@ -401,6 +402,8 @@ export interface EditorTheme {
401
402
  accentColor?: (str: string) => string;
402
403
  /** Background fill used by filled composer styles. */
403
404
  surfaceColor?: (str: string) => string;
405
+ /** Foreground used when the composer shape leaves its text surface transparent. */
406
+ textColor?: (str: string) => string;
404
407
  selectList: SelectListTheme;
405
408
  symbols: SymbolTheme;
406
409
  editorPaddingX?: number;
@@ -1271,13 +1274,16 @@ export class Editor implements Component, Focusable {
1271
1274
  displayWidth = visibleWidth(displayText);
1272
1275
  }
1273
1276
  }
1277
+ const renderedText = isFilledComposerStyle(style)
1278
+ ? displayText
1279
+ : (this.#theme.textColor ?? PASSTHROUGH_COLOR)(displayText);
1274
1280
 
1275
1281
  const linePad = padding(Math.max(0, lineContentWidth - displayWidth));
1276
1282
 
1277
1283
  result.push(
1278
1284
  ...style.renderRow({
1279
1285
  ...chromeCtx,
1280
- text: displayText,
1286
+ text: renderedText,
1281
1287
  pad: linePad,
1282
1288
  gutter: gutterText,
1283
1289
  isLastRow: visibleIndex === visibleLayoutLines.length - 1,
@@ -1515,11 +1515,11 @@ const DEFAULT_COLOR_SWATCH_GLYPH = "■";
1515
1515
 
1516
1516
  // `#` + 3-8 hex digits, not glued to a surrounding word/`#`/`&` (avoids HTML
1517
1517
  // entities like ☃ and paths like foo#fff), not the start of a canonical
1518
- // UUID, and not trailed by more hex (so over-long runs never produce a
1519
- // misleading swatch). Length/letter rules are enforced in classifyHexColor
1520
- // since the alternation can't express "exactly 3, 6, or 8".
1521
- const HEX_COLOR_REGEX =
1522
- /(?<![\w#&])#(?![0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12})([0-9a-fA-F]{3,8})(?![0-9a-fA-F])/g;
1518
+ // UUID, and not trailed by another word char (over-long runs and word
1519
+ // fragments like the "#eac" of "#each" never produce a misleading swatch).
1520
+ // Length/letter rules are enforced in classifyHexColor since the alternation
1521
+ // can't express "exactly 3, 6, or 8".
1522
+ const HEX_COLOR_REGEX = /(?<![\w#&])#(?![0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12})([0-9a-fA-F]{3,8})(?!\w)/g;
1523
1523
  const HEX_COLOR_EXACT_REGEX = /^#([0-9a-fA-F]{3,8})$/;
1524
1524
 
1525
1525
  /**
@@ -676,6 +676,18 @@ export function setTerminalTextSizing(enabled: boolean): void {
676
676
  TERMINAL.textSizing = enabled;
677
677
  }
678
678
 
679
+ /**
680
+ * Override OSC 8 hyperlink capability at runtime. The coding-agent calls this
681
+ * from the `tui.hyperlinks` setting so its resolved policy (`off`/`auto`/`always`)
682
+ * drives every renderer that gates on {@link TERMINAL}`.hyperlinks` — notably the
683
+ * Markdown component's `[text](url)`/bare-URL links — consistently with the
684
+ * path/resource links that already consult the setting directly. Tests flip it
685
+ * to exercise the OSC 8 and plain-text paths deterministically.
686
+ */
687
+ export function setTerminalHyperlinks(enabled: boolean): void {
688
+ TERMINAL.hyperlinks = enabled;
689
+ }
690
+
679
691
  export function getTerminalInfo(
680
692
  terminalId: TerminalId,
681
693
  platform: NodeJS.Platform = process.platform,