render

package
v0.0.0-...-ece5352 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2023 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DISPLAY_BLOCK = iota + 1
	DISPLAY_CONTENT
	DISPLAY_INLINE
	DISPLAY_INLINE_BLOCK
	DISPLAY_FLEX
	DISPLAY_NONE
)
View Source
const (
	TAG_BODY = iota + 1
	TAG_BR
	TAG_BUTTON
	TAG_DIV
	TAG_FIELDSET
	TAG_FORM
	TAG_HEAD
	TAG_HEADING
	TAG_HR
	TAG_HTML
	TAG_IMG
	TAG_INPUT
	TAG_LABEL
	TAG_LEGEND
	TAG_OPTGROUP
	TAG_OPTION
	TAG_PARAGRAPH
	TAG_SELECT
	TAG_SPAN
	TAG_TEXT
	TAG_UNKNOWN
)
View Source
const ANSI_BG_RGB_COLOR = "\x1b[48;2;%d;%d;%dm"
View Source
const ANSI_BG_TRANSPARENT_COLOR = "\x1b[0;39;49m"
View Source
const ANSI_CURSOR_HIDE = "\x1B[?25l"
View Source
const ANSI_CURSOR_SHOW = "\x1B[?25h"
View Source
const ANSI_CURSOR_UP = "\x1B[%dA"
View Source
const ANSI_FG_RGB_COLOR = "\x1b[38;2;%d;%d;%dm▄"
View Source
const ANSI_FG_TRANSPARENT_COLOR = "\x1b[0m "
View Source
const ANSI_RESET = "\x1b[0m"
View Source
const DEFAULT_TERM_COLS = 80
View Source
const DEFAULT_TERM_ROWS = 24
View Source
const FPS = 15

Variables

This section is empty.

Functions

func FillBg

func FillBg(color lipgloss.TerminalColor, src string, w, h int) string

func NewCell

func NewCell(raw string, opts ...CellOpt) cell

func NewEngine

func NewEngine(ctx context.Context, doc vui.Documentary) *engine

func NewStyling

func NewStyling() styling

NewStyling return new styling instance

func NewTissue

func NewTissue(cs cells, s *styling) *tissue

Tissue is matrix of cell: [][]cell Tissue receive list cells and compute to matrix cells adapt these rules: - If cell is display block - It must display reside inside one row - If cell is display-block, it able to append to previous row - If cell is display-block the total width of all cells in a row not great than iMaxWidth

func TransformFrom

func TransformFrom(base styling) transformer

Transform receive base styling (parent style) Compute and return new styling The following is attr applied from css:

- margin - padding - border - background (inherit) - color (inherit) - display

The following is rule applied specific cases:

  • width always less than terminal width updated when css.width less than base.width base.width - base.padding
  • height always less than terminal width update if css.height less than base.height base.height - base.padding

func WithDisplay

func WithDisplay(d string) func(*cell)

func WithPosition

func WithPosition(x int, y int) func(*cell)

Types

type Anchor

type Anchor struct{}

func (*Anchor) Render

func (r *Anchor) Render(n vui.INode, s styling, child string) string

func (*Anchor) Style

func (r *Anchor) Style(base styling, n vui.INode) styling

type Body

type Body struct{}

func (*Body) Render

func (r *Body) Render(n vui.INode, s styling, child string) string

func (*Body) Style

func (r *Body) Style(base styling, n vui.INode) styling

type Br

type Br struct{}

func (*Br) Render

func (r *Br) Render(n vui.INode, s styling, child string) string

func (*Br) Style

func (r *Br) Style(base styling, n vui.INode) styling

type Button

type Button struct{}

func (*Button) Render

func (r *Button) Render(n vui.INode, s styling, child string) string

func (*Button) Style

func (r *Button) Style(base styling, n vui.INode) styling

type CellOpt

type CellOpt func(*cell)

type Div

type Div struct{}

func (*Div) Render

func (r *Div) Render(n vui.INode, s styling, child string) string

func (*Div) Style

func (r *Div) Style(base styling, n vui.INode) styling

type Executor

type Executor interface {
	Render(vui.INode, styling, string) string
	Style(styling, vui.INode) styling
}

type FieldSet

type FieldSet struct{}

func (*FieldSet) Render

func (r *FieldSet) Render(n vui.INode, s styling, child string) string

func (*FieldSet) Style

func (r *FieldSet) Style(base styling, n vui.INode) styling

type Form

type Form struct{}

func (*Form) Render

func (r *Form) Render(n vui.INode, s styling, child string) string

func (*Form) Style

func (r *Form) Style(base styling, n vui.INode) styling
type Head struct{}

func (*Head) Render

func (r *Head) Render(n vui.INode, s styling, child string) string

func (*Head) Style

func (r *Head) Style(base styling, n vui.INode) styling

type Heading

type Heading struct{}

func (*Heading) Render

func (r *Heading) Render(n vui.INode, s styling, child string) string

func (*Heading) Style

func (r *Heading) Style(base styling, n vui.INode) styling

type Hr

type Hr struct{}

func (*Hr) Render

func (r *Hr) Render(n vui.INode, s styling, child string) string

func (*Hr) Style

func (r *Hr) Style(base styling, n vui.INode) styling

type Html

type Html struct{}

func (*Html) Render

func (r *Html) Render(n vui.INode, s styling, child string) string

func (*Html) Style

func (r *Html) Style(base styling, n vui.INode) styling

calculate the term size and set to html

type Img

type Img struct{}

func (*Img) Render

func (r *Img) Render(n vui.INode, s styling, child string) string

func (*Img) Style

func (r *Img) Style(base styling, n vui.INode) styling

type Input

type Input struct{}

func (*Input) Render

func (r *Input) Render(n vui.INode, s styling, child string) string

func (*Input) Style

func (r *Input) Style(base styling, n vui.INode) styling

type Label

type Label struct{}

func (*Label) Render

func (r *Label) Render(n vui.INode, s styling, child string) string

func (*Label) Style

func (r *Label) Style(base styling, n vui.INode) styling

type Legend

type Legend struct{}

func (*Legend) Render

func (r *Legend) Render(n vui.INode, s styling, child string) string

func (*Legend) Style

func (r *Legend) Style(base styling, n vui.INode) styling

type OptGroup

type OptGroup struct{}

func (*OptGroup) Render

func (r *OptGroup) Render(n vui.INode, s styling, child string) string

func (*OptGroup) Style

func (r *OptGroup) Style(base styling, n vui.INode) styling

type Option

type Option struct{}

func (*Option) Render

func (r *Option) Render(n vui.INode, s styling, child string) string

func (*Option) Style

func (r *Option) Style(base styling, n vui.INode) styling

type Paragraph

type Paragraph struct{}

func (*Paragraph) Render

func (r *Paragraph) Render(n vui.INode, s styling, child string) string

func (*Paragraph) Style

func (r *Paragraph) Style(base styling, n vui.INode) styling

type Registry

type Registry map[uint32]Executor

type Select

type Select struct{}

func (*Select) Render

func (r *Select) Render(n vui.INode, s styling, child string) string

func (*Select) Style

func (r *Select) Style(base styling, n vui.INode) styling

type Span

type Span struct{}

func (*Span) Render

func (r *Span) Render(n vui.INode, s styling, child string) string

func (*Span) Style

func (r *Span) Style(base styling, n vui.INode) styling

type Text

type Text struct{}

func (*Text) Render

func (r *Text) Render(n vui.INode, s styling, child string) string

func (*Text) Style

func (r *Text) Style(base styling, n vui.INode) styling

type Unknown

type Unknown struct{}

func (*Unknown) Render

func (r *Unknown) Render(n vui.INode, s styling, child string) string

func (*Unknown) Style

func (r *Unknown) Style(base styling, n vui.INode) styling

Jump to

Keyboard shortcuts

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