@vincemakes/kiso-tui-cells 0.20.1 → 0.20.2

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.
@@ -215,9 +215,13 @@ export interface PickOption {
215
215
  export interface PickSpec {
216
216
  readonly header: string;
217
217
  readonly options: readonly PickOption[];
218
- /** the `t` row \u2014 typing it directly is always available, because a
219
- * list of profiles is never the list of models that exist */
220
- readonly typeHint: string;
218
+ /** the `t` row typing directly. OPTIONAL, and its absence means the
219
+ * option list is the WHOLE world: `/model`'s profiles never are (a
220
+ * model that exists but is not configured has to be typeable), and
221
+ * `/mode`'s five tiers always are. Offering a `t` row over a closed
222
+ * set is a row that carries no fact — §1.3 — and it is what made
223
+ * the owner read the mode panel as "type the answer". */
224
+ readonly typeHint?: string;
221
225
  /** shown INSTEAD of the options when there are none. The copy is the
222
226
  * caller's and is reproduced verbatim. */
223
227
  readonly emptyNote?: string;
@@ -432,4 +436,12 @@ export declare function pickAffordance(state: PickRuntime): string;
432
436
  /** Compose a pick view. The flavor/name/title/args fields exist for the
433
437
  * approval path and are given inert values here \u2014 the pick block
434
438
  * reads none of them. */
439
+ /** DC-36 — the same shell for the MODE picker.
440
+ *
441
+ * `/model` learned to pick in TUI2-R2 ④; `/mode` never did, and the
442
+ * five tiers are a CLOSED set — the one case where making a human
443
+ * type the answer is least defensible. The pick block reads only
444
+ * `pick` and `statusText`, so a second flavour is a name and a
445
+ * fallback question, not a second mechanism. */
446
+ export declare function modePickView(spec: PickSpec, statusText: string): PanelView;
435
447
  export declare function modelPickView(spec: PickSpec, statusText: string): PanelView;
@@ -543,8 +543,10 @@ export function pickBlockRows(view, state, W, maxRows) {
543
543
  }
544
544
  }
545
545
  const typing = state.phase === "custom";
546
- const tText = cutLine(`${typing ? p.bold : ""}${typing ? "\u2192" : " "} t ${p.reset}${p.dim}${escapeTerminal(spec.typeHint)}${p.reset}`, room);
547
- rows.push(typing ? selectionBar(tText, visibleWidth(tText), W) : ` ${tText}`);
546
+ if (spec.typeHint !== undefined) {
547
+ const tText = cutLine(`${typing ? p.bold : ""}${typing ? "\u2192" : " "} t ${p.reset}${p.dim}${escapeTerminal(spec.typeHint)}${p.reset}`, room);
548
+ rows.push(typing ? selectionBar(tText, visibleWidth(tText), W) : ` ${tText}`);
549
+ }
548
550
  rows.push(` ${p.dim}${cutLine(pickAffordance(state), room)}${p.reset}`);
549
551
  rows.push(`${p.dim}${"\u2500".repeat(Math.max(0, W))}${p.reset}`);
550
552
  return rows;
@@ -571,11 +573,36 @@ export function pickStatus(view) {
571
573
  return view.statusText;
572
574
  }
573
575
  export function pickAffordance(state) {
574
- return state.phase === "custom" ? "enter commits \u00b7 esc backs out" : "digits pick \u00b7 \u23ce confirms \u00b7 esc";
576
+ // DC-36 the row NAMES the arrows. TUI2-R2 bound ↑↓ to the pick's
577
+ // cursor and the keys sheet has said `panels: ↑↓ move` ever since,
578
+ // but this row — the one a human is actually looking at while the
579
+ // panel is up — advertised only the digits. The owner read it as
580
+ // "type the answer", which is the same lesson DC-30 filed: a hint
581
+ // that omits the gesture is why the gesture goes unused.
582
+ return state.phase === "custom" ? "enter commits \u00b7 esc backs out" : "\u2191\u2193 move \u00b7 digits pick \u00b7 \u23ce confirms \u00b7 esc";
575
583
  }
576
584
  /** Compose a pick view. The flavor/name/title/args fields exist for the
577
585
  * approval path and are given inert values here \u2014 the pick block
578
586
  * reads none of them. */
587
+ /** DC-36 — the same shell for the MODE picker.
588
+ *
589
+ * `/model` learned to pick in TUI2-R2 ④; `/mode` never did, and the
590
+ * five tiers are a CLOSED set — the one case where making a human
591
+ * type the answer is least defensible. The pick block reads only
592
+ * `pick` and `statusText`, so a second flavour is a name and a
593
+ * fallback question, not a second mechanism. */
594
+ export function modePickView(spec, statusText) {
595
+ return {
596
+ flavor: "simple",
597
+ name: "mode",
598
+ title: "mode",
599
+ speaker: "you",
600
+ statusText,
601
+ args: { kind: "text", lines: [] },
602
+ fallbackQuestion: "switch mode? (name) ",
603
+ pick: spec,
604
+ };
605
+ }
579
606
  export function modelPickView(spec, statusText) {
580
607
  return {
581
608
  flavor: "simple",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vincemakes/kiso-tui-cells",
3
- "version": "0.20.1",
3
+ "version": "0.20.2",
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",