@vincemakes/kiso-tui-cells 0.46.2 → 0.47.1

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/render.d.ts CHANGED
@@ -5,7 +5,8 @@
5
5
  * produce the bytes a human sees. Colors are raw ANSI — zero
6
6
  * dependencies (the tui-cells package has none).
7
7
  */
8
- import type { Ground } from "./ground.js";
8
+ import type { Ground, Rgb } from "./ground.js";
9
+ import { type Tier } from "./graphite.js";
9
10
  /**
10
11
  * v2a — the palette, centralized (no hard-coded codes elsewhere); v5
11
12
  * (TUI v5 #16e, the v4.1 design): the decorative blue (38;5;75) is
@@ -114,13 +115,72 @@ export interface Palette {
114
115
  readonly washDim: string;
115
116
  readonly washDimEnd: string;
116
117
  readonly reset: string;
118
+ /** Graphite (design.md §2) — the tokens the redesign reads. Each is an
119
+ * SGR open for its colour in the resolved tier (§2: 24-bit or the
120
+ * nearest xterm-256 index), and EMPTY where the ground is unknown or
121
+ * colour is off: §3.1 forbids an absolute colour on a ground nobody
122
+ * established, so every one of them degrades to the terminal's own.
123
+ * Foregrounds close with `fgEnd` (39), backgrounds with `washEnd`
124
+ * (49), for the reason `rv` closes with 27. */
125
+ readonly ink2: string;
126
+ readonly rail: string;
127
+ readonly line: string;
128
+ readonly gold: string;
129
+ readonly goldMark: string;
130
+ readonly blue: string;
131
+ readonly ok: string;
132
+ readonly fail: string;
133
+ readonly humanInk: string;
134
+ readonly track: string;
135
+ readonly washRun: string;
136
+ readonly washDone: string;
137
+ readonly washFail: string;
138
+ readonly washAsk: string;
139
+ readonly human: string;
140
+ readonly codeBg: string;
141
+ readonly add: string;
142
+ readonly del: string;
143
+ /** Graphite §6 (R2a) — the changed words inside a `+` / `-` row: the
144
+ * row's ground deepened toward its colour, as a BACKGROUND. */
145
+ readonly addWord: string;
146
+ readonly delWord: string;
147
+ /** Graphite §5 (R2b) — the bar down a quote's rows, and an alert's
148
+ * (NOTE / TIP / IMPORTANT in blue, WARNING in gold, CAUTION in the
149
+ * failure colour): one cell of the ground deepened toward the colour,
150
+ * as a BACKGROUND (§1.5 — a glyph bar seams between rows). */
151
+ /** Graphite §5 (R2b) — a table's rails: between `line` and `rail`, so
152
+ * the grid reads without outweighing the words in it. */
153
+ readonly edge: string;
154
+ readonly quoteBar: string;
155
+ readonly noteBar: string;
156
+ readonly warnBar: string;
157
+ readonly cautionBar: string;
158
+ /** Graphite §7.4 — a card's EDGE: one cell of its ground deepened
159
+ * toward the state's colour, as a BACKGROUND (§1.5: a glyph bar down
160
+ * several rows shows a break at every row in Apple Terminal; a cell's
161
+ * background does not). One per card state. */
162
+ readonly runEdge: string;
163
+ readonly failEdge: string;
164
+ readonly askEdge: string;
165
+ /** Graphite §7.9 — the person's block's edge: one cell of gold toward
166
+ * the warm ground, as a BACKGROUND, the same width as a card's edge.
167
+ * A half-cell `▌` is thinner but shows a break at every row in Apple
168
+ * Terminal (the owner's seam tests, 2026-09-29). */
169
+ readonly humanEdge: string;
170
+ readonly fgEnd: string;
171
+ /** §5.2 — the command breath's seven foreground opens; empty where
172
+ * the mark freezes (no ground, or no colour). */
173
+ readonly breath: readonly string[];
174
+ /** The tier the colours were written in, or null when none were. */
175
+ readonly tier: Tier | null;
117
176
  }
177
+ export declare function paletteFor(kind: "light" | "dark", ground: Rgb | null, tier: Tier): Palette;
118
178
  /**
119
179
  * DC-3 — one table per ground.
120
180
  *
121
- * R3 (owner, 2026-08-27) — `dim` is ABSOLUTE once the ground is known,
122
- * and design.md §2's table always said so: light `243` `#767676` at
123
- * 4.54:1, dark `246` `#949494` at 5.50:1 (both re-measured here).
181
+ * R3 (owner, 2026-08-27) — `dim` is ABSOLUTE once the ground is known:
182
+ * Graphite's `dim`, measured against the floor on every surface it can
183
+ * reach (design.md §2.1).
124
184
  *
125
185
  * DC-3 shipped SGR 2 instead, on the argument that an attribute adapts
126
186
  * to the ground while an absolute grey asserts one. That argument is
@@ -136,6 +196,8 @@ export interface Palette {
136
196
  * attribute is exactly the "correct on any ground" degradation there.
137
197
  */
138
198
  export declare const COLOR_NEUTRAL: Palette;
199
+ /** The two reference palettes: Graphite on its reference grounds, in the
200
+ * 24-bit tier. `paletteFor` is the general form. */
139
201
  export declare const COLOR_LIGHT: Palette;
140
202
  export declare const COLOR_DARK: Palette;
141
203
  /** The historical name — the palette for a colour TTY whose ground has
@@ -143,8 +205,9 @@ export declare const COLOR_DARK: Palette;
143
205
  * was the defect. */
144
206
  export declare const COLOR_ON: Palette;
145
207
  export declare const COLOR_OFF: Palette;
146
- export declare function setGround(g: Ground): void;
208
+ export declare function setGround(g: Ground, rgb?: Rgb | null): void;
147
209
  export declare function currentGround(): Ground;
210
+ export declare function currentGroundRgb(): Rgb | null;
148
211
  export declare function palette(): Palette;
149
212
  export declare function stripAnsi(text: string): string;
150
213
  export declare function escapeTerminal(text: string): string;
@@ -254,11 +317,20 @@ export declare function renderTerminalGap(statusLine: string | null): string;
254
317
  * the transition. Every glyph is in Menlo and absent from Apple Color
255
318
  * Emoji (§6.1's test, run). */
256
319
  export declare const TWINKLE: readonly ["✧", "✦", "✶", "✸", "✺", "✸", "✦"];
257
- /** The breath's frame: `●` at the step's grey, for the CURRENT ground.
258
- * With no ground — or under NO_COLOR — it freezes to a static `●`,
259
- * because a brightness ramp needs a background to be a ramp against and
260
- * §3.1 forbids guessing one. The glyph never changes, so the freeze
261
- * degrades the motion and never the meaning. */
320
+ /**
321
+ * Graphite §7.8 — the composer's top rule: `gold-mark` for its first eighth,
322
+ * fading to `line` by a third of the width, `line` after. Drawn in a
323
+ * handful of runs, not a colour per cell, so the row costs a few escapes
324
+ * rather than one per column. Off a known ground it is the plain dim rule.
325
+ */
326
+ export declare function fadeRule(W: number): string;
327
+ /** The breath's frame: `●` at the step's brightness (§5.2 — seven steps
328
+ * of gold toward the running card's ground, never under the graphic
329
+ * floor, `graphite.ts` `breathRamp`). With no ground — or under
330
+ * NO_COLOR — it freezes to a static `●`, because a brightness ramp needs
331
+ * a background to be a ramp against and §3.1 forbids guessing one. The
332
+ * glyph never changes, so the freeze degrades the motion and never the
333
+ * meaning. */
262
334
  export declare function breathFrame(step: number): string;
263
335
  /** The twinkle's frame — pure glyph, no palette involved. */
264
336
  export declare function twinkleFrame(step: number): string;
@@ -266,15 +338,38 @@ export declare function twinkleFrame(step: number): string;
266
338
  * marks stay in step on a screen showing both. */
267
339
  export declare const MOTION_FRAMES = 7;
268
340
  export declare const TAGLINE = "the coding agent that survives kill -9";
269
- /** R2 — what the opening knows about the session. Optional because the
270
- * off-TTY caller prints a banner before a model is bound. */
341
+ /**
342
+ * Graphite §7.10 — the opening: the wordmark, then what loaded.
343
+ *
344
+ * DECLARED REVERSAL (Graphite, owner-ruled 2026-09-28) of R2's "no logo,
345
+ * the name is the mark". R2 retired the wordmark because it cost the rows
346
+ * a first screen needed for three questions — what model, where am I, what
347
+ * is loaded. The model and the folder moved to the status bar (§8.9), what
348
+ * is loaded moved beside the wordmark, and the wordmark came back: ten
349
+ * rows, once, at the top of a session — including in the 80×24 window a
350
+ * Mac opens by default (owner, 2026-09-29: a wordmark the default window
351
+ * never shows is not worth drawing). Under 20 rows, on a terminal too
352
+ * narrow for it, and on a resume (the history is above the opening there,
353
+ * and ten rows of wordmark would bury its tail) the opening is one line.
354
+ *
355
+ * The R2 keys row retires with it: `?` lists the keys (§8.5).
356
+ */
357
+ export declare const MOTTO = "intent \u2192 effect \u2192 durable fact";
358
+ /** The wordmark's width in cells (its widest row). */
359
+ export declare const WORDMARK_W: number;
360
+ /** One fact the opening states: its label, the fact, and a quieter note
361
+ * after it. An empty label continues the fact above it. */
362
+ export interface BannerFact {
363
+ readonly label: string;
364
+ readonly value: string;
365
+ readonly note?: string;
366
+ }
367
+ /** §7.10 — what the opening knows: what loaded (the CLI composes the
368
+ * facts; this module only lays them out), and whether the session was
369
+ * resumed (a resumed session opens on the one-line form). */
271
370
  export interface BannerMeta {
272
- readonly model: string;
273
- readonly mode: string;
274
- readonly cwd: string;
275
- /** DC-49 — the workspace IS the user's home directory. Computed by the
276
- * CLI (realpath on both sides); the banner only renders it. */
277
- readonly homeWorkspace?: boolean;
371
+ readonly facts: readonly BannerFact[];
372
+ readonly resumed?: boolean;
278
373
  }
279
374
  /** W20 — the ONE-ROW cut with the honest mark, SGR-aware. A line that
280
375
  * fits (≤ W) passes through whole; an overflow cuts the content at
@@ -293,16 +388,30 @@ export declare function cutLine(line: string, W: number): string;
293
388
  * for it, so a truncated row never exceeds W (a cut row carries the
294
389
  * marker INSIDE the width; a row that fits is returned untouched). */
295
390
  export declare function truncateRow(row: string, width: number): string;
296
- /** v3 §01 (V6-2) + W1: the banner lines for a width W and height H —
297
- * the tier table (extends the existing "under 40 columns, skip the
298
- * logo" rule with a HEIGHT input; VD-14 merged the two art tiers):
299
- * W ≥ 40 and H ≥ 14 → the 2-row wordmark, 2-column indent
300
- * anything smaller → text rows only
301
- * then the blank, then "vX — tagline" — the art IS the wordmark, so the
302
- * text row does not repeat the name — then extensions — then the W5
303
- * resume list (BIG only, W5). Every row truncates at the terminal width
304
- * with a " (+N)" marker. Pure. */
391
+ /**
392
+ * Graphite §7.10 — the opening's rows for a width W and height H. Pure;
393
+ * invariant ① holds at every width (each row is cut to W).
394
+ *
395
+ * - The tall form (H ≥ 30, W ≥ the wordmark at the content edge, not a
396
+ * resume): the wordmark, its rule, the tagline with the version, the
397
+ * motto. The facts sit beside it behind one hairline when W ≥ 96, and
398
+ * below it otherwise.
399
+ * - The one-line form otherwise: `✦ kiso <version> · <tagline>`, the
400
+ * facts below it.
401
+ *
402
+ * On a known ground the block cells take `mix(ink, dim, row / 4)` top to
403
+ * bottom, the box-drawing shadow `mix(rail, ground, 0.35)`, and the rule
404
+ * fades from `dim` to the ground; there is no gold (§1.2 — gold is the
405
+ * edge, and the opening has none). Off one the wordmark is the terminal's
406
+ * own foreground. `<version>` is the caller's, never a literal.
407
+ */
305
408
  export declare function bannerLines(W: number, H: number, version: string, extensionsText: string, resume?: readonly ResumeMeta[], now?: number, meta?: BannerMeta | undefined): string[];
409
+ /** The rule under the wordmark: `dim` fading to the ground, in a few runs.
410
+ * Off a known ground, the plain dim rule. */
411
+ /** Graphite §5 (R2b) — the rule under an answer's `#` heading: `gold-mark`
412
+ * fading to the ground over `n` cells (the prototype's forty). Off a known
413
+ * ground, the plain dim rule. */
414
+ export declare function headingRule(n: number): string;
306
415
  /** W5 — the opening-screen resume list. Every field already exists
307
416
  * behind renderSessionLine / `kiso sessions`: the relative time, the
308
417
  * title, then the right-aligned "N events · M runs". The columns are