menu

package
v0.7.7 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SanitizeMenu added in v0.5.0

func SanitizeMenu[T Menu | EditMenu](input T)

Types

type EditItem added in v0.5.0

type EditItem struct {
	Text   string `json:"text"`
	Href   string `json:"href,omitempty"`
	Lang   string `json:"lang,omitempty"`
	Title  string `json:"title,omitempty"`
	Target string `json:"target,omitempty"`

	Icon   string `json:"icon,omitempty"`
	Image  string `json:"image,omitempty"`
	ImgAlt string `json:"img-alt,omitempty"`

	Active bool `json:"active,omitempty"`

	SubMenu EditMenu `json:"sub-menu,omitempty"`

	Hidden string `json:"hidden,omitempty"`

	Context context.Context `json:"context,omitempty"`

	Expand       string `json:"expand,omitempty"`
	ExpandExtras string `json:"expand-extras,omitempty"`
	Delete       bool   `json:"delete,omitempty"`
	MoveUp       bool   `json:"move-up,omitempty"`
	MoveDown     bool   `json:"move-down,omitempty"`
	Append       bool   `json:"append,omitempty"`
}

func (EditItem) AsItem added in v0.5.0

func (i EditItem) AsItem() (clone *Item)

func (EditItem) String added in v0.5.0

func (i EditItem) String() (value string)

type EditMenu added in v0.5.0

type EditMenu []*EditItem

func NewEditMenuFromJson added in v0.5.0

func NewEditMenuFromJson(data []byte) (menu EditMenu, err error)

func (EditMenu) AsMenu added in v0.5.0

func (m EditMenu) AsMenu() (clone Menu)

func (EditMenu) CollapseAll added in v0.5.0

func (m EditMenu) CollapseAll()

func (EditMenu) ExpandAll added in v0.5.0

func (m EditMenu) ExpandAll()

func (EditMenu) Len added in v0.5.0

func (m EditMenu) Len() (size int)

func (EditMenu) ProcessAllChanges added in v0.5.0

func (m EditMenu) ProcessAllChanges() (modified EditMenu)

func (EditMenu) ProcessChanges added in v0.5.0

func (m EditMenu) ProcessChanges() (modified EditMenu, changed bool)

func (EditMenu) SanitizeAll added in v0.5.0

func (m EditMenu) SanitizeAll()

func (EditMenu) String added in v0.5.0

func (m EditMenu) String() (value string)

type Item

type Item struct {
	Text   string `json:"text"`
	Href   string `json:"href,omitempty"`
	Lang   string `json:"lang,omitempty"`
	Title  string `json:"title,omitempty"`
	Target string `json:"target,omitempty"`

	Icon   string `json:"icon,omitempty"`
	Image  string `json:"image,omitempty"`
	ImgAlt string `json:"img-alt,omitempty"`

	Active bool `json:"active,omitempty"`

	SubMenu Menu `json:"sub-menu,omitempty"`

	Hidden string `json:"hidden,omitempty"`

	Context context.Context `json:"context,omitempty"`
}

func (Item) String added in v0.5.0

func (i Item) String() (value string)
type Menu []*Item

func NewMenuFromJson

func NewMenuFromJson(data []byte) (menu Menu, err error)
func (m Menu) DeepActive() (index string)
func (m Menu) SanitizeAll()
func (m Menu) String() (value string)

Jump to

Keyboard shortcuts

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