components

package
v0.0.0-...-a634514 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2024 License: BSD-3-Clause, MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddItemMsg

type AddItemMsg struct{}

type ClearCompleted

type ClearCompleted struct{}

ClearCompleted is an action which clears the completed items.

type Destroy

type Destroy struct {
	Index int
}

type EditInput

type EditInput struct {
	Index int
	Title string
}

type FilterButton

type FilterButton struct {
	masc.Core

	Label        string      `masc:"prop"`
	Filter       FilterState `masc:"prop"`
	ActiveFilter bool
}

FilterButton is a masc.Component which allows the user to select a filter state.

func (*FilterButton) Copy

func (b *FilterButton) Copy() masc.Component

func (*FilterButton) Render

func (b *FilterButton) Render(send func(masc.Msg)) masc.ComponentOrHTML

Render implements the masc.Component interface.

type FilterState

type FilterState int

FilterState represents a viewing filter for Todo items in the store.

const (
	// All is a FilterState which shows all items.
	All FilterState = iota

	// Active is a FilterState which shows only non-completed items.
	Active

	// Completed is a FilterState which shows only completed items.
	Completed
)

type Item

type Item struct {
	Title     string
	Completed bool
	// contains filtered or unexported fields
}

Item represents a single Todo item in the store.

type ItemList

type ItemList []*Item

type ItemView

type ItemView struct {
	masc.Core

	Index     int    `masc:"prop"`
	Title     string `masc:"prop"`
	Completed bool   `masc:"prop"`

	Editing   bool   `masc:"prop"`
	EditTitle string `masc:"prop"`
	// contains filtered or unexported fields
}

ItemView is a masc.Component which represents a single item in the TODO list.

func (*ItemView) Copy

func (p *ItemView) Copy() masc.Component

func (*ItemView) Key

func (p *ItemView) Key() interface{}

Key implements the masc.Keyer interface.

func (*ItemView) Render

func (p *ItemView) Render(send func(masc.Msg)) masc.ComponentOrHTML

Render implements the masc.Component interface.

type NewItemTitleMsg

type NewItemTitleMsg struct {
	Title string
}

type PageView

type PageView struct {
	masc.Core

	Items []*Item `masc:"prop"`

	// Filter represents the active viewing filter for items.
	Filter FilterState
	// contains filtered or unexported fields
}

PageView is a masc.Component which represents the entire page.

func (*PageView) ActiveItemCount

func (m *PageView) ActiveItemCount() int

ActiveItemCount returns the current number of items that are not completed.

func (*PageView) CompletedItemCount

func (m *PageView) CompletedItemCount() int

CompletedItemCount returns the current number of items that are completed.

func (*PageView) Copy

func (m *PageView) Copy() masc.Component

func (*PageView) Init

func (m *PageView) Init() masc.Cmd

func (*PageView) Render

func (m *PageView) Render(send func(masc.Msg)) masc.ComponentOrHTML

Render implements the masc.Component interface.

func (*PageView) Update

func (m *PageView) Update(msg masc.Msg) (masc.Model, masc.Cmd)

type SetAllCompleted

type SetAllCompleted struct {
	Completed bool
}

SetAllCompleted is an action which marks all existing items as being completed or not.

type SetFilter

type SetFilter struct {
	Filter FilterState
}

SetFilter is an action which sets the filter for the viewed items.

type StartEdit

type StartEdit struct {
	Index int
}

type StopEdit

type StopEdit struct {
	Index int
}

type UpdateCompleted

type UpdateCompleted struct {
	Index     int
	Completed bool
}

Jump to

Keyboard shortcuts

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