component

package
v0.0.0-...-de24375 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2024 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TitleStyle                = lipgloss.NewStyle().Bold(true)
	DescriptionStyle          = lipgloss.NewStyle()
	DropdownItemStyle         = lipgloss.NewStyle().PaddingLeft(4)
	SelectedDropdownItemStyle = lipgloss.NewStyle().PaddingLeft(2).Foreground(lipgloss.Color("170"))
)

Functions

This section is empty.

Types

type Commander

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

func (*Commander) EqualOutput

func (c *Commander) EqualOutput(expected string) bool

func (*Commander) Renders

func (c *Commander) Renders() chan []string

func (*Commander) Start

func (c *Commander) Start()

func (*Commander) Stop

func (c *Commander) Stop()

type Component

type Component interface {
	validate.Validator
	grpcutils.ProtoWrapper[*v1beta1.Component]
	Render(c *engine.Context, p *Props) renderer.Model
}

func New

func New(c *v1beta1.Component) (Component, error)
type Dropdown struct {
	*v1beta1.Component_Dropdown
	Query engine.DOMQuery

	OptionValueTemps      []*engine.TemplateRenderer
	MapperOptionValueTemp *engine.TemplateRenderer
	MapperOptionTextTemp  *engine.TemplateRenderer
	OptionMergeIfTemps    []*engine.TemplateRenderer
	FromListSelectorTemp  *engine.TemplateRenderer
}

func NewDropdown

func NewDropdown(d *v1beta1.Component_Dropdown) (*Dropdown, error)
func (d *Dropdown) GetQueries() []engine.DOMQuery
func (d *Dropdown) Render(ctx *engine.Context, props *Props) renderer.Model
func (d *Dropdown) ToProto() *v1beta1.Component
func (d *Dropdown) Validate() error
type DropdownModel struct {
	Props *Props
	List  list.Model
	Comp  *v1beta1.Component_Dropdown
}
func (d *DropdownModel) GetId() string
func (d *DropdownModel) Init() tea.Cmd
func (d *DropdownModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)
func (d *DropdownModel) View() string

type Input

type Input struct {
	*v1beta1.Component_Input
}

func NewInput

func NewInput(i *v1beta1.Component_Input) (*Input, error)

func (*Input) Render

func (i *Input) Render(_ *engine.Context, props *Props) renderer.Model

func (*Input) ToProto

func (i *Input) ToProto() *v1beta1.Component

func (*Input) Validate

func (i *Input) Validate() error

type InputModel

type InputModel struct {
	Props *Props
	Text  textinput.Model
	Comp  *v1beta1.Component_Input
}

func (*InputModel) GetId

func (i *InputModel) GetId() string

func (*InputModel) Init

func (i *InputModel) Init() tea.Cmd

func (*InputModel) Update

func (i *InputModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*InputModel) View

func (i *InputModel) View() string

type OnSubmitMsg

type OnSubmitMsg struct {
	Id    string
	Value *v1beta1.Value
}

type Output

type Output interface {
	fmt.Stringer
	io.Writer
}

type Props

type Props struct {
	ID          string
	Title       string
	Description string
}

type TestApp

type TestApp struct {
	Components  []tea.Model
	Renders     []string
	RenderCount atomic.Int32
	OnRender    func(renders []string)
}

func (*TestApp) Init

func (t *TestApp) Init() tea.Cmd

func (*TestApp) Update

func (t *TestApp) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*TestApp) View

func (t *TestApp) View() string

type TestSuite

type TestSuite struct {
	suite.Suite
}

func (*TestSuite) EqualDropdownItems

func (s *TestSuite) EqualDropdownItems(expected []*dropdownItem, actual []list.Item, args ...any) bool

func (*TestSuite) NewApp

func (s *TestSuite) NewApp(store *engine.TemplateData, props *Props, components ...Component) *Commander

Jump to

Keyboard shortcuts

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