Documentation
¶
Index ¶
- Constants
- Variables
- func UniqueID() string
- func ValidAttr(attr string) bool
- func ValidClass(class string) bool
- func ValidTag(tag string) bool
- func WriteFloat(w io.Writer, f float64) error
- func WriteInt(w io.Writer, n int64) error
- func WriteString(w io.Writer, s string) (int, error)
- func WriteUint(w io.Writer, n uint64) error
- type EscapeWriter
- type Mod
- func Accept(v string) Mod
- func AcceptCharset(v string) Mod
- func AccessKey(v string) Mod
- func Action(v string) Mod
- func Allow(v string) Mod
- func AllowFullscreen(v ...TypedValue) Mod
- func Alt(v string) Mod
- func Aria(name string, v TypedValue) Mod
- func As(v string) Mod
- func Async(v ...TypedValue) Mod
- func Attr(name string, value ...string) Mod
- func AttrBool(name string, value ...bool) Mod
- func AttrValue(name string, value ...TypedValue) Mod
- func Autocapitalize(v string) Mod
- func Autocomplete(v string) Mod
- func Autofocus(v ...TypedValue) Mod
- func Autoplay(v ...TypedValue) Mod
- func Capture(v string) Mod
- func Charset(v string) Mod
- func Checked(v ...TypedValue) Mod
- func CiteAttr(v string) Mod
- func Class(class string) Mod
- func ColSpan(v int) Mod
- func Content(nodes ...*Node) Mod
- func ContentAttr(v string) Mod
- func Controls(v ...TypedValue) Mod
- func CrossOrigin(v string) Mod
- func Data(name string, v TypedValue) Mod
- func DateTime(v string) Mod
- func Decoding(v string) Mod
- func Default(v ...TypedValue) Mod
- func Defer(v ...TypedValue) Mod
- func Dir(v string) Mod
- func Disabled(v ...TypedValue) Mod
- func Download(value ...string) Mod
- func Draggable(v ...bool) Mod
- func EnterKeyHint(v string) Mod
- func For(v string) Mod
- func FormNoValidate(v ...TypedValue) Mod
- func GroupLabel(v string) Mod
- func Headers(v string) Mod
- func Height(v int) Mod
- func Hint(v string) Mod
- func Href(v string) Mod
- func Hreflang(v string) Mod
- func HttpEquiv(v string) Mod
- func ID(v string) Mod
- func Inert(v ...TypedValue) Mod
- func InputMode(v string) Mod
- func IsMap(v ...TypedValue) Mod
- func ItemScope(v ...TypedValue) Mod
- func Kind(v string) Mod
- func Lang(v string) Mod
- func List(v string) Mod
- func Loading(v string) Mod
- func Loop(v ...TypedValue) Mod
- func Max(v int) Mod
- func MaxDate(v time.Time) Mod
- func Min(v int) Mod
- func MinDate(v time.Time) Mod
- func ModIf(cond bool, fn func() Mod) Mod
- func Mods(mods ...Mod) Mod
- func Multiple(v ...TypedValue) Mod
- func Muted(v ...TypedValue) Mod
- func Name(v string) Mod
- func NoModule(v ...TypedValue) Mod
- func Novalidate(v ...TypedValue) Mod
- func On(event string, js string) Mod
- func OnBlur(js string) Mod
- func OnChange(js string) Mod
- func OnClick(js string) Mod
- func OnCopy(js string) Mod
- func OnCut(js string) Mod
- func OnDblClick(js string) Mod
- func OnDrag(js string) Mod
- func OnDragEnd(js string) Mod
- func OnDragEnter(js string) Mod
- func OnDragLeave(js string) Mod
- func OnDragOver(js string) Mod
- func OnDragStart(js string) Mod
- func OnDrop(js string) Mod
- func OnError(js string) Mod
- func OnFocus(js string) Mod
- func OnInput(js string) Mod
- func OnKeyDown(js string) Mod
- func OnKeyPress(js string) Mod
- func OnKeyUp(js string) Mod
- func OnLoad(js string) Mod
- func OnMouseDown(js string) Mod
- func OnMouseEnter(js string) Mod
- func OnMouseLeave(js string) Mod
- func OnMouseMove(js string) Mod
- func OnMouseOut(js string) Mod
- func OnMouseOver(js string) Mod
- func OnMouseUp(js string) Mod
- func OnPaste(js string) Mod
- func OnReset(js string) Mod
- func OnScroll(js string) Mod
- func OnSelect(js string) Mod
- func OnSubmit(js string) Mod
- func OnWheel(js string) Mod
- func Open(v ...TypedValue) Mod
- func Optimum(v float64) Mod
- func Pattern(v string) Mod
- func Ping(v string) Mod
- func Placeholder(v string) Mod
- func PlaysInline(v ...TypedValue) Mod
- func Poster(v string) Mod
- func Postpone(mods ...Mod) Mod
- func Preload(v string) Mod
- func Readonly(v ...TypedValue) Mod
- func ReferrerPolicy(v string) Mod
- func Rel(v string) Mod
- func Required(v ...TypedValue) Mod
- func Reversed(v ...TypedValue) Mod
- func Role(v string) Mod
- func RowSpan(v int) Mod
- func Selected(v ...TypedValue) Mod
- func Sizes(v string) Mod
- func Slot(name string, nodes ...*Node) Mod
- func SlotAttr(v string) Mod
- func Spellcheck(v ...bool) Mod
- func Src(v string) Mod
- func Srcdoc(v string) Mod
- func Srclang(v string) Mod
- func Srcset(v string) Mod
- func Start(v int) Mod
- func Step(value ...int) Mod
- func Style(v string) Mod
- func TabIndex(v int) Mod
- func Tag(tag string) Mod
- func TagEx(tag string, void bool) Mod
- func TextContent(s string) Mod
- func Translate(v string) Mod
- func Type(v string) Mod
- func Value(v TypedValue) Mod
- func Var(name string, value string) Mod
- func VarValue(name string, value TypedValue) Mod
- func Viewport(v string) Mod
- func Width(v int) Mod
- func Wrap(v string) Mod
- func WriteFn(fn func(*Node, io.Writer) error) Mod
- type Node
- func A(m ...Mod) *Node
- func Abbr(m ...Mod) *Node
- func Address(m ...Mod) *Node
- func Area(m ...Mod) *Node
- func Article(m ...Mod) *Node
- func Aside(m ...Mod) *Node
- func Audio(m ...Mod) *Node
- func B(m ...Mod) *Node
- func Base(m ...Mod) *Node
- func Bdi(m ...Mod) *Node
- func Bdo(m ...Mod) *Node
- func Blockquote(m ...Mod) *Node
- func Body(m ...Mod) *Node
- func Br(m ...Mod) *Node
- func Build(tag string, mods ...Mod) *Node
- func Button(m ...Mod) *Node
- func Canvas(m ...Mod) *Node
- func Caption(m ...Mod) *Node
- func Cite(m ...Mod) *Node
- func Code(m ...Mod) *Node
- func Col(m ...Mod) *Node
- func Colgroup(m ...Mod) *Node
- func DOCTYPE() *Node
- func DataTag(v string, mods ...Mod) *Node
- func Datalist(m ...Mod) *Node
- func Dd(m ...Mod) *Node
- func Del(m ...Mod) *Node
- func Details(m ...Mod) *Node
- func Dfn(m ...Mod) *Node
- func Dialog(m ...Mod) *Node
- func Div(m ...Mod) *Node
- func Dl(m ...Mod) *Node
- func Dt(m ...Mod) *Node
- func Em(m ...Mod) *Node
- func Embed(m ...Mod) *Node
- func Fieldset(m ...Mod) *Node
- func Figcaption(m ...Mod) *Node
- func Figure(m ...Mod) *Node
- func Footer(m ...Mod) *Node
- func Form(m ...Mod) *Node
- func Get() *Node
- func Group(nodes ...*Node) *Node
- func H1(m ...Mod) *Node
- func H2(m ...Mod) *Node
- func H3(m ...Mod) *Node
- func H4(m ...Mod) *Node
- func H5(m ...Mod) *Node
- func H6(m ...Mod) *Node
- func Head(m ...Mod) *Node
- func Header(m ...Mod) *Node
- func Hr(m ...Mod) *Node
- func Html(m ...Mod) *Node
- func I(m ...Mod) *Node
- func Icon(href string, mods ...Mod) *Node
- func If(cond bool, fn func() *Node) *Node
- func Iframe(m ...Mod) *Node
- func Img(m ...Mod) *Node
- func Input(m ...Mod) *Node
- func Ins(m ...Mod) *Node
- func Join(nodes ...*Node) *Node
- func Kbd(m ...Mod) *Node
- func Label(m ...Mod) *Node
- func Legend(m ...Mod) *Node
- func Li(m ...Mod) *Node
- func Link(m ...Mod) *Node
- func Main(m ...Mod) *Node
- func Map(m ...Mod) *Node
- func Mark(m ...Mod) *Node
- func Meta(m ...Mod) *Node
- func Meter(m ...Mod) *Node
- func Nav(m ...Mod) *Node
- func Noscript(m ...Mod) *Node
- func Object(m ...Mod) *Node
- func Ol(m ...Mod) *Node
- func Optgroup(m ...Mod) *Node
- func Option(m ...Mod) *Node
- func Output(m ...Mod) *Node
- func P(m ...Mod) *Node
- func Param(m ...Mod) *Node
- func Picture(m ...Mod) *Node
- func Pre(m ...Mod) *Node
- func Progress(m ...Mod) *Node
- func Q(m ...Mod) *Node
- func RawBytes(b []byte) *Node
- func RawString(s string) *Node
- func Rp(m ...Mod) *Node
- func Rt(m ...Mod) *Node
- func Ruby(m ...Mod) *Node
- func S(m ...Mod) *Node
- func Samp(m ...Mod) *Node
- func Script(m ...Mod) *Node
- func Section(m ...Mod) *Node
- func Select(m ...Mod) *Node
- func SlotTag(name string, m ...Mod) *Node
- func Small(m ...Mod) *Node
- func Source(m ...Mod) *Node
- func Span(m ...Mod) *Node
- func Static(fn func() *Node) *Node
- func Strong(m ...Mod) *Node
- func StyleTag(m ...Mod) *Node
- func Stylesheet(href string, mods ...Mod) *Node
- func Sub(m ...Mod) *Node
- func Summary(m ...Mod) *Node
- func Sup(m ...Mod) *Node
- func Table(m ...Mod) *Node
- func Tbody(m ...Mod) *Node
- func Td(m ...Mod) *Node
- func Template(m ...Mod) *Node
- func Text(s string) *Node
- func TextValue(v TypedValue) *Node
- func Textarea(m ...Mod) *Node
- func Tfoot(m ...Mod) *Node
- func Th(m ...Mod) *Node
- func Thead(m ...Mod) *Node
- func Time(m ...Mod) *Node
- func Title(value string, mods ...Mod) *Node
- func TitleValue(value TypedValue, mods ...Mod) *Node
- func Tr(m ...Mod) *Node
- func Track(m ...Mod) *Node
- func U(m ...Mod) *Node
- func Ul(m ...Mod) *Node
- func VarTag(value string, mods ...Mod) *Node
- func Video(m ...Mod) *Node
- func Wbr(m ...Mod) *Node
- func (n *Node) A(name string, value ...string) *Node
- func (n *Node) AV(name string, value ...TypedValue) *Node
- func (n *Node) Accept(v string) *Node
- func (n *Node) AcceptCharset(v string) *Node
- func (n *Node) AccessKey(v string) *Node
- func (n *Node) Action(v string) *Node
- func (n *Node) All() iter.Seq[*Node]
- func (n *Node) Allow(v string) *Node
- func (n *Node) AllowFullscreen(v ...TypedValue) *Node
- func (n *Node) Alt(v string) *Node
- func (n *Node) Append(nodes ...*Node) *Node
- func (n *Node) AppendSlot(name string, nodes ...*Node) *Node
- func (n *Node) Apply(mods []Mod) *Node
- func (n *Node) Aria(name string, v TypedValue) *Node
- func (n *Node) As(v string) *Node
- func (n *Node) Async(v ...TypedValue) *Node
- func (n *Node) Attr(name string, value ...string) *Node
- func (n *Node) AttrBool(name string, value ...bool) *Node
- func (n *Node) AttrValue(name string, value ...TypedValue) *Node
- func (n *Node) Attrs() iter.Seq2[string, TypedValue]
- func (n *Node) Autocapitalize(v string) *Node
- func (n *Node) Autocomplete(v string) *Node
- func (n *Node) Autofocus(v ...TypedValue) *Node
- func (n *Node) Autoplay(v ...TypedValue) *Node
- func (n *Node) C(name string) *Node
- func (n *Node) Capture(v string) *Node
- func (n *Node) Charset(v string) *Node
- func (n *Node) Checked(v ...TypedValue) *Node
- func (n *Node) Cite(v string) *Node
- func (n *Node) Class(name string) *Node
- func (n *Node) Classes() iter.Seq[string]
- func (n *Node) Clear()
- func (n *Node) ColSpan(v int) *Node
- func (n *Node) Content(nodes ...*Node) *Node
- func (n *Node) ContentAttr(v string) *Node
- func (n *Node) Controls(v ...TypedValue) *Node
- func (n *Node) CopyClassPrefix(prefixes ...string) Mod
- func (n *Node) CopyClassPrefixTo(dst *Node, prefixes ...string) *Node
- func (n *Node) CopyClassSuffix(suffixes ...string) Mod
- func (n *Node) CopyClassSuffixTo(dst *Node, suffixes ...string) *Node
- func (n *Node) Count(flags ...int) int
- func (n *Node) CrossOrigin(v string) *Node
- func (n *Node) Data(name string, v TypedValue) *Node
- func (n *Node) DateTime(v string) *Node
- func (n *Node) Decoding(v string) *Node
- func (n *Node) Default(v ...TypedValue) *Node
- func (n *Node) DefaultContent(fn func(*Node)) *Node
- func (n *Node) Defer(v ...TypedValue) *Node
- func (n *Node) DeleteSlot(names ...string) *Node
- func (n *Node) Dir(v string) *Node
- func (n *Node) Disabled(v ...TypedValue) *Node
- func (n *Node) Download(value ...string) *Node
- func (n *Node) Draggable(v ...bool) *Node
- func (n *Node) Each(fn func(*Node) bool) *Node
- func (n *Node) EachAttr(fn func(string, TypedValue) bool) *Node
- func (n *Node) EachClass(fn func(string) bool) *Node
- func (n *Node) EachVar(fn func(string, TypedValue) bool)
- func (n *Node) EnterKeyHint(v string) *Node
- func (n *Node) ExtractContent() *Node
- func (n *Node) ExtractContentNodes() (extracted []*Node)
- func (n *Node) ExtractSlot(name string) *Node
- func (n *Node) ExtractSlotNodes(name string) []*Node
- func (n *Node) For(v string) *Node
- func (n *Node) FormNoValidate(v ...TypedValue) *Node
- func (n *Node) GetAttr(name string) TypedValue
- func (n *Node) GetTag() (string, bool)
- func (n *Node) GetVar(name string) TypedValue
- func (n *Node) GroupLabel(v string) *Node
- func (n *Node) HasAttr(names ...string) bool
- func (n *Node) HasAttrAll(names ...string) bool
- func (n *Node) HasAttrPrefix(prefix string) bool
- func (n *Node) HasAttrSuffix(suffix string) bool
- func (n *Node) HasClass(names ...string) bool
- func (n *Node) HasClassAll(names ...string) bool
- func (n *Node) HasClassPrefix(prefix string) bool
- func (n *Node) HasClassSuffix(suffix string) bool
- func (n *Node) HasContent() bool
- func (n *Node) HasSlot(name string) bool
- func (n *Node) HasVar(names ...string) bool
- func (n *Node) HasVarAll(names ...string) bool
- func (n *Node) Headers(v string) *Node
- func (n *Node) Height(v int) *Node
- func (n *Node) Hint(v string) *Node
- func (n *Node) Href(v string) *Node
- func (n *Node) Hreflang(v string) *Node
- func (n *Node) HttpEquiv(v string) *Node
- func (n *Node) ID(v string) *Node
- func (n *Node) If(cond bool, fn func(*Node)) *Node
- func (n *Node) Inert(v ...TypedValue) *Node
- func (n *Node) InputMode(v string) *Node
- func (n *Node) IsMap(v ...TypedValue) *Node
- func (n *Node) ItemScope(v ...TypedValue) *Node
- func (n *Node) Kind(v string) *Node
- func (n *Node) Lang(v string) *Node
- func (n *Node) List(v string) *Node
- func (n *Node) Loading(v string) *Node
- func (n *Node) Loop(v ...TypedValue) *Node
- func (n *Node) Max(v int) *Node
- func (n *Node) MaxDate(v time.Time) *Node
- func (n *Node) Min(v int) *Node
- func (n *Node) MinDate(v time.Time) *Node
- func (n *Node) Mod(mods ...Mod) *Node
- func (n *Node) ModIf(cond bool, fn func(*Node) Mod) Mod
- func (n *Node) MoveAttr(names ...string) Mod
- func (n *Node) MoveAttrPrefix(prefix string) Mod
- func (n *Node) MoveAttrPrefixTo(dst *Node, prefix string) *Node
- func (n *Node) MoveAttrSuffix(suffix string) Mod
- func (n *Node) MoveAttrSuffixTo(dst *Node, suffix string) *Node
- func (n *Node) MoveAttrTo(dst *Node, names ...string) *Node
- func (n *Node) MoveClass(names ...string) Mod
- func (n *Node) MoveClassPrefix(prefixes ...string) Mod
- func (n *Node) MoveClassPrefixTo(dst *Node, prefixes ...string) *Node
- func (n *Node) MoveClassSuffix(suffixes ...string) Mod
- func (n *Node) MoveClassSuffixTo(dst *Node, suffixes ...string) *Node
- func (n *Node) MoveClassTo(dst *Node, names ...string) *Node
- func (n *Node) MoveContent(dst *Node)
- func (n *Node) MoveContentTo(dst *Node) *Node
- func (n *Node) MoveSlot(names ...string) Mod
- func (n *Node) MoveSlotTo(dst *Node, names ...string) *Node
- func (n *Node) MoveVarPrefixTo(dst *Node, prefix string) *Node
- func (n *Node) MoveVarSuffixTo(dst *Node, prefix string) *Node
- func (n *Node) MoveVarTo(dst *Node, names ...string) *Node
- func (n *Node) Multiple(v ...TypedValue) *Node
- func (n *Node) Muted(v ...TypedValue) *Node
- func (n *Node) Name(v string) *Node
- func (n *Node) NoContent() bool
- func (n *Node) NoModule(v ...TypedValue) *Node
- func (n *Node) Novalidate(v ...TypedValue) *Node
- func (n *Node) On(event string, js string) *Node
- func (n *Node) OnBlur(js string) *Node
- func (n *Node) OnChange(js string) *Node
- func (n *Node) OnClick(js string) *Node
- func (n *Node) OnCopy(js string) *Node
- func (n *Node) OnCut(js string) *Node
- func (n *Node) OnDblClick(js string) *Node
- func (n *Node) OnDrag(js string) *Node
- func (n *Node) OnDragEnd(js string) *Node
- func (n *Node) OnDragEnter(js string) *Node
- func (n *Node) OnDragLeave(js string) *Node
- func (n *Node) OnDragOver(js string) *Node
- func (n *Node) OnDragStart(js string) *Node
- func (n *Node) OnDrop(js string) *Node
- func (n *Node) OnError(js string) *Node
- func (n *Node) OnFocus(js string) *Node
- func (n *Node) OnInput(js string) *Node
- func (n *Node) OnKeyDown(js string) *Node
- func (n *Node) OnKeyPress(js string) *Node
- func (n *Node) OnKeyUp(js string) *Node
- func (n *Node) OnLoad(js string) *Node
- func (n *Node) OnMouseDown(js string) *Node
- func (n *Node) OnMouseEnter(js string) *Node
- func (n *Node) OnMouseLeave(js string) *Node
- func (n *Node) OnMouseMove(js string) *Node
- func (n *Node) OnMouseOut(js string) *Node
- func (n *Node) OnMouseOver(js string) *Node
- func (n *Node) OnMouseUp(js string) *Node
- func (n *Node) OnPaste(js string) *Node
- func (n *Node) OnReset(js string) *Node
- func (n *Node) OnScroll(js string) *Node
- func (n *Node) OnSelect(js string) *Node
- func (n *Node) OnSubmit(js string) *Node
- func (n *Node) OnWheel(js string) *Node
- func (n *Node) Open(v ...TypedValue) *Node
- func (n *Node) Optimum(v float64) *Node
- func (n *Node) Own() *Node
- func (n *Node) Owned() bool
- func (n *Node) Pattern(v string) *Node
- func (n *Node) Ping(v string) *Node
- func (n *Node) Placeholder(v string) *Node
- func (n *Node) PlaysInline(v ...TypedValue) *Node
- func (n *Node) Poster(v string) *Node
- func (n *Node) Postpone(mods ...Mod) *Node
- func (n *Node) Preload(v string) *Node
- func (n *Node) Prepend(nodes ...*Node) *Node
- func (n *Node) PrependSlot(name string, nodes ...*Node) *Node
- func (n *Node) Readonly(v ...TypedValue) *Node
- func (n *Node) ReferrerPolicy(v string) *Node
- func (n *Node) Rel(v string) *Node
- func (n *Node) Release()
- func (n *Node) RemoveAttr(names ...string) *Node
- func (n *Node) RemoveClass(names ...string) *Node
- func (n *Node) RemoveContent() *Node
- func (n *Node) RemoveVar(names ...string) *Node
- func (n *Node) Render(w io.Writer, flags ...int) error
- func (n *Node) Required(v ...TypedValue) *Node
- func (n *Node) Reversed(v ...TypedValue) *Node
- func (n *Node) Role(v string) *Node
- func (n *Node) RowSpan(v int) *Node
- func (n *Node) Selected(v ...TypedValue) *Node
- func (n *Node) SetPoolingNeighbor(x *Node)
- func (n *Node) SetTag(tag string) *Node
- func (n *Node) SetTagEx(tag string, void bool) *Node
- func (n *Node) SetWriteFn(fn func(*Node, io.Writer) error) *Node
- func (n *Node) Sizes(v string) *Node
- func (n *Node) Slot(name string, nodes ...*Node) *Node
- func (n *Node) SlotAttr(v string) *Node
- func (n *Node) Spellcheck(v ...bool) *Node
- func (n *Node) Src(v string) *Node
- func (n *Node) Srcdoc(v string) *Node
- func (n *Node) Srclang(v string) *Node
- func (n *Node) Srcset(v string) *Node
- func (n *Node) Start(v int) *Node
- func (n *Node) StaticContent(fn func() *Node) *Node
- func (n *Node) Step(value ...int) *Node
- func (n *Node) String() string
- func (n *Node) Style(v string) *Node
- func (n *Node) T(s string) *Node
- func (n *Node) TV(v TypedValue) *Node
- func (n *Node) TabIndex(v int) *Node
- func (n *Node) Tag(tag string) *Node
- func (n *Node) Text(s string) *Node
- func (n *Node) TextValue(v TypedValue) *Node
- func (n *Node) Translate(v string) *Node
- func (n *Node) Type(v string) *Node
- func (n *Node) UniqueID() *Node
- func (n *Node) UnsafeScript()
- func (n *Node) V(name string, value string) *Node
- func (n *Node) VV(name string, value string) *Node
- func (n *Node) Value(v TypedValue) *Node
- func (n *Node) Var(name string, value string) *Node
- func (n *Node) VarValue(name string, value TypedValue) *Node
- func (n *Node) Vars() iter.Seq2[string, TypedValue]
- func (n *Node) Viewport(v string) *Node
- func (n *Node) Width(v int) *Node
- func (n *Node) WithSlot(name string, fn func(n *Node, slot *Node))
- func (n *Node) Wrap(v string) *Node
- func (n *Node) X(nodes ...*Node) *Node
- type TypedValue
- func Any(v any) TypedValue
- func Bool(v bool) TypedValue
- func Bytes(b []byte) TypedValue
- func Float(v float64) TypedValue
- func Int(v int) TypedValue
- func Int64(v int64) TypedValue
- func JSON(v any) TypedValue
- func String(s string) TypedValue
- func Uint(v uint) TypedValue
- func Uint64(v uint64) TypedValue
- func (v TypedValue) Any() any
- func (v TypedValue) Bool() (bool, bool)
- func (v TypedValue) BoolOrDefault(d bool) bool
- func (v TypedValue) BoolOrZero() bool
- func (v TypedValue) Bytes() ([]byte, bool)
- func (v TypedValue) BytesOrZero() []byte
- func (v TypedValue) Float64() (float64, bool)
- func (v TypedValue) FloatOrDefault(d float64) float64
- func (v TypedValue) FloatOrZero() float64
- func (v TypedValue) Int64() (int64, bool)
- func (v TypedValue) IntOrDefault(d int64) int64
- func (v TypedValue) IntOrZero() int64
- func (v TypedValue) JSON() (any, bool)
- func (v TypedValue) JSONOrZero() any
- func (v TypedValue) Kind() ValueKind
- func (v TypedValue) String() (string, bool)
- func (v TypedValue) StringOrDefault(d string) string
- func (v TypedValue) StringOrZero() string
- func (v TypedValue) Uint64() (uint64, bool)
- func (v TypedValue) UintOrDefault(d uint64) uint64
- func (v TypedValue) UintOrZero() uint64
- func (v TypedValue) Valid() bool
- type ValueKind
Constants ¶
const ( CountWithRoot = 1 << iota // adds tree root to the node count CountRecursive CountSkipNil // excludes nil nodes from count )
const CountContent = 0 // counts direct children
const CountTree = CountRecursive | CountWithRoot
const ( // RenderAssumeNoReplace skips duplicate checks for classes and attributes. // This may speed up rendering of big class/attribute lists. // In most cases this is not needed. RenderAssumeNoReplace = 1 << iota )
Variables ¶
var NoPool bool
NoPool disables automatic pooling.
Functions ¶
func ValidClass ¶
Types ¶
type EscapeWriter ¶
EscapeWriter is an io.Writer that escapes HTML special characters.
type Mod ¶
type Mod = func(n *Node)
Mod represents a function that modifies a Node.
func AcceptCharset ¶
func AllowFullscreen ¶
func AllowFullscreen(v ...TypedValue) Mod
func Aria ¶
func Aria(name string, v TypedValue) Mod
func Async ¶
func Async(v ...TypedValue) Mod
func Attr ¶
Attr returns a Mod that sets an attribute. If value is omitted, it sets a boolean attribute. Attr should not be used to set a class attribute; use Class instead.
func AttrBool ¶
AttrBool returns a Mod that sets a boolean attribute. If value is omitted, it is treated as enabled.
func AttrValue ¶
func AttrValue(name string, value ...TypedValue) Mod
AttrValue returns a Mod that sets an attribute. If value is omitted, it sets a boolean attribute. AttrValue should not be used to set a class attribute; use Class instead.
func Autocapitalize ¶
func Autocomplete ¶
func Autofocus ¶
func Autofocus(v ...TypedValue) Mod
func Autoplay ¶
func Autoplay(v ...TypedValue) Mod
func Checked ¶
func Checked(v ...TypedValue) Mod
func ContentAttr ¶
func Controls ¶
func Controls(v ...TypedValue) Mod
func CrossOrigin ¶
func Data ¶
func Data(name string, v TypedValue) Mod
func Default ¶
func Default(v ...TypedValue) Mod
func Defer ¶
func Defer(v ...TypedValue) Mod
func Disabled ¶
func Disabled(v ...TypedValue) Mod
func Download ¶
Download sets the "download" attribute, If value is omitted, it sets a boolean attribute.
func Draggable ¶
Draggable sets the "draggable". If value is omitted, it sets a string value "true". If value is provided and false, it sets a string value "false".
func EnterKeyHint ¶
func FormNoValidate ¶
func FormNoValidate(v ...TypedValue) Mod
func GroupLabel ¶
func Inert ¶
func Inert(v ...TypedValue) Mod
func IsMap ¶
func IsMap(v ...TypedValue) Mod
func ItemScope ¶
func ItemScope(v ...TypedValue) Mod
func Loop ¶
func Loop(v ...TypedValue) Mod
func ModIf ¶
ModIf conditionally returns a modifier produced by fn when cond is true. If cond is false, ModIf returns nil.
func Multiple ¶
func Multiple(v ...TypedValue) Mod
func Muted ¶
func Muted(v ...TypedValue) Mod
func NoModule ¶
func NoModule(v ...TypedValue) Mod
func Novalidate ¶
func Novalidate(v ...TypedValue) Mod
func OnDblClick ¶
func OnDragEnter ¶
func OnDragLeave ¶
func OnDragOver ¶
func OnDragStart ¶
func OnKeyPress ¶
func OnMouseDown ¶
func OnMouseEnter ¶
func OnMouseLeave ¶
func OnMouseMove ¶
func OnMouseOut ¶
func OnMouseOver ¶
func Open ¶
func Open(v ...TypedValue) Mod
func Placeholder ¶
func PlaysInline ¶
func PlaysInline(v ...TypedValue) Mod
func Readonly ¶
func Readonly(v ...TypedValue) Mod
func ReferrerPolicy ¶
func Required ¶
func Required(v ...TypedValue) Mod
func Reversed ¶
func Reversed(v ...TypedValue) Mod
func Selected ¶
func Selected(v ...TypedValue) Mod
func Slot ¶
Slot returns a Mod that sets the content of a named slot. If the slot exists, its content is replaced.
func Spellcheck ¶
Spellcheck sets the "spellcheck" attribute. If value is omitted, it sets a boolean attribute. If value is provided and false, it sets a string value "false".
func TextContent ¶
TextContent returns a Mod that sets (replaces) the content of the node to a single text node. The content is HTML-escaped during rendering.
func Value ¶
func Value(v TypedValue) Mod
func Var ¶
Var returns a Mod that attaches arbitrary user data (variable) to the node. These variables are not rendered to HTML.
func VarValue ¶
func VarValue(name string, value TypedValue) Mod
VarValue returns a Mod that attaches arbitrary user data (variable) to the node. These variables are not rendered to HTML.
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
Node represents an HTML element or a special rendering node (e.g. text/raw/group).
func Blockquote ¶
func Build ¶
Build retrieves a Node from the pool, sets its tag, and applies the provided modifiers.
func Figcaption ¶
func Get ¶
func Get() *Node
Get retrieves a zeroed Node from the global pool. Most users should use Build, Group, Text and others instead.
func Group ¶
Group creates a logical group of nodes that renders its children without a wrapping parent tag.
func If ¶
If conditionally returns a node produced by fn when cond is true. If cond is false, If returns nil.
func Join ¶ added in v0.4.0
Join returns a Group if at least one of the provided nodes is not nil. Otherwise, it returns nil.
func RawBytes ¶
RawBytes creates a raw HTML node from a byte slice. The content is written directly to the output without escaping.
func RawString ¶
RawString creates a raw HTML node from a string. The content is written directly to the output without escaping.
func Static ¶
Static renders the node returned by fn once and caches the result globally. Subsequent calls return a cached raw byte node, avoiding re-rendering.
The cache key is the function pointer; closures are cached by function address and therefore execute at most once, regardless of captured variables.
func Stylesheet ¶
func TextValue ¶
func TextValue(v TypedValue) *Node
TextValue creates a text node from an arbitrary value. The content is HTML-escaped during rendering.
func TitleValue ¶
func TitleValue(value TypedValue, mods ...Mod) *Node
func (*Node) AV ¶ added in v0.3.0
func (n *Node) AV(name string, value ...TypedValue) *Node
AV is an alias for AttrValue
func (*Node) AcceptCharset ¶
func (*Node) AllowFullscreen ¶
func (n *Node) AllowFullscreen(v ...TypedValue) *Node
func (*Node) AppendSlot ¶
AppendSlot adds nodes to the end of a named slot.
func (*Node) Async ¶
func (n *Node) Async(v ...TypedValue) *Node
func (*Node) Attr ¶
Attr sets the value of an attribute. If value is omitted, it sets a boolean attribute. To unset a boolean attribute, use BoolAttr(name, false) or RemoveAttr(name) or AttrValue(name, Unset). Attr should not be used to set a class attribute; use Class instead.
func (*Node) AttrBool ¶
AttrBool sets the value of an attribute. If value is omitted, it is treated as enabled. To unset a boolean attribute, use BoolAttr(name, false) or RemoveAttr(name) or AttrValue(name, Unset).
func (*Node) AttrValue ¶
func (n *Node) AttrValue(name string, value ...TypedValue) *Node
AttrValue sets the value of an attribute. If value is omitted, it sets a boolean attribute. To unset a boolean attribute, use AttrValue(name, Unset) or RemoveAttr(name). AttrValue should not be used to set a class attribute; use Class instead.
func (*Node) Attrs ¶ added in v0.3.0
func (n *Node) Attrs() iter.Seq2[string, TypedValue]
Attrs returns an iterator over active attributes.
func (*Node) Autocapitalize ¶
func (*Node) Autocomplete ¶
func (*Node) Autofocus ¶
func (n *Node) Autofocus(v ...TypedValue) *Node
func (*Node) Autoplay ¶
func (n *Node) Autoplay(v ...TypedValue) *Node
func (*Node) Checked ¶
func (n *Node) Checked(v ...TypedValue) *Node
func (*Node) Class ¶
Class adds a class name to the node. Multiple classes can be separated by spaces.
func (*Node) Clear ¶ added in v0.3.0
func (n *Node) Clear()
Clear resets the node. All children are returned to the pool unless pooling is disabled. Owned flag remains unchanged.
func (*Node) ContentAttr ¶
func (*Node) Controls ¶
func (n *Node) Controls(v ...TypedValue) *Node
func (*Node) CopyClassPrefix ¶
CopyClassPrefix returns a Mod that copies classes with specific prefixes to a destination node.
func (*Node) CopyClassPrefixTo ¶
CopyClassPrefixTo copies classes starting with the given prefixes to the destination node.
func (*Node) CopyClassSuffix ¶
CopyClassSuffix returns a Mod that copies classes with specific suffixes to a destination node.
func (*Node) CopyClassSuffixTo ¶
CopyClassSuffixTo copies classes ending with the given suffixes to the destination node.
func (*Node) Count ¶ added in v0.2.0
Count returns a number of content nodes. Flags can optionally modify the count behavior.
func (*Node) CrossOrigin ¶
func (*Node) Default ¶
func (n *Node) Default(v ...TypedValue) *Node
func (*Node) DefaultContent ¶ added in v0.2.0
DefaultContent postpones a function that executes fn if the node's content is empty.
func (*Node) Defer ¶
func (n *Node) Defer(v ...TypedValue) *Node
func (*Node) DeleteSlot ¶
DeleteSlot removes specific named slots and releases their content.
func (*Node) Disabled ¶
func (n *Node) Disabled(v ...TypedValue) *Node
func (*Node) Download ¶
Download sets the "download" attribute, If value is omitted, it sets a boolean attribute.
func (*Node) Draggable ¶
Draggable sets the "draggable". If value is omitted, it sets a string value "true". If value is provided and false, it sets a string value "false".
func (*Node) Each ¶ added in v0.3.0
Each calls fn for each non-nil child node. Iteration stops if fn returns false.
func (*Node) EachAttr ¶
func (n *Node) EachAttr(fn func(string, TypedValue) bool) *Node
EachAttr iterates over all attributes, calling fn for each. Iteration stops if fn returns false.
func (*Node) EachClass ¶
EachClass iterates over all active classes, calling fn for each. Iteration stops if fn returns false.
func (*Node) EachVar ¶ added in v0.4.0
func (n *Node) EachVar(fn func(string, TypedValue) bool)
EachVar iterates over all active classes, calling fn for each. Iteration stops if fn returns false.
func (*Node) EnterKeyHint ¶
func (*Node) ExtractContent ¶
ExtractContent removes and returns the content of the node as Group node.
func (*Node) ExtractContentNodes ¶ added in v0.2.0
ExtractContentNodes removes and returns the content of the node.
func (*Node) ExtractSlot ¶
ExtractSlot removes and returns the contents of a named slot as a Group node. If slot does not exist or has no content, ExtractSlot returns nil.
func (*Node) ExtractSlotNodes ¶ added in v0.2.0
ExtractSlotNodes removes and returns the content of a named slot.
func (*Node) FormNoValidate ¶
func (n *Node) FormNoValidate(v ...TypedValue) *Node
func (*Node) GetAttr ¶
func (n *Node) GetAttr(name string) TypedValue
GetAttr retrieves the attribute value by name. Returns a zero value if not found. Use TypedValue.Valid to check for validity.
func (*Node) GetTag ¶
GetTag returns the current tag name and whether it is a void (self-closing) element.
func (*Node) GetVar ¶
func (n *Node) GetVar(name string) TypedValue
GetVar retrieves the value of a user variable by name. Returns unset value if not found.
func (*Node) GroupLabel ¶
func (*Node) HasAttrAll ¶
HasAttrAll checks if the node has all of the specified attributes.
func (*Node) HasAttrPrefix ¶
HasAttrPrefix checks if the node has any attribute starting with the given prefix.
func (*Node) HasAttrSuffix ¶
HasAttrSuffix checks if the node has any attribute ending with the given suffix.
func (*Node) HasClassAll ¶
HasClassAll checks if the node has all of the specified classes.
func (*Node) HasClassPrefix ¶
HasClassPrefix checks if the node has any class starting with the given prefix.
func (*Node) HasClassSuffix ¶
HasClassSuffix checks if the node has any class ending with the given suffix.
func (*Node) HasContent ¶
HasContent checks if the node has any content.
func (*Node) Inert ¶
func (n *Node) Inert(v ...TypedValue) *Node
func (*Node) IsMap ¶
func (n *Node) IsMap(v ...TypedValue) *Node
func (*Node) ItemScope ¶
func (n *Node) ItemScope(v ...TypedValue) *Node
func (*Node) Loop ¶
func (n *Node) Loop(v ...TypedValue) *Node
func (*Node) MoveAttr ¶
MoveAttr returns a Mod that moves specific attributes to a destination node.
func (*Node) MoveAttrPrefix ¶
MoveAttrPrefix returns a Mod that moves attributes with a specific prefix to a destination node.
func (*Node) MoveAttrPrefixTo ¶
MoveAttrPrefixTo moves all attributes starting with the given prefix to the destination node.
func (*Node) MoveAttrSuffix ¶
MoveAttrSuffix returns a Mod that moves attributes with a specific suffix to a destination node.
func (*Node) MoveAttrSuffixTo ¶
MoveAttrSuffixTo moves all attributes ending with the given suffix to the destination node.
func (*Node) MoveAttrTo ¶
MoveAttrTo moves specific attributes from the current node to the destination node.
func (*Node) MoveClassPrefix ¶
MoveClassPrefix returns a Mod that moves classes with specific prefixes to a destination node.
func (*Node) MoveClassPrefixTo ¶
MoveClassPrefixTo moves classes starting with the given prefixes to the destination node.
func (*Node) MoveClassSuffix ¶
MoveClassSuffix returns a Mod that moves classes with specific suffixes to a destination node.
func (*Node) MoveClassSuffixTo ¶
MoveClassSuffixTo moves classes ending with the given suffixes to the destination node.
func (*Node) MoveClassTo ¶
MoveClassTo moves specific classes from the current node to the destination node.
func (*Node) MoveContent ¶
MoveContent is a Mod that moves the content to a destination node.
func (*Node) MoveContentTo ¶
MoveContentTo moves all content from the current node to the destination node.
func (*Node) MoveSlotTo ¶
MoveSlotTo moves named slots and their content to the destination node.
func (*Node) MoveVarPrefixTo ¶
MoveVarPrefixTo moves variables starting with the given prefix to the destination node.
func (*Node) MoveVarSuffixTo ¶
MoveVarSuffixTo moves variables ending with the given suffix to the destination node.
func (*Node) MoveVarTo ¶
MoveVarTo moves specific variables from the current node to the destination node.
func (*Node) Multiple ¶
func (n *Node) Multiple(v ...TypedValue) *Node
func (*Node) Muted ¶
func (n *Node) Muted(v ...TypedValue) *Node
func (*Node) NoModule ¶
func (n *Node) NoModule(v ...TypedValue) *Node
func (*Node) Novalidate ¶
func (n *Node) Novalidate(v ...TypedValue) *Node
func (*Node) OnDblClick ¶
func (*Node) OnDragEnter ¶
func (*Node) OnDragLeave ¶
func (*Node) OnDragOver ¶
func (*Node) OnDragStart ¶
func (*Node) OnKeyPress ¶
func (*Node) OnMouseDown ¶
func (*Node) OnMouseEnter ¶
func (*Node) OnMouseLeave ¶
func (*Node) OnMouseMove ¶
func (*Node) OnMouseOut ¶
func (*Node) OnMouseOver ¶
func (*Node) Open ¶
func (n *Node) Open(v ...TypedValue) *Node
func (*Node) Own ¶
Own marks the node as owned, preventing it from being returned to the pool by Release.
func (*Node) Owned ¶
Owned returns true if the node has been marked as owned and will not be returned to the pool.
func (*Node) Placeholder ¶
func (*Node) PlaysInline ¶
func (n *Node) PlaysInline(v ...TypedValue) *Node
func (*Node) PrependSlot ¶
PrependSlot adds nodes to the beginning of a named slot.
func (*Node) Readonly ¶
func (n *Node) Readonly(v ...TypedValue) *Node
func (*Node) ReferrerPolicy ¶
func (*Node) Release ¶
func (n *Node) Release()
Release returns the node and its children to the pool for reuse. If the node is marked as Owned or pooling is disabled, Release is no-op.
func (*Node) RemoveAttr ¶
RemoveAttr removes the specified attributes from the node.
func (*Node) RemoveClass ¶
RemoveClass removes the specified class names from the node.
func (*Node) RemoveContent ¶
RemoveContent clears the content and recursively releases all child nodes.
func (*Node) Render ¶
Render writes the HTML representation of the node to w. Optional flags alter the rendering behavior.
func (*Node) Required ¶
func (n *Node) Required(v ...TypedValue) *Node
func (*Node) Reversed ¶
func (n *Node) Reversed(v ...TypedValue) *Node
func (*Node) Selected ¶
func (n *Node) Selected(v ...TypedValue) *Node
func (*Node) SetPoolingNeighbor ¶
SetPoolingNeighbor links another node to be released together with n.
func (*Node) SetTagEx ¶
SetTagEx sets the HTML tag name and explicitly controls the void element status.
func (*Node) SetWriteFn ¶
SetWriteFn overrides the default rendering logic of the node with fn.
func (*Node) Slot ¶
Slot sets the content of a named slot. If the slot exists, its content is replaced.
func (*Node) Spellcheck ¶
Spellcheck sets the "spellcheck" attribute. If value is omitted, it sets a boolean attribute. If value is provided and false, it sets a string value "false".
func (*Node) StaticContent ¶
StaticContent sets the content of the node to the cached output of fn. Subsequent calls return a cached raw byte node, avoiding re-rendering.
The cache key is the function pointer; closures are cached by function address and therefore execute at most once, regardless of captured variables.
func (*Node) TV ¶ added in v0.3.0
func (n *Node) TV(v TypedValue) *Node
TV is an alias for TextValue.
func (*Node) Text ¶
Text sets (replaces) the content of the node to a single text node. The content is HTML-escaped during rendering.
func (*Node) TextValue ¶
func (n *Node) TextValue(v TypedValue) *Node
TextValue sets (replaces) the content of the node to a single text node. The content is HTML-escaped during rendering.
func (*Node) UnsafeScript ¶
func (n *Node) UnsafeScript()
UnsafeScript enables unsafe <script> rendering.
func (*Node) Value ¶
func (n *Node) Value(v TypedValue) *Node
func (*Node) Var ¶
Var attaches arbitrary user data (variable) to the node. These variables are not rendered to HTML.
func (*Node) VarValue ¶
func (n *Node) VarValue(name string, value TypedValue) *Node
VarValue attaches arbitrary user data (variable) to the node. These variables are not rendered to HTML.
func (*Node) Vars ¶ added in v0.4.0
func (n *Node) Vars() iter.Seq2[string, TypedValue]
Vars returns iterator over active classes.
type TypedValue ¶
type TypedValue struct {
// contains filtered or unexported fields
}
TypedValue can hold strings, ints, booleans and floats without allocation.
var Unset TypedValue
Unset represents an empty, unset or removed value.
func Any ¶
func Any(v any) TypedValue
func Bool ¶
func Bool(v bool) TypedValue
func Bytes ¶
func Bytes(b []byte) TypedValue
func Float ¶
func Float(v float64) TypedValue
func Int ¶
func Int(v int) TypedValue
func Int64 ¶
func Int64(v int64) TypedValue
func JSON ¶
func JSON(v any) TypedValue
func String ¶
func String(s string) TypedValue
func Uint ¶
func Uint(v uint) TypedValue
func Uint64 ¶
func Uint64(v uint64) TypedValue
func (TypedValue) Any ¶
func (v TypedValue) Any() any
func (TypedValue) Bool ¶
func (v TypedValue) Bool() (bool, bool)
func (TypedValue) BoolOrDefault ¶
func (v TypedValue) BoolOrDefault(d bool) bool
func (TypedValue) BoolOrZero ¶
func (v TypedValue) BoolOrZero() bool
func (TypedValue) Bytes ¶
func (v TypedValue) Bytes() ([]byte, bool)
func (TypedValue) BytesOrZero ¶
func (v TypedValue) BytesOrZero() []byte
func (TypedValue) Float64 ¶
func (v TypedValue) Float64() (float64, bool)
func (TypedValue) FloatOrDefault ¶
func (v TypedValue) FloatOrDefault(d float64) float64
func (TypedValue) FloatOrZero ¶
func (v TypedValue) FloatOrZero() float64
func (TypedValue) Int64 ¶
func (v TypedValue) Int64() (int64, bool)
func (TypedValue) IntOrDefault ¶
func (v TypedValue) IntOrDefault(d int64) int64
func (TypedValue) IntOrZero ¶
func (v TypedValue) IntOrZero() int64
func (TypedValue) JSON ¶
func (v TypedValue) JSON() (any, bool)
func (TypedValue) JSONOrZero ¶
func (v TypedValue) JSONOrZero() any
func (TypedValue) Kind ¶
func (v TypedValue) Kind() ValueKind
func (TypedValue) String ¶
func (v TypedValue) String() (string, bool)
func (TypedValue) StringOrDefault ¶
func (v TypedValue) StringOrDefault(d string) string
func (TypedValue) StringOrZero ¶
func (v TypedValue) StringOrZero() string
func (TypedValue) Uint64 ¶
func (v TypedValue) Uint64() (uint64, bool)
func (TypedValue) UintOrDefault ¶
func (v TypedValue) UintOrDefault(d uint64) uint64
func (TypedValue) UintOrZero ¶
func (v TypedValue) UintOrZero() uint64
func (TypedValue) Valid ¶
func (v TypedValue) Valid() bool
Valid returns true if it contains a valid value.