dom

package
v0.0.0-...-2f5d245 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2023 License: GPL-3.0 Imports: 1 Imported by: 0

Documentation

Overview

package DOM

provides an abstraction to the Document Object Model to enable programmatic definitions of the document object model using golang

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Render

func Render(node Node) string

Render traverses a node tree and generates a string of that node including all renderings of child nodes

Types

type AEl

type AEl struct {
	*Element
}

a href

func A

func A(hp Props, nodes ...Node) *AEl

func (*AEl) IsNil

func (u *AEl) IsNil() bool

func (*AEl) Tag

func (u *AEl) Tag() string

type BodyEl

type BodyEl struct {
	Element
}

func Body

func Body(nodes ...Node) *BodyEl

func (*BodyEl) HTMLProps

func (b *BodyEl) HTMLProps() Props

TODO: implement

func (*BodyEl) IsNil

func (b *BodyEl) IsNil() bool

func (*BodyEl) Tag

func (b *BodyEl) Tag() string

type Class

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

func NewClass

func NewClass(className ...string) *Class

func (*Class) Add

func (c *Class) Add(className string) *Class

Add adds the className to the target class

func (*Class) Nil

func (c *Class) Nil() bool

func (*Class) Parse

func (c *Class) Parse() string

type DOM

type DOM struct {
	Header *Header
	Body   *BodyEl
}

func (*DOM) Render

func (d *DOM) Render()

Render injects the defined DOM into the browser this relies on the target html document calling body.innerHTML = getHTML() this is the default behaviour for raft.

type DivEl

type DivEl struct {
	*Element
}

func Div

func Div(hp Props, nodes ...Node) *DivEl

func (*DivEl) IsNil

func (d *DivEl) IsNil() bool

func (*DivEl) Tag

func (d *DivEl) Tag() string

type Element

type Element struct {
	Ns []Node
	// contains filtered or unexported fields
}

func NewElement

func NewElement(hp Props, nodes ...Node) *Element

func (*Element) El

func (e *Element) El(n Node)

func (*Element) HTMLProps

func (e *Element) HTMLProps() Props

func (*Element) IsNil

func (e *Element) IsNil() bool

func (*Element) Nodes

func (e *Element) Nodes() []Node

func (*Element) Props

func (e *Element) Props() string

type HTMLPropser

type HTMLPropser interface {
	HTMLProps() Props
}
type Header struct {
	Element
}

func (*Header) HTMLProps

func (h *Header) HTMLProps() Props

TODO: implement

func (*Header) IsNil

func (h *Header) IsNil() bool

func (*Header) Tag

func (h *Header) Tag() string

type LIEl

type LIEl struct {
	*Element
}

Unordered List

func LI

func LI(hp Props, nodes ...Node) *LIEl

func (*LIEl) IsNil

func (u *LIEl) IsNil() bool

func (*LIEl) Tag

func (u *LIEl) Tag() string

type Node

type Node interface {
	Tager          // Tager provides open and close tags for the node
	HTMLPropser    // HTMLPropser provides the html properties for the node
	Nodes() []Node // Nodes returns child nodes for the node
	IsNil() bool
}

type P

type P struct {
	*Element
}

Support Vector Graphic

func NewP

func NewP(hp Props, nodes ...Node) *P

func (*P) IsNil

func (b *P) IsNil() bool

func (*P) Tag

func (b *P) Tag() string

type PathEl

type PathEl struct {
	*Element
}

Support Vector Graphic

func Path

func Path(hp Props, nodes ...Node) *PathEl

func (*PathEl) IsNil

func (p *PathEl) IsNil() bool

func (*PathEl) Tag

func (p *PathEl) Tag() string

type Props

type Props struct {
	InnerHTML  string
	Class      *Class
	ID         string
	HRef       string
	Rel        string
	Content    string
	CharSet    string
	AriaLabel  string
	D          string
	AriaHidden string
	XMLNS      string
	Fill       string
	ViewBox    string
}

type SVGEl

type SVGEl struct {
	*Element
}

Support Vector Graphic

func SVG

func SVG(hp Props, nodes ...Node) *SVGEl

func (*SVGEl) IsNil

func (b *SVGEl) IsNil() bool

func (*SVGEl) Tag

func (b *SVGEl) Tag() string

type SpanEl

type SpanEl struct {
	*Element
}

func Span

func Span(hp Props, nodes ...Node) *SpanEl

func (*SpanEl) IsNil

func (b *SpanEl) IsNil() bool

func (*SpanEl) Tag

func (b *SpanEl) Tag() string

type Tager

type Tager interface {
	Tag() string
}

type ULEl

type ULEl struct {
	*Element
}

Unordered List

func UL

func UL(hp Props, nodes ...Node) *ULEl

func (*ULEl) IsNil

func (u *ULEl) IsNil() bool

func (*ULEl) Tag

func (u *ULEl) Tag() string

Jump to

Keyboard shortcuts

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