Skip to content

package document

import "kaiju/markup/document"

Functions

TransformHTML

func TransformHTML(htmlStr string, withData any) string

Types

Document

struct

type Document struct {
    Elements     []*Element
    TopElements  []*Element
    HeadElements []*Element

    // Has unexported fields.
}

DocumentFromHTMLString

func DocumentFromHTMLString(host *engine.Host, htmlStr string, withData any, funcMap map[string]func(*Element)) *Document

Document.Activate

func (d *Document) Activate()

Document.AddChildElement

func (d *Document) AddChildElement(parent *Element, elm *Element)

Document.ApplyStyle

func (d *Document) ApplyStyle()

Document.Clean

func (d *Document) Clean()

Document.Deactivate

func (d *Document) Deactivate()

Document.Destroy

func (d *Document) Destroy()

Document.GetElementById

func (h *Document) GetElementById(id string) (*Element, bool)

Document.GetElementsByClass

func (h *Document) GetElementsByClass(class string) []*Element

Document.GetElementsByGroup

func (h *Document) GetElementsByGroup(group string) []*Element

Document.GetElementsByTagName

func (h *Document) GetElementsByTagName(tag string) []*Element

Document.RemoveElement

func (d *Document) RemoveElement(elm *Element)

Document.SetGroup

func (d *Document) SetGroup(group *ui.Group)

Document.SetupStylizer

func (d *Document) SetupStylizer(style rules.StyleSheet, host *engine.Host,

styleReader func(rules.StyleSheet, Document, engine.Host))

Element

struct

type Element struct {
    UI       ui.UI
    UIPanel  *ui.Panel
    Parent   *Element
    Children []*Element

    // Has unexported fields.
}

NewHTML

func NewHTML(htmlStr string) *Element

Element.Attribute

func (e *Element) Attribute(key string) string

Element.Body

func (e *Element) Body() *Element

Element.Data

func (e *Element) Data() string

Element.EnforceColor

func (d *Element) EnforceColor(color matrix.Color)

Element.FindElementById

func (e *Element) FindElementById(id string) *Element

Element.FindElementByTag

func (e *Element) FindElementByTag(tag string) *Element

Element.FindElementLabelById

func (e *Element) FindElementLabelById(id string) *ui.Label

Element.FindElementsByTag

func (e *Element) FindElementsByTag(tag string) []*Element

Element.Head

func (e *Element) Head() *Element

Element.Html

func (e *Element) Html() *Element

Element.InnerLabel

func (d Element) InnerLabel() *ui.Label

Element.IsButton

func (e *Element) IsButton() bool

Element.IsImage

func (e *Element) IsImage() bool

Element.IsInput

func (e *Element) IsInput() bool

Element.IsText

func (e *Element) IsText() bool

Element.Root

func (e *Element) Root() *Element

Element.UnEnforceColor

func (d *Element) UnEnforceColor()

TemplateIndexedAny

struct

type TemplateIndexedAny struct {
    Idx   int
    Value any
}