OOKNET                             [ /  search the index  ]  
──────────────────────────────────────────────────────────────────────────────────────
══════════════════════════════════════════════════════════════════════════════════════
OOKNET   [ /  search  ]  
────────────────────────────────────────────────
════════════════════════════════════════════════
 
 
master @ 21 LINES
 
[ HISTORY ]  [ UP ]
 

// Generic slotted box: build-time top/bottom borders, CSS glyph rails
// down the sides (same trick as Dialog). Anything can live inside.
import { G, checkGrid, len, rule } from "../../lib/ascii";

export interface Props {
  title?: string;
}

export function buildPanelTop(width: number, title?: string): string {
  if (!title) return G.TL + rule(width - 2) + G.TR;
  const label = ` ${title} `;
  const tail = width - 3 - len(label);
  if (tail < 1) {
    throw new Error(`[ascii] panel title too long for ${width} cells: "${title}"`)
;
  }
  return checkGrid(G.TL + G.H + label + rule(tail) + G.TR, width, "panel top");
}

export const buildPanelBottom = (width: number): string =>
  G.BL + rule(width - 2) + G.BR;

// Generic slotted box: build-time top/botto
m borders, CSS glyph rails
// down the sides (same trick as Dialog). An
ything can live inside.
import { G, checkGrid, len, rule } from "../
../lib/ascii";

export interface Props {
  title?: string;
}

export function buildPanelTop(width: number,
 title?: string): string {
  if (!title) return G.TL + rule(width - 2) 
+ G.TR;
  const label = ` ${title} `;
  const tail = width - 3 - len(label);
  if (tail < 1) {
    throw new Error(`[ascii] panel title too
 long for ${width} cells: "${title}"`);
  }
  return checkGrid(G.TL + G.H + label + rule
(tail) + G.TR, width, "panel top");
}

export const buildPanelBottom = (width: numb
er): string =>
  G.BL + rule(width - 2) + G.BR;
 
──────────────────────────────────────────────────────────────────────────────────────
OOKNET
────────────────────────────────────────────────
OOKNET