@vincemakes/kiso-tui-cells 0.22.0 → 0.24.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/dist/ground.d.ts CHANGED
@@ -31,8 +31,12 @@ export declare function parseOscColor(body: string): Rgb | null;
31
31
  export declare function relativeLuminance({ r, g, b }: Rgb): number;
32
32
  export declare function groundFrom(rgb: Rgb): Exclude<Ground, "unknown">;
33
33
  export interface GroundInputs {
34
- /** KISO_THEME — an explicit answer from the human. */
34
+ /** KISO_THEME, or the user config's `theme` — an explicit answer from
35
+ * the human. The environment wins over the file; both are rung 1. */
35
36
  readonly theme?: string | undefined;
37
+ /** The terminal's OWN account of its colour scheme, from its answer to
38
+ * `CSI ? 996 n` (`CSI ? 997 ; 1|2 n`). */
39
+ readonly colorScheme?: "dark" | "light" | undefined;
36
40
  /** The body of the terminal's OSC 11 answer, if one arrived. */
37
41
  readonly osc?: string | undefined;
38
42
  /** The COLORFGBG environment variable, if it is set. */
@@ -42,5 +46,15 @@ export interface GroundInputs {
42
46
  * The ladder, first hit wins. Every rung that cannot answer falls
43
47
  * through rather than guessing, and the bottom of the ladder is
44
48
  * `unknown` — see the module comment for why that is a result.
49
+ *
50
+ * 1 theme an explicit answer from the human (env, then config)
51
+ * 2 colorScheme the terminal's own report (CSI 997)
52
+ * 3 osc the background colour, and a luminance threshold
53
+ * 4 colorfgbg an environment variable some terminals set
54
+ * unknown reverse video, correct on any ground
55
+ *
56
+ * kiso never guesses. A terminal that answers nothing and a human who
57
+ * set nothing leave the ground `unknown`, and `unknown` degrades — it
58
+ * does not default to dark and hope.
45
59
  */
46
- export declare function resolveGround({ theme, osc, colorfgbg }: GroundInputs): Ground;
60
+ export declare function resolveGround({ theme, colorScheme, osc, colorfgbg }: GroundInputs): Ground;
package/dist/ground.js CHANGED
@@ -60,11 +60,28 @@ function fromColorFgBg(value) {
60
60
  * The ladder, first hit wins. Every rung that cannot answer falls
61
61
  * through rather than guessing, and the bottom of the ladder is
62
62
  * `unknown` — see the module comment for why that is a result.
63
+ *
64
+ * 1 theme an explicit answer from the human (env, then config)
65
+ * 2 colorScheme the terminal's own report (CSI 997)
66
+ * 3 osc the background colour, and a luminance threshold
67
+ * 4 colorfgbg an environment variable some terminals set
68
+ * unknown reverse video, correct on any ground
69
+ *
70
+ * kiso never guesses. A terminal that answers nothing and a human who
71
+ * set nothing leave the ground `unknown`, and `unknown` degrades — it
72
+ * does not default to dark and hope.
63
73
  */
64
- export function resolveGround({ theme, osc, colorfgbg }) {
74
+ export function resolveGround({ theme, colorScheme, osc, colorfgbg }) {
65
75
  const explicit = theme?.trim().toLowerCase();
66
76
  if (explicit === "light" || explicit === "dark")
67
77
  return explicit;
78
+ // The terminal's own REPORT outranks the colour it hands over. OSC 11
79
+ // gives a background colour and kiso infers a ground from its
80
+ // luminance — a threshold applied to someone else's number. `CSI 997`
81
+ // is the terminal saying which it is. When both answer they normally
82
+ // agree; when they do not, the account beats the inference.
83
+ if (colorScheme === "dark" || colorScheme === "light")
84
+ return colorScheme;
68
85
  if (osc !== undefined && osc !== "") {
69
86
  const rgb = parseOscColor(osc);
70
87
  if (rgb !== null)
package/dist/index.d.ts CHANGED
@@ -6,7 +6,7 @@
6
6
  * package); the cli never imports it directly. Experimental — no
7
7
  * API-stability promise yet.
8
8
  */
9
- export { SPINNER, foldLine, foldWords, visibleWidth, bodySpacing, Container, cellComponent, focusToken, ROLLUP_NOUN, turnFold, foldTerms, CAP_TASK_LIVE, formatDuration, statusLine, boxTop, boxBottom, terminalPipe, type FrameCtx, type RenderLine, type Component, type BodyCell, } from "./components.js";
9
+ export { SPINNER, foldLine, foldWords, visibleWidth, bodySpacing, Container, cellComponent, focusToken, ROLLUP_NOUN, foldTerms, CAP_TASK_LIVE, formatDuration, statusLine, boxTop, boxBottom, terminalPipe, type FrameCtx, type RenderLine, type Component, type BodyCell, } from "./components.js";
10
10
  export { editFileDiff, truncateDiff, writeFileDiff, type DiffLine, type DiffResult } from "./diff.js";
11
11
  export { pendingQueueRows } from "./components.js";
12
12
  export { charWidth, displayWidth, leadWidth, widthOf } from "./width.js";
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@
6
6
  * package); the cli never imports it directly. Experimental — no
7
7
  * API-stability promise yet.
8
8
  */
9
- export { SPINNER, foldLine, foldWords, visibleWidth, bodySpacing, Container, cellComponent, focusToken, ROLLUP_NOUN, turnFold, foldTerms, CAP_TASK_LIVE, formatDuration, statusLine, boxTop, boxBottom, terminalPipe, } from "./components.js";
9
+ export { SPINNER, foldLine, foldWords, visibleWidth, bodySpacing, Container, cellComponent, focusToken, ROLLUP_NOUN, foldTerms, CAP_TASK_LIVE, formatDuration, statusLine, boxTop, boxBottom, terminalPipe, } from "./components.js";
10
10
  export { editFileDiff, truncateDiff, writeFileDiff } from "./diff.js";
11
11
  // W22 (the v8 input round): the pending-queue chips — the SAME
12
12
  // UserMessage chip with the □ gutter, pre-rendered above the input
package/dist/render.d.ts CHANGED
@@ -29,6 +29,17 @@ import type { Ground } from "./ground.js";
29
29
  * The functional colors are deliberately NOT moved and not
30
30
  * approximated: red stays SGR 31, green stays SGR 32. A reader who has
31
31
  * learned that colour means something must keep being right.
32
+ *
33
+ * R2's retired wordmark, re-measured 2026-09-02 and recorded so the
34
+ * question is not reopened from memory: braille (U+2800–U+28FF) IS
35
+ * available — Apple Terminal's default Menlo falls back to Apple
36
+ * Braille and draws solid dots, correcting what design.md §6 used to
37
+ * say. Rasterised through it, a four-leaf mark reads from 12×6 cells
38
+ * upward and turns to dominoes below 10×5 — the same threshold R2
39
+ * measured for block characters — and a dense tiling bands
40
+ * horizontally, because the font's dot pitch does not divide the cell
41
+ * height. The owner looked at it on the real terminal and declined it.
42
+ * §7.10 stands: no logo, the name is the mark.
32
43
  */
33
44
  export interface Palette {
34
45
  readonly bold: string;
@@ -71,7 +82,7 @@ export interface Palette {
71
82
  readonly rvEnd: string;
72
83
  /** DC-3 — the VERBATIM surface: the human's own words, and inline
73
84
  * code. A background, so it needs the ground; with no ground it is
74
- * reverse video, which is correct on any ground and is rung 4 of the
85
+ * reverse video, which is correct on any ground and is the LAST rung of the
75
86
  * ladder in `ground.ts`. Closed with 49 rather than SGR 0, for the
76
87
  * reason `rv` is closed with 27: a washed span sits inside other
77
88
  * spans and must end without stranding them. */
@@ -111,7 +122,7 @@ export interface Palette {
111
122
  * ruling's own set gaining its missing member.
112
123
  *
113
124
  * With NO ground it is NOTHING: §3.1 forbids an absolute foreground
114
- * in a palette that has not established a background, and rung 4's
125
+ * in a palette that has not established a background, and the last rung's
115
126
  * wash is reverse video, where any foreground grey inverts into a
116
127
  * grey block. Body text on the surface is the correct degradation.
117
128
  * It closes with 39 (the default foreground) rather than SGR 0, for
package/dist/render.js CHANGED
@@ -24,7 +24,7 @@ const BASE = { bold: "\x1b[1m", dim: "\x1b[2m", red: "\x1b[31m", green: "\x1b[32
24
24
  * dark 173 `#d7875f` 5.97:1
25
25
  *
26
26
  * With NO ground established the token stays ANSI 31 — the TERMINAL's
27
- * own red, which its theme picked for its own background. That is rung
27
+ * own red, which its theme picked for its own background. That is the last rung
28
28
  * 4's principle exactly: when the ground is unknown, use the thing that
29
29
  * is correct on any ground rather than guessing one.
30
30
  */
@@ -179,6 +179,8 @@ function toolSummaryDetail(name, input, result) {
179
179
  }
180
180
  case "list_dir":
181
181
  return String(input.path ?? "(root)");
182
+ case "search_text":
183
+ return searchSubject(input);
182
184
  default:
183
185
  return String(input.path ?? input.command ?? "");
184
186
  }
@@ -197,10 +199,25 @@ export function toolTarget(name, input) {
197
199
  return String(input.command ?? "?");
198
200
  case "list_dir":
199
201
  return String(input.path ?? "(root)");
202
+ case "search_text":
203
+ return searchSubject(input);
200
204
  default:
201
205
  return String(input.path ?? input.command ?? "");
202
206
  }
203
207
  }
208
+ /** R13 — a search's subject is WHAT IT LOOKED FOR. The schema is
209
+ * `pattern` (required) + `path` (optional), and both switches here fell
210
+ * through to the default, which reads `path` — so a search of the whole
211
+ * tree had an EMPTY head row, and one scoped to a directory named the
212
+ * directory instead of the pattern. The scope is a fact too, so it
213
+ * rides behind: `search TODO · src`. */
214
+ function searchSubject(input) {
215
+ const pattern = String(input.pattern ?? input.query ?? "");
216
+ const path = input.path === undefined || input.path === null || input.path === "" ? "" : String(input.path);
217
+ if (pattern === "")
218
+ return path;
219
+ return path === "" ? pattern : `${pattern} · ${path}`;
220
+ }
204
221
  /** The exit code of a shell result: parsed from the failure text, 0 on success. */
205
222
  function exitCodeOf(result) {
206
223
  if (!result.isError)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vincemakes/kiso-tui-cells",
3
- "version": "0.22.0",
3
+ "version": "0.24.0",
4
4
  "description": "kiso tui-cells — the components cell renderer (components, diff, width, the render slice). Zero runtime dependencies: input is data, output is bytes.",
5
5
  "type": "module",
6
6
  "license": "MIT",