tui

package
v0.1.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 15, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	PrimaryColor   = lipgloss.Color("#7D56F4")
	SecondaryColor = lipgloss.Color("#04B575")
	WarningColor   = lipgloss.Color("#FFCC00")
	ErrorColor     = lipgloss.Color("#FF5F56")
	SubtleColor    = lipgloss.Color("#626262")
	WhiteColor     = lipgloss.Color("#FFFFFF")
	BlackColor     = lipgloss.Color("#000000")

	// Document-specific colors
	FRDColor = lipgloss.Color("#FF6B6B") // Definitions - Red
	KSIColor = lipgloss.Color("#4ECDC4") // Indicators - Teal
	VDRColor = lipgloss.Color("#45B7D1") // Vuln Detection - Blue
	UCMColor = lipgloss.Color("#96CEB4") // Crypto Modules - Green
	SCGColor = lipgloss.Color("#FFEAA7") // Secure Config Guide - Yellow
	ADSColor = lipgloss.Color("#DDA0DD") // Auth Data Sharing - Plum
	CCMColor = lipgloss.Color("#98D8C8") // Continuous Monitor - Mint
	FSIColor = lipgloss.Color("#F7DC6F") // Security Inbox - Gold
	ICPColor = lipgloss.Color("#BB8FCE") // Incident Comms - Purple
	MASColor = lipgloss.Color("#85C1E9") // Min Assessment - Sky Blue
	PVAColor = lipgloss.Color("#F8B500") // Persistent Valid - Orange
	SCNColor = lipgloss.Color("#58D68D") // Significant Change - Lime
)

Color palette

View Source
var (
	AppStyle = lipgloss.NewStyle().Padding(1, 2)

	TitleStyle = lipgloss.NewStyle().
				Foreground(PrimaryColor).
				Bold(true).
				MarginBottom(1)

	DetailTitleStyle = lipgloss.NewStyle().
						Foreground(PrimaryColor).
						Bold(true).
						MarginBottom(1)

	DetailLabelStyle = lipgloss.NewStyle().
						Foreground(SubtleColor).
						Width(18)

	DetailValueStyle = lipgloss.NewStyle().
						Foreground(WhiteColor)

	DetailURLStyle = lipgloss.NewStyle().
					Foreground(SecondaryColor).
					Underline(true)

	HelpStyle = lipgloss.NewStyle().
				Foreground(SubtleColor).
				MarginTop(1)

	SelectedStyle = lipgloss.NewStyle().
					Foreground(PrimaryColor).
					Bold(true)

	NormalStyle = lipgloss.NewStyle().
				Foreground(WhiteColor)

	DimStyle = lipgloss.NewStyle().
				Foreground(SubtleColor)

	StatementStyle = lipgloss.NewStyle().
					Foreground(WhiteColor).
					MarginTop(1).
					MarginBottom(1)

	NoteStyle = lipgloss.NewStyle().
				Foreground(WarningColor).
				Italic(true)

	RetiredStyle = lipgloss.NewStyle().
					Foreground(ErrorColor).
					Bold(true)

	ControlStyle = lipgloss.NewStyle().
					Foreground(SecondaryColor)

	// Impact text styles (colored text, no background)
	ImpactHighStyle = lipgloss.NewStyle().Foreground(ErrorColor).Bold(true)
	ImpactModStyle  = lipgloss.NewStyle().Foreground(WarningColor).Bold(true)
	ImpactLowStyle  = lipgloss.NewStyle().Foreground(SecondaryColor).Bold(true)

	// Keyword subtle indicator styles
	KeywordMustStyle    = lipgloss.NewStyle().Foreground(ErrorColor)
	KeywordShouldStyle  = lipgloss.NewStyle().Foreground(WarningColor)
	KeywordMayStyle     = lipgloss.NewStyle().Foreground(SecondaryColor)
	KeywordMustNotStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("#FF2D2D"))
)

Styles

View Source
var AffectsOptions = []string{"", "Providers", "Agencies", "Assessors", "FedRAMP"}

AffectsOptions defines the cycle order for affects filtering

View Source
var DocumentColors = map[string]lipgloss.Color{
	"FRD": FRDColor,
	"KSI": KSIColor,
	"VDR": VDRColor,
	"UCM": UCMColor,
	"SCG": SCGColor,
	"ADS": ADSColor,
	"CCM": CCMColor,
	"FSI": FSIColor,
	"ICP": ICPColor,
	"MAS": MASColor,
	"PVA": PVAColor,
	"SCN": SCNColor,
}

DocumentColors maps document codes to colors

View Source
var KeywordOptions = []string{"", "MUST", "MUST NOT", "SHOULD", "SHOULD NOT", "MAY"}

KeywordOptions defines the cycle order for keyword filtering

Functions

func DocumentBadge

func DocumentBadge(code string) string

Badge styles

func ImpactBadge

func ImpactBadge(low, moderate, high bool) string

func ImpactText

func ImpactText(low, moderate, high bool) string

ImpactText returns colored text for impact level (no background)

func KeywordBadge

func KeywordBadge(keyword string) string

func KeywordIndicator

func KeywordIndicator(keyword string) string

KeywordIndicator returns a subtle colored dot for keyword display

func RetiredBadge

func RetiredBadge() string

func ViewBadge

func ViewBadge(name string, active bool) string

Types

type DataLoadedMsg

type DataLoadedMsg struct {
	Documents    []model.Document
	Requirements []model.Requirement
	Definitions  []model.Definition
	Indicators   []model.Indicator
}

Messages

type ErrorMsg

type ErrorMsg struct {
	Err error
}

type ItemDelegate

type ItemDelegate struct {
	ShowDescription bool
}

ItemDelegate handles rendering of list items

func NewItemDelegate

func NewItemDelegate() ItemDelegate

func (ItemDelegate) Height

func (d ItemDelegate) Height() int

func (ItemDelegate) Render

func (d ItemDelegate) Render(w io.Writer, m list.Model, index int, item list.Item)

func (ItemDelegate) Spacing

func (d ItemDelegate) Spacing() int

func (ItemDelegate) Update

func (d ItemDelegate) Update(msg tea.Msg, m *list.Model) tea.Cmd

type KeyMap

type KeyMap struct {
	Up         key.Binding
	Down       key.Binding
	Enter      key.Binding
	Back       key.Binding
	Quit       key.Binding
	Help       key.Binding
	Home       key.Binding
	Reqs       key.Binding
	Defs       key.Binding
	Indicators key.Binding
	Filter     key.Binding
}

KeyMap defines all key bindings

func DefaultKeyMap

func DefaultKeyMap() KeyMap

DefaultKeyMap returns the default key bindings

func (KeyMap) FullHelp

func (k KeyMap) FullHelp() [][]key.Binding

FullHelp returns full key help

func (KeyMap) ShortHelp

func (k KeyMap) ShortHelp() []key.Binding

ShortHelp returns brief key help

type Model

type Model struct {
	// contains filtered or unexported fields
}

Model is the main application model

func NewModel

func NewModel(opts ...ModelOption) Model

NewModel creates a new application model

func (Model) Init

func (m Model) Init() tea.Cmd

Init initializes the model

func (Model) Update

func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update handles messages and updates the model

func (Model) View

func (m Model) View() string

View renders the model

type ModelOption

type ModelOption func(*Model)

ModelOption configures the TUI model

func WithRefresh

func WithRefresh(refresh bool) ModelOption

WithRefresh forces fresh data fetch

type ViewState

type ViewState int

ViewState represents the current view

const (
	ViewHome ViewState = iota
	ViewRequirements
	ViewDefinitions
	ViewIndicators
	ViewDetail
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL