Liking cljdoc? Tell your friends :D

com.blockether.vis.internal.header

Channel-agnostic header layout & content spec.

Every channel — terminal TUI, web, Telegram, future surfaces — renders the same conceptual header band:

[LEFT 30%]   [CENTER 40% workspace switcher]   [RIGHT 30%]

The decisions a channel cannot make on its own (slot ratios, workspace switcher sizing/visibility caps, default labels, copy id length, glyphs) live here as plain Clojure data. A channel imports this namespace, reads the values, and projects them onto its medium — TextGraphics cells for Lanterna, divs/spans for HTML, a keyboard row for Telegram, etc.

No graphics. No I/O. No channel-specific deps. Pure data + tiny pure helpers, written as .cljc so a ClojureScript web UI can require it directly.

Channel-agnostic header layout & content spec.

Every channel — terminal TUI, web, Telegram, future surfaces —
renders the same conceptual header band:

    [LEFT 30%]   [CENTER 40% workspace switcher]   [RIGHT 30%]

The decisions a channel cannot make on its own (slot ratios, workspace
switcher sizing/visibility caps, default labels, copy id length, glyphs)
live here as plain Clojure data. A channel imports this namespace,
reads the values, and projects them onto its medium — TextGraphics
cells for Lanterna, divs/spans for HTML, a keyboard row for
Telegram, etc.

No graphics. No I/O. No channel-specific deps. Pure data + tiny
pure helpers, written as `.cljc` so a ClojureScript web UI can
require it directly.
raw docstring

copy-iconclj

Glyph used by the right-slot copy session id affordance.

Glyph used by the right-slot `copy session id` affordance.
sourceraw docstring

id-display-charsclj

How many leading characters of the session UUID every channel shows next to the copy affordance. Matches vis sessions short form.

How many leading characters of the session UUID every channel
shows next to the copy affordance. Matches `vis sessions`
short form.
sourceraw docstring

left-slot-colsclj

Static width (in display cells) of the LEFT header slot (notifications). A fixed column count instead of a fraction, so the left slot stays the same size whether the terminal is 80 or 200 columns wide.

Static width (in display cells) of the LEFT header slot (notifications).
A fixed column count instead of a fraction, so the left slot stays the
same size whether the terminal is 80 or 200 columns wide.
sourceraw docstring

left-slot-ratioclj

Fraction of the total width given to the LEFT slot (notifications).

Fraction of the total width given to the LEFT slot (notifications).
sourceraw docstring

max-visible-tab-entriesclj

Upper clamp for visible workspace count: huge screens stop spreading past this — past it the centre slot would look like a header full of workspaces and nothing else.

Upper clamp for visible workspace count: huge screens stop spreading
past this — past it the centre slot would look like a header full of
workspaces and nothing else.
sourceraw docstring

max-visible-workspace-countclj

(max-visible-workspace-count workspace-n width)

How many workspaces to show inside width cells.

Policy (identical across channels):

  • clamp the natural fit width / tab-entry-target-width to [min-visible-tab-entries, max-visible-tab-entries],
  • never exceed workspace-n (cannot show what does not exist),
  • if even min-visible-tab-entries cannot fit the natural budget, fall back to the natural fit so tiny surfaces degrade gracefully.
How many workspaces to show inside `width` cells.

Policy (identical across channels):
- clamp the natural fit `width / tab-entry-target-width` to
  `[min-visible-tab-entries, max-visible-tab-entries]`,
- never exceed `workspace-n` (cannot show what does not exist),
- if even `min-visible-tab-entries` cannot fit the natural
  budget, fall back to the natural fit so tiny surfaces degrade
  gracefully.
sourceraw docstring

min-visible-tab-entriesclj

Lower clamp for visible workspace count: even on narrowish screens we keep at least this many visible (the arrows reach the rest).

Lower clamp for visible workspace count: even on narrowish screens we
keep at least this many visible (the arrows reach the rest).
sourceraw docstring

right-slot-colsclj

Static width (in display cells) of the RIGHT header slot (session-id copy affordance). Fixed column count, see left-slot-cols.

Static width (in display cells) of the RIGHT header slot (session-id copy
affordance). Fixed column count, see `left-slot-cols`.
sourceraw docstring

right-slot-ratioclj

Fraction of the total width given to the RIGHT slot (channel status + session-id copy affordance).

Fraction of the total width given to the RIGHT slot (channel status +
session-id copy affordance).
sourceraw docstring

short-idclj

(short-id id)

Shorten a session UUID to the shared display length. Returns nil for blank input so channels can use truthy guards.

Shorten a session UUID to the shared display length. Returns
nil for blank input so channels can use truthy guards.
sourceraw docstring

slot-gap-colsclj

Blank columns kept on EACH side between the centre slot and the left / right side slots, so the middle never crashes into either edge slot.

Blank columns kept on EACH side between the centre slot and the left /
right side slots, so the middle never crashes into either edge slot.
sourceraw docstring

slot-layoutclj

(slot-layout cols)

Fixed-width header layout for a band cols wide.

LEFT and RIGHT are sized by their slot ratios (left-slot-ratio / right-slot-ratio) but capped at the static left-slot-cols / right-slot-cols so they never eat the whole band on a wide terminal; CENTER absorbs whatever is left after also reserving slot-gap-cols blank columns on each side of the centre. Every width clamps at 0 so a narrow band degrades gracefully (centre collapses first, then the right slot) instead of going negative.

Returns {:left-x :left-w :center-x :center-w :right-x :right-w} - absolute x positions + widths a channel paints directly.

Fixed-width header layout for a band `cols` wide.

LEFT and RIGHT are sized by their slot ratios (`left-slot-ratio` /
`right-slot-ratio`) but capped at the static `left-slot-cols` /
`right-slot-cols` so they never eat the whole band on a wide terminal;
CENTER absorbs whatever is left after also reserving `slot-gap-cols`
blank columns on each side of the centre. Every width
clamps at 0 so a narrow band degrades gracefully (centre collapses first,
then the right slot) instead of going negative.

Returns `{:left-x :left-w :center-x :center-w :right-x :right-w}` -
absolute x positions + widths a channel paints directly.
sourceraw docstring

slot-widthsclj

(slot-widths cols)

Compute integer widths [left center right] for a header cols wide. center = cols - left - right so rounding errors never bleed off-screen.

Compute integer widths `[left center right]` for a header `cols` wide.
`center = cols - left - right` so rounding errors never bleed off-screen.
sourceraw docstring

tab-entry-paddingclj

Inner padding (in display cells / spaces) reserved on each side of a workspace label so the label never crashes into the cell border.

Inner padding (in display cells / spaces) reserved on each side of a
workspace label so the label never crashes into the cell border.
sourceraw docstring

tab-entry-target-widthclj

Natural width per workspace entry used to drive the visible-entry clamp. Wider → fewer workspaces fit before arrows appear; narrower → more workspaces fit but labels truncate sooner.

Natural width per workspace entry used to drive the visible-entry
clamp. Wider → fewer workspaces fit before arrows appear; narrower →
more workspaces fit but labels truncate sooner.
sourceraw docstring

title-or-placeholderclj

(title-or-placeholder title)

Visible label for a session: its title if non-blank, otherwise untitled-session-label. Used by both workspace-label sync in state and the synthesised fallback workspace in channels.

Visible label for a session: its title if non-blank, otherwise
`untitled-session-label`. Used by both workspace-label sync in
state and the synthesised fallback workspace in channels.
sourceraw docstring

untitled-session-labelclj

Default label every channel shows for a workspace whose session has no title yet. Renamed by the state layer once a title is generated.

Default label every channel shows for a workspace whose session has
no title yet. Renamed by the state layer once a title is generated.
sourceraw docstring

workspace-arrow-leftclj

Glyph for the previous workspace overflow affordance.

Glyph for the `previous workspace` overflow affordance.
sourceraw docstring

workspace-arrow-rightclj

Glyph for the next workspace overflow affordance.

Glyph for the `next workspace` overflow affordance.
sourceraw docstring

workspace-ellipsisclj

Glyph appended when a workspace label has to be truncated.

Glyph appended when a workspace label has to be truncated.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close