Documentation
¶
Overview ¶
Package entity defines domain entities for the browser.
Package entity contains domain entities representing core business concepts. These entities are pure Go types with no infrastructure dependencies.
Index ¶
- Constants
- Variables
- type DailyVisitCount
- type DomainStat
- type Favorite
- type FavoriteID
- type FavoriteTree
- type Folder
- type FolderID
- type HistoryAnalytics
- type HistoryEntry
- type HistoryMatch
- type HistoryStats
- type HourlyDistribution
- type Pane
- type PaneID
- type PaneNode
- func (n *PaneNode) ActivePane() *PaneNode
- func (n *PaneNode) FindPane(id PaneID) *PaneNode
- func (n *PaneNode) IsContainer() bool
- func (n *PaneNode) IsLeaf() bool
- func (n *PaneNode) IsSplit() bool
- func (n *PaneNode) LeafCount() int
- func (n *PaneNode) Left() *PaneNode
- func (n *PaneNode) Right() *PaneNode
- func (n *PaneNode) StackedPanes() []*PaneNode
- func (n *PaneNode) Walk(fn func(*PaneNode) bool)
- type PaneRect
- type PurgeResult
- type PurgeTarget
- type PurgeTargetType
- type Session
- type SessionID
- type SessionType
- type SplitDirection
- type Tab
- type TabID
- type TabList
- func (tl *TabList) ActiveTab() *Tab
- func (tl *TabList) Add(tab *Tab)
- func (tl *TabList) Count() int
- func (tl *TabList) Find(id TabID) *Tab
- func (tl *TabList) Move(id TabID, newPos int) bool
- func (tl *TabList) Remove(id TabID) bool
- func (tl *TabList) SetActive(id TabID)
- func (tl *TabList) TabAt(index int) *Tab
- type Tag
- type TagID
- type WindowType
- type Workspace
- type WorkspaceID
- type ZoomLevel
Constants ¶
const ( ZoomDefault = 1.0 ZoomMin = 0.25 // 25% ZoomMax = 5.0 // 500% ZoomStep = 0.1 // 10% increments )
Default zoom constants
Variables ¶
var ErrInvalidSession = errors.New("invalid session")
Functions ¶
This section is empty.
Types ¶
type DailyVisitCount ¶
type DailyVisitCount struct {
Day string `json:"day"`
Entries int64 `json:"entries"`
Visits int64 `json:"visits"`
}
DailyVisitCount contains visit counts by day.
type DomainStat ¶
type DomainStat struct {
Domain string `json:"domain"`
PageCount int64 `json:"page_count"`
TotalVisits int64 `json:"total_visits"`
LastVisit time.Time `json:"last_visit"`
}
DomainStat contains per-domain visit statistics.
type Favorite ¶
type Favorite struct {
ID FavoriteID `json:"id"`
URL string `json:"url"`
Title string `json:"title"`
FaviconURL string `json:"favicon_url"`
FolderID *FolderID `json:"folder_id"` // nil = root level
ShortcutKey *int `json:"shortcut_key"` // 1-9 for quick access (Alt+1 through Alt+9)
Position int `json:"position"` // Order within folder
Tags []Tag `json:"tags,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
Favorite represents a bookmarked URL.
func NewFavorite ¶
NewFavorite creates a new favorite for a URL.
func (*Favorite) HasShortcut ¶
HasShortcut returns true if this favorite has a keyboard shortcut.
type FavoriteTree ¶
type FavoriteTree struct {
RootFolders []*Folder
RootFavorites []*Favorite
FolderMap map[FolderID]*Folder // Quick lookup
ChildFolders map[FolderID][]*Folder // Children of each folder
ChildFavorites map[FolderID][]*Favorite // Favorites in each folder
}
FavoriteTree represents a hierarchical view of folders and favorites.
func NewFavoriteTree ¶
func NewFavoriteTree() *FavoriteTree
NewFavoriteTree creates an empty favorite tree.
type Folder ¶
type Folder struct {
ID FolderID `json:"id"`
Name string `json:"name"`
Icon string `json:"icon"` // Optional icon identifier
ParentID *FolderID `json:"parent_id"` // nil = root level
Position int `json:"position"` // Order within parent
CreatedAt time.Time `json:"created_at"`
}
Folder represents a container for organizing favorites.
type HistoryAnalytics ¶
type HistoryAnalytics struct {
TotalEntries int64 `json:"total_entries"`
TotalVisits int64 `json:"total_visits"`
UniqueDays int64 `json:"unique_days"`
TopDomains []*DomainStat `json:"top_domains"`
DailyVisits []*DailyVisitCount `json:"daily_visits"`
HourlyDistribution []*HourlyDistribution `json:"hourly_distribution"`
}
HistoryAnalytics contains all analytics data for the homepage.
type HistoryEntry ¶
type HistoryEntry struct {
ID int64 `json:"id"`
URL string `json:"url"`
Title string `json:"title"`
FaviconURL string `json:"favicon_url"`
VisitCount int64 `json:"visit_count"`
LastVisited time.Time `json:"last_visited"`
CreatedAt time.Time `json:"created_at"`
}
HistoryEntry represents a visited URL in browsing history.
func NewHistoryEntry ¶
func NewHistoryEntry(url, title string) *HistoryEntry
NewHistoryEntry creates a new history entry for a URL.
func (*HistoryEntry) IncrementVisit ¶
func (h *HistoryEntry) IncrementVisit()
IncrementVisit updates the entry for a new visit.
type HistoryMatch ¶
type HistoryMatch struct {
Entry *HistoryEntry
Score float64 // Match score (higher is better)
}
HistoryMatch represents a history entry that matched a search query. Used for fuzzy search results with scoring.
type HistoryStats ¶
type HistoryStats struct {
TotalEntries int64 `json:"total_entries"`
TotalVisits int64 `json:"total_visits"`
UniqueDays int64 `json:"unique_days"`
}
HistoryStats contains aggregated history statistics.
type HourlyDistribution ¶
HourlyDistribution contains visit counts by hour of day.
type Pane ¶
type Pane struct {
ID PaneID
URI string
Title string
FaviconURL string
WindowType WindowType
ZoomFactor float64
CanGoBack bool
CanForward bool
IsLoading bool
CreatedAt time.Time
// Popup-specific fields
IsRelated bool // Shares context with parent
ParentPaneID *PaneID // Parent pane if this is a related popup
AutoClose bool // Auto-close on OAuth success
RequestID string // Request ID for popup tracking
}
Pane represents a single browsing context (a WebView container). This is the leaf-level entity that holds navigation state.
type PaneNode ¶
type PaneNode struct {
ID string
Pane *Pane // Non-nil for leaf nodes
Parent *PaneNode // nil for root
Children []*PaneNode
// Layout
SplitDir SplitDirection
SplitRatio float64 // 0.0-1.0, position of divider
// Stacked panes (alternative to split)
IsStacked bool
ActiveStackIndex int
}
PaneNode represents a node in the workspace pane tree structure. It can be either:
- Leaf node: Contains a single Pane
- Split node: Contains two children (left/right or top/bottom)
- Stacked node: Contains multiple panes in a tabbed view
func (*PaneNode) ActivePane ¶
ActivePane returns the currently visible pane in a stacked container.
func (*PaneNode) IsContainer ¶
IsContainer returns true if this is a split or stacked container.
func (*PaneNode) StackedPanes ¶
StackedPanes returns the list of panes if this is a stacked container.
type PaneRect ¶
type PaneRect struct {
PaneID PaneID
X, Y int // Top-left position relative to workspace container
W, H int // Width and height
}
PaneRect represents a pane's screen position and size. Used for geometric navigation to find adjacent panes by position.
type PurgeResult ¶
type PurgeResult struct {
Target PurgeTarget
Success bool
Error error
}
PurgeResult represents the outcome of purging a single target.
type PurgeTarget ¶
type PurgeTarget struct {
Type PurgeTargetType
Path string
Description string
Size int64
Exists bool
}
PurgeTarget represents something that can be purged.
type PurgeTargetType ¶
type PurgeTargetType int
PurgeTargetType identifies what kind of purgeable item this is.
const ( PurgeTargetConfig PurgeTargetType = iota PurgeTargetData PurgeTargetState PurgeTargetCache PurgeTargetFilterJSON PurgeTargetFilterStore PurgeTargetFilterCache PurgeTargetDesktopFile PurgeTargetIcon )
type Session ¶
Session captures metadata about a dumber run. A browser session is expected to have a corresponding log file.
type SessionID ¶
type SessionID string
SessionID uniquely identifies an application session. For now it matches the log session ID format (YYYYMMDD_HHMMSS_xxxx).
type SessionType ¶
type SessionType string
SessionType distinguishes long-running browser sessions from ephemeral CLI invocations.
const ( SessionTypeBrowser SessionType = "browser" SessionTypeCLI SessionType = "cli" )
type SplitDirection ¶
type SplitDirection int
SplitDirection indicates how a pane container splits its children.
const ( SplitNone SplitDirection = iota // Leaf node or stacked container SplitHorizontal // Left/right split SplitVertical // Top/bottom split )
type Tab ¶
type Tab struct {
ID TabID
Name string // Display name (often derived from active pane title)
Workspace *Workspace // The workspace this tab contains
Position int // Position in the tab bar (0-indexed)
IsPinned bool // Pinned tabs stay at the left
CreatedAt time.Time
}
Tab represents a browser tab containing a workspace. Tabs are the top-level container in the browser's tab bar.
func NewTab ¶
func NewTab(tabID TabID, workspaceID WorkspaceID, initialPane *Pane) *Tab
NewTab creates a new tab with an initial pane.
type TabList ¶
type TabList struct {
Tabs []*Tab
ActiveTabID TabID
PreviousActiveTabID TabID // Tracks last active tab for Alt+Tab style switching
}
TabList manages an ordered collection of tabs.
type Tag ¶
type Tag struct {
ID TagID `json:"id"`
Name string `json:"name"`
Color string `json:"color"` // Hex color code (e.g., "#FF5733")
CreatedAt time.Time `json:"created_at"`
}
Tag represents a label that can be applied to favorites.
type WindowType ¶
type WindowType int
WindowType indicates the type of browser window.
const ( WindowMain WindowType = iota // Regular browser tab WindowPopup // Popup window (OAuth, feature-restricted) )
type Workspace ¶
type Workspace struct {
ID WorkspaceID
Name string
Root *PaneNode // Root of the pane tree
ActivePaneID PaneID // Currently focused pane
CreatedAt time.Time
}
Workspace represents a collection of panes arranged in a tree layout. Each tab contains exactly one workspace.
func NewWorkspace ¶
func NewWorkspace(id WorkspaceID, initialPane *Pane) *Workspace
NewWorkspace creates a new workspace with an initial pane.
func (*Workspace) ActivePane ¶
ActivePane returns the currently active pane node.
type ZoomLevel ¶
type ZoomLevel struct {
Domain string // Domain name (e.g., "github.com")
ZoomFactor float64 // Zoom factor (1.0 = 100%, 1.5 = 150%)
UpdatedAt time.Time
}
ZoomLevel represents the zoom factor for a specific domain. Allows users to set persistent zoom levels per-site.
func NewZoomLevel ¶
NewZoomLevel creates a new zoom level for a domain.
func (*ZoomLevel) Percentage ¶
Percentage returns the zoom factor as a percentage (e.g., 150 for 1.5).