Documentation
¶
Overview ¶
Package ui defines Harbor's terminal design tokens and geometry primitives.
Index ¶
- Constants
- func Composer(theme Theme, width int, posture, identity string) string
- func ComposerGeometry(layout Layout, lines int) (int, int)
- func ComposerWithText(theme Theme, width int, posture, status, identity, draft string) string
- func DescribeLayout(layout Layout) string
- func DialogGeometry(layout Layout, requestedWidth, rows int) (int, int, int)
- func HeavyCard(theme Theme, role Role, width int, lines ...string) string
- func LiveComposer(theme Theme, width int, posture, status, identity, draft string, ...) string
- func PadRight(value string, width int) string
- func Truncate(value string, width int) string
- func Width(value string) int
- type Cluster
- type Environment
- type Layout
- type Mode
- type Profile
- type Role
- type Theme
Constants ¶
const ( // OuterPadding is the horizontal canvas inset. OuterPadding = 2 // SidebarWidth is the fixed sidebar width. SidebarWidth = 42 // ActionBreakpoint is the first width with horizontal actions. ActionBreakpoint = 80 // SidebarBreakpoint is the final width with an overlay sidebar. SidebarBreakpoint = 120 // HomeComposerWidth is the minimum wide-terminal composer cap. HomeComposerWidth = 75 // DialogMedium is the medium dialog cap. DialogMedium = 60 // DialogLarge is the large dialog cap. DialogLarge = 88 // DialogXLarge is the extra-large dialog cap. DialogXLarge = 116 // AutocompleteRows is the maximum autocomplete height. AutocompleteRows = 10 )
Variables ¶
This section is empty.
Functions ¶
func ComposerGeometry ¶
ComposerGeometry returns the capped composer width and viewport-derived height.
func ComposerWithText ¶
ComposerWithText renders the detached foundation composer.
func DescribeLayout ¶
DescribeLayout returns a stable geometry summary used by smoke gates.
func DialogGeometry ¶
DialogGeometry returns a fixed dialog's capped width, height, and top row.
func LiveComposer ¶
func LiveComposer(theme Theme, width int, posture, status, identity, draft string, cursor, selectionStart, selectionEnd int) string
LiveComposer renders a wrapped operational draft with an exact cursor and inverse-styled selection. It contains no fabricated Runtime metadata.
Types ¶
type Cluster ¶
Cluster is one grapheme and its visible width.
func Clusters ¶
Clusters splits plain text using x/ansi's grapheme-aware truncation. It deliberately shares the same width authority as every layout operation.
The input MUST be plain text. On styled input ansi.Truncate returns a re-terminated string that is not a prefix of the source, so the scan could never advance; the prefix guard below consumes the remainder in one cluster instead of looping forever. Callers rendering styled content keep text and style separate (the canvas takes plain text plus one style per write).
type Environment ¶
Environment describes terminal capabilities used to compile a theme.
func EnvironmentFrom ¶
func EnvironmentFrom(lookup func(string) (string, bool)) Environment
EnvironmentFrom reads terminal capability variables. NO_COLOR is enabled by presence, including an explicitly empty value.
type Layout ¶
type Layout struct {
Width, Height int
ContentWidth, ContentHeight int
MainWidth, SidebarWidth int
HorizontalActions, JoinedSidebar bool
}
Layout is the explicit pre-style root geometry.
type Role ¶
type Role uint8
Role names a semantic color; components never choose literal colors.
const ( RolePrimary Role = iota RoleSecondary RoleAccent RoleError RoleWarning RoleSuccess RoleInfo RoleText RoleMuted RoleCanvas RolePanel RoleElement RoleBorder // Brand roles carry the Harbor mark's palette — the lighthouse beam, // beacon light, tower, and sea from the canonical logo — so even the // pixel mark stays inside the semantic token system. RoleBrandBeam RoleBrandLight RoleBrandTower RoleBrandSea )
type Theme ¶
type Theme struct {
// contains filtered or unexported fields
}
Theme is an immutable compiled semantic palette.
func CompileTheme ¶
func CompileTheme(environment Environment) Theme
CompileTheme selects profile and background mode from terminal capabilities.
func (Theme) SemanticValue ¶
SemanticValue exposes a compiled role for style conformance tests.