panelreg

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: May 27, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package panelreg provides a global panel builder registry that enables panel packages to self-register via init() without creating import cycles between layout and individual panel packages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Builders

func Builders() map[string]Builder

Builders returns a snapshot of all registered builders.

func Register

func Register(name string, b Builder)

Register adds a panel builder under the given name. Panel packages call this from init() to self-register. If a builder with that name already exists, it is replaced.

func Reset

func Reset()

Reset clears all registered builders. Used by tests only.

Types

type Builder

type Builder func(deps Deps) panels.Panel

Builder constructs a panel given runtime dependencies.

type Deps

type Deps struct {
	Ctx       context.Context
	Config    *config.Config
	GitClient git.GitClient // shared client; may be nil
	Theme     *theme.Theme  // may be nil
}

Deps holds runtime dependencies available to panel builders. It is populated once at startup and passed to every registered builder.

func (Deps) ApplyActionsCfg

func (d Deps) ApplyActionsCfg(p panels.Panel) panels.Panel

ApplyActionsCfg injects the actions configuration into panels that support the optional SetActionsCfg method.

func (Deps) Cwd

func (d Deps) Cwd() string

Cwd returns the current working directory, falling back to "." on error.

func (Deps) NewGitClient

func (d Deps) NewGitClient() (*git.Client, string, error)

NewGitClient creates a fresh git client for the current working directory. Returns (client, cwd, error).

func (Deps) Placeholder

func (d Deps) Placeholder(name string) panels.Panel

Placeholder returns a placeholder panel for the given name, using the theme from deps.

Jump to

Keyboard shortcuts

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