element

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2026 License: MIT Imports: 18 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

element

Package element provides high-level logical DOM components for Kite. These components wrap base dom.Element and dom.TextNode implementations to provide default styles, a declarative API, and fluent builder-style modifiers.

Declarative API

Kite elements use a functional, declarative API for tree construction. This allows you to build complex UI structures with minimal boilerplate.

Functional Constructors

Each element provides a global functional constructor that accepts variadic ...any children.

ui := element.Box(
    element.Box("Header").Style(headerStyle),
    element.UL(
        element.LI("First Item"),
        element.LI("Second Item"),
    ),
)
Automatic String Boxing

When a string is passed as a child to a functional constructor, it is automatically converted into a TextElement.

// These are equivalent:
element.Box("Hello")
element.Box(element.Text("Hello"))
Slice Flattening

Constructors automatically flatten slices of elements or any values, making it easy to generate children dynamically.

items := []string{"A", "B", "C"}
list := element.UL(items) // Automatically creates 3 TextElements

Fluent Modifiers

Elements support fluent modifier methods that return the element itself for chaining. These methods allow you to set styles, IDs, classes, and event listeners.

btn := element.Box("Click Me").
    SetID("submit-btn").
    WithClass("primary").
    Style(style.Style{
        Background: style.Some(style.ColorBlue),
    }).
    OnEvent(event.TypeClick, func(ev event.Event) {
        fmt.Println("Clicked!")
    })

Available Elements

Function Tag Name Description
Box box A generic container (similar to <div>).
Span span An inline container (similar to <span>).
Text #text A leaf node containing text.
Button button A clickable button with centered content and interactive states.
Form form A container component that gathers child FormControl values and manages implicit submission mechanics.
Input input A single-line text input field.
TextArea textarea A multi-line scrollable text editor.
Select select A dropdown selection component with overlay.
Option option A data element for Select options.
Checkbox checkbox A toggleable checkbox with UA glyphs.
RadioGroup radiogroup A container that manages a set of Radio buttons.
Radio radio A single radio button within a group.
UL ul An unordered list with markers.
OL ol An ordered list with numbers.
LI li A list item.
Table table A table container.
TR tr A table row.
TD td A table cell.
Overlay overlay An anchored overlay with smart flipping.
Dialog dialog A full-screen modal container.

Caret Navigation & CursorNavigable

All elements in package element inherit caret navigation and text selection capabilities via their base element wrapper. You can make any element cursor-navigable by calling .CursorNavigable(true).

When an element is cursor-navigable, pressing arrow keys when the element is focused moves a text selection caret character-by-character through its text content, with automatic skipping over collapsed whitespace. When the caret reaches the boundary of the text content, it shifts focus to the next spatial element in that direction.

card := element.Button("  Action Card  ").CursorNavigable(true)

Implicit Adoption

Elements created via functional constructors are initially owned by a global "orphan" document. When you mount the root of your tree to the Kite Engine using eng.Mount(root), the entire tree is recursively adopted by the engine's main document. This eliminates the need to pass a document reference through every component constructor.

Documentation

Overview

Package element provides containers, text, form controls, and overlays for building a Kite document. Constructors such as Box and Span accept child nodes and convert strings to text nodes. Mount the resulting tree on the engine.

ui := element.Box(element.Span("Hello"), element.Button("Continue"))

Index

Examples

Constants

View Source
const DefaultPasswordMask = '•'

DefaultPasswordMask is the default masking glyph used when password mode is enabled without an explicit custom mask rune.

Variables

View Source
var (
	DefaultPlaceholderGray = color.RGBA{136, 136, 136, 255} // #888888

)

Functions

This section is empty.

Types

type BoxElement

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

BoxElement represents a generic container element (like a HTML <div>).

func Box

func Box(children ...any) *BoxElement

Box creates a new generic box container with the given children.

Example
package main

import (
	"fmt"
	"strings"

	"github.com/masterkeysrd/kite/dom"
	"github.com/masterkeysrd/kite/element"
	"github.com/masterkeysrd/kite/style"
	"github.com/masterkeysrd/kite/testenv"
)

func printScreen(root dom.Element) {
	env := testenv.New(nil, 24, 8)
	defer env.Close()

	env.Mount(root)
	env.Flush()

	for line := range strings.SplitSeq(strings.TrimRight(env.DumpText(), " \n"), "\n") {
		fmt.Println(strings.TrimSpace(line))
	}
}

func main() {
	heading := style.S().Bold(true)
	panel := element.Box(
		element.Box("Inbox").Style(heading),
		element.Box("No new messages"),
	)

	printScreen(panel)
}
Output:
Inbox
No new messages

func NewBox

func NewBox(doc dom.Document) *BoxElement

NewBox creates a new generic box container.

func (*BoxElement) AddChild

func (b *BoxElement) AddChild(child dom.Node) *Self

AddChild adds child as the last child of this element and returns the element itself for fluent chaining.

func (*BoxElement) Animate

func (b *BoxElement) Animate(
	from, to style.Style,
	opts animation.Options,
) *animation.Playback

Animate interpolates style properties from start to end on the element over opts.Duration using the document window's frame clock. Unrelated author styles are preserved via sparse merging, and the animation cancels automatically if the element disconnects from the document.

func (*BoxElement) CursorNavigable

func (b *BoxElement) CursorNavigable(v bool) *Self

CursorNavigable enables character-level caret navigation and text selection on this element.

func (*BoxElement) DefaultStyle

func (b *BoxElement) DefaultStyle() style.Style

DefaultStyle returns the element-type default style.

func (*BoxElement) DispatchEvent

func (b *BoxElement) DispatchEvent(e event.Event)

DispatchEvent fires an event that propagates through the DOM tree.

func (*BoxElement) EventListeners

func (b *BoxElement) EventListeners() []PendingListener

EventListeners returns the event listener registrations for this element. Used by the engine's event-target resolver to wire up dispatch.

func (*BoxElement) Hidden

func (b *BoxElement) Hidden(v bool) *Self

Hidden sets or clears the hidden state and returns *Self.

func (*BoxElement) IntrinsicStyle

func (b *BoxElement) IntrinsicStyle() style.Style

IntrinsicStyle returns the UA-mandated forced style for this element. Properties set here have the highest cascade precedence; authors cannot override them via Style(). Most elements return an empty style.S(). Replaced and compound elements return a sparse Style with UA-forced properties (e.g. Display:InlineBlock, OverflowX:Clip). See ADR-010.

func (*BoxElement) IsCursorNavigable

func (b *BoxElement) IsCursorNavigable() bool

IsCursorNavigable reports whether the element is cursor-navigable.

func (*BoxElement) IsDirtyStyle

func (b *BoxElement) IsDirtyStyle() bool

IsDirtyStyle reports whether this element's style needs re-resolution.

func (*BoxElement) IsHidden

func (b *BoxElement) IsHidden() bool

IsHidden reports whether the element is hidden.

func (*BoxElement) Listeners

func (b *BoxElement) Listeners() []PendingListener

Listeners returns the set of event listeners registered on this element.

func (*BoxElement) MoveCaret

func (b *BoxElement) MoveCaret(dir dom.Direction) (boundaryReached bool)

MoveCaret satisfies the dom.SpatialCaret interface.

func (*BoxElement) OnBlur

func (b *BoxElement) OnBlur(fn func(*event.FocusEvent)) *Self

OnBlur registers a typed blur listener and returns *Self.

func (*BoxElement) OnClick

func (b *BoxElement) OnClick(fn func(*event.MouseEvent)) *Self

OnClick registers a typed click listener and returns *Self.

func (*BoxElement) OnConnect

func (b *BoxElement) OnConnect(fn func()) *Self

OnConnect registers fn to run each time the element enters the live document.

func (*BoxElement) OnConnected

func (b *BoxElement) OnConnected()

func (*BoxElement) OnDisconnect

func (b *BoxElement) OnDisconnect(fn func()) *Self

OnDisconnect registers fn to run just before the element leaves the live document.

func (*BoxElement) OnDisconnected

func (b *BoxElement) OnDisconnected()

func (*BoxElement) OnEvent

func (b *BoxElement) OnEvent(typ event.EventType, fn event.Listener) *Self

OnEvent registers fn as a listener for event of type typ and returns *Self. Listeners are stored on the element and retrieved by the engine's event-target resolver during dispatch setup. Nil handlers are ignored.

func (*BoxElement) OnFocus

func (b *BoxElement) OnFocus(fn func(*event.FocusEvent)) *Self

OnFocus registers a typed focus listener and returns *Self.

func (*BoxElement) OnKey

func (b *BoxElement) OnKey(combo string, fn func(*event.KeyEvent)) *Self

OnKey registers a keydown listener filtered by combo via event.KeyEvent.MatchString and returns *Self.

func (*BoxElement) OnKeyDown

func (b *BoxElement) OnKeyDown(fn func(*event.KeyEvent)) *Self

OnKeyDown registers a typed keydown listener and returns *Self.

func (*BoxElement) OnKeyPress

func (b *BoxElement) OnKeyPress(fn func(*event.KeyEvent)) *Self

OnKeyPress registers a typed keypress listener and returns *Self.

func (*BoxElement) OnKeyUp

func (b *BoxElement) OnKeyUp(fn func(*event.KeyEvent)) *Self

OnKeyUp registers a typed keyup listener and returns *Self.

func (*BoxElement) OnMouseDown

func (b *BoxElement) OnMouseDown(fn func(*event.MouseEvent)) *Self

OnMouseDown registers a typed mousedown listener and returns *Self.

func (*BoxElement) OnMouseEnter

func (b *BoxElement) OnMouseEnter(fn func(*event.MouseEvent)) *Self

OnMouseEnter registers a typed mouseenter listener and returns *Self.

func (*BoxElement) OnMouseLeave

func (b *BoxElement) OnMouseLeave(fn func(*event.MouseEvent)) *Self

OnMouseLeave registers a typed mouseleave listener and returns *Self.

func (*BoxElement) OnMouseMove

func (b *BoxElement) OnMouseMove(fn func(*event.MouseEvent)) *Self

OnMouseMove registers a typed mousemove listener and returns *Self.

func (*BoxElement) OnMouseUp

func (b *BoxElement) OnMouseUp(fn func(*event.MouseEvent)) *Self

OnMouseUp registers a typed mouseup listener and returns *Self.

func (*BoxElement) OnPress

func (b *BoxElement) OnPress(fn func()) *Self

OnPress registers a zero-argument activation listener on click (including keyboard Enter/Space activation on buttons) and returns *Self.

func (*BoxElement) OnSelectionChange

func (b *BoxElement) OnSelectionChange(fn func(*event.SelectionChangeEvent)) *Self

OnSelectionChange registers a typed selectionchange listener and returns *Self.

func (*BoxElement) OnWheelEvent

func (b *BoxElement) OnWheelEvent(fn func(*event.WheelEvent)) *Self

OnWheelEvent registers a typed wheel listener and returns *Self. Named OnWheelEvent to avoid colliding with event.Scrollable's OnWheel method.

func (*BoxElement) RawStyle

func (b *BoxElement) RawStyle() style.Style

RawStyle returns the author-set style for this element.

func (*BoxElement) Ref

func (b *BoxElement) Ref(dst **Self) *Self

Ref stores a pointer to the concrete element into dst (if non-nil) and returns *Self.

func (*BoxElement) ResetCaret

func (b *BoxElement) ResetCaret(dir dom.Direction)

ResetCaret satisfies the dom.SpatialCaret interface.

func (*BoxElement) ScrollbarX

func (b *BoxElement) ScrollbarX(v bool) *Self

ScrollbarX enables or disables the horizontal scrollbar and returns *Self.

func (*BoxElement) ScrollbarY

func (b *BoxElement) ScrollbarY(v bool) *Self

ScrollbarY enables or disables the vertical scrollbar and returns *Self.

func (*BoxElement) SetCursorNavigable

func (b *BoxElement) SetCursorNavigable(v bool)

SetCursorNavigable sets whether the element is cursor-navigable.

func (*BoxElement) SetHidden

func (b *BoxElement) SetHidden(v bool)

SetHidden sets or clears the hidden state and marks style dirty.

func (*BoxElement) SetStyle

func (b *BoxElement) SetStyle(s style.Style)

SetStyle replaces the element's style wholesale and marks style dirty.

func (*BoxElement) SetText

func (b *BoxElement) SetText(text string) *Self

SetText replaces the element's children with a single text node containing text, updating an existing sole text child in place when possible, and returns *Self.

func (*BoxElement) SetTextf

func (b *BoxElement) SetTextf(format string, args ...any) *Self

SetTextf formats text with fmt.Sprintf and passes the result to [SetText].

func (*BoxElement) Style

func (b *BoxElement) Style(s style.Style) *Self

Style replaces the element's style wholesale and returns *Self. Calling Style twice discards the first call; style composition belongs at the style.Style value level via Style.Merge.

func (*BoxElement) Unwrap

func (b *BoxElement) Unwrap() dom.Node

Unwrap returns the underlying dom.Node.

func (*BoxElement) WithClass

func (b *BoxElement) WithClass(class string) *Self

WithClass sets the string classification tag and returns *Self.

func (*BoxElement) WithID

func (b *BoxElement) WithID(id string) *Self

WithID sets the element's identifier and returns *Self.

func (*BoxElement) WithTabIndex

func (b *BoxElement) WithTabIndex(index int) *Self

WithTabIndex sets the tab index on the element and returns *Self.

type BrElement

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

BrElement represents an HTML <br> element: a void inline element that forces a mandatory line break in the inline formatting context (IFC).

Architecture summary:

  • Display is "inline" (not a block container).
  • The IFC builder detects BrElement via the brElement interface and emits an InlineBr item, which the LineBreaker treats as a forced line end with a '\n' byte cluster so that cursor.FromTextFragment counts the corresponding '\n' byte from the buffer.
  • A placeholder BrElement (placeholder == true) is detected via the brPlaceholderElement interface and emits InlineBrPlaceholder instead. The placeholder contributes ZERO bytes to the cursor offset model — it only ensures the IFC produces an empty trailing line when the buffer value ends with '\n', matching the browser's <br id="placeholder"> convention.

This is used by TextAreaElement's UA shadow subtree to represent newlines inserted via the Enter key, matching the HTML spec model.

func Br

func Br() *BrElement

Br creates a new content BrElement using the orphan document.

func NewBr

func NewBr(doc dom.Document) *BrElement

NewBr creates a new content BrElement owned by doc. It represents a '\n' character in the buffer.

func NewPlaceholderBr

func NewPlaceholderBr(doc dom.Document) *BrElement

NewPlaceholderBr creates a trailing placeholder BrElement owned by doc. It forces an empty line in the IFC but contributes ZERO bytes to the cursor byte-offset model — it is never backed by a '\n' in the buffer.

func (*BrElement) AddChild

func (b *BrElement) AddChild(child dom.Node) *Self

AddChild adds child as the last child of this element and returns the element itself for fluent chaining.

func (*BrElement) Animate

func (b *BrElement) Animate(
	from, to style.Style,
	opts animation.Options,
) *animation.Playback

Animate interpolates style properties from start to end on the element over opts.Duration using the document window's frame clock. Unrelated author styles are preserved via sparse merging, and the animation cancels automatically if the element disconnects from the document.

func (*BrElement) CursorNavigable

func (b *BrElement) CursorNavigable(v bool) *Self

CursorNavigable enables character-level caret navigation and text selection on this element.

func (*BrElement) DefaultStyle

func (b *BrElement) DefaultStyle() style.Style

DefaultStyle returns the element-type default style.

func (*BrElement) DispatchEvent

func (b *BrElement) DispatchEvent(e event.Event)

DispatchEvent fires an event that propagates through the DOM tree.

func (*BrElement) EventListeners

func (b *BrElement) EventListeners() []PendingListener

EventListeners returns the event listener registrations for this element. Used by the engine's event-target resolver to wire up dispatch.

func (*BrElement) Hidden

func (b *BrElement) Hidden(v bool) *Self

Hidden sets or clears the hidden state and returns *Self.

func (*BrElement) IntrinsicStyle

func (b *BrElement) IntrinsicStyle() style.Style

IntrinsicStyle returns the UA-mandated style for <br>.

func (*BrElement) IsBr

func (b *BrElement) IsBr() bool

IsBr implements the layout.brElement interface. Returns true only for content brs (not placeholders), so the IFC emits a '\n' byte cluster.

func (*BrElement) IsCursorNavigable

func (b *BrElement) IsCursorNavigable() bool

IsCursorNavigable reports whether the element is cursor-navigable.

func (*BrElement) IsDirtyStyle

func (b *BrElement) IsDirtyStyle() bool

IsDirtyStyle reports whether this element's style needs re-resolution.

func (*BrElement) IsFocusable

func (b *BrElement) IsFocusable() bool

IsFocusable returns false: <br> is never a focus target.

func (*BrElement) IsHidden

func (b *BrElement) IsHidden() bool

IsHidden reports whether the element is hidden.

func (*BrElement) IsPlaceholderBr

func (b *BrElement) IsPlaceholderBr() bool

IsPlaceholderBr implements the layout.brPlaceholderElement interface. Returns true only for placeholder brs, so the IFC sets hadForcedBreakAtEnd without emitting any byte cluster.

func (*BrElement) Listeners

func (b *BrElement) Listeners() []PendingListener

Listeners returns the set of event listeners registered on this element.

func (*BrElement) MoveCaret

func (b *BrElement) MoveCaret(dir dom.Direction) (boundaryReached bool)

MoveCaret satisfies the dom.SpatialCaret interface.

func (*BrElement) OnBlur

func (b *BrElement) OnBlur(fn func(*event.FocusEvent)) *Self

OnBlur registers a typed blur listener and returns *Self.

func (*BrElement) OnClick

func (b *BrElement) OnClick(fn func(*event.MouseEvent)) *Self

OnClick registers a typed click listener and returns *Self.

func (*BrElement) OnConnect

func (b *BrElement) OnConnect(fn func()) *Self

OnConnect registers fn to run each time the element enters the live document.

func (*BrElement) OnConnected

func (b *BrElement) OnConnected()

func (*BrElement) OnDisconnect

func (b *BrElement) OnDisconnect(fn func()) *Self

OnDisconnect registers fn to run just before the element leaves the live document.

func (*BrElement) OnDisconnected

func (b *BrElement) OnDisconnected()

func (*BrElement) OnEvent

func (b *BrElement) OnEvent(typ event.EventType, fn event.Listener) *Self

OnEvent registers fn as a listener for event of type typ and returns *Self. Listeners are stored on the element and retrieved by the engine's event-target resolver during dispatch setup. Nil handlers are ignored.

func (*BrElement) OnFocus

func (b *BrElement) OnFocus(fn func(*event.FocusEvent)) *Self

OnFocus registers a typed focus listener and returns *Self.

func (*BrElement) OnKey

func (b *BrElement) OnKey(combo string, fn func(*event.KeyEvent)) *Self

OnKey registers a keydown listener filtered by combo via event.KeyEvent.MatchString and returns *Self.

func (*BrElement) OnKeyDown

func (b *BrElement) OnKeyDown(fn func(*event.KeyEvent)) *Self

OnKeyDown registers a typed keydown listener and returns *Self.

func (*BrElement) OnKeyPress

func (b *BrElement) OnKeyPress(fn func(*event.KeyEvent)) *Self

OnKeyPress registers a typed keypress listener and returns *Self.

func (*BrElement) OnKeyUp

func (b *BrElement) OnKeyUp(fn func(*event.KeyEvent)) *Self

OnKeyUp registers a typed keyup listener and returns *Self.

func (*BrElement) OnMouseDown

func (b *BrElement) OnMouseDown(fn func(*event.MouseEvent)) *Self

OnMouseDown registers a typed mousedown listener and returns *Self.

func (*BrElement) OnMouseEnter

func (b *BrElement) OnMouseEnter(fn func(*event.MouseEvent)) *Self

OnMouseEnter registers a typed mouseenter listener and returns *Self.

func (*BrElement) OnMouseLeave

func (b *BrElement) OnMouseLeave(fn func(*event.MouseEvent)) *Self

OnMouseLeave registers a typed mouseleave listener and returns *Self.

func (*BrElement) OnMouseMove

func (b *BrElement) OnMouseMove(fn func(*event.MouseEvent)) *Self

OnMouseMove registers a typed mousemove listener and returns *Self.

func (*BrElement) OnMouseUp

func (b *BrElement) OnMouseUp(fn func(*event.MouseEvent)) *Self

OnMouseUp registers a typed mouseup listener and returns *Self.

func (*BrElement) OnPress

func (b *BrElement) OnPress(fn func()) *Self

OnPress registers a zero-argument activation listener on click (including keyboard Enter/Space activation on buttons) and returns *Self.

func (*BrElement) OnSelectionChange

func (b *BrElement) OnSelectionChange(fn func(*event.SelectionChangeEvent)) *Self

OnSelectionChange registers a typed selectionchange listener and returns *Self.

func (*BrElement) OnWheelEvent

func (b *BrElement) OnWheelEvent(fn func(*event.WheelEvent)) *Self

OnWheelEvent registers a typed wheel listener and returns *Self. Named OnWheelEvent to avoid colliding with event.Scrollable's OnWheel method.

func (*BrElement) RawStyle

func (b *BrElement) RawStyle() style.Style

RawStyle returns the author-set style for this element.

func (*BrElement) Ref

func (b *BrElement) Ref(dst **Self) *Self

Ref stores a pointer to the concrete element into dst (if non-nil) and returns *Self.

func (*BrElement) ResetCaret

func (b *BrElement) ResetCaret(dir dom.Direction)

ResetCaret satisfies the dom.SpatialCaret interface.

func (*BrElement) ScrollbarX

func (b *BrElement) ScrollbarX(v bool) *Self

ScrollbarX enables or disables the horizontal scrollbar and returns *Self.

func (*BrElement) ScrollbarY

func (b *BrElement) ScrollbarY(v bool) *Self

ScrollbarY enables or disables the vertical scrollbar and returns *Self.

func (*BrElement) SetCursorNavigable

func (b *BrElement) SetCursorNavigable(v bool)

SetCursorNavigable sets whether the element is cursor-navigable.

func (*BrElement) SetHidden

func (b *BrElement) SetHidden(v bool)

SetHidden sets or clears the hidden state and marks style dirty.

func (*BrElement) SetStyle

func (b *BrElement) SetStyle(s style.Style)

SetStyle replaces the element's style wholesale and marks style dirty.

func (*BrElement) SetText

func (b *BrElement) SetText(text string) *Self

SetText replaces the element's children with a single text node containing text, updating an existing sole text child in place when possible, and returns *Self.

func (*BrElement) SetTextf

func (b *BrElement) SetTextf(format string, args ...any) *Self

SetTextf formats text with fmt.Sprintf and passes the result to [SetText].

func (*BrElement) Style

func (b *BrElement) Style(s style.Style) *Self

Style replaces the element's style wholesale and returns *Self. Calling Style twice discards the first call; style composition belongs at the style.Style value level via Style.Merge.

func (*BrElement) Unwrap

func (b *BrElement) Unwrap() dom.Node

Unwrap returns the underlying dom.Node.

func (*BrElement) WithClass

func (b *BrElement) WithClass(class string) *Self

WithClass sets the string classification tag and returns *Self.

func (*BrElement) WithID

func (b *BrElement) WithID(id string) *Self

WithID sets the element's identifier and returns *Self.

func (*BrElement) WithTabIndex

func (b *BrElement) WithTabIndex(index int) *Self

WithTabIndex sets the tab index on the element and returns *Self.

type ButtonElement

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

ButtonElement implements a clickable button component.

func Button

func Button(children ...any) *ButtonElement

Button creates a new ButtonElement with the given children.

func NewButton

func NewButton(doc dom.Document, children ...any) *ButtonElement

NewButton creates a new ButtonElement owned by doc.

func (*ButtonElement) AddChild

func (b *ButtonElement) AddChild(child dom.Node) *Self

AddChild adds child as the last child of this element and returns the element itself for fluent chaining.

func (*ButtonElement) Animate

func (b *ButtonElement) Animate(
	from, to style.Style,
	opts animation.Options,
) *animation.Playback

Animate interpolates style properties from start to end on the element over opts.Duration using the document window's frame clock. Unrelated author styles are preserved via sparse merging, and the animation cancels automatically if the element disconnects from the document.

func (*ButtonElement) ButtonType

func (b *ButtonElement) ButtonType() string

ButtonType returns the type of the button.

func (*ButtonElement) CursorNavigable

func (b *ButtonElement) CursorNavigable(v bool) *Self

CursorNavigable enables character-level caret navigation and text selection on this element.

func (*ButtonElement) DefaultStyle

func (b *ButtonElement) DefaultStyle() style.Style

DefaultStyle returns the element's default style, including dynamic state.

func (*ButtonElement) Disabled

func (b *ButtonElement) Disabled(v bool) *ButtonElement

func (*ButtonElement) DispatchEvent

func (b *ButtonElement) DispatchEvent(e event.Event)

DispatchEvent fires an event that propagates through the DOM tree.

func (*ButtonElement) EventListeners

func (b *ButtonElement) EventListeners() []PendingListener

EventListeners returns the event listener registrations for this element. Used by the engine's event-target resolver to wire up dispatch.

func (*ButtonElement) Hidden

func (b *ButtonElement) Hidden(v bool) *Self

Hidden sets or clears the hidden state and returns *Self.

func (*ButtonElement) IntrinsicStyle

func (b *ButtonElement) IntrinsicStyle() style.Style

func (*ButtonElement) IsCursorNavigable

func (b *ButtonElement) IsCursorNavigable() bool

IsCursorNavigable reports whether the element is cursor-navigable.

func (*ButtonElement) IsDirtyStyle

func (b *ButtonElement) IsDirtyStyle() bool

IsDirtyStyle reports whether this element's style needs re-resolution.

func (*ButtonElement) IsDisabled

func (b *ButtonElement) IsDisabled() bool

func (*ButtonElement) IsHidden

func (b *ButtonElement) IsHidden() bool

IsHidden reports whether the element is hidden.

func (*ButtonElement) Listeners

func (b *ButtonElement) Listeners() []PendingListener

Listeners returns the set of event listeners registered on this element.

func (*ButtonElement) MoveCaret

func (b *ButtonElement) MoveCaret(dir dom.Direction) (boundaryReached bool)

MoveCaret satisfies the dom.SpatialCaret interface.

func (*ButtonElement) OnBlur

func (b *ButtonElement) OnBlur(fn func(*event.FocusEvent)) *Self

OnBlur registers a typed blur listener and returns *Self.

func (*ButtonElement) OnClick

func (b *ButtonElement) OnClick(fn func(*event.MouseEvent)) *Self

OnClick registers a typed click listener and returns *Self.

func (*ButtonElement) OnConnect

func (b *ButtonElement) OnConnect(fn func()) *Self

OnConnect registers fn to run each time the element enters the live document.

func (*ButtonElement) OnConnected

func (b *ButtonElement) OnConnected()

func (*ButtonElement) OnDisconnect

func (b *ButtonElement) OnDisconnect(fn func()) *Self

OnDisconnect registers fn to run just before the element leaves the live document.

func (*ButtonElement) OnDisconnected

func (b *ButtonElement) OnDisconnected()

func (*ButtonElement) OnEvent

func (b *ButtonElement) OnEvent(typ event.EventType, fn event.Listener) *Self

OnEvent registers fn as a listener for event of type typ and returns *Self. Listeners are stored on the element and retrieved by the engine's event-target resolver during dispatch setup. Nil handlers are ignored.

func (*ButtonElement) OnFocus

func (b *ButtonElement) OnFocus(fn func(*event.FocusEvent)) *Self

OnFocus registers a typed focus listener and returns *Self.

func (*ButtonElement) OnKey

func (b *ButtonElement) OnKey(combo string, fn func(*event.KeyEvent)) *Self

OnKey registers a keydown listener filtered by combo via event.KeyEvent.MatchString and returns *Self.

func (*ButtonElement) OnKeyDown

func (b *ButtonElement) OnKeyDown(fn func(*event.KeyEvent)) *Self

OnKeyDown registers a typed keydown listener and returns *Self.

func (*ButtonElement) OnKeyPress

func (b *ButtonElement) OnKeyPress(fn func(*event.KeyEvent)) *Self

OnKeyPress registers a typed keypress listener and returns *Self.

func (*ButtonElement) OnKeyUp

func (b *ButtonElement) OnKeyUp(fn func(*event.KeyEvent)) *Self

OnKeyUp registers a typed keyup listener and returns *Self.

func (*ButtonElement) OnMouseDown

func (b *ButtonElement) OnMouseDown(fn func(*event.MouseEvent)) *Self

OnMouseDown registers a typed mousedown listener and returns *Self.

func (*ButtonElement) OnMouseEnter

func (b *ButtonElement) OnMouseEnter(fn func(*event.MouseEvent)) *Self

OnMouseEnter registers a typed mouseenter listener and returns *Self.

func (*ButtonElement) OnMouseLeave

func (b *ButtonElement) OnMouseLeave(fn func(*event.MouseEvent)) *Self

OnMouseLeave registers a typed mouseleave listener and returns *Self.

func (*ButtonElement) OnMouseMove

func (b *ButtonElement) OnMouseMove(fn func(*event.MouseEvent)) *Self

OnMouseMove registers a typed mousemove listener and returns *Self.

func (*ButtonElement) OnMouseUp

func (b *ButtonElement) OnMouseUp(fn func(*event.MouseEvent)) *Self

OnMouseUp registers a typed mouseup listener and returns *Self.

func (*ButtonElement) OnPress

func (b *ButtonElement) OnPress(fn func()) *Self

OnPress registers a zero-argument activation listener on click (including keyboard Enter/Space activation on buttons) and returns *Self.

func (*ButtonElement) OnSelectionChange

func (b *ButtonElement) OnSelectionChange(fn func(*event.SelectionChangeEvent)) *Self

OnSelectionChange registers a typed selectionchange listener and returns *Self.

func (*ButtonElement) OnWheelEvent

func (b *ButtonElement) OnWheelEvent(fn func(*event.WheelEvent)) *Self

OnWheelEvent registers a typed wheel listener and returns *Self. Named OnWheelEvent to avoid colliding with event.Scrollable's OnWheel method.

func (*ButtonElement) RawStyle

func (b *ButtonElement) RawStyle() style.Style

RawStyle returns the author-set style for this element.

func (*ButtonElement) Ref

func (b *ButtonElement) Ref(dst **Self) *Self

Ref stores a pointer to the concrete element into dst (if non-nil) and returns *Self.

func (*ButtonElement) ResetCaret

func (b *ButtonElement) ResetCaret(dir dom.Direction)

ResetCaret satisfies the dom.SpatialCaret interface.

func (*ButtonElement) ScrollbarX

func (b *ButtonElement) ScrollbarX(v bool) *Self

ScrollbarX enables or disables the horizontal scrollbar and returns *Self.

func (*ButtonElement) ScrollbarY

func (b *ButtonElement) ScrollbarY(v bool) *Self

ScrollbarY enables or disables the vertical scrollbar and returns *Self.

func (*ButtonElement) SetActive

func (b *ButtonElement) SetActive(active bool)

SetActive sets the button's active (pressed) state.

func (*ButtonElement) SetCursorNavigable

func (b *ButtonElement) SetCursorNavigable(v bool)

SetCursorNavigable sets whether the element is cursor-navigable.

func (*ButtonElement) SetData

func (b *ButtonElement) SetData(data string)

SetData replaces the button's children with a single text node containing data.

func (*ButtonElement) SetDisabled

func (b *ButtonElement) SetDisabled(v bool)

func (*ButtonElement) SetHidden

func (b *ButtonElement) SetHidden(v bool)

SetHidden sets or clears the hidden state and marks style dirty.

func (*ButtonElement) SetStyle

func (b *ButtonElement) SetStyle(s style.Style)

SetStyle replaces the element's style wholesale and marks style dirty.

func (*ButtonElement) SetText

func (b *ButtonElement) SetText(text string) *Self

SetText replaces the element's children with a single text node containing text, updating an existing sole text child in place when possible, and returns *Self.

func (*ButtonElement) SetTextf

func (b *ButtonElement) SetTextf(format string, args ...any) *Self

SetTextf formats text with fmt.Sprintf and passes the result to [SetText].

func (*ButtonElement) Style

func (b *ButtonElement) Style(s style.Style) *Self

Style replaces the element's style wholesale and returns *Self. Calling Style twice discards the first call; style composition belongs at the style.Style value level via Style.Merge.

func (*ButtonElement) Type

func (b *ButtonElement) Type(btnType string) *ButtonElement

Type sets the button type (e.g. "button", "submit") and returns the ButtonElement.

func (*ButtonElement) Unwrap

func (b *ButtonElement) Unwrap() dom.Node

Unwrap returns the underlying dom.Node.

func (*ButtonElement) WithClass

func (b *ButtonElement) WithClass(class string) *Self

WithClass sets the string classification tag and returns *Self.

func (*ButtonElement) WithID

func (b *ButtonElement) WithID(id string) *Self

WithID sets the element's identifier and returns *Self.

func (*ButtonElement) WithTabIndex

func (b *ButtonElement) WithTabIndex(index int) *Self

WithTabIndex sets the tab index on the element and returns *Self.

type CaretController

type CaretController struct {
	Element dom.Element
	Offset  int
	// contains filtered or unexported fields
}

CaretController tracks cursor state and detects transitions across element boundaries.

func (*CaretController) Move

func (c *CaretController) Move(dir dom.Direction, view dom.View) (int, bool)

Move moves the caret inside the element in the given direction. Returns (newOffset, boundaryReached).

type CheckboxElement

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

CheckboxElement implements a toggleable checkbox component.

func Checkbox

func Checkbox(checked bool) *CheckboxElement

Checkbox creates a new CheckboxElement with the given checked state.

func NewCheckbox

func NewCheckbox(doc dom.Document, checked bool) *CheckboxElement

NewCheckbox creates a new CheckboxElement owned by doc.

func (*CheckboxElement) AddChild

func (b *CheckboxElement) AddChild(child dom.Node) *Self

AddChild adds child as the last child of this element and returns the element itself for fluent chaining.

func (*CheckboxElement) Animate

func (b *CheckboxElement) Animate(
	from, to style.Style,
	opts animation.Options,
) *animation.Playback

Animate interpolates style properties from start to end on the element over opts.Duration using the document window's frame clock. Unrelated author styles are preserved via sparse merging, and the animation cancels automatically if the element disconnects from the document.

func (*CheckboxElement) Checked

func (c *CheckboxElement) Checked() bool

Checked reports whether the checkbox is checked.

func (*CheckboxElement) CursorNavigable

func (b *CheckboxElement) CursorNavigable(v bool) *Self

CursorNavigable enables character-level caret navigation and text selection on this element.

func (*CheckboxElement) DefaultStyle

func (b *CheckboxElement) DefaultStyle() style.Style

DefaultStyle returns the element-type default style.

func (*CheckboxElement) Disabled

func (c *CheckboxElement) Disabled(v bool) *CheckboxElement

func (*CheckboxElement) DispatchEvent

func (b *CheckboxElement) DispatchEvent(e event.Event)

DispatchEvent fires an event that propagates through the DOM tree.

func (*CheckboxElement) EventListeners

func (b *CheckboxElement) EventListeners() []PendingListener

EventListeners returns the event listener registrations for this element. Used by the engine's event-target resolver to wire up dispatch.

func (*CheckboxElement) Hidden

func (b *CheckboxElement) Hidden(v bool) *Self

Hidden sets or clears the hidden state and returns *Self.

func (*CheckboxElement) IntrinsicStyle

func (b *CheckboxElement) IntrinsicStyle() style.Style

IntrinsicStyle returns the UA-mandated forced style for this element. Properties set here have the highest cascade precedence; authors cannot override them via Style(). Most elements return an empty style.S(). Replaced and compound elements return a sparse Style with UA-forced properties (e.g. Display:InlineBlock, OverflowX:Clip). See ADR-010.

func (*CheckboxElement) IsCursorNavigable

func (b *CheckboxElement) IsCursorNavigable() bool

IsCursorNavigable reports whether the element is cursor-navigable.

func (*CheckboxElement) IsDirtyStyle

func (b *CheckboxElement) IsDirtyStyle() bool

IsDirtyStyle reports whether this element's style needs re-resolution.

func (*CheckboxElement) IsDisabled

func (c *CheckboxElement) IsDisabled() bool

func (*CheckboxElement) IsHidden

func (b *CheckboxElement) IsHidden() bool

IsHidden reports whether the element is hidden.

func (*CheckboxElement) Listeners

func (b *CheckboxElement) Listeners() []PendingListener

Listeners returns the set of event listeners registered on this element.

func (*CheckboxElement) MoveCaret

func (b *CheckboxElement) MoveCaret(dir dom.Direction) (boundaryReached bool)

MoveCaret satisfies the dom.SpatialCaret interface.

func (*CheckboxElement) Name

func (c *CheckboxElement) Name() string

Name returns the form control name.

func (*CheckboxElement) OnBlur

func (b *CheckboxElement) OnBlur(fn func(*event.FocusEvent)) *Self

OnBlur registers a typed blur listener and returns *Self.

func (*CheckboxElement) OnChange

func (c *CheckboxElement) OnChange(fn func(bool)) *CheckboxElement

OnChange registers a callback invoked with the new checked state on user toggle (click or Space), never on programmatic SetChecked calls.

func (*CheckboxElement) OnClick

func (b *CheckboxElement) OnClick(fn func(*event.MouseEvent)) *Self

OnClick registers a typed click listener and returns *Self.

func (*CheckboxElement) OnConnect

func (b *CheckboxElement) OnConnect(fn func()) *Self

OnConnect registers fn to run each time the element enters the live document.

func (*CheckboxElement) OnConnected

func (b *CheckboxElement) OnConnected()

func (*CheckboxElement) OnDisconnect

func (b *CheckboxElement) OnDisconnect(fn func()) *Self

OnDisconnect registers fn to run just before the element leaves the live document.

func (*CheckboxElement) OnDisconnected

func (b *CheckboxElement) OnDisconnected()

func (*CheckboxElement) OnEvent

func (b *CheckboxElement) OnEvent(typ event.EventType, fn event.Listener) *Self

OnEvent registers fn as a listener for event of type typ and returns *Self. Listeners are stored on the element and retrieved by the engine's event-target resolver during dispatch setup. Nil handlers are ignored.

func (*CheckboxElement) OnFocus

func (b *CheckboxElement) OnFocus(fn func(*event.FocusEvent)) *Self

OnFocus registers a typed focus listener and returns *Self.

func (*CheckboxElement) OnKey

func (b *CheckboxElement) OnKey(combo string, fn func(*event.KeyEvent)) *Self

OnKey registers a keydown listener filtered by combo via event.KeyEvent.MatchString and returns *Self.

func (*CheckboxElement) OnKeyDown

func (b *CheckboxElement) OnKeyDown(fn func(*event.KeyEvent)) *Self

OnKeyDown registers a typed keydown listener and returns *Self.

func (*CheckboxElement) OnKeyPress

func (b *CheckboxElement) OnKeyPress(fn func(*event.KeyEvent)) *Self

OnKeyPress registers a typed keypress listener and returns *Self.

func (*CheckboxElement) OnKeyUp

func (b *CheckboxElement) OnKeyUp(fn func(*event.KeyEvent)) *Self

OnKeyUp registers a typed keyup listener and returns *Self.

func (*CheckboxElement) OnMouseDown

func (b *CheckboxElement) OnMouseDown(fn func(*event.MouseEvent)) *Self

OnMouseDown registers a typed mousedown listener and returns *Self.

func (*CheckboxElement) OnMouseEnter

func (b *CheckboxElement) OnMouseEnter(fn func(*event.MouseEvent)) *Self

OnMouseEnter registers a typed mouseenter listener and returns *Self.

func (*CheckboxElement) OnMouseLeave

func (b *CheckboxElement) OnMouseLeave(fn func(*event.MouseEvent)) *Self

OnMouseLeave registers a typed mouseleave listener and returns *Self.

func (*CheckboxElement) OnMouseMove

func (b *CheckboxElement) OnMouseMove(fn func(*event.MouseEvent)) *Self

OnMouseMove registers a typed mousemove listener and returns *Self.

func (*CheckboxElement) OnMouseUp

func (b *CheckboxElement) OnMouseUp(fn func(*event.MouseEvent)) *Self

OnMouseUp registers a typed mouseup listener and returns *Self.

func (*CheckboxElement) OnPress

func (b *CheckboxElement) OnPress(fn func()) *Self

OnPress registers a zero-argument activation listener on click (including keyboard Enter/Space activation on buttons) and returns *Self.

func (*CheckboxElement) OnSelectionChange

func (b *CheckboxElement) OnSelectionChange(fn func(*event.SelectionChangeEvent)) *Self

OnSelectionChange registers a typed selectionchange listener and returns *Self.

func (*CheckboxElement) OnWheelEvent

func (b *CheckboxElement) OnWheelEvent(fn func(*event.WheelEvent)) *Self

OnWheelEvent registers a typed wheel listener and returns *Self. Named OnWheelEvent to avoid colliding with event.Scrollable's OnWheel method.

func (*CheckboxElement) RawStyle

func (b *CheckboxElement) RawStyle() style.Style

RawStyle returns the author-set style for this element.

func (*CheckboxElement) Ref

func (b *CheckboxElement) Ref(dst **Self) *Self

Ref stores a pointer to the concrete element into dst (if non-nil) and returns *Self.

func (*CheckboxElement) ResetCaret

func (b *CheckboxElement) ResetCaret(dir dom.Direction)

ResetCaret satisfies the dom.SpatialCaret interface.

func (*CheckboxElement) ScrollbarX

func (b *CheckboxElement) ScrollbarX(v bool) *Self

ScrollbarX enables or disables the horizontal scrollbar and returns *Self.

func (*CheckboxElement) ScrollbarY

func (b *CheckboxElement) ScrollbarY(v bool) *Self

ScrollbarY enables or disables the vertical scrollbar and returns *Self.

func (*CheckboxElement) SetChecked

func (c *CheckboxElement) SetChecked(checked bool) *CheckboxElement

SetChecked sets the checked state and updates the UI.

func (*CheckboxElement) SetCursorNavigable

func (b *CheckboxElement) SetCursorNavigable(v bool)

SetCursorNavigable sets whether the element is cursor-navigable.

func (*CheckboxElement) SetDisabled

func (c *CheckboxElement) SetDisabled(v bool)

func (*CheckboxElement) SetGlyphs

func (c *CheckboxElement) SetGlyphs(unchecked, checked string) *CheckboxElement

SetGlyphs customizes the strings used for unchecked and checked states.

func (*CheckboxElement) SetHidden

func (b *CheckboxElement) SetHidden(v bool)

SetHidden sets or clears the hidden state and marks style dirty.

func (*CheckboxElement) SetStyle

func (b *CheckboxElement) SetStyle(s style.Style)

SetStyle replaces the element's style wholesale and marks style dirty.

func (*CheckboxElement) SetText

func (b *CheckboxElement) SetText(text string) *Self

SetText replaces the element's children with a single text node containing text, updating an existing sole text child in place when possible, and returns *Self.

func (*CheckboxElement) SetTextf

func (b *CheckboxElement) SetTextf(format string, args ...any) *Self

SetTextf formats text with fmt.Sprintf and passes the result to [SetText].

func (*CheckboxElement) Style

func (b *CheckboxElement) Style(s style.Style) *Self

Style replaces the element's style wholesale and returns *Self. Calling Style twice discards the first call; style composition belongs at the style.Style value level via Style.Merge.

func (*CheckboxElement) Unwrap

func (b *CheckboxElement) Unwrap() dom.Node

Unwrap returns the underlying dom.Node.

func (*CheckboxElement) Value

func (c *CheckboxElement) Value() any

Value returns the checked state of the checkbox.

func (*CheckboxElement) WithClass

func (b *CheckboxElement) WithClass(class string) *Self

WithClass sets the string classification tag and returns *Self.

func (*CheckboxElement) WithID

func (b *CheckboxElement) WithID(id string) *Self

WithID sets the element's identifier and returns *Self.

func (*CheckboxElement) WithName

func (c *CheckboxElement) WithName(name string) *CheckboxElement

WithName sets the form control name and returns the CheckboxElement.

func (*CheckboxElement) WithTabIndex

func (b *CheckboxElement) WithTabIndex(index int) *Self

WithTabIndex sets the tab index on the element and returns *Self.

type DialogElement

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

func Dialog

func Dialog(children ...any) *DialogElement

func NewDialog

func NewDialog(doc dom.Document, children ...any) *DialogElement

func (*DialogElement) AddChild

func (b *DialogElement) AddChild(child dom.Node) *Self

AddChild adds child as the last child of this element and returns the element itself for fluent chaining.

func (*DialogElement) Animate

func (b *DialogElement) Animate(
	from, to style.Style,
	opts animation.Options,
) *animation.Playback

Animate interpolates style properties from start to end on the element over opts.Duration using the document window's frame clock. Unrelated author styles are preserved via sparse merging, and the animation cancels automatically if the element disconnects from the document.

func (*DialogElement) CursorNavigable

func (b *DialogElement) CursorNavigable(v bool) *Self

CursorNavigable enables character-level caret navigation and text selection on this element.

func (*DialogElement) DefaultStyle

func (b *DialogElement) DefaultStyle() style.Style

DefaultStyle returns the element-type default style.

func (*DialogElement) DispatchEvent

func (b *DialogElement) DispatchEvent(e event.Event)

DispatchEvent fires an event that propagates through the DOM tree.

func (*DialogElement) EventListeners

func (b *DialogElement) EventListeners() []PendingListener

EventListeners returns the event listener registrations for this element. Used by the engine's event-target resolver to wire up dispatch.

func (*DialogElement) Hidden

func (b *DialogElement) Hidden(v bool) *Self

Hidden sets or clears the hidden state and returns *Self.

func (*DialogElement) IntrinsicStyle

func (b *DialogElement) IntrinsicStyle() style.Style

IntrinsicStyle returns the UA-mandated forced style for this element. Properties set here have the highest cascade precedence; authors cannot override them via Style(). Most elements return an empty style.S(). Replaced and compound elements return a sparse Style with UA-forced properties (e.g. Display:InlineBlock, OverflowX:Clip). See ADR-010.

func (*DialogElement) IsCursorNavigable

func (b *DialogElement) IsCursorNavigable() bool

IsCursorNavigable reports whether the element is cursor-navigable.

func (*DialogElement) IsDirtyStyle

func (b *DialogElement) IsDirtyStyle() bool

IsDirtyStyle reports whether this element's style needs re-resolution.

func (*DialogElement) IsFocusable

func (d *DialogElement) IsFocusable() bool

func (*DialogElement) IsHidden

func (b *DialogElement) IsHidden() bool

IsHidden reports whether the element is hidden.

func (*DialogElement) Listeners

func (b *DialogElement) Listeners() []PendingListener

Listeners returns the set of event listeners registered on this element.

func (*DialogElement) MoveCaret

func (b *DialogElement) MoveCaret(dir dom.Direction) (boundaryReached bool)

MoveCaret satisfies the dom.SpatialCaret interface.

func (*DialogElement) OnBlur

func (b *DialogElement) OnBlur(fn func(*event.FocusEvent)) *Self

OnBlur registers a typed blur listener and returns *Self.

func (*DialogElement) OnClick

func (b *DialogElement) OnClick(fn func(*event.MouseEvent)) *Self

OnClick registers a typed click listener and returns *Self.

func (*DialogElement) OnConnect

func (b *DialogElement) OnConnect(fn func()) *Self

OnConnect registers fn to run each time the element enters the live document.

func (*DialogElement) OnConnected

func (d *DialogElement) OnConnected()

func (*DialogElement) OnDisconnect

func (b *DialogElement) OnDisconnect(fn func()) *Self

OnDisconnect registers fn to run just before the element leaves the live document.

func (*DialogElement) OnDisconnected

func (d *DialogElement) OnDisconnected()

func (*DialogElement) OnEvent

func (b *DialogElement) OnEvent(typ event.EventType, fn event.Listener) *Self

OnEvent registers fn as a listener for event of type typ and returns *Self. Listeners are stored on the element and retrieved by the engine's event-target resolver during dispatch setup. Nil handlers are ignored.

func (*DialogElement) OnFocus

func (b *DialogElement) OnFocus(fn func(*event.FocusEvent)) *Self

OnFocus registers a typed focus listener and returns *Self.

func (*DialogElement) OnKey

func (b *DialogElement) OnKey(combo string, fn func(*event.KeyEvent)) *Self

OnKey registers a keydown listener filtered by combo via event.KeyEvent.MatchString and returns *Self.

func (*DialogElement) OnKeyDown

func (b *DialogElement) OnKeyDown(fn func(*event.KeyEvent)) *Self

OnKeyDown registers a typed keydown listener and returns *Self.

func (*DialogElement) OnKeyPress

func (b *DialogElement) OnKeyPress(fn func(*event.KeyEvent)) *Self

OnKeyPress registers a typed keypress listener and returns *Self.

func (*DialogElement) OnKeyUp

func (b *DialogElement) OnKeyUp(fn func(*event.KeyEvent)) *Self

OnKeyUp registers a typed keyup listener and returns *Self.

func (*DialogElement) OnMouseDown

func (b *DialogElement) OnMouseDown(fn func(*event.MouseEvent)) *Self

OnMouseDown registers a typed mousedown listener and returns *Self.

func (*DialogElement) OnMouseEnter

func (b *DialogElement) OnMouseEnter(fn func(*event.MouseEvent)) *Self

OnMouseEnter registers a typed mouseenter listener and returns *Self.

func (*DialogElement) OnMouseLeave

func (b *DialogElement) OnMouseLeave(fn func(*event.MouseEvent)) *Self

OnMouseLeave registers a typed mouseleave listener and returns *Self.

func (*DialogElement) OnMouseMove

func (b *DialogElement) OnMouseMove(fn func(*event.MouseEvent)) *Self

OnMouseMove registers a typed mousemove listener and returns *Self.

func (*DialogElement) OnMouseUp

func (b *DialogElement) OnMouseUp(fn func(*event.MouseEvent)) *Self

OnMouseUp registers a typed mouseup listener and returns *Self.

func (*DialogElement) OnPress

func (b *DialogElement) OnPress(fn func()) *Self

OnPress registers a zero-argument activation listener on click (including keyboard Enter/Space activation on buttons) and returns *Self.

func (*DialogElement) OnSelectionChange

func (b *DialogElement) OnSelectionChange(fn func(*event.SelectionChangeEvent)) *Self

OnSelectionChange registers a typed selectionchange listener and returns *Self.

func (*DialogElement) OnWheel

func (d *DialogElement) OnWheel(e *event.WheelEvent)

OnWheel implements event.Scrollable to trap scroll/wheel events inside the dialog.

func (*DialogElement) OnWheelEvent

func (b *DialogElement) OnWheelEvent(fn func(*event.WheelEvent)) *Self

OnWheelEvent registers a typed wheel listener and returns *Self. Named OnWheelEvent to avoid colliding with event.Scrollable's OnWheel method.

func (*DialogElement) RawStyle

func (b *DialogElement) RawStyle() style.Style

RawStyle returns the author-set style for this element.

func (*DialogElement) Ref

func (b *DialogElement) Ref(dst **Self) *Self

Ref stores a pointer to the concrete element into dst (if non-nil) and returns *Self.

func (*DialogElement) ResetCaret

func (b *DialogElement) ResetCaret(dir dom.Direction)

ResetCaret satisfies the dom.SpatialCaret interface.

func (*DialogElement) ScrollbarX

func (b *DialogElement) ScrollbarX(v bool) *Self

ScrollbarX enables or disables the horizontal scrollbar and returns *Self.

func (*DialogElement) ScrollbarY

func (b *DialogElement) ScrollbarY(v bool) *Self

ScrollbarY enables or disables the vertical scrollbar and returns *Self.

func (*DialogElement) SetCursorNavigable

func (b *DialogElement) SetCursorNavigable(v bool)

SetCursorNavigable sets whether the element is cursor-navigable.

func (*DialogElement) SetHidden

func (b *DialogElement) SetHidden(v bool)

SetHidden sets or clears the hidden state and marks style dirty.

func (*DialogElement) SetStyle

func (b *DialogElement) SetStyle(s style.Style)

SetStyle replaces the element's style wholesale and marks style dirty.

func (*DialogElement) SetText

func (b *DialogElement) SetText(text string) *Self

SetText replaces the element's children with a single text node containing text, updating an existing sole text child in place when possible, and returns *Self.

func (*DialogElement) SetTextf

func (b *DialogElement) SetTextf(format string, args ...any) *Self

SetTextf formats text with fmt.Sprintf and passes the result to [SetText].

func (*DialogElement) SetZIndex

func (d *DialogElement) SetZIndex(zIndex int) *DialogElement

SetZIndex updates the dialog's overlay z-index.

func (*DialogElement) Style

func (b *DialogElement) Style(s style.Style) *Self

Style replaces the element's style wholesale and returns *Self. Calling Style twice discards the first call; style composition belongs at the style.Style value level via Style.Merge.

func (*DialogElement) Unwrap

func (b *DialogElement) Unwrap() dom.Node

Unwrap returns the underlying dom.Node.

func (*DialogElement) WithClass

func (b *DialogElement) WithClass(class string) *Self

WithClass sets the string classification tag and returns *Self.

func (*DialogElement) WithID

func (b *DialogElement) WithID(id string) *Self

WithID sets the element's identifier and returns *Self.

func (*DialogElement) WithTabIndex

func (b *DialogElement) WithTabIndex(index int) *Self

WithTabIndex sets the tab index on the element and returns *Self.

func (*DialogElement) ZIndex

func (d *DialogElement) ZIndex(zIndex int) *DialogElement

ZIndex updates the dialog's overlay z-index.

type Element

type Element interface {
	dom.Element

	// RawStyle returns the author-set style for this element.
	RawStyle() style.Style

	// SetStyle replaces the author-set style for this element and marks style dirty.
	SetStyle(s style.Style)

	// IsHidden reports whether the element is in the hidden state.
	IsHidden() bool

	// SetHidden sets or clears the element's hidden state and marks style dirty.
	SetHidden(v bool)

	// Listeners returns the set of event listeners registered on this element.
	Listeners() []PendingListener

	// DispatchEvent fires an event that propagates through the DOM tree.
	DispatchEvent(e event.Event)

	// SetCursorNavigable sets whether the element is cursor-navigable.
	SetCursorNavigable(bool)
	// IsCursorNavigable reports whether the element is cursor-navigable.
	IsCursorNavigable() bool
}

Element is the interface satisfied by every native element type. It extends dom.Element so wrapper elements can participate directly in logical-tree APIs while still exposing builder-oriented style and state helpers.

type FormElement

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

FormElement implements the HTML <form> container element.

func Form

func Form(children ...any) *FormElement

Form creates a new FormElement using the orphan document.

Example
package main

import (
	"fmt"

	"github.com/masterkeysrd/kite/element"
	"github.com/masterkeysrd/kite/event"
	"github.com/masterkeysrd/kite/testenv"
)

func main() {
	env := testenv.New(nil, 40, 5)
	defer env.Close()

	save := element.Button("Save").Type("submit")
	form := element.Form(
		element.Input("Ada").WithName("name"),
		element.Checkbox(true).WithName("notify"),
		save,
	)
	form.AddEventListener(event.EventSubmit, func(e event.Event) {
		data := e.(*event.SubmitEvent).FormData
		fmt.Printf("%s: notifications %v\n", data["name"], data["notify"])
	})

	env.Mount(form)
	env.Flush()
	env.ClickElement(save)
}
Output:
Ada: notifications true

func NewForm

func NewForm(doc dom.Document, children ...any) *FormElement

NewForm creates a new FormElement owned by doc.

func (*FormElement) AddChild

func (b *FormElement) AddChild(child dom.Node) *Self

AddChild adds child as the last child of this element and returns the element itself for fluent chaining.

func (*FormElement) Animate

func (b *FormElement) Animate(
	from, to style.Style,
	opts animation.Options,
) *animation.Playback

Animate interpolates style properties from start to end on the element over opts.Duration using the document window's frame clock. Unrelated author styles are preserved via sparse merging, and the animation cancels automatically if the element disconnects from the document.

func (*FormElement) CursorNavigable

func (b *FormElement) CursorNavigable(v bool) *Self

CursorNavigable enables character-level caret navigation and text selection on this element.

func (*FormElement) DefaultStyle

func (b *FormElement) DefaultStyle() style.Style

DefaultStyle returns the element-type default style.

func (*FormElement) DispatchEvent

func (b *FormElement) DispatchEvent(e event.Event)

DispatchEvent fires an event that propagates through the DOM tree.

func (*FormElement) EventListeners

func (b *FormElement) EventListeners() []PendingListener

EventListeners returns the event listener registrations for this element. Used by the engine's event-target resolver to wire up dispatch.

func (*FormElement) Hidden

func (b *FormElement) Hidden(v bool) *Self

Hidden sets or clears the hidden state and returns *Self.

func (*FormElement) IntrinsicStyle

func (b *FormElement) IntrinsicStyle() style.Style

IntrinsicStyle returns the UA-mandated forced style for this element. Properties set here have the highest cascade precedence; authors cannot override them via Style(). Most elements return an empty style.S(). Replaced and compound elements return a sparse Style with UA-forced properties (e.g. Display:InlineBlock, OverflowX:Clip). See ADR-010.

func (*FormElement) IsCursorNavigable

func (b *FormElement) IsCursorNavigable() bool

IsCursorNavigable reports whether the element is cursor-navigable.

func (*FormElement) IsDirtyStyle

func (b *FormElement) IsDirtyStyle() bool

IsDirtyStyle reports whether this element's style needs re-resolution.

func (*FormElement) IsHidden

func (b *FormElement) IsHidden() bool

IsHidden reports whether the element is hidden.

func (*FormElement) Listeners

func (b *FormElement) Listeners() []PendingListener

Listeners returns the set of event listeners registered on this element.

func (*FormElement) MoveCaret

func (b *FormElement) MoveCaret(dir dom.Direction) (boundaryReached bool)

MoveCaret satisfies the dom.SpatialCaret interface.

func (*FormElement) OnBlur

func (b *FormElement) OnBlur(fn func(*event.FocusEvent)) *Self

OnBlur registers a typed blur listener and returns *Self.

func (*FormElement) OnClick

func (b *FormElement) OnClick(fn func(*event.MouseEvent)) *Self

OnClick registers a typed click listener and returns *Self.

func (*FormElement) OnConnect

func (b *FormElement) OnConnect(fn func()) *Self

OnConnect registers fn to run each time the element enters the live document.

func (*FormElement) OnConnected

func (b *FormElement) OnConnected()

func (*FormElement) OnDisconnect

func (b *FormElement) OnDisconnect(fn func()) *Self

OnDisconnect registers fn to run just before the element leaves the live document.

func (*FormElement) OnDisconnected

func (b *FormElement) OnDisconnected()

func (*FormElement) OnEvent

func (b *FormElement) OnEvent(typ event.EventType, fn event.Listener) *Self

OnEvent registers fn as a listener for event of type typ and returns *Self. Listeners are stored on the element and retrieved by the engine's event-target resolver during dispatch setup. Nil handlers are ignored.

func (*FormElement) OnFocus

func (b *FormElement) OnFocus(fn func(*event.FocusEvent)) *Self

OnFocus registers a typed focus listener and returns *Self.

func (*FormElement) OnKey

func (b *FormElement) OnKey(combo string, fn func(*event.KeyEvent)) *Self

OnKey registers a keydown listener filtered by combo via event.KeyEvent.MatchString and returns *Self.

func (*FormElement) OnKeyDown

func (b *FormElement) OnKeyDown(fn func(*event.KeyEvent)) *Self

OnKeyDown registers a typed keydown listener and returns *Self.

func (*FormElement) OnKeyPress

func (b *FormElement) OnKeyPress(fn func(*event.KeyEvent)) *Self

OnKeyPress registers a typed keypress listener and returns *Self.

func (*FormElement) OnKeyUp

func (b *FormElement) OnKeyUp(fn func(*event.KeyEvent)) *Self

OnKeyUp registers a typed keyup listener and returns *Self.

func (*FormElement) OnMouseDown

func (b *FormElement) OnMouseDown(fn func(*event.MouseEvent)) *Self

OnMouseDown registers a typed mousedown listener and returns *Self.

func (*FormElement) OnMouseEnter

func (b *FormElement) OnMouseEnter(fn func(*event.MouseEvent)) *Self

OnMouseEnter registers a typed mouseenter listener and returns *Self.

func (*FormElement) OnMouseLeave

func (b *FormElement) OnMouseLeave(fn func(*event.MouseEvent)) *Self

OnMouseLeave registers a typed mouseleave listener and returns *Self.

func (*FormElement) OnMouseMove

func (b *FormElement) OnMouseMove(fn func(*event.MouseEvent)) *Self

OnMouseMove registers a typed mousemove listener and returns *Self.

func (*FormElement) OnMouseUp

func (b *FormElement) OnMouseUp(fn func(*event.MouseEvent)) *Self

OnMouseUp registers a typed mouseup listener and returns *Self.

func (*FormElement) OnPress

func (b *FormElement) OnPress(fn func()) *Self

OnPress registers a zero-argument activation listener on click (including keyboard Enter/Space activation on buttons) and returns *Self.

func (*FormElement) OnSelectionChange

func (b *FormElement) OnSelectionChange(fn func(*event.SelectionChangeEvent)) *Self

OnSelectionChange registers a typed selectionchange listener and returns *Self.

func (*FormElement) OnWheelEvent

func (b *FormElement) OnWheelEvent(fn func(*event.WheelEvent)) *Self

OnWheelEvent registers a typed wheel listener and returns *Self. Named OnWheelEvent to avoid colliding with event.Scrollable's OnWheel method.

func (*FormElement) RawStyle

func (b *FormElement) RawStyle() style.Style

RawStyle returns the author-set style for this element.

func (*FormElement) Ref

func (b *FormElement) Ref(dst **Self) *Self

Ref stores a pointer to the concrete element into dst (if non-nil) and returns *Self.

func (*FormElement) Reset

func (f *FormElement) Reset()

Reset dispatches a cancelable EventReset and restores all descendant form controls to their initial values unless a listener called PreventDefault.

func (*FormElement) ResetCaret

func (b *FormElement) ResetCaret(dir dom.Direction)

ResetCaret satisfies the dom.SpatialCaret interface.

func (*FormElement) ScrollbarX

func (b *FormElement) ScrollbarX(v bool) *Self

ScrollbarX enables or disables the horizontal scrollbar and returns *Self.

func (*FormElement) ScrollbarY

func (b *FormElement) ScrollbarY(v bool) *Self

ScrollbarY enables or disables the vertical scrollbar and returns *Self.

func (*FormElement) SetCursorNavigable

func (b *FormElement) SetCursorNavigable(v bool)

SetCursorNavigable sets whether the element is cursor-navigable.

func (*FormElement) SetHidden

func (b *FormElement) SetHidden(v bool)

SetHidden sets or clears the hidden state and marks style dirty.

func (*FormElement) SetStyle

func (b *FormElement) SetStyle(s style.Style)

SetStyle replaces the element's style wholesale and marks style dirty.

func (*FormElement) SetText

func (b *FormElement) SetText(text string) *Self

SetText replaces the element's children with a single text node containing text, updating an existing sole text child in place when possible, and returns *Self.

func (*FormElement) SetTextf

func (b *FormElement) SetTextf(format string, args ...any) *Self

SetTextf formats text with fmt.Sprintf and passes the result to [SetText].

func (*FormElement) SetValues

func (f *FormElement) SetValues(values map[string]any)

SetValues updates named descendant form controls from values. Exact name matches take precedence, falling back to case-insensitive matches.

func (*FormElement) Style

func (b *FormElement) Style(s style.Style) *Self

Style replaces the element's style wholesale and returns *Self. Calling Style twice discards the first call; style composition belongs at the style.Style value level via Style.Merge.

func (*FormElement) Submit

func (f *FormElement) Submit()

Submit collects all FormControl values in f's subtree and dispatches EventSubmit.

func (*FormElement) Unwrap

func (b *FormElement) Unwrap() dom.Node

Unwrap returns the underlying dom.Node.

func (*FormElement) Values

func (f *FormElement) Values() map[string]any

Values collects the current values of all named form controls in f's subtree.

func (*FormElement) WithClass

func (b *FormElement) WithClass(class string) *Self

WithClass sets the string classification tag and returns *Self.

func (*FormElement) WithID

func (b *FormElement) WithID(id string) *Self

WithID sets the element's identifier and returns *Self.

func (*FormElement) WithTabIndex

func (b *FormElement) WithTabIndex(index int) *Self

WithTabIndex sets the tab index on the element and returns *Self.

type FormResetEvent

type FormResetEvent struct {
	*event.BaseEvent
	// contains filtered or unexported fields
}

FormResetEvent is dispatched before a FormElement resets its controls. Calling PreventDefault cancels the reset.

func (*FormResetEvent) AfterReset

func (e *FormResetEvent) AfterReset(fn func())

AfterReset registers fn to run after the form controls have been reset.

type InputElement

type InputElement struct {
	TextControlBase[*InputElement]
	// contains filtered or unexported fields
}

InputElement is a single-line text-input widget implemented as a UA shadow host (ADR-009).

Architecture summary:

  • The host gets a plain render.Box; the standard IFC shapes the text.
  • A UA shadow subtree is attached via AttachUARoot(): the structure is ua-input-root → ua-input-div → TextNode. The div is an unconstrained block that grows as the user types; the host clips it via overflow:clip and translates it via ScrollTo/ScrollBy.
  • UA-mandated styles live in IntrinsicStyle(): display:inline-block, overflow-x:clip, overflow-y:clip, white-space:nowrap.
  • Cursor positioning uses cursor.FromTextFragment on the inner div's fragment, whose direct children are the IFC line-boxes.
  • Common text-editing mechanics (CaretPosition, ScrollCursorIntoView, handleMouseDown, handleKeyDown) are implemented by the embedded TextControlBase[InputElement]. See ADR-013, TSK-029.

See ADR-009, ADR-010, ADR-013, TSK-024, TSK-029.

func Input

func Input(initialValue string) *InputElement

Input creates a new InputElement with the given initial value using the orphan document (for use in declarative tree construction).

func NewInput

func NewInput(doc dom.Document, initialValue string) *InputElement

NewInput creates a new InputElement owned by doc with an optional initial value.

func (*InputElement) AddChild

func (b *InputElement) AddChild(child dom.Node) *Self

AddChild adds child as the last child of this element and returns the element itself for fluent chaining.

func (*InputElement) Animate

func (b *InputElement) Animate(
	from, to style.Style,
	opts animation.Options,
) *animation.Playback

Animate interpolates style properties from start to end on the element over opts.Duration using the document window's frame clock. Unrelated author styles are preserved via sparse merging, and the animation cancels automatically if the element disconnects from the document.

func (*InputElement) Blur

func (inp *InputElement) Blur()

Blur programmatically removes focus from the input element.

func (*InputElement) Buffer

func (inp *InputElement) Buffer() *text.Buffer

Buffer returns the underlying text.Buffer for direct manipulation. After any direct mutation, callers must call SyncBuffer() to propagate the change to the UA text node and the render tree.

func (*InputElement) CursorNavigable

func (b *InputElement) CursorNavigable(v bool) *Self

CursorNavigable enables character-level caret navigation and text selection on this element.

func (*InputElement) DefaultStyle

func (b *InputElement) DefaultStyle() style.Style

DefaultStyle returns the element-type default style.

func (*InputElement) Disabled

func (inp *InputElement) Disabled(v bool) *InputElement

func (*InputElement) DispatchEvent

func (b *InputElement) DispatchEvent(e event.Event)

DispatchEvent fires an event that propagates through the DOM tree.

func (*InputElement) EventListeners

func (b *InputElement) EventListeners() []PendingListener

EventListeners returns the event listener registrations for this element. Used by the engine's event-target resolver to wire up dispatch.

func (*InputElement) Focus

func (inp *InputElement) Focus()

Focus programmatically moves focus to the input element.

func (*InputElement) Hidden

func (b *InputElement) Hidden(v bool) *Self

Hidden sets or clears the hidden state and returns *Self.

func (*InputElement) IntrinsicStyle

func (b *InputElement) IntrinsicStyle() style.Style

IntrinsicStyle returns the UA-mandated forced style for this element. Properties set here have the highest cascade precedence; authors cannot override them via Style(). Most elements return an empty style.S(). Replaced and compound elements return a sparse Style with UA-forced properties (e.g. Display:InlineBlock, OverflowX:Clip). See ADR-010.

func (*InputElement) IsCursorNavigable

func (b *InputElement) IsCursorNavigable() bool

IsCursorNavigable reports whether the element is cursor-navigable.

func (*InputElement) IsDirtyStyle

func (b *InputElement) IsDirtyStyle() bool

IsDirtyStyle reports whether this element's style needs re-resolution.

func (*InputElement) IsDisabled

func (inp *InputElement) IsDisabled() bool

func (*InputElement) IsFocusable

func (inp *InputElement) IsFocusable() bool

IsFocusable always returns true for input elements.

func (*InputElement) IsHidden

func (b *InputElement) IsHidden() bool

IsHidden reports whether the element is hidden.

func (*InputElement) Listeners

func (b *InputElement) Listeners() []PendingListener

Listeners returns the set of event listeners registered on this element.

func (*InputElement) Mask

func (inp *InputElement) Mask() rune

Mask returns the active mask rune, or 0 if masking is disabled. When password mode is enabled without a custom mask rune, it returns DefaultPasswordMask ('•').

func (*InputElement) MoveCaret

func (b *InputElement) MoveCaret(dir dom.Direction) (boundaryReached bool)

MoveCaret satisfies the dom.SpatialCaret interface.

func (*InputElement) Name

func (inp *InputElement) Name() string

Name returns the form control name.

func (*InputElement) OnBlur

func (b *InputElement) OnBlur(fn func(*event.FocusEvent)) *Self

OnBlur registers a typed blur listener and returns *Self.

func (*InputElement) OnChange

func (inp *InputElement) OnChange(fn func(string)) *InputElement

OnChange registers a callback invoked with the new text on user-initiated buffer edits, never on programmatic SetValue calls.

func (*InputElement) OnClick

func (b *InputElement) OnClick(fn func(*event.MouseEvent)) *Self

OnClick registers a typed click listener and returns *Self.

func (*InputElement) OnConnect

func (b *InputElement) OnConnect(fn func()) *Self

OnConnect registers fn to run each time the element enters the live document.

func (*InputElement) OnConnected

func (b *InputElement) OnConnected()

func (*InputElement) OnDisconnect

func (b *InputElement) OnDisconnect(fn func()) *Self

OnDisconnect registers fn to run just before the element leaves the live document.

func (*InputElement) OnDisconnected

func (b *InputElement) OnDisconnected()

func (*InputElement) OnEvent

func (b *InputElement) OnEvent(typ event.EventType, fn event.Listener) *Self

OnEvent registers fn as a listener for event of type typ and returns *Self. Listeners are stored on the element and retrieved by the engine's event-target resolver during dispatch setup. Nil handlers are ignored.

func (*InputElement) OnFocus

func (b *InputElement) OnFocus(fn func(*event.FocusEvent)) *Self

OnFocus registers a typed focus listener and returns *Self.

func (*InputElement) OnKey

func (b *InputElement) OnKey(combo string, fn func(*event.KeyEvent)) *Self

OnKey registers a keydown listener filtered by combo via event.KeyEvent.MatchString and returns *Self.

func (*InputElement) OnKeyDown

func (b *InputElement) OnKeyDown(fn func(*event.KeyEvent)) *Self

OnKeyDown registers a typed keydown listener and returns *Self.

func (*InputElement) OnKeyPress

func (b *InputElement) OnKeyPress(fn func(*event.KeyEvent)) *Self

OnKeyPress registers a typed keypress listener and returns *Self.

func (*InputElement) OnKeyUp

func (b *InputElement) OnKeyUp(fn func(*event.KeyEvent)) *Self

OnKeyUp registers a typed keyup listener and returns *Self.

func (*InputElement) OnMouseDown

func (b *InputElement) OnMouseDown(fn func(*event.MouseEvent)) *Self

OnMouseDown registers a typed mousedown listener and returns *Self.

func (*InputElement) OnMouseEnter

func (b *InputElement) OnMouseEnter(fn func(*event.MouseEvent)) *Self

OnMouseEnter registers a typed mouseenter listener and returns *Self.

func (*InputElement) OnMouseLeave

func (b *InputElement) OnMouseLeave(fn func(*event.MouseEvent)) *Self

OnMouseLeave registers a typed mouseleave listener and returns *Self.

func (*InputElement) OnMouseMove

func (b *InputElement) OnMouseMove(fn func(*event.MouseEvent)) *Self

OnMouseMove registers a typed mousemove listener and returns *Self.

func (*InputElement) OnMouseUp

func (b *InputElement) OnMouseUp(fn func(*event.MouseEvent)) *Self

OnMouseUp registers a typed mouseup listener and returns *Self.

func (*InputElement) OnPress

func (b *InputElement) OnPress(fn func()) *Self

OnPress registers a zero-argument activation listener on click (including keyboard Enter/Space activation on buttons) and returns *Self.

func (*InputElement) OnSelectionChange

func (b *InputElement) OnSelectionChange(fn func(*event.SelectionChangeEvent)) *Self

OnSelectionChange registers a typed selectionchange listener and returns *Self.

func (*InputElement) OnWheel

func (inp *InputElement) OnWheel(e *event.WheelEvent)

OnWheel implements event.Scrollable. Input disables wheel scrolling.

func (*InputElement) OnWheelEvent

func (b *InputElement) OnWheelEvent(fn func(*event.WheelEvent)) *Self

OnWheelEvent registers a typed wheel listener and returns *Self. Named OnWheelEvent to avoid colliding with event.Scrollable's OnWheel method.

func (*InputElement) Password

func (inp *InputElement) Password() bool

Password reports whether password display mode is enabled.

func (*InputElement) RawStyle

func (b *InputElement) RawStyle() style.Style

RawStyle returns the author-set style for this element.

func (*InputElement) Ref

func (b *InputElement) Ref(dst **Self) *Self

Ref stores a pointer to the concrete element into dst (if non-nil) and returns *Self.

func (*InputElement) ResetCaret

func (b *InputElement) ResetCaret(dir dom.Direction)

ResetCaret satisfies the dom.SpatialCaret interface.

func (*InputElement) ScrollbarX

func (b *InputElement) ScrollbarX(v bool) *Self

ScrollbarX enables or disables the horizontal scrollbar and returns *Self.

func (*InputElement) ScrollbarY

func (b *InputElement) ScrollbarY(v bool) *Self

ScrollbarY enables or disables the vertical scrollbar and returns *Self.

func (*InputElement) SetCursorNavigable

func (b *InputElement) SetCursorNavigable(v bool)

SetCursorNavigable sets whether the element is cursor-navigable.

func (*InputElement) SetDisabled

func (inp *InputElement) SetDisabled(v bool)

func (*InputElement) SetHidden

func (b *InputElement) SetHidden(v bool)

SetHidden sets or clears the hidden state and marks style dirty.

func (*InputElement) SetStyle

func (b *InputElement) SetStyle(s style.Style)

SetStyle replaces the element's style wholesale and marks style dirty.

func (*InputElement) SetText

func (b *InputElement) SetText(text string) *Self

SetText replaces the element's children with a single text node containing text, updating an existing sole text child in place when possible, and returns *Self.

func (*InputElement) SetTextf

func (b *InputElement) SetTextf(format string, args ...any) *Self

SetTextf formats text with fmt.Sprintf and passes the result to [SetText].

func (*InputElement) SetValue

func (inp *InputElement) SetValue(v string) *InputElement

SetValue replaces the buffer content with v, repositioning the cursor to the end of the new value.

func (*InputElement) Style

func (b *InputElement) Style(s style.Style) *Self

Style replaces the element's style wholesale and returns *Self. Calling Style twice discards the first call; style composition belongs at the style.Style value level via Style.Merge.

func (*InputElement) SyncBuffer

func (inp *InputElement) SyncBuffer()

SyncBuffer propagates the current buffer state to the UA text node and marks layout dirty. Call this after any direct mutation of Buffer().

func (*InputElement) Text

func (inp *InputElement) Text() string

Text returns the current text value of the input.

func (*InputElement) TextContent

func (inp *InputElement) TextContent() string

TextContent returns the current text value of the input, satisfying the dom.Node interface.

func (*InputElement) Unwrap

func (b *InputElement) Unwrap() dom.Node

Unwrap returns the underlying dom.Node.

func (*InputElement) Value

func (inp *InputElement) Value() any

Value returns the current text value of the input.

func (*InputElement) WithClass

func (b *InputElement) WithClass(class string) *Self

WithClass sets the string classification tag and returns *Self.

func (*InputElement) WithID

func (b *InputElement) WithID(id string) *Self

WithID sets the element's identifier and returns *Self.

func (*InputElement) WithMask

func (inp *InputElement) WithMask(r rune) *InputElement

WithMask sets a custom mask rune used to obscure displayed input text and returns the InputElement. Passing 0 clears the custom mask rune.

func (*InputElement) WithName

func (inp *InputElement) WithName(name string) *InputElement

WithName sets the form control name and returns the InputElement.

func (*InputElement) WithPassword

func (inp *InputElement) WithPassword(enabled bool) *InputElement

WithPassword enables or disables password display mode and returns the InputElement. When enabled without an explicit mask rune, DefaultPasswordMask ('•') is used to obscure displayed text.

func (*InputElement) WithPlaceholder

func (inp *InputElement) WithPlaceholder(p string) *InputElement

WithPlaceholder sets the placeholder text and returns the InputElement.

func (*InputElement) WithPlaceholderStyle

func (inp *InputElement) WithPlaceholderStyle(s style.Style) *InputElement

WithPlaceholderStyle sets the style for the placeholder and returns the InputElement.

func (*InputElement) WithTabIndex

func (b *InputElement) WithTabIndex(index int) *Self

WithTabIndex sets the tab index on the element and returns *Self.

type LabelElement

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

LabelElement represents an HTML <label> caption associated with a form control, either implicitly by wrapping it or explicitly via For(id).

func Label

func Label(children ...any) *LabelElement

Label creates a new LabelElement with the given children.

func NewLabel

func NewLabel(doc dom.Document, children ...any) *LabelElement

NewLabel creates a new LabelElement owned by doc.

func (*LabelElement) AddChild

func (b *LabelElement) AddChild(child dom.Node) *Self

AddChild adds child as the last child of this element and returns the element itself for fluent chaining.

func (*LabelElement) Animate

func (b *LabelElement) Animate(
	from, to style.Style,
	opts animation.Options,
) *animation.Playback

Animate interpolates style properties from start to end on the element over opts.Duration using the document window's frame clock. Unrelated author styles are preserved via sparse merging, and the animation cancels automatically if the element disconnects from the document.

func (*LabelElement) Control

func (l *LabelElement) Control() Element

Control returns the labelable form control associated with l, or nil.

func (*LabelElement) CursorNavigable

func (b *LabelElement) CursorNavigable(v bool) *Self

CursorNavigable enables character-level caret navigation and text selection on this element.

func (*LabelElement) DefaultStyle

func (b *LabelElement) DefaultStyle() style.Style

DefaultStyle returns the element-type default style.

func (*LabelElement) DispatchEvent

func (b *LabelElement) DispatchEvent(e event.Event)

DispatchEvent fires an event that propagates through the DOM tree.

func (*LabelElement) EventListeners

func (b *LabelElement) EventListeners() []PendingListener

EventListeners returns the event listener registrations for this element. Used by the engine's event-target resolver to wire up dispatch.

func (*LabelElement) For

func (l *LabelElement) For(id string) *LabelElement

For associates the label with the control whose ID equals id and returns l.

func (*LabelElement) ForID

func (l *LabelElement) ForID() string

ForID returns the explicit target control ID, or "" for implicit association.

func (*LabelElement) Hidden

func (b *LabelElement) Hidden(v bool) *Self

Hidden sets or clears the hidden state and returns *Self.

func (*LabelElement) IntrinsicStyle

func (b *LabelElement) IntrinsicStyle() style.Style

IntrinsicStyle returns the UA-mandated forced style for this element. Properties set here have the highest cascade precedence; authors cannot override them via Style(). Most elements return an empty style.S(). Replaced and compound elements return a sparse Style with UA-forced properties (e.g. Display:InlineBlock, OverflowX:Clip). See ADR-010.

func (*LabelElement) IsCursorNavigable

func (b *LabelElement) IsCursorNavigable() bool

IsCursorNavigable reports whether the element is cursor-navigable.

func (*LabelElement) IsDirtyStyle

func (b *LabelElement) IsDirtyStyle() bool

IsDirtyStyle reports whether this element's style needs re-resolution.

func (*LabelElement) IsHidden

func (b *LabelElement) IsHidden() bool

IsHidden reports whether the element is hidden.

func (*LabelElement) Listeners

func (b *LabelElement) Listeners() []PendingListener

Listeners returns the set of event listeners registered on this element.

func (*LabelElement) MoveCaret

func (b *LabelElement) MoveCaret(dir dom.Direction) (boundaryReached bool)

MoveCaret satisfies the dom.SpatialCaret interface.

func (*LabelElement) OnBlur

func (b *LabelElement) OnBlur(fn func(*event.FocusEvent)) *Self

OnBlur registers a typed blur listener and returns *Self.

func (*LabelElement) OnClick

func (b *LabelElement) OnClick(fn func(*event.MouseEvent)) *Self

OnClick registers a typed click listener and returns *Self.

func (*LabelElement) OnConnect

func (b *LabelElement) OnConnect(fn func()) *Self

OnConnect registers fn to run each time the element enters the live document.

func (*LabelElement) OnConnected

func (b *LabelElement) OnConnected()

func (*LabelElement) OnDisconnect

func (b *LabelElement) OnDisconnect(fn func()) *Self

OnDisconnect registers fn to run just before the element leaves the live document.

func (*LabelElement) OnDisconnected

func (b *LabelElement) OnDisconnected()

func (*LabelElement) OnEvent

func (b *LabelElement) OnEvent(typ event.EventType, fn event.Listener) *Self

OnEvent registers fn as a listener for event of type typ and returns *Self. Listeners are stored on the element and retrieved by the engine's event-target resolver during dispatch setup. Nil handlers are ignored.

func (*LabelElement) OnFocus

func (b *LabelElement) OnFocus(fn func(*event.FocusEvent)) *Self

OnFocus registers a typed focus listener and returns *Self.

func (*LabelElement) OnKey

func (b *LabelElement) OnKey(combo string, fn func(*event.KeyEvent)) *Self

OnKey registers a keydown listener filtered by combo via event.KeyEvent.MatchString and returns *Self.

func (*LabelElement) OnKeyDown

func (b *LabelElement) OnKeyDown(fn func(*event.KeyEvent)) *Self

OnKeyDown registers a typed keydown listener and returns *Self.

func (*LabelElement) OnKeyPress

func (b *LabelElement) OnKeyPress(fn func(*event.KeyEvent)) *Self

OnKeyPress registers a typed keypress listener and returns *Self.

func (*LabelElement) OnKeyUp

func (b *LabelElement) OnKeyUp(fn func(*event.KeyEvent)) *Self

OnKeyUp registers a typed keyup listener and returns *Self.

func (*LabelElement) OnMouseDown

func (b *LabelElement) OnMouseDown(fn func(*event.MouseEvent)) *Self

OnMouseDown registers a typed mousedown listener and returns *Self.

func (*LabelElement) OnMouseEnter

func (b *LabelElement) OnMouseEnter(fn func(*event.MouseEvent)) *Self

OnMouseEnter registers a typed mouseenter listener and returns *Self.

func (*LabelElement) OnMouseLeave

func (b *LabelElement) OnMouseLeave(fn func(*event.MouseEvent)) *Self

OnMouseLeave registers a typed mouseleave listener and returns *Self.

func (*LabelElement) OnMouseMove

func (b *LabelElement) OnMouseMove(fn func(*event.MouseEvent)) *Self

OnMouseMove registers a typed mousemove listener and returns *Self.

func (*LabelElement) OnMouseUp

func (b *LabelElement) OnMouseUp(fn func(*event.MouseEvent)) *Self

OnMouseUp registers a typed mouseup listener and returns *Self.

func (*LabelElement) OnPress

func (b *LabelElement) OnPress(fn func()) *Self

OnPress registers a zero-argument activation listener on click (including keyboard Enter/Space activation on buttons) and returns *Self.

func (*LabelElement) OnSelectionChange

func (b *LabelElement) OnSelectionChange(fn func(*event.SelectionChangeEvent)) *Self

OnSelectionChange registers a typed selectionchange listener and returns *Self.

func (*LabelElement) OnWheelEvent

func (b *LabelElement) OnWheelEvent(fn func(*event.WheelEvent)) *Self

OnWheelEvent registers a typed wheel listener and returns *Self. Named OnWheelEvent to avoid colliding with event.Scrollable's OnWheel method.

func (*LabelElement) RawStyle

func (b *LabelElement) RawStyle() style.Style

RawStyle returns the author-set style for this element.

func (*LabelElement) Ref

func (b *LabelElement) Ref(dst **Self) *Self

Ref stores a pointer to the concrete element into dst (if non-nil) and returns *Self.

func (*LabelElement) ResetCaret

func (b *LabelElement) ResetCaret(dir dom.Direction)

ResetCaret satisfies the dom.SpatialCaret interface.

func (*LabelElement) ScrollbarX

func (b *LabelElement) ScrollbarX(v bool) *Self

ScrollbarX enables or disables the horizontal scrollbar and returns *Self.

func (*LabelElement) ScrollbarY

func (b *LabelElement) ScrollbarY(v bool) *Self

ScrollbarY enables or disables the vertical scrollbar and returns *Self.

func (*LabelElement) SetCursorNavigable

func (b *LabelElement) SetCursorNavigable(v bool)

SetCursorNavigable sets whether the element is cursor-navigable.

func (*LabelElement) SetFor

func (l *LabelElement) SetFor(id string)

SetFor updates the target control ID for explicit label association.

func (*LabelElement) SetHidden

func (b *LabelElement) SetHidden(v bool)

SetHidden sets or clears the hidden state and marks style dirty.

func (*LabelElement) SetStyle

func (b *LabelElement) SetStyle(s style.Style)

SetStyle replaces the element's style wholesale and marks style dirty.

func (*LabelElement) SetText

func (b *LabelElement) SetText(text string) *Self

SetText replaces the element's children with a single text node containing text, updating an existing sole text child in place when possible, and returns *Self.

func (*LabelElement) SetTextf

func (b *LabelElement) SetTextf(format string, args ...any) *Self

SetTextf formats text with fmt.Sprintf and passes the result to [SetText].

func (*LabelElement) Style

func (b *LabelElement) Style(s style.Style) *Self

Style replaces the element's style wholesale and returns *Self. Calling Style twice discards the first call; style composition belongs at the style.Style value level via Style.Merge.

func (*LabelElement) Unwrap

func (b *LabelElement) Unwrap() dom.Node

Unwrap returns the underlying dom.Node.

func (*LabelElement) WithClass

func (b *LabelElement) WithClass(class string) *Self

WithClass sets the string classification tag and returns *Self.

func (*LabelElement) WithID

func (b *LabelElement) WithID(id string) *Self

WithID sets the element's identifier and returns *Self.

func (*LabelElement) WithTabIndex

func (b *LabelElement) WithTabIndex(index int) *Self

WithTabIndex sets the tab index on the element and returns *Self.

type ListItemElement

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

ListItemElement represents an item in a list (<li>).

func LI

func LI(children ...any) *ListItemElement

LI creates a new list item with the given children.

func NewListItem

func NewListItem(doc dom.Document) *ListItemElement

NewListItem creates a new list item.

func (*ListItemElement) AddChild

func (b *ListItemElement) AddChild(child dom.Node) *Self

AddChild adds child as the last child of this element and returns the element itself for fluent chaining.

func (*ListItemElement) Animate

func (b *ListItemElement) Animate(
	from, to style.Style,
	opts animation.Options,
) *animation.Playback

Animate interpolates style properties from start to end on the element over opts.Duration using the document window's frame clock. Unrelated author styles are preserved via sparse merging, and the animation cancels automatically if the element disconnects from the document.

func (*ListItemElement) CursorNavigable

func (b *ListItemElement) CursorNavigable(v bool) *Self

CursorNavigable enables character-level caret navigation and text selection on this element.

func (*ListItemElement) DefaultStyle

func (b *ListItemElement) DefaultStyle() style.Style

DefaultStyle returns the element-type default style.

func (*ListItemElement) DispatchEvent

func (b *ListItemElement) DispatchEvent(e event.Event)

DispatchEvent fires an event that propagates through the DOM tree.

func (*ListItemElement) EventListeners

func (b *ListItemElement) EventListeners() []PendingListener

EventListeners returns the event listener registrations for this element. Used by the engine's event-target resolver to wire up dispatch.

func (*ListItemElement) Hidden

func (b *ListItemElement) Hidden(v bool) *Self

Hidden sets or clears the hidden state and returns *Self.

func (*ListItemElement) IntrinsicStyle

func (b *ListItemElement) IntrinsicStyle() style.Style

IntrinsicStyle returns the UA-mandated forced style for this element. Properties set here have the highest cascade precedence; authors cannot override them via Style(). Most elements return an empty style.S(). Replaced and compound elements return a sparse Style with UA-forced properties (e.g. Display:InlineBlock, OverflowX:Clip). See ADR-010.

func (*ListItemElement) IsCursorNavigable

func (b *ListItemElement) IsCursorNavigable() bool

IsCursorNavigable reports whether the element is cursor-navigable.

func (*ListItemElement) IsDirtyStyle

func (b *ListItemElement) IsDirtyStyle() bool

IsDirtyStyle reports whether this element's style needs re-resolution.

func (*ListItemElement) IsHidden

func (b *ListItemElement) IsHidden() bool

IsHidden reports whether the element is hidden.

func (*ListItemElement) Listeners

func (b *ListItemElement) Listeners() []PendingListener

Listeners returns the set of event listeners registered on this element.

func (*ListItemElement) MoveCaret

func (b *ListItemElement) MoveCaret(dir dom.Direction) (boundaryReached bool)

MoveCaret satisfies the dom.SpatialCaret interface.

func (*ListItemElement) OnBlur

func (b *ListItemElement) OnBlur(fn func(*event.FocusEvent)) *Self

OnBlur registers a typed blur listener and returns *Self.

func (*ListItemElement) OnClick

func (b *ListItemElement) OnClick(fn func(*event.MouseEvent)) *Self

OnClick registers a typed click listener and returns *Self.

func (*ListItemElement) OnConnect

func (b *ListItemElement) OnConnect(fn func()) *Self

OnConnect registers fn to run each time the element enters the live document.

func (*ListItemElement) OnConnected

func (b *ListItemElement) OnConnected()

func (*ListItemElement) OnDisconnect

func (b *ListItemElement) OnDisconnect(fn func()) *Self

OnDisconnect registers fn to run just before the element leaves the live document.

func (*ListItemElement) OnDisconnected

func (b *ListItemElement) OnDisconnected()

func (*ListItemElement) OnEvent

func (b *ListItemElement) OnEvent(typ event.EventType, fn event.Listener) *Self

OnEvent registers fn as a listener for event of type typ and returns *Self. Listeners are stored on the element and retrieved by the engine's event-target resolver during dispatch setup. Nil handlers are ignored.

func (*ListItemElement) OnFocus

func (b *ListItemElement) OnFocus(fn func(*event.FocusEvent)) *Self

OnFocus registers a typed focus listener and returns *Self.

func (*ListItemElement) OnKey

func (b *ListItemElement) OnKey(combo string, fn func(*event.KeyEvent)) *Self

OnKey registers a keydown listener filtered by combo via event.KeyEvent.MatchString and returns *Self.

func (*ListItemElement) OnKeyDown

func (b *ListItemElement) OnKeyDown(fn func(*event.KeyEvent)) *Self

OnKeyDown registers a typed keydown listener and returns *Self.

func (*ListItemElement) OnKeyPress

func (b *ListItemElement) OnKeyPress(fn func(*event.KeyEvent)) *Self

OnKeyPress registers a typed keypress listener and returns *Self.

func (*ListItemElement) OnKeyUp

func (b *ListItemElement) OnKeyUp(fn func(*event.KeyEvent)) *Self

OnKeyUp registers a typed keyup listener and returns *Self.

func (*ListItemElement) OnMouseDown

func (b *ListItemElement) OnMouseDown(fn func(*event.MouseEvent)) *Self

OnMouseDown registers a typed mousedown listener and returns *Self.

func (*ListItemElement) OnMouseEnter

func (b *ListItemElement) OnMouseEnter(fn func(*event.MouseEvent)) *Self

OnMouseEnter registers a typed mouseenter listener and returns *Self.

func (*ListItemElement) OnMouseLeave

func (b *ListItemElement) OnMouseLeave(fn func(*event.MouseEvent)) *Self

OnMouseLeave registers a typed mouseleave listener and returns *Self.

func (*ListItemElement) OnMouseMove

func (b *ListItemElement) OnMouseMove(fn func(*event.MouseEvent)) *Self

OnMouseMove registers a typed mousemove listener and returns *Self.

func (*ListItemElement) OnMouseUp

func (b *ListItemElement) OnMouseUp(fn func(*event.MouseEvent)) *Self

OnMouseUp registers a typed mouseup listener and returns *Self.

func (*ListItemElement) OnPress

func (b *ListItemElement) OnPress(fn func()) *Self

OnPress registers a zero-argument activation listener on click (including keyboard Enter/Space activation on buttons) and returns *Self.

func (*ListItemElement) OnSelectionChange

func (b *ListItemElement) OnSelectionChange(fn func(*event.SelectionChangeEvent)) *Self

OnSelectionChange registers a typed selectionchange listener and returns *Self.

func (*ListItemElement) OnWheelEvent

func (b *ListItemElement) OnWheelEvent(fn func(*event.WheelEvent)) *Self

OnWheelEvent registers a typed wheel listener and returns *Self. Named OnWheelEvent to avoid colliding with event.Scrollable's OnWheel method.

func (*ListItemElement) RawStyle

func (b *ListItemElement) RawStyle() style.Style

RawStyle returns the author-set style for this element.

func (*ListItemElement) Ref

func (b *ListItemElement) Ref(dst **Self) *Self

Ref stores a pointer to the concrete element into dst (if non-nil) and returns *Self.

func (*ListItemElement) ResetCaret

func (b *ListItemElement) ResetCaret(dir dom.Direction)

ResetCaret satisfies the dom.SpatialCaret interface.

func (*ListItemElement) ScrollbarX

func (b *ListItemElement) ScrollbarX(v bool) *Self

ScrollbarX enables or disables the horizontal scrollbar and returns *Self.

func (*ListItemElement) ScrollbarY

func (b *ListItemElement) ScrollbarY(v bool) *Self

ScrollbarY enables or disables the vertical scrollbar and returns *Self.

func (*ListItemElement) SetCursorNavigable

func (b *ListItemElement) SetCursorNavigable(v bool)

SetCursorNavigable sets whether the element is cursor-navigable.

func (*ListItemElement) SetHidden

func (b *ListItemElement) SetHidden(v bool)

SetHidden sets or clears the hidden state and marks style dirty.

func (*ListItemElement) SetStyle

func (b *ListItemElement) SetStyle(s style.Style)

SetStyle replaces the element's style wholesale and marks style dirty.

func (*ListItemElement) SetText

func (b *ListItemElement) SetText(text string) *Self

SetText replaces the element's children with a single text node containing text, updating an existing sole text child in place when possible, and returns *Self.

func (*ListItemElement) SetTextf

func (b *ListItemElement) SetTextf(format string, args ...any) *Self

SetTextf formats text with fmt.Sprintf and passes the result to [SetText].

func (*ListItemElement) Style

func (b *ListItemElement) Style(s style.Style) *Self

Style replaces the element's style wholesale and returns *Self. Calling Style twice discards the first call; style composition belongs at the style.Style value level via Style.Merge.

func (*ListItemElement) Unwrap

func (b *ListItemElement) Unwrap() dom.Node

Unwrap returns the underlying dom.Node.

func (*ListItemElement) WithClass

func (b *ListItemElement) WithClass(class string) *Self

WithClass sets the string classification tag and returns *Self.

func (*ListItemElement) WithID

func (b *ListItemElement) WithID(id string) *Self

WithID sets the element's identifier and returns *Self.

func (*ListItemElement) WithTabIndex

func (b *ListItemElement) WithTabIndex(index int) *Self

WithTabIndex sets the tab index on the element and returns *Self.

type OptionElement

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

OptionElement represents a single option in a Select component. It is a metadata-only element that does not participate in the main render tree.

func NewOption

func NewOption(doc dom.Document, text, value string) *OptionElement

NewOption creates a new OptionElement owned by doc.

func Option

func Option(text, value string) *OptionElement

Option creates a new OptionElement with the given text and value.

func (*OptionElement) AddChild

func (b *OptionElement) AddChild(child dom.Node) *Self

AddChild adds child as the last child of this element and returns the element itself for fluent chaining.

func (*OptionElement) Animate

func (b *OptionElement) Animate(
	from, to style.Style,
	opts animation.Options,
) *animation.Playback

Animate interpolates style properties from start to end on the element over opts.Duration using the document window's frame clock. Unrelated author styles are preserved via sparse merging, and the animation cancels automatically if the element disconnects from the document.

func (*OptionElement) CursorNavigable

func (b *OptionElement) CursorNavigable(v bool) *Self

CursorNavigable enables character-level caret navigation and text selection on this element.

func (*OptionElement) DefaultStyle

func (b *OptionElement) DefaultStyle() style.Style

DefaultStyle returns the element-type default style.

func (*OptionElement) Disabled

func (o *OptionElement) Disabled(v bool) *OptionElement

func (*OptionElement) DispatchEvent

func (b *OptionElement) DispatchEvent(e event.Event)

DispatchEvent fires an event that propagates through the DOM tree.

func (*OptionElement) EventListeners

func (b *OptionElement) EventListeners() []PendingListener

EventListeners returns the event listener registrations for this element. Used by the engine's event-target resolver to wire up dispatch.

func (*OptionElement) Hidden

func (b *OptionElement) Hidden(v bool) *Self

Hidden sets or clears the hidden state and returns *Self.

func (*OptionElement) IntrinsicStyle

func (o *OptionElement) IntrinsicStyle() style.Style

func (*OptionElement) IsCursorNavigable

func (b *OptionElement) IsCursorNavigable() bool

IsCursorNavigable reports whether the element is cursor-navigable.

func (*OptionElement) IsDirtyStyle

func (b *OptionElement) IsDirtyStyle() bool

IsDirtyStyle reports whether this element's style needs re-resolution.

func (*OptionElement) IsDisabled

func (o *OptionElement) IsDisabled() bool

func (*OptionElement) IsHidden

func (b *OptionElement) IsHidden() bool

IsHidden reports whether the element is hidden.

func (*OptionElement) Listeners

func (b *OptionElement) Listeners() []PendingListener

Listeners returns the set of event listeners registered on this element.

func (*OptionElement) MoveCaret

func (b *OptionElement) MoveCaret(dir dom.Direction) (boundaryReached bool)

MoveCaret satisfies the dom.SpatialCaret interface.

func (*OptionElement) OnBlur

func (b *OptionElement) OnBlur(fn func(*event.FocusEvent)) *Self

OnBlur registers a typed blur listener and returns *Self.

func (*OptionElement) OnClick

func (b *OptionElement) OnClick(fn func(*event.MouseEvent)) *Self

OnClick registers a typed click listener and returns *Self.

func (*OptionElement) OnConnect

func (b *OptionElement) OnConnect(fn func()) *Self

OnConnect registers fn to run each time the element enters the live document.

func (*OptionElement) OnConnected

func (b *OptionElement) OnConnected()

func (*OptionElement) OnDisconnect

func (b *OptionElement) OnDisconnect(fn func()) *Self

OnDisconnect registers fn to run just before the element leaves the live document.

func (*OptionElement) OnDisconnected

func (b *OptionElement) OnDisconnected()

func (*OptionElement) OnEvent

func (b *OptionElement) OnEvent(typ event.EventType, fn event.Listener) *Self

OnEvent registers fn as a listener for event of type typ and returns *Self. Listeners are stored on the element and retrieved by the engine's event-target resolver during dispatch setup. Nil handlers are ignored.

func (*OptionElement) OnFocus

func (b *OptionElement) OnFocus(fn func(*event.FocusEvent)) *Self

OnFocus registers a typed focus listener and returns *Self.

func (*OptionElement) OnKey

func (b *OptionElement) OnKey(combo string, fn func(*event.KeyEvent)) *Self

OnKey registers a keydown listener filtered by combo via event.KeyEvent.MatchString and returns *Self.

func (*OptionElement) OnKeyDown

func (b *OptionElement) OnKeyDown(fn func(*event.KeyEvent)) *Self

OnKeyDown registers a typed keydown listener and returns *Self.

func (*OptionElement) OnKeyPress

func (b *OptionElement) OnKeyPress(fn func(*event.KeyEvent)) *Self

OnKeyPress registers a typed keypress listener and returns *Self.

func (*OptionElement) OnKeyUp

func (b *OptionElement) OnKeyUp(fn func(*event.KeyEvent)) *Self

OnKeyUp registers a typed keyup listener and returns *Self.

func (*OptionElement) OnMouseDown

func (b *OptionElement) OnMouseDown(fn func(*event.MouseEvent)) *Self

OnMouseDown registers a typed mousedown listener and returns *Self.

func (*OptionElement) OnMouseEnter

func (b *OptionElement) OnMouseEnter(fn func(*event.MouseEvent)) *Self

OnMouseEnter registers a typed mouseenter listener and returns *Self.

func (*OptionElement) OnMouseLeave

func (b *OptionElement) OnMouseLeave(fn func(*event.MouseEvent)) *Self

OnMouseLeave registers a typed mouseleave listener and returns *Self.

func (*OptionElement) OnMouseMove

func (b *OptionElement) OnMouseMove(fn func(*event.MouseEvent)) *Self

OnMouseMove registers a typed mousemove listener and returns *Self.

func (*OptionElement) OnMouseUp

func (b *OptionElement) OnMouseUp(fn func(*event.MouseEvent)) *Self

OnMouseUp registers a typed mouseup listener and returns *Self.

func (*OptionElement) OnPress

func (b *OptionElement) OnPress(fn func()) *Self

OnPress registers a zero-argument activation listener on click (including keyboard Enter/Space activation on buttons) and returns *Self.

func (*OptionElement) OnSelectionChange

func (b *OptionElement) OnSelectionChange(fn func(*event.SelectionChangeEvent)) *Self

OnSelectionChange registers a typed selectionchange listener and returns *Self.

func (*OptionElement) OnWheelEvent

func (b *OptionElement) OnWheelEvent(fn func(*event.WheelEvent)) *Self

OnWheelEvent registers a typed wheel listener and returns *Self. Named OnWheelEvent to avoid colliding with event.Scrollable's OnWheel method.

func (*OptionElement) RawStyle

func (b *OptionElement) RawStyle() style.Style

RawStyle returns the author-set style for this element.

func (*OptionElement) Ref

func (b *OptionElement) Ref(dst **Self) *Self

Ref stores a pointer to the concrete element into dst (if non-nil) and returns *Self.

func (*OptionElement) ResetCaret

func (b *OptionElement) ResetCaret(dir dom.Direction)

ResetCaret satisfies the dom.SpatialCaret interface.

func (*OptionElement) ScrollbarX

func (b *OptionElement) ScrollbarX(v bool) *Self

ScrollbarX enables or disables the horizontal scrollbar and returns *Self.

func (*OptionElement) ScrollbarY

func (b *OptionElement) ScrollbarY(v bool) *Self

ScrollbarY enables or disables the vertical scrollbar and returns *Self.

func (*OptionElement) SetCursorNavigable

func (b *OptionElement) SetCursorNavigable(v bool)

SetCursorNavigable sets whether the element is cursor-navigable.

func (*OptionElement) SetDisabled

func (o *OptionElement) SetDisabled(v bool)

func (*OptionElement) SetHidden

func (b *OptionElement) SetHidden(v bool)

SetHidden sets or clears the hidden state and marks style dirty.

func (*OptionElement) SetStyle

func (b *OptionElement) SetStyle(s style.Style)

SetStyle replaces the element's style wholesale and marks style dirty.

func (*OptionElement) SetText

func (o *OptionElement) SetText(text string) *OptionElement

SetText sets the display text of the option.

func (*OptionElement) SetTextf

func (b *OptionElement) SetTextf(format string, args ...any) *Self

SetTextf formats text with fmt.Sprintf and passes the result to [SetText].

func (*OptionElement) SetValue

func (o *OptionElement) SetValue(value string) *OptionElement

SetValue sets the value of the option.

func (*OptionElement) Style

func (b *OptionElement) Style(s style.Style) *Self

Style replaces the element's style wholesale and returns *Self. Calling Style twice discards the first call; style composition belongs at the style.Style value level via Style.Merge.

func (*OptionElement) Unwrap

func (b *OptionElement) Unwrap() dom.Node

Unwrap returns the underlying dom.Node.

func (*OptionElement) WithClass

func (b *OptionElement) WithClass(class string) *Self

WithClass sets the string classification tag and returns *Self.

func (*OptionElement) WithID

func (b *OptionElement) WithID(id string) *Self

WithID sets the element's identifier and returns *Self.

func (*OptionElement) WithTabIndex

func (b *OptionElement) WithTabIndex(index int) *Self

WithTabIndex sets the tab index on the element and returns *Self.

type OrderedListElement

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

OrderedListElement represents a list of items where the order matters (<ol>).

func NewOrderedList

func NewOrderedList(doc dom.Document) *OrderedListElement

NewOrderedList creates a new ordered list.

func OL

func OL(children ...any) *OrderedListElement

OL creates a new ordered list with the given children.

Example
package main

import (
	"fmt"
	"strings"

	"github.com/masterkeysrd/kite/dom"
	"github.com/masterkeysrd/kite/element"
	"github.com/masterkeysrd/kite/testenv"
)

func printScreen(root dom.Element) {
	env := testenv.New(nil, 24, 8)
	defer env.Close()

	env.Mount(root)
	env.Flush()

	for line := range strings.SplitSeq(strings.TrimRight(env.DumpText(), " \n"), "\n") {
		fmt.Println(strings.TrimSpace(line))
	}
}

func main() {
	list := element.OL(
		element.LI("Build"),
		element.LI("Test"),
	)

	printScreen(list)
}
Output:
1. Build
2. Test

func (*OrderedListElement) AddChild

func (b *OrderedListElement) AddChild(child dom.Node) *Self

AddChild adds child as the last child of this element and returns the element itself for fluent chaining.

func (*OrderedListElement) Animate

func (b *OrderedListElement) Animate(
	from, to style.Style,
	opts animation.Options,
) *animation.Playback

Animate interpolates style properties from start to end on the element over opts.Duration using the document window's frame clock. Unrelated author styles are preserved via sparse merging, and the animation cancels automatically if the element disconnects from the document.

func (*OrderedListElement) CursorNavigable

func (b *OrderedListElement) CursorNavigable(v bool) *Self

CursorNavigable enables character-level caret navigation and text selection on this element.

func (*OrderedListElement) DefaultStyle

func (b *OrderedListElement) DefaultStyle() style.Style

DefaultStyle returns the element-type default style.

func (*OrderedListElement) DispatchEvent

func (b *OrderedListElement) DispatchEvent(e event.Event)

DispatchEvent fires an event that propagates through the DOM tree.

func (*OrderedListElement) EventListeners

func (b *OrderedListElement) EventListeners() []PendingListener

EventListeners returns the event listener registrations for this element. Used by the engine's event-target resolver to wire up dispatch.

func (*OrderedListElement) Hidden

func (b *OrderedListElement) Hidden(v bool) *Self

Hidden sets or clears the hidden state and returns *Self.

func (*OrderedListElement) IntrinsicStyle

func (b *OrderedListElement) IntrinsicStyle() style.Style

IntrinsicStyle returns the UA-mandated forced style for this element. Properties set here have the highest cascade precedence; authors cannot override them via Style(). Most elements return an empty style.S(). Replaced and compound elements return a sparse Style with UA-forced properties (e.g. Display:InlineBlock, OverflowX:Clip). See ADR-010.

func (*OrderedListElement) IsCursorNavigable

func (b *OrderedListElement) IsCursorNavigable() bool

IsCursorNavigable reports whether the element is cursor-navigable.

func (*OrderedListElement) IsDirtyStyle

func (b *OrderedListElement) IsDirtyStyle() bool

IsDirtyStyle reports whether this element's style needs re-resolution.

func (*OrderedListElement) IsHidden

func (b *OrderedListElement) IsHidden() bool

IsHidden reports whether the element is hidden.

func (*OrderedListElement) Listeners

func (b *OrderedListElement) Listeners() []PendingListener

Listeners returns the set of event listeners registered on this element.

func (*OrderedListElement) MoveCaret

func (b *OrderedListElement) MoveCaret(dir dom.Direction) (boundaryReached bool)

MoveCaret satisfies the dom.SpatialCaret interface.

func (*OrderedListElement) OnBlur

func (b *OrderedListElement) OnBlur(fn func(*event.FocusEvent)) *Self

OnBlur registers a typed blur listener and returns *Self.

func (*OrderedListElement) OnClick

func (b *OrderedListElement) OnClick(fn func(*event.MouseEvent)) *Self

OnClick registers a typed click listener and returns *Self.

func (*OrderedListElement) OnConnect

func (b *OrderedListElement) OnConnect(fn func()) *Self

OnConnect registers fn to run each time the element enters the live document.

func (*OrderedListElement) OnConnected

func (b *OrderedListElement) OnConnected()

func (*OrderedListElement) OnDisconnect

func (b *OrderedListElement) OnDisconnect(fn func()) *Self

OnDisconnect registers fn to run just before the element leaves the live document.

func (*OrderedListElement) OnDisconnected

func (b *OrderedListElement) OnDisconnected()

func (*OrderedListElement) OnEvent

func (b *OrderedListElement) OnEvent(typ event.EventType, fn event.Listener) *Self

OnEvent registers fn as a listener for event of type typ and returns *Self. Listeners are stored on the element and retrieved by the engine's event-target resolver during dispatch setup. Nil handlers are ignored.

func (*OrderedListElement) OnFocus

func (b *OrderedListElement) OnFocus(fn func(*event.FocusEvent)) *Self

OnFocus registers a typed focus listener and returns *Self.

func (*OrderedListElement) OnKey

func (b *OrderedListElement) OnKey(combo string, fn func(*event.KeyEvent)) *Self

OnKey registers a keydown listener filtered by combo via event.KeyEvent.MatchString and returns *Self.

func (*OrderedListElement) OnKeyDown

func (b *OrderedListElement) OnKeyDown(fn func(*event.KeyEvent)) *Self

OnKeyDown registers a typed keydown listener and returns *Self.

func (*OrderedListElement) OnKeyPress

func (b *OrderedListElement) OnKeyPress(fn func(*event.KeyEvent)) *Self

OnKeyPress registers a typed keypress listener and returns *Self.

func (*OrderedListElement) OnKeyUp

func (b *OrderedListElement) OnKeyUp(fn func(*event.KeyEvent)) *Self

OnKeyUp registers a typed keyup listener and returns *Self.

func (*OrderedListElement) OnMouseDown

func (b *OrderedListElement) OnMouseDown(fn func(*event.MouseEvent)) *Self

OnMouseDown registers a typed mousedown listener and returns *Self.

func (*OrderedListElement) OnMouseEnter

func (b *OrderedListElement) OnMouseEnter(fn func(*event.MouseEvent)) *Self

OnMouseEnter registers a typed mouseenter listener and returns *Self.

func (*OrderedListElement) OnMouseLeave

func (b *OrderedListElement) OnMouseLeave(fn func(*event.MouseEvent)) *Self

OnMouseLeave registers a typed mouseleave listener and returns *Self.

func (*OrderedListElement) OnMouseMove

func (b *OrderedListElement) OnMouseMove(fn func(*event.MouseEvent)) *Self

OnMouseMove registers a typed mousemove listener and returns *Self.

func (*OrderedListElement) OnMouseUp

func (b *OrderedListElement) OnMouseUp(fn func(*event.MouseEvent)) *Self

OnMouseUp registers a typed mouseup listener and returns *Self.

func (*OrderedListElement) OnPress

func (b *OrderedListElement) OnPress(fn func()) *Self

OnPress registers a zero-argument activation listener on click (including keyboard Enter/Space activation on buttons) and returns *Self.

func (*OrderedListElement) OnSelectionChange

func (b *OrderedListElement) OnSelectionChange(fn func(*event.SelectionChangeEvent)) *Self

OnSelectionChange registers a typed selectionchange listener and returns *Self.

func (*OrderedListElement) OnWheelEvent

func (b *OrderedListElement) OnWheelEvent(fn func(*event.WheelEvent)) *Self

OnWheelEvent registers a typed wheel listener and returns *Self. Named OnWheelEvent to avoid colliding with event.Scrollable's OnWheel method.

func (*OrderedListElement) RawStyle

func (b *OrderedListElement) RawStyle() style.Style

RawStyle returns the author-set style for this element.

func (*OrderedListElement) Ref

func (b *OrderedListElement) Ref(dst **Self) *Self

Ref stores a pointer to the concrete element into dst (if non-nil) and returns *Self.

func (*OrderedListElement) ResetCaret

func (b *OrderedListElement) ResetCaret(dir dom.Direction)

ResetCaret satisfies the dom.SpatialCaret interface.

func (*OrderedListElement) ScrollbarX

func (b *OrderedListElement) ScrollbarX(v bool) *Self

ScrollbarX enables or disables the horizontal scrollbar and returns *Self.

func (*OrderedListElement) ScrollbarY

func (b *OrderedListElement) ScrollbarY(v bool) *Self

ScrollbarY enables or disables the vertical scrollbar and returns *Self.

func (*OrderedListElement) SetCursorNavigable

func (b *OrderedListElement) SetCursorNavigable(v bool)

SetCursorNavigable sets whether the element is cursor-navigable.

func (*OrderedListElement) SetHidden

func (b *OrderedListElement) SetHidden(v bool)

SetHidden sets or clears the hidden state and marks style dirty.

func (*OrderedListElement) SetStyle

func (b *OrderedListElement) SetStyle(s style.Style)

SetStyle replaces the element's style wholesale and marks style dirty.

func (*OrderedListElement) SetText

func (b *OrderedListElement) SetText(text string) *Self

SetText replaces the element's children with a single text node containing text, updating an existing sole text child in place when possible, and returns *Self.

func (*OrderedListElement) SetTextf

func (b *OrderedListElement) SetTextf(format string, args ...any) *Self

SetTextf formats text with fmt.Sprintf and passes the result to [SetText].

func (*OrderedListElement) Style

func (b *OrderedListElement) Style(s style.Style) *Self

Style replaces the element's style wholesale and returns *Self. Calling Style twice discards the first call; style composition belongs at the style.Style value level via Style.Merge.

func (*OrderedListElement) Unwrap

func (b *OrderedListElement) Unwrap() dom.Node

Unwrap returns the underlying dom.Node.

func (*OrderedListElement) WithClass

func (b *OrderedListElement) WithClass(class string) *Self

WithClass sets the string classification tag and returns *Self.

func (*OrderedListElement) WithID

func (b *OrderedListElement) WithID(id string) *Self

WithID sets the element's identifier and returns *Self.

func (*OrderedListElement) WithTabIndex

func (b *OrderedListElement) WithTabIndex(index int) *Self

WithTabIndex sets the tab index on the element and returns *Self.

type OverlayConfig

type OverlayConfig struct {
	Anchor    dom.Element
	ZIndex    int
	Placement geom.Placement
	Flip      bool
}

type OverlayElement

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

func NewOverlay

func NewOverlay(doc dom.Document, anchor dom.Element, children ...any) *OverlayElement

func Overlay

func Overlay(anchor dom.Element, children ...any) *OverlayElement

func (*OverlayElement) AddChild

func (b *OverlayElement) AddChild(child dom.Node) *Self

AddChild adds child as the last child of this element and returns the element itself for fluent chaining.

func (*OverlayElement) Anchor

func (o *OverlayElement) Anchor() dom.Node

Anchor implements layout.OverlayLever.

func (*OverlayElement) Animate

func (b *OverlayElement) Animate(
	from, to style.Style,
	opts animation.Options,
) *animation.Playback

Animate interpolates style properties from start to end on the element over opts.Duration using the document window's frame clock. Unrelated author styles are preserved via sparse merging, and the animation cancels automatically if the element disconnects from the document.

func (*OverlayElement) CreateRenderObject

func (o *OverlayElement) CreateRenderObject() render.Object

CreateRenderObject implements render.CustomObjectProvider.

func (*OverlayElement) CursorNavigable

func (b *OverlayElement) CursorNavigable(v bool) *Self

CursorNavigable enables character-level caret navigation and text selection on this element.

func (*OverlayElement) DefaultStyle

func (b *OverlayElement) DefaultStyle() style.Style

DefaultStyle returns the element-type default style.

func (*OverlayElement) DispatchEvent

func (b *OverlayElement) DispatchEvent(e event.Event)

DispatchEvent fires an event that propagates through the DOM tree.

func (*OverlayElement) EventListeners

func (b *OverlayElement) EventListeners() []PendingListener

EventListeners returns the event listener registrations for this element. Used by the engine's event-target resolver to wire up dispatch.

func (*OverlayElement) Flip

func (o *OverlayElement) Flip() bool

Flip implements layout.OverlayLever.

func (*OverlayElement) Hidden

func (b *OverlayElement) Hidden(v bool) *Self

Hidden sets or clears the hidden state and returns *Self.

func (*OverlayElement) IntrinsicStyle

func (b *OverlayElement) IntrinsicStyle() style.Style

IntrinsicStyle returns the UA-mandated forced style for this element. Properties set here have the highest cascade precedence; authors cannot override them via Style(). Most elements return an empty style.S(). Replaced and compound elements return a sparse Style with UA-forced properties (e.g. Display:InlineBlock, OverflowX:Clip). See ADR-010.

func (*OverlayElement) IsCursorNavigable

func (b *OverlayElement) IsCursorNavigable() bool

IsCursorNavigable reports whether the element is cursor-navigable.

func (*OverlayElement) IsDirtyStyle

func (b *OverlayElement) IsDirtyStyle() bool

IsDirtyStyle reports whether this element's style needs re-resolution.

func (*OverlayElement) IsHidden

func (b *OverlayElement) IsHidden() bool

IsHidden reports whether the element is hidden.

func (*OverlayElement) Listeners

func (b *OverlayElement) Listeners() []PendingListener

Listeners returns the set of event listeners registered on this element.

func (*OverlayElement) MoveCaret

func (b *OverlayElement) MoveCaret(dir dom.Direction) (boundaryReached bool)

MoveCaret satisfies the dom.SpatialCaret interface.

func (*OverlayElement) OnBlur

func (b *OverlayElement) OnBlur(fn func(*event.FocusEvent)) *Self

OnBlur registers a typed blur listener and returns *Self.

func (*OverlayElement) OnClick

func (b *OverlayElement) OnClick(fn func(*event.MouseEvent)) *Self

OnClick registers a typed click listener and returns *Self.

func (*OverlayElement) OnConnect

func (b *OverlayElement) OnConnect(fn func()) *Self

OnConnect registers fn to run each time the element enters the live document.

func (*OverlayElement) OnConnected

func (o *OverlayElement) OnConnected()

OnConnected implements dom.Lifecycle.

func (*OverlayElement) OnDisconnect

func (b *OverlayElement) OnDisconnect(fn func()) *Self

OnDisconnect registers fn to run just before the element leaves the live document.

func (*OverlayElement) OnDisconnected

func (o *OverlayElement) OnDisconnected()

OnDisconnected implements dom.Lifecycle.

func (*OverlayElement) OnEvent

func (b *OverlayElement) OnEvent(typ event.EventType, fn event.Listener) *Self

OnEvent registers fn as a listener for event of type typ and returns *Self. Listeners are stored on the element and retrieved by the engine's event-target resolver during dispatch setup. Nil handlers are ignored.

func (*OverlayElement) OnFocus

func (b *OverlayElement) OnFocus(fn func(*event.FocusEvent)) *Self

OnFocus registers a typed focus listener and returns *Self.

func (*OverlayElement) OnKey

func (b *OverlayElement) OnKey(combo string, fn func(*event.KeyEvent)) *Self

OnKey registers a keydown listener filtered by combo via event.KeyEvent.MatchString and returns *Self.

func (*OverlayElement) OnKeyDown

func (b *OverlayElement) OnKeyDown(fn func(*event.KeyEvent)) *Self

OnKeyDown registers a typed keydown listener and returns *Self.

func (*OverlayElement) OnKeyPress

func (b *OverlayElement) OnKeyPress(fn func(*event.KeyEvent)) *Self

OnKeyPress registers a typed keypress listener and returns *Self.

func (*OverlayElement) OnKeyUp

func (b *OverlayElement) OnKeyUp(fn func(*event.KeyEvent)) *Self

OnKeyUp registers a typed keyup listener and returns *Self.

func (*OverlayElement) OnMouseDown

func (b *OverlayElement) OnMouseDown(fn func(*event.MouseEvent)) *Self

OnMouseDown registers a typed mousedown listener and returns *Self.

func (*OverlayElement) OnMouseEnter

func (b *OverlayElement) OnMouseEnter(fn func(*event.MouseEvent)) *Self

OnMouseEnter registers a typed mouseenter listener and returns *Self.

func (*OverlayElement) OnMouseLeave

func (b *OverlayElement) OnMouseLeave(fn func(*event.MouseEvent)) *Self

OnMouseLeave registers a typed mouseleave listener and returns *Self.

func (*OverlayElement) OnMouseMove

func (b *OverlayElement) OnMouseMove(fn func(*event.MouseEvent)) *Self

OnMouseMove registers a typed mousemove listener and returns *Self.

func (*OverlayElement) OnMouseUp

func (b *OverlayElement) OnMouseUp(fn func(*event.MouseEvent)) *Self

OnMouseUp registers a typed mouseup listener and returns *Self.

func (*OverlayElement) OnPress

func (b *OverlayElement) OnPress(fn func()) *Self

OnPress registers a zero-argument activation listener on click (including keyboard Enter/Space activation on buttons) and returns *Self.

func (*OverlayElement) OnSelectionChange

func (b *OverlayElement) OnSelectionChange(fn func(*event.SelectionChangeEvent)) *Self

OnSelectionChange registers a typed selectionchange listener and returns *Self.

func (*OverlayElement) OnWheelEvent

func (b *OverlayElement) OnWheelEvent(fn func(*event.WheelEvent)) *Self

OnWheelEvent registers a typed wheel listener and returns *Self. Named OnWheelEvent to avoid colliding with event.Scrollable's OnWheel method.

func (*OverlayElement) Placement

func (o *OverlayElement) Placement() geom.Placement

Placement implements layout.OverlayLever.

func (*OverlayElement) RawStyle

func (b *OverlayElement) RawStyle() style.Style

RawStyle returns the author-set style for this element.

func (*OverlayElement) Ref

func (b *OverlayElement) Ref(dst **Self) *Self

Ref stores a pointer to the concrete element into dst (if non-nil) and returns *Self.

func (*OverlayElement) ResetCaret

func (b *OverlayElement) ResetCaret(dir dom.Direction)

ResetCaret satisfies the dom.SpatialCaret interface.

func (*OverlayElement) ScrollbarX

func (b *OverlayElement) ScrollbarX(v bool) *Self

ScrollbarX enables or disables the horizontal scrollbar and returns *Self.

func (*OverlayElement) ScrollbarY

func (b *OverlayElement) ScrollbarY(v bool) *Self

ScrollbarY enables or disables the vertical scrollbar and returns *Self.

func (*OverlayElement) SetConfig

func (o *OverlayElement) SetConfig(config OverlayConfig) *OverlayElement

SetConfig updates the overlay element's configuration.

func (*OverlayElement) SetCursorNavigable

func (b *OverlayElement) SetCursorNavigable(v bool)

SetCursorNavigable sets whether the element is cursor-navigable.

func (*OverlayElement) SetHidden

func (b *OverlayElement) SetHidden(v bool)

SetHidden sets or clears the hidden state and marks style dirty.

func (*OverlayElement) SetStyle

func (b *OverlayElement) SetStyle(s style.Style)

SetStyle replaces the element's style wholesale and marks style dirty.

func (*OverlayElement) SetText

func (b *OverlayElement) SetText(text string) *Self

SetText replaces the element's children with a single text node containing text, updating an existing sole text child in place when possible, and returns *Self.

func (*OverlayElement) SetTextf

func (b *OverlayElement) SetTextf(format string, args ...any) *Self

SetTextf formats text with fmt.Sprintf and passes the result to [SetText].

func (*OverlayElement) Style

func (b *OverlayElement) Style(s style.Style) *Self

Style replaces the element's style wholesale and returns *Self. Calling Style twice discards the first call; style composition belongs at the style.Style value level via Style.Merge.

func (*OverlayElement) Unwrap

func (b *OverlayElement) Unwrap() dom.Node

Unwrap returns the underlying dom.Node.

func (*OverlayElement) WithAnchor

func (o *OverlayElement) WithAnchor(a dom.Element) *OverlayElement

WithAnchor sets the anchor element for positioning the overlay.

func (*OverlayElement) WithClass

func (b *OverlayElement) WithClass(class string) *Self

WithClass sets the string classification tag and returns *Self.

func (*OverlayElement) WithFlip

func (o *OverlayElement) WithFlip(flip bool) *OverlayElement

WithFlip configures whether the overlay flips when overflowing the viewport.

func (*OverlayElement) WithID

func (b *OverlayElement) WithID(id string) *Self

WithID sets the element's identifier and returns *Self.

func (*OverlayElement) WithPlacement

func (o *OverlayElement) WithPlacement(p geom.Placement) *OverlayElement

WithPlacement sets the preferred placement relative to the anchor.

func (*OverlayElement) WithTabIndex

func (b *OverlayElement) WithTabIndex(index int) *Self

WithTabIndex sets the tab index on the element and returns *Self.

func (*OverlayElement) WithZIndex

func (o *OverlayElement) WithZIndex(zIndex int) *OverlayElement

WithZIndex sets the overlay's top-layer z-index.

type PendingListener

type PendingListener struct {
	// Typ is the event type this listener is registered for.
	Typ event.EventType
	// Fn is the listener function.
	Fn event.Listener
}

PendingListener records an event registration from OnEvent(). It is exported so that the engine's event-target resolver and tests can inspect registered listeners without accessing unexported fields.

type RadioElement

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

RadioElement represents a single radio button within a RadioGroup.

func NewRadio

func NewRadio(doc dom.Document, value string) *RadioElement

NewRadio creates a new RadioElement owned by doc with the given value.

func Radio

func Radio(value string) *RadioElement

Radio creates a new RadioElement with the given value.

func (*RadioElement) AddChild

func (b *RadioElement) AddChild(child dom.Node) *Self

AddChild adds child as the last child of this element and returns the element itself for fluent chaining.

func (*RadioElement) Animate

func (b *RadioElement) Animate(
	from, to style.Style,
	opts animation.Options,
) *animation.Playback

Animate interpolates style properties from start to end on the element over opts.Duration using the document window's frame clock. Unrelated author styles are preserved via sparse merging, and the animation cancels automatically if the element disconnects from the document.

func (*RadioElement) Checked

func (r *RadioElement) Checked() bool

Checked reports whether the radio button is selected.

func (*RadioElement) CursorNavigable

func (b *RadioElement) CursorNavigable(v bool) *Self

CursorNavigable enables character-level caret navigation and text selection on this element.

func (*RadioElement) DefaultStyle

func (b *RadioElement) DefaultStyle() style.Style

DefaultStyle returns the element-type default style.

func (*RadioElement) Disabled

func (r *RadioElement) Disabled(v bool) *RadioElement

func (*RadioElement) DispatchEvent

func (b *RadioElement) DispatchEvent(e event.Event)

DispatchEvent fires an event that propagates through the DOM tree.

func (*RadioElement) EventListeners

func (b *RadioElement) EventListeners() []PendingListener

EventListeners returns the event listener registrations for this element. Used by the engine's event-target resolver to wire up dispatch.

func (*RadioElement) Hidden

func (b *RadioElement) Hidden(v bool) *Self

Hidden sets or clears the hidden state and returns *Self.

func (*RadioElement) IntrinsicStyle

func (b *RadioElement) IntrinsicStyle() style.Style

IntrinsicStyle returns the UA-mandated forced style for this element. Properties set here have the highest cascade precedence; authors cannot override them via Style(). Most elements return an empty style.S(). Replaced and compound elements return a sparse Style with UA-forced properties (e.g. Display:InlineBlock, OverflowX:Clip). See ADR-010.

func (*RadioElement) IsCursorNavigable

func (b *RadioElement) IsCursorNavigable() bool

IsCursorNavigable reports whether the element is cursor-navigable.

func (*RadioElement) IsDirtyStyle

func (b *RadioElement) IsDirtyStyle() bool

IsDirtyStyle reports whether this element's style needs re-resolution.

func (*RadioElement) IsDisabled

func (r *RadioElement) IsDisabled() bool

func (*RadioElement) IsHidden

func (b *RadioElement) IsHidden() bool

IsHidden reports whether the element is hidden.

func (*RadioElement) Listeners

func (b *RadioElement) Listeners() []PendingListener

Listeners returns the set of event listeners registered on this element.

func (*RadioElement) MoveCaret

func (b *RadioElement) MoveCaret(dir dom.Direction) (boundaryReached bool)

MoveCaret satisfies the dom.SpatialCaret interface.

func (*RadioElement) Name

func (r *RadioElement) Name() string

Name returns the form control name.

func (*RadioElement) OnBlur

func (b *RadioElement) OnBlur(fn func(*event.FocusEvent)) *Self

OnBlur registers a typed blur listener and returns *Self.

func (*RadioElement) OnClick

func (b *RadioElement) OnClick(fn func(*event.MouseEvent)) *Self

OnClick registers a typed click listener and returns *Self.

func (*RadioElement) OnConnect

func (b *RadioElement) OnConnect(fn func()) *Self

OnConnect registers fn to run each time the element enters the live document.

func (*RadioElement) OnConnected

func (b *RadioElement) OnConnected()

func (*RadioElement) OnDisconnect

func (b *RadioElement) OnDisconnect(fn func()) *Self

OnDisconnect registers fn to run just before the element leaves the live document.

func (*RadioElement) OnDisconnected

func (b *RadioElement) OnDisconnected()

func (*RadioElement) OnEvent

func (b *RadioElement) OnEvent(typ event.EventType, fn event.Listener) *Self

OnEvent registers fn as a listener for event of type typ and returns *Self. Listeners are stored on the element and retrieved by the engine's event-target resolver during dispatch setup. Nil handlers are ignored.

func (*RadioElement) OnFocus

func (b *RadioElement) OnFocus(fn func(*event.FocusEvent)) *Self

OnFocus registers a typed focus listener and returns *Self.

func (*RadioElement) OnKey

func (b *RadioElement) OnKey(combo string, fn func(*event.KeyEvent)) *Self

OnKey registers a keydown listener filtered by combo via event.KeyEvent.MatchString and returns *Self.

func (*RadioElement) OnKeyDown

func (b *RadioElement) OnKeyDown(fn func(*event.KeyEvent)) *Self

OnKeyDown registers a typed keydown listener and returns *Self.

func (*RadioElement) OnKeyPress

func (b *RadioElement) OnKeyPress(fn func(*event.KeyEvent)) *Self

OnKeyPress registers a typed keypress listener and returns *Self.

func (*RadioElement) OnKeyUp

func (b *RadioElement) OnKeyUp(fn func(*event.KeyEvent)) *Self

OnKeyUp registers a typed keyup listener and returns *Self.

func (*RadioElement) OnMouseDown

func (b *RadioElement) OnMouseDown(fn func(*event.MouseEvent)) *Self

OnMouseDown registers a typed mousedown listener and returns *Self.

func (*RadioElement) OnMouseEnter

func (b *RadioElement) OnMouseEnter(fn func(*event.MouseEvent)) *Self

OnMouseEnter registers a typed mouseenter listener and returns *Self.

func (*RadioElement) OnMouseLeave

func (b *RadioElement) OnMouseLeave(fn func(*event.MouseEvent)) *Self

OnMouseLeave registers a typed mouseleave listener and returns *Self.

func (*RadioElement) OnMouseMove

func (b *RadioElement) OnMouseMove(fn func(*event.MouseEvent)) *Self

OnMouseMove registers a typed mousemove listener and returns *Self.

func (*RadioElement) OnMouseUp

func (b *RadioElement) OnMouseUp(fn func(*event.MouseEvent)) *Self

OnMouseUp registers a typed mouseup listener and returns *Self.

func (*RadioElement) OnPress

func (b *RadioElement) OnPress(fn func()) *Self

OnPress registers a zero-argument activation listener on click (including keyboard Enter/Space activation on buttons) and returns *Self.

func (*RadioElement) OnSelectionChange

func (b *RadioElement) OnSelectionChange(fn func(*event.SelectionChangeEvent)) *Self

OnSelectionChange registers a typed selectionchange listener and returns *Self.

func (*RadioElement) OnWheelEvent

func (b *RadioElement) OnWheelEvent(fn func(*event.WheelEvent)) *Self

OnWheelEvent registers a typed wheel listener and returns *Self. Named OnWheelEvent to avoid colliding with event.Scrollable's OnWheel method.

func (*RadioElement) RawStyle

func (b *RadioElement) RawStyle() style.Style

RawStyle returns the author-set style for this element.

func (*RadioElement) Ref

func (b *RadioElement) Ref(dst **Self) *Self

Ref stores a pointer to the concrete element into dst (if non-nil) and returns *Self.

func (*RadioElement) ResetCaret

func (b *RadioElement) ResetCaret(dir dom.Direction)

ResetCaret satisfies the dom.SpatialCaret interface.

func (*RadioElement) ScrollbarX

func (b *RadioElement) ScrollbarX(v bool) *Self

ScrollbarX enables or disables the horizontal scrollbar and returns *Self.

func (*RadioElement) ScrollbarY

func (b *RadioElement) ScrollbarY(v bool) *Self

ScrollbarY enables or disables the vertical scrollbar and returns *Self.

func (*RadioElement) SetCursorNavigable

func (b *RadioElement) SetCursorNavigable(v bool)

SetCursorNavigable sets whether the element is cursor-navigable.

func (*RadioElement) SetDisabled

func (r *RadioElement) SetDisabled(v bool)

func (*RadioElement) SetGlyphs

func (r *RadioElement) SetGlyphs(unchecked, checked string) *RadioElement

SetGlyphs customizes the strings used for unchecked and checked states.

func (*RadioElement) SetHidden

func (b *RadioElement) SetHidden(v bool)

SetHidden sets or clears the hidden state and marks style dirty.

func (*RadioElement) SetStyle

func (b *RadioElement) SetStyle(s style.Style)

SetStyle replaces the element's style wholesale and marks style dirty.

func (*RadioElement) SetText

func (b *RadioElement) SetText(text string) *Self

SetText replaces the element's children with a single text node containing text, updating an existing sole text child in place when possible, and returns *Self.

func (*RadioElement) SetTextf

func (b *RadioElement) SetTextf(format string, args ...any) *Self

SetTextf formats text with fmt.Sprintf and passes the result to [SetText].

func (*RadioElement) SetValue

func (r *RadioElement) SetValue(value string) *RadioElement

SetValue updates the radio button's value.

func (*RadioElement) Style

func (b *RadioElement) Style(s style.Style) *Self

Style replaces the element's style wholesale and returns *Self. Calling Style twice discards the first call; style composition belongs at the style.Style value level via Style.Merge.

func (*RadioElement) Unwrap

func (b *RadioElement) Unwrap() dom.Node

Unwrap returns the underlying dom.Node.

func (*RadioElement) Value

func (r *RadioElement) Value() any

Value returns the value associated with this radio button.

func (*RadioElement) WithClass

func (b *RadioElement) WithClass(class string) *Self

WithClass sets the string classification tag and returns *Self.

func (*RadioElement) WithID

func (b *RadioElement) WithID(id string) *Self

WithID sets the element's identifier and returns *Self.

func (*RadioElement) WithName

func (r *RadioElement) WithName(name string) *RadioElement

WithName sets the form control name and returns the RadioElement.

func (*RadioElement) WithTabIndex

func (b *RadioElement) WithTabIndex(index int) *Self

WithTabIndex sets the tab index on the element and returns *Self.

type RadioGroupElement

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

RadioGroupElement manages a set of RadioElements and ensures only one is selected at a time.

func NewRadioGroup

func NewRadioGroup(doc dom.Document, children ...any) *RadioGroupElement

NewRadioGroup creates a new RadioGroupElement owned by doc.

func RadioGroup

func RadioGroup(children ...any) *RadioGroupElement

RadioGroup creates a new RadioGroupElement with the given children.

func (*RadioGroupElement) AddChild

func (rg *RadioGroupElement) AddChild(child dom.Node) *RadioGroupElement

AddChild overrides elementBase.AddChild to sync new radio children.

func (*RadioGroupElement) Animate

func (b *RadioGroupElement) Animate(
	from, to style.Style,
	opts animation.Options,
) *animation.Playback

Animate interpolates style properties from start to end on the element over opts.Duration using the document window's frame clock. Unrelated author styles are preserved via sparse merging, and the animation cancels automatically if the element disconnects from the document.

func (*RadioGroupElement) AppendChild

func (rg *RadioGroupElement) AppendChild(child dom.Node) dom.Node

AppendChild overrides dom.Element.AppendChild to sync new radio children.

func (*RadioGroupElement) CursorNavigable

func (b *RadioGroupElement) CursorNavigable(v bool) *Self

CursorNavigable enables character-level caret navigation and text selection on this element.

func (*RadioGroupElement) DefaultStyle

func (b *RadioGroupElement) DefaultStyle() style.Style

DefaultStyle returns the element-type default style.

func (*RadioGroupElement) DefaultValue

func (rg *RadioGroupElement) DefaultValue(value string) *RadioGroupElement

func (*RadioGroupElement) Disabled

func (rg *RadioGroupElement) Disabled(v bool) *RadioGroupElement

func (*RadioGroupElement) DispatchEvent

func (b *RadioGroupElement) DispatchEvent(e event.Event)

DispatchEvent fires an event that propagates through the DOM tree.

func (*RadioGroupElement) EventListeners

func (b *RadioGroupElement) EventListeners() []PendingListener

EventListeners returns the event listener registrations for this element. Used by the engine's event-target resolver to wire up dispatch.

func (*RadioGroupElement) Hidden

func (b *RadioGroupElement) Hidden(v bool) *Self

Hidden sets or clears the hidden state and returns *Self.

func (*RadioGroupElement) IntrinsicStyle

func (b *RadioGroupElement) IntrinsicStyle() style.Style

IntrinsicStyle returns the UA-mandated forced style for this element. Properties set here have the highest cascade precedence; authors cannot override them via Style(). Most elements return an empty style.S(). Replaced and compound elements return a sparse Style with UA-forced properties (e.g. Display:InlineBlock, OverflowX:Clip). See ADR-010.

func (*RadioGroupElement) IsCursorNavigable

func (b *RadioGroupElement) IsCursorNavigable() bool

IsCursorNavigable reports whether the element is cursor-navigable.

func (*RadioGroupElement) IsDirtyStyle

func (b *RadioGroupElement) IsDirtyStyle() bool

IsDirtyStyle reports whether this element's style needs re-resolution.

func (*RadioGroupElement) IsDisabled

func (rg *RadioGroupElement) IsDisabled() bool

func (*RadioGroupElement) IsHidden

func (b *RadioGroupElement) IsHidden() bool

IsHidden reports whether the element is hidden.

func (*RadioGroupElement) Listeners

func (b *RadioGroupElement) Listeners() []PendingListener

Listeners returns the set of event listeners registered on this element.

func (*RadioGroupElement) MoveCaret

func (b *RadioGroupElement) MoveCaret(dir dom.Direction) (boundaryReached bool)

MoveCaret satisfies the dom.SpatialCaret interface.

func (*RadioGroupElement) OnBlur

func (b *RadioGroupElement) OnBlur(fn func(*event.FocusEvent)) *Self

OnBlur registers a typed blur listener and returns *Self.

func (*RadioGroupElement) OnChange

func (rg *RadioGroupElement) OnChange(fn func(string)) *RadioGroupElement

OnChange sets a callback to be invoked when the selected value changes.

func (*RadioGroupElement) OnClick

func (b *RadioGroupElement) OnClick(fn func(*event.MouseEvent)) *Self

OnClick registers a typed click listener and returns *Self.

func (*RadioGroupElement) OnConnect

func (b *RadioGroupElement) OnConnect(fn func()) *Self

OnConnect registers fn to run each time the element enters the live document.

func (*RadioGroupElement) OnConnected

func (b *RadioGroupElement) OnConnected()

func (*RadioGroupElement) OnDisconnect

func (b *RadioGroupElement) OnDisconnect(fn func()) *Self

OnDisconnect registers fn to run just before the element leaves the live document.

func (*RadioGroupElement) OnDisconnected

func (b *RadioGroupElement) OnDisconnected()

func (*RadioGroupElement) OnEvent

func (b *RadioGroupElement) OnEvent(typ event.EventType, fn event.Listener) *Self

OnEvent registers fn as a listener for event of type typ and returns *Self. Listeners are stored on the element and retrieved by the engine's event-target resolver during dispatch setup. Nil handlers are ignored.

func (*RadioGroupElement) OnFocus

func (b *RadioGroupElement) OnFocus(fn func(*event.FocusEvent)) *Self

OnFocus registers a typed focus listener and returns *Self.

func (*RadioGroupElement) OnKey

func (b *RadioGroupElement) OnKey(combo string, fn func(*event.KeyEvent)) *Self

OnKey registers a keydown listener filtered by combo via event.KeyEvent.MatchString and returns *Self.

func (*RadioGroupElement) OnKeyDown

func (b *RadioGroupElement) OnKeyDown(fn func(*event.KeyEvent)) *Self

OnKeyDown registers a typed keydown listener and returns *Self.

func (*RadioGroupElement) OnKeyPress

func (b *RadioGroupElement) OnKeyPress(fn func(*event.KeyEvent)) *Self

OnKeyPress registers a typed keypress listener and returns *Self.

func (*RadioGroupElement) OnKeyUp

func (b *RadioGroupElement) OnKeyUp(fn func(*event.KeyEvent)) *Self

OnKeyUp registers a typed keyup listener and returns *Self.

func (*RadioGroupElement) OnMouseDown

func (b *RadioGroupElement) OnMouseDown(fn func(*event.MouseEvent)) *Self

OnMouseDown registers a typed mousedown listener and returns *Self.

func (*RadioGroupElement) OnMouseEnter

func (b *RadioGroupElement) OnMouseEnter(fn func(*event.MouseEvent)) *Self

OnMouseEnter registers a typed mouseenter listener and returns *Self.

func (*RadioGroupElement) OnMouseLeave

func (b *RadioGroupElement) OnMouseLeave(fn func(*event.MouseEvent)) *Self

OnMouseLeave registers a typed mouseleave listener and returns *Self.

func (*RadioGroupElement) OnMouseMove

func (b *RadioGroupElement) OnMouseMove(fn func(*event.MouseEvent)) *Self

OnMouseMove registers a typed mousemove listener and returns *Self.

func (*RadioGroupElement) OnMouseUp

func (b *RadioGroupElement) OnMouseUp(fn func(*event.MouseEvent)) *Self

OnMouseUp registers a typed mouseup listener and returns *Self.

func (*RadioGroupElement) OnPress

func (b *RadioGroupElement) OnPress(fn func()) *Self

OnPress registers a zero-argument activation listener on click (including keyboard Enter/Space activation on buttons) and returns *Self.

func (*RadioGroupElement) OnSelectionChange

func (b *RadioGroupElement) OnSelectionChange(fn func(*event.SelectionChangeEvent)) *Self

OnSelectionChange registers a typed selectionchange listener and returns *Self.

func (*RadioGroupElement) OnWheelEvent

func (b *RadioGroupElement) OnWheelEvent(fn func(*event.WheelEvent)) *Self

OnWheelEvent registers a typed wheel listener and returns *Self. Named OnWheelEvent to avoid colliding with event.Scrollable's OnWheel method.

func (*RadioGroupElement) RawStyle

func (b *RadioGroupElement) RawStyle() style.Style

RawStyle returns the author-set style for this element.

func (*RadioGroupElement) Ref

func (b *RadioGroupElement) Ref(dst **Self) *Self

Ref stores a pointer to the concrete element into dst (if non-nil) and returns *Self.

func (*RadioGroupElement) ResetCaret

func (b *RadioGroupElement) ResetCaret(dir dom.Direction)

ResetCaret satisfies the dom.SpatialCaret interface.

func (*RadioGroupElement) ScrollbarX

func (b *RadioGroupElement) ScrollbarX(v bool) *Self

ScrollbarX enables or disables the horizontal scrollbar and returns *Self.

func (*RadioGroupElement) ScrollbarY

func (b *RadioGroupElement) ScrollbarY(v bool) *Self

ScrollbarY enables or disables the vertical scrollbar and returns *Self.

func (*RadioGroupElement) SetCursorNavigable

func (b *RadioGroupElement) SetCursorNavigable(v bool)

SetCursorNavigable sets whether the element is cursor-navigable.

func (*RadioGroupElement) SetDisabled

func (rg *RadioGroupElement) SetDisabled(v bool)

func (*RadioGroupElement) SetHidden

func (b *RadioGroupElement) SetHidden(v bool)

SetHidden sets or clears the hidden state and marks style dirty.

func (*RadioGroupElement) SetStyle

func (b *RadioGroupElement) SetStyle(s style.Style)

SetStyle replaces the element's style wholesale and marks style dirty.

func (*RadioGroupElement) SetText

func (b *RadioGroupElement) SetText(text string) *Self

SetText replaces the element's children with a single text node containing text, updating an existing sole text child in place when possible, and returns *Self.

func (*RadioGroupElement) SetTextf

func (b *RadioGroupElement) SetTextf(format string, args ...any) *Self

SetTextf formats text with fmt.Sprintf and passes the result to [SetText].

func (*RadioGroupElement) SetValue

func (rg *RadioGroupElement) SetValue(value string) *RadioGroupElement

SetValue updates the selected value and synchronizes all child radio buttons.

func (*RadioGroupElement) Style

func (b *RadioGroupElement) Style(s style.Style) *Self

Style replaces the element's style wholesale and returns *Self. Calling Style twice discards the first call; style composition belongs at the style.Style value level via Style.Merge.

func (*RadioGroupElement) Unwrap

func (b *RadioGroupElement) Unwrap() dom.Node

Unwrap returns the underlying dom.Node.

func (*RadioGroupElement) Value

func (rg *RadioGroupElement) Value() string

Value returns the currently selected value in the group.

func (*RadioGroupElement) WithClass

func (b *RadioGroupElement) WithClass(class string) *Self

WithClass sets the string classification tag and returns *Self.

func (*RadioGroupElement) WithID

func (b *RadioGroupElement) WithID(id string) *Self

WithID sets the element's identifier and returns *Self.

func (*RadioGroupElement) WithTabIndex

func (b *RadioGroupElement) WithTabIndex(index int) *Self

WithTabIndex sets the tab index on the element and returns *Self.

type SelectElement

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

SelectElement implements a dropdown selection component.

func NewSelect

func NewSelect(doc dom.Document, children ...any) *SelectElement

NewSelect creates a new SelectElement owned by doc.

func Select

func Select(children ...any) *SelectElement

Select creates a new SelectElement with the given children.

func (*SelectElement) AddChild

func (b *SelectElement) AddChild(child dom.Node) *Self

AddChild adds child as the last child of this element and returns the element itself for fluent chaining.

func (*SelectElement) Animate

func (b *SelectElement) Animate(
	from, to style.Style,
	opts animation.Options,
) *animation.Playback

Animate interpolates style properties from start to end on the element over opts.Duration using the document window's frame clock. Unrelated author styles are preserved via sparse merging, and the animation cancels automatically if the element disconnects from the document.

func (*SelectElement) AppendChild

func (s *SelectElement) AppendChild(child dom.Node) dom.Node

AppendChild overrides dom.Element.AppendChild to sync select options.

func (*SelectElement) CursorNavigable

func (b *SelectElement) CursorNavigable(v bool) *Self

CursorNavigable enables character-level caret navigation and text selection on this element.

func (*SelectElement) DefaultStyle

func (b *SelectElement) DefaultStyle() style.Style

DefaultStyle returns the element-type default style.

func (*SelectElement) DefaultValue

func (s *SelectElement) DefaultValue(value string) *SelectElement

func (*SelectElement) Disabled

func (s *SelectElement) Disabled(v bool) *SelectElement

func (*SelectElement) DispatchEvent

func (b *SelectElement) DispatchEvent(e event.Event)

DispatchEvent fires an event that propagates through the DOM tree.

func (*SelectElement) EventListeners

func (b *SelectElement) EventListeners() []PendingListener

EventListeners returns the event listener registrations for this element. Used by the engine's event-target resolver to wire up dispatch.

func (*SelectElement) Hidden

func (b *SelectElement) Hidden(v bool) *Self

Hidden sets or clears the hidden state and returns *Self.

func (*SelectElement) IntrinsicStyle

func (b *SelectElement) IntrinsicStyle() style.Style

IntrinsicStyle returns the UA-mandated forced style for this element. Properties set here have the highest cascade precedence; authors cannot override them via Style(). Most elements return an empty style.S(). Replaced and compound elements return a sparse Style with UA-forced properties (e.g. Display:InlineBlock, OverflowX:Clip). See ADR-010.

func (*SelectElement) IsCursorNavigable

func (b *SelectElement) IsCursorNavigable() bool

IsCursorNavigable reports whether the element is cursor-navigable.

func (*SelectElement) IsDirtyStyle

func (b *SelectElement) IsDirtyStyle() bool

IsDirtyStyle reports whether this element's style needs re-resolution.

func (*SelectElement) IsDisabled

func (s *SelectElement) IsDisabled() bool

func (*SelectElement) IsHidden

func (b *SelectElement) IsHidden() bool

IsHidden reports whether the element is hidden.

func (*SelectElement) Listeners

func (b *SelectElement) Listeners() []PendingListener

Listeners returns the set of event listeners registered on this element.

func (*SelectElement) MoveCaret

func (b *SelectElement) MoveCaret(dir dom.Direction) (boundaryReached bool)

MoveCaret satisfies the dom.SpatialCaret interface.

func (*SelectElement) Name

func (s *SelectElement) Name() string

Name returns the form control name.

func (*SelectElement) OnBlur

func (b *SelectElement) OnBlur(fn func(*event.FocusEvent)) *Self

OnBlur registers a typed blur listener and returns *Self.

func (*SelectElement) OnChange

func (s *SelectElement) OnChange(fn func(string)) *SelectElement

OnChange sets a callback to be invoked when the selection changes.

func (*SelectElement) OnClick

func (b *SelectElement) OnClick(fn func(*event.MouseEvent)) *Self

OnClick registers a typed click listener and returns *Self.

func (*SelectElement) OnConnect

func (b *SelectElement) OnConnect(fn func()) *Self

OnConnect registers fn to run each time the element enters the live document.

func (*SelectElement) OnConnected

func (b *SelectElement) OnConnected()

func (*SelectElement) OnDisconnect

func (b *SelectElement) OnDisconnect(fn func()) *Self

OnDisconnect registers fn to run just before the element leaves the live document.

func (*SelectElement) OnDisconnected

func (b *SelectElement) OnDisconnected()

func (*SelectElement) OnEvent

func (b *SelectElement) OnEvent(typ event.EventType, fn event.Listener) *Self

OnEvent registers fn as a listener for event of type typ and returns *Self. Listeners are stored on the element and retrieved by the engine's event-target resolver during dispatch setup. Nil handlers are ignored.

func (*SelectElement) OnFocus

func (b *SelectElement) OnFocus(fn func(*event.FocusEvent)) *Self

OnFocus registers a typed focus listener and returns *Self.

func (*SelectElement) OnKey

func (b *SelectElement) OnKey(combo string, fn func(*event.KeyEvent)) *Self

OnKey registers a keydown listener filtered by combo via event.KeyEvent.MatchString and returns *Self.

func (*SelectElement) OnKeyDown

func (b *SelectElement) OnKeyDown(fn func(*event.KeyEvent)) *Self

OnKeyDown registers a typed keydown listener and returns *Self.

func (*SelectElement) OnKeyPress

func (b *SelectElement) OnKeyPress(fn func(*event.KeyEvent)) *Self

OnKeyPress registers a typed keypress listener and returns *Self.

func (*SelectElement) OnKeyUp

func (b *SelectElement) OnKeyUp(fn func(*event.KeyEvent)) *Self

OnKeyUp registers a typed keyup listener and returns *Self.

func (*SelectElement) OnMouseDown

func (b *SelectElement) OnMouseDown(fn func(*event.MouseEvent)) *Self

OnMouseDown registers a typed mousedown listener and returns *Self.

func (*SelectElement) OnMouseEnter

func (b *SelectElement) OnMouseEnter(fn func(*event.MouseEvent)) *Self

OnMouseEnter registers a typed mouseenter listener and returns *Self.

func (*SelectElement) OnMouseLeave

func (b *SelectElement) OnMouseLeave(fn func(*event.MouseEvent)) *Self

OnMouseLeave registers a typed mouseleave listener and returns *Self.

func (*SelectElement) OnMouseMove

func (b *SelectElement) OnMouseMove(fn func(*event.MouseEvent)) *Self

OnMouseMove registers a typed mousemove listener and returns *Self.

func (*SelectElement) OnMouseUp

func (b *SelectElement) OnMouseUp(fn func(*event.MouseEvent)) *Self

OnMouseUp registers a typed mouseup listener and returns *Self.

func (*SelectElement) OnPress

func (b *SelectElement) OnPress(fn func()) *Self

OnPress registers a zero-argument activation listener on click (including keyboard Enter/Space activation on buttons) and returns *Self.

func (*SelectElement) OnSelectionChange

func (b *SelectElement) OnSelectionChange(fn func(*event.SelectionChangeEvent)) *Self

OnSelectionChange registers a typed selectionchange listener and returns *Self.

func (*SelectElement) OnWheelEvent

func (b *SelectElement) OnWheelEvent(fn func(*event.WheelEvent)) *Self

OnWheelEvent registers a typed wheel listener and returns *Self. Named OnWheelEvent to avoid colliding with event.Scrollable's OnWheel method.

func (*SelectElement) RawStyle

func (b *SelectElement) RawStyle() style.Style

RawStyle returns the author-set style for this element.

func (*SelectElement) Ref

func (b *SelectElement) Ref(dst **Self) *Self

Ref stores a pointer to the concrete element into dst (if non-nil) and returns *Self.

func (*SelectElement) RemoveChild

func (s *SelectElement) RemoveChild(child dom.Node) dom.Node

RemoveChild overrides dom.Element.RemoveChild to sync select options.

func (*SelectElement) ResetCaret

func (b *SelectElement) ResetCaret(dir dom.Direction)

ResetCaret satisfies the dom.SpatialCaret interface.

func (*SelectElement) ScrollbarX

func (b *SelectElement) ScrollbarX(v bool) *Self

ScrollbarX enables or disables the horizontal scrollbar and returns *Self.

func (*SelectElement) ScrollbarY

func (b *SelectElement) ScrollbarY(v bool) *Self

ScrollbarY enables or disables the vertical scrollbar and returns *Self.

func (*SelectElement) SetCursorNavigable

func (b *SelectElement) SetCursorNavigable(v bool)

SetCursorNavigable sets whether the element is cursor-navigable.

func (*SelectElement) SetData

func (s *SelectElement) SetData(data string)

func (*SelectElement) SetDisabled

func (s *SelectElement) SetDisabled(v bool)

func (*SelectElement) SetHidden

func (b *SelectElement) SetHidden(v bool)

SetHidden sets or clears the hidden state and marks style dirty.

func (*SelectElement) SetOptions

func (s *SelectElement) SetOptions(options []*OptionElement) *SelectElement

SetOptions updates the list of options available in the dropdown.

func (*SelectElement) SetStyle

func (b *SelectElement) SetStyle(s style.Style)

SetStyle replaces the element's style wholesale and marks style dirty.

func (*SelectElement) SetText

func (b *SelectElement) SetText(text string) *Self

SetText replaces the element's children with a single text node containing text, updating an existing sole text child in place when possible, and returns *Self.

func (*SelectElement) SetTextf

func (b *SelectElement) SetTextf(format string, args ...any) *Self

SetTextf formats text with fmt.Sprintf and passes the result to [SetText].

func (*SelectElement) SetValue

func (s *SelectElement) SetValue(value string) *SelectElement

SetValue updates the selected value and updates the trigger button text.

func (*SelectElement) Style

func (b *SelectElement) Style(s style.Style) *Self

Style replaces the element's style wholesale and returns *Self. Calling Style twice discards the first call; style composition belongs at the style.Style value level via Style.Merge.

func (*SelectElement) Unwrap

func (b *SelectElement) Unwrap() dom.Node

Unwrap returns the underlying dom.Node.

func (*SelectElement) Value

func (s *SelectElement) Value() any

Value returns the currently selected value.

func (*SelectElement) WithClass

func (b *SelectElement) WithClass(class string) *Self

WithClass sets the string classification tag and returns *Self.

func (*SelectElement) WithID

func (b *SelectElement) WithID(id string) *Self

WithID sets the element's identifier and returns *Self.

func (*SelectElement) WithName

func (s *SelectElement) WithName(name string) *SelectElement

WithName sets the form control name and returns the SelectElement.

func (*SelectElement) WithTabIndex

func (b *SelectElement) WithTabIndex(index int) *Self

WithTabIndex sets the tab index on the element and returns *Self.

type SpanElement

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

SpanElement represents an inline container element (like a HTML <span>).

func NewSpan

func NewSpan(doc dom.Document) *SpanElement

NewSpan creates a new inline span container.

func Span

func Span(children ...any) *SpanElement

Span creates a new inline span container with the given children.

func (*SpanElement) AddChild

func (b *SpanElement) AddChild(child dom.Node) *Self

AddChild adds child as the last child of this element and returns the element itself for fluent chaining.

func (*SpanElement) Animate

func (b *SpanElement) Animate(
	from, to style.Style,
	opts animation.Options,
) *animation.Playback

Animate interpolates style properties from start to end on the element over opts.Duration using the document window's frame clock. Unrelated author styles are preserved via sparse merging, and the animation cancels automatically if the element disconnects from the document.

func (*SpanElement) CursorNavigable

func (b *SpanElement) CursorNavigable(v bool) *Self

CursorNavigable enables character-level caret navigation and text selection on this element.

func (*SpanElement) DefaultStyle

func (b *SpanElement) DefaultStyle() style.Style

DefaultStyle returns the element-type default style.

func (*SpanElement) DispatchEvent

func (b *SpanElement) DispatchEvent(e event.Event)

DispatchEvent fires an event that propagates through the DOM tree.

func (*SpanElement) EventListeners

func (b *SpanElement) EventListeners() []PendingListener

EventListeners returns the event listener registrations for this element. Used by the engine's event-target resolver to wire up dispatch.

func (*SpanElement) Hidden

func (b *SpanElement) Hidden(v bool) *Self

Hidden sets or clears the hidden state and returns *Self.

func (*SpanElement) IntrinsicStyle

func (b *SpanElement) IntrinsicStyle() style.Style

IntrinsicStyle returns the UA-mandated forced style for this element. Properties set here have the highest cascade precedence; authors cannot override them via Style(). Most elements return an empty style.S(). Replaced and compound elements return a sparse Style with UA-forced properties (e.g. Display:InlineBlock, OverflowX:Clip). See ADR-010.

func (*SpanElement) IsCursorNavigable

func (b *SpanElement) IsCursorNavigable() bool

IsCursorNavigable reports whether the element is cursor-navigable.

func (*SpanElement) IsDirtyStyle

func (b *SpanElement) IsDirtyStyle() bool

IsDirtyStyle reports whether this element's style needs re-resolution.

func (*SpanElement) IsHidden

func (b *SpanElement) IsHidden() bool

IsHidden reports whether the element is hidden.

func (*SpanElement) Listeners

func (b *SpanElement) Listeners() []PendingListener

Listeners returns the set of event listeners registered on this element.

func (*SpanElement) MoveCaret

func (b *SpanElement) MoveCaret(dir dom.Direction) (boundaryReached bool)

MoveCaret satisfies the dom.SpatialCaret interface.

func (*SpanElement) OnBlur

func (b *SpanElement) OnBlur(fn func(*event.FocusEvent)) *Self

OnBlur registers a typed blur listener and returns *Self.

func (*SpanElement) OnClick

func (b *SpanElement) OnClick(fn func(*event.MouseEvent)) *Self

OnClick registers a typed click listener and returns *Self.

func (*SpanElement) OnConnect

func (b *SpanElement) OnConnect(fn func()) *Self

OnConnect registers fn to run each time the element enters the live document.

func (*SpanElement) OnConnected

func (b *SpanElement) OnConnected()

func (*SpanElement) OnDisconnect

func (b *SpanElement) OnDisconnect(fn func()) *Self

OnDisconnect registers fn to run just before the element leaves the live document.

func (*SpanElement) OnDisconnected

func (b *SpanElement) OnDisconnected()

func (*SpanElement) OnEvent

func (b *SpanElement) OnEvent(typ event.EventType, fn event.Listener) *Self

OnEvent registers fn as a listener for event of type typ and returns *Self. Listeners are stored on the element and retrieved by the engine's event-target resolver during dispatch setup. Nil handlers are ignored.

func (*SpanElement) OnFocus

func (b *SpanElement) OnFocus(fn func(*event.FocusEvent)) *Self

OnFocus registers a typed focus listener and returns *Self.

func (*SpanElement) OnKey

func (b *SpanElement) OnKey(combo string, fn func(*event.KeyEvent)) *Self

OnKey registers a keydown listener filtered by combo via event.KeyEvent.MatchString and returns *Self.

func (*SpanElement) OnKeyDown

func (b *SpanElement) OnKeyDown(fn func(*event.KeyEvent)) *Self

OnKeyDown registers a typed keydown listener and returns *Self.

func (*SpanElement) OnKeyPress

func (b *SpanElement) OnKeyPress(fn func(*event.KeyEvent)) *Self

OnKeyPress registers a typed keypress listener and returns *Self.

func (*SpanElement) OnKeyUp

func (b *SpanElement) OnKeyUp(fn func(*event.KeyEvent)) *Self

OnKeyUp registers a typed keyup listener and returns *Self.

func (*SpanElement) OnMouseDown

func (b *SpanElement) OnMouseDown(fn func(*event.MouseEvent)) *Self

OnMouseDown registers a typed mousedown listener and returns *Self.

func (*SpanElement) OnMouseEnter

func (b *SpanElement) OnMouseEnter(fn func(*event.MouseEvent)) *Self

OnMouseEnter registers a typed mouseenter listener and returns *Self.

func (*SpanElement) OnMouseLeave

func (b *SpanElement) OnMouseLeave(fn func(*event.MouseEvent)) *Self

OnMouseLeave registers a typed mouseleave listener and returns *Self.

func (*SpanElement) OnMouseMove

func (b *SpanElement) OnMouseMove(fn func(*event.MouseEvent)) *Self

OnMouseMove registers a typed mousemove listener and returns *Self.

func (*SpanElement) OnMouseUp

func (b *SpanElement) OnMouseUp(fn func(*event.MouseEvent)) *Self

OnMouseUp registers a typed mouseup listener and returns *Self.

func (*SpanElement) OnPress

func (b *SpanElement) OnPress(fn func()) *Self

OnPress registers a zero-argument activation listener on click (including keyboard Enter/Space activation on buttons) and returns *Self.

func (*SpanElement) OnSelectionChange

func (b *SpanElement) OnSelectionChange(fn func(*event.SelectionChangeEvent)) *Self

OnSelectionChange registers a typed selectionchange listener and returns *Self.

func (*SpanElement) OnWheelEvent

func (b *SpanElement) OnWheelEvent(fn func(*event.WheelEvent)) *Self

OnWheelEvent registers a typed wheel listener and returns *Self. Named OnWheelEvent to avoid colliding with event.Scrollable's OnWheel method.

func (*SpanElement) RawStyle

func (b *SpanElement) RawStyle() style.Style

RawStyle returns the author-set style for this element.

func (*SpanElement) Ref

func (b *SpanElement) Ref(dst **Self) *Self

Ref stores a pointer to the concrete element into dst (if non-nil) and returns *Self.

func (*SpanElement) ResetCaret

func (b *SpanElement) ResetCaret(dir dom.Direction)

ResetCaret satisfies the dom.SpatialCaret interface.

func (*SpanElement) ScrollbarX

func (b *SpanElement) ScrollbarX(v bool) *Self

ScrollbarX enables or disables the horizontal scrollbar and returns *Self.

func (*SpanElement) ScrollbarY

func (b *SpanElement) ScrollbarY(v bool) *Self

ScrollbarY enables or disables the vertical scrollbar and returns *Self.

func (*SpanElement) SetCursorNavigable

func (b *SpanElement) SetCursorNavigable(v bool)

SetCursorNavigable sets whether the element is cursor-navigable.

func (*SpanElement) SetHidden

func (b *SpanElement) SetHidden(v bool)

SetHidden sets or clears the hidden state and marks style dirty.

func (*SpanElement) SetStyle

func (b *SpanElement) SetStyle(s style.Style)

SetStyle replaces the element's style wholesale and marks style dirty.

func (*SpanElement) SetText

func (b *SpanElement) SetText(text string) *Self

SetText replaces the element's children with a single text node containing text, updating an existing sole text child in place when possible, and returns *Self.

func (*SpanElement) SetTextf

func (b *SpanElement) SetTextf(format string, args ...any) *Self

SetTextf formats text with fmt.Sprintf and passes the result to [SetText].

func (*SpanElement) Style

func (b *SpanElement) Style(s style.Style) *Self

Style replaces the element's style wholesale and returns *Self. Calling Style twice discards the first call; style composition belongs at the style.Style value level via Style.Merge.

func (*SpanElement) Unwrap

func (b *SpanElement) Unwrap() dom.Node

Unwrap returns the underlying dom.Node.

func (*SpanElement) WithClass

func (b *SpanElement) WithClass(class string) *Self

WithClass sets the string classification tag and returns *Self.

func (*SpanElement) WithID

func (b *SpanElement) WithID(id string) *Self

WithID sets the element's identifier and returns *Self.

func (*SpanElement) WithTabIndex

func (b *SpanElement) WithTabIndex(index int) *Self

WithTabIndex sets the tab index on the element and returns *Self.

type TableBodyElement

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

TableBodyElement represents a table body group element.

func NewTableBody

func NewTableBody(doc dom.Document) *TableBodyElement

NewTableBody creates a new table body group element.

func TBody

func TBody(children ...any) *TableBodyElement

TBody creates a new table body group element with the given children.

func TableBody

func TableBody(children ...any) *TableBodyElement

TableBody is an alias for TBody.

func (*TableBodyElement) AddChild

func (b *TableBodyElement) AddChild(child dom.Node) *Self

AddChild adds child as the last child of this element and returns the element itself for fluent chaining.

func (*TableBodyElement) Animate

func (b *TableBodyElement) Animate(
	from, to style.Style,
	opts animation.Options,
) *animation.Playback

Animate interpolates style properties from start to end on the element over opts.Duration using the document window's frame clock. Unrelated author styles are preserved via sparse merging, and the animation cancels automatically if the element disconnects from the document.

func (*TableBodyElement) CursorNavigable

func (b *TableBodyElement) CursorNavigable(v bool) *Self

CursorNavigable enables character-level caret navigation and text selection on this element.

func (*TableBodyElement) DefaultStyle

func (b *TableBodyElement) DefaultStyle() style.Style

DefaultStyle returns the element-type default style.

func (*TableBodyElement) DispatchEvent

func (b *TableBodyElement) DispatchEvent(e event.Event)

DispatchEvent fires an event that propagates through the DOM tree.

func (*TableBodyElement) EventListeners

func (b *TableBodyElement) EventListeners() []PendingListener

EventListeners returns the event listener registrations for this element. Used by the engine's event-target resolver to wire up dispatch.

func (*TableBodyElement) Hidden

func (b *TableBodyElement) Hidden(v bool) *Self

Hidden sets or clears the hidden state and returns *Self.

func (*TableBodyElement) IntrinsicStyle

func (b *TableBodyElement) IntrinsicStyle() style.Style

IntrinsicStyle returns the UA-mandated forced style for this element. Properties set here have the highest cascade precedence; authors cannot override them via Style(). Most elements return an empty style.S(). Replaced and compound elements return a sparse Style with UA-forced properties (e.g. Display:InlineBlock, OverflowX:Clip). See ADR-010.

func (*TableBodyElement) IsCursorNavigable

func (b *TableBodyElement) IsCursorNavigable() bool

IsCursorNavigable reports whether the element is cursor-navigable.

func (*TableBodyElement) IsDirtyStyle

func (b *TableBodyElement) IsDirtyStyle() bool

IsDirtyStyle reports whether this element's style needs re-resolution.

func (*TableBodyElement) IsHidden

func (b *TableBodyElement) IsHidden() bool

IsHidden reports whether the element is hidden.

func (*TableBodyElement) Listeners

func (b *TableBodyElement) Listeners() []PendingListener

Listeners returns the set of event listeners registered on this element.

func (*TableBodyElement) MoveCaret

func (b *TableBodyElement) MoveCaret(dir dom.Direction) (boundaryReached bool)

MoveCaret satisfies the dom.SpatialCaret interface.

func (*TableBodyElement) OnBlur

func (b *TableBodyElement) OnBlur(fn func(*event.FocusEvent)) *Self

OnBlur registers a typed blur listener and returns *Self.

func (*TableBodyElement) OnClick

func (b *TableBodyElement) OnClick(fn func(*event.MouseEvent)) *Self

OnClick registers a typed click listener and returns *Self.

func (*TableBodyElement) OnConnect

func (b *TableBodyElement) OnConnect(fn func()) *Self

OnConnect registers fn to run each time the element enters the live document.

func (*TableBodyElement) OnConnected

func (b *TableBodyElement) OnConnected()

func (*TableBodyElement) OnDisconnect

func (b *TableBodyElement) OnDisconnect(fn func()) *Self

OnDisconnect registers fn to run just before the element leaves the live document.

func (*TableBodyElement) OnDisconnected

func (b *TableBodyElement) OnDisconnected()

func (*TableBodyElement) OnEvent

func (b *TableBodyElement) OnEvent(typ event.EventType, fn event.Listener) *Self

OnEvent registers fn as a listener for event of type typ and returns *Self. Listeners are stored on the element and retrieved by the engine's event-target resolver during dispatch setup. Nil handlers are ignored.

func (*TableBodyElement) OnFocus

func (b *TableBodyElement) OnFocus(fn func(*event.FocusEvent)) *Self

OnFocus registers a typed focus listener and returns *Self.

func (*TableBodyElement) OnKey

func (b *TableBodyElement) OnKey(combo string, fn func(*event.KeyEvent)) *Self

OnKey registers a keydown listener filtered by combo via event.KeyEvent.MatchString and returns *Self.

func (*TableBodyElement) OnKeyDown

func (b *TableBodyElement) OnKeyDown(fn func(*event.KeyEvent)) *Self

OnKeyDown registers a typed keydown listener and returns *Self.

func (*TableBodyElement) OnKeyPress

func (b *TableBodyElement) OnKeyPress(fn func(*event.KeyEvent)) *Self

OnKeyPress registers a typed keypress listener and returns *Self.

func (*TableBodyElement) OnKeyUp

func (b *TableBodyElement) OnKeyUp(fn func(*event.KeyEvent)) *Self

OnKeyUp registers a typed keyup listener and returns *Self.

func (*TableBodyElement) OnMouseDown

func (b *TableBodyElement) OnMouseDown(fn func(*event.MouseEvent)) *Self

OnMouseDown registers a typed mousedown listener and returns *Self.

func (*TableBodyElement) OnMouseEnter

func (b *TableBodyElement) OnMouseEnter(fn func(*event.MouseEvent)) *Self

OnMouseEnter registers a typed mouseenter listener and returns *Self.

func (*TableBodyElement) OnMouseLeave

func (b *TableBodyElement) OnMouseLeave(fn func(*event.MouseEvent)) *Self

OnMouseLeave registers a typed mouseleave listener and returns *Self.

func (*TableBodyElement) OnMouseMove

func (b *TableBodyElement) OnMouseMove(fn func(*event.MouseEvent)) *Self

OnMouseMove registers a typed mousemove listener and returns *Self.

func (*TableBodyElement) OnMouseUp

func (b *TableBodyElement) OnMouseUp(fn func(*event.MouseEvent)) *Self

OnMouseUp registers a typed mouseup listener and returns *Self.

func (*TableBodyElement) OnPress

func (b *TableBodyElement) OnPress(fn func()) *Self

OnPress registers a zero-argument activation listener on click (including keyboard Enter/Space activation on buttons) and returns *Self.

func (*TableBodyElement) OnSelectionChange

func (b *TableBodyElement) OnSelectionChange(fn func(*event.SelectionChangeEvent)) *Self

OnSelectionChange registers a typed selectionchange listener and returns *Self.

func (*TableBodyElement) OnWheelEvent

func (b *TableBodyElement) OnWheelEvent(fn func(*event.WheelEvent)) *Self

OnWheelEvent registers a typed wheel listener and returns *Self. Named OnWheelEvent to avoid colliding with event.Scrollable's OnWheel method.

func (*TableBodyElement) RawStyle

func (b *TableBodyElement) RawStyle() style.Style

RawStyle returns the author-set style for this element.

func (*TableBodyElement) Ref

func (b *TableBodyElement) Ref(dst **Self) *Self

Ref stores a pointer to the concrete element into dst (if non-nil) and returns *Self.

func (*TableBodyElement) ResetCaret

func (b *TableBodyElement) ResetCaret(dir dom.Direction)

ResetCaret satisfies the dom.SpatialCaret interface.

func (*TableBodyElement) ScrollbarX

func (b *TableBodyElement) ScrollbarX(v bool) *Self

ScrollbarX enables or disables the horizontal scrollbar and returns *Self.

func (*TableBodyElement) ScrollbarY

func (b *TableBodyElement) ScrollbarY(v bool) *Self

ScrollbarY enables or disables the vertical scrollbar and returns *Self.

func (*TableBodyElement) SetCursorNavigable

func (b *TableBodyElement) SetCursorNavigable(v bool)

SetCursorNavigable sets whether the element is cursor-navigable.

func (*TableBodyElement) SetHidden

func (b *TableBodyElement) SetHidden(v bool)

SetHidden sets or clears the hidden state and marks style dirty.

func (*TableBodyElement) SetStyle

func (b *TableBodyElement) SetStyle(s style.Style)

SetStyle replaces the element's style wholesale and marks style dirty.

func (*TableBodyElement) SetText

func (b *TableBodyElement) SetText(text string) *Self

SetText replaces the element's children with a single text node containing text, updating an existing sole text child in place when possible, and returns *Self.

func (*TableBodyElement) SetTextf

func (b *TableBodyElement) SetTextf(format string, args ...any) *Self

SetTextf formats text with fmt.Sprintf and passes the result to [SetText].

func (*TableBodyElement) Style

func (b *TableBodyElement) Style(s style.Style) *Self

Style replaces the element's style wholesale and returns *Self. Calling Style twice discards the first call; style composition belongs at the style.Style value level via Style.Merge.

func (*TableBodyElement) Unwrap

func (b *TableBodyElement) Unwrap() dom.Node

Unwrap returns the underlying dom.Node.

func (*TableBodyElement) WithClass

func (b *TableBodyElement) WithClass(class string) *Self

WithClass sets the string classification tag and returns *Self.

func (*TableBodyElement) WithID

func (b *TableBodyElement) WithID(id string) *Self

WithID sets the element's identifier and returns *Self.

func (*TableBodyElement) WithTabIndex

func (b *TableBodyElement) WithTabIndex(index int) *Self

WithTabIndex sets the tab index on the element and returns *Self.

type TableCellElement

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

TableCellElement represents a table cell element.

func NewTableCell

func NewTableCell(doc dom.Document) *TableCellElement

NewTableCell creates a new table cell element.

func TD

func TD(children ...any) *TableCellElement

TD creates a new table cell element with the given children.

func (*TableCellElement) AddChild

func (b *TableCellElement) AddChild(child dom.Node) *Self

AddChild adds child as the last child of this element and returns the element itself for fluent chaining.

func (*TableCellElement) Animate

func (b *TableCellElement) Animate(
	from, to style.Style,
	opts animation.Options,
) *animation.Playback

Animate interpolates style properties from start to end on the element over opts.Duration using the document window's frame clock. Unrelated author styles are preserved via sparse merging, and the animation cancels automatically if the element disconnects from the document.

func (*TableCellElement) ColSpan

func (td *TableCellElement) ColSpan() int

ColSpan returns the number of columns the cell spans.

func (*TableCellElement) CursorNavigable

func (b *TableCellElement) CursorNavigable(v bool) *Self

CursorNavigable enables character-level caret navigation and text selection on this element.

func (*TableCellElement) DefaultStyle

func (b *TableCellElement) DefaultStyle() style.Style

DefaultStyle returns the element-type default style.

func (*TableCellElement) DispatchEvent

func (b *TableCellElement) DispatchEvent(e event.Event)

DispatchEvent fires an event that propagates through the DOM tree.

func (*TableCellElement) EventListeners

func (b *TableCellElement) EventListeners() []PendingListener

EventListeners returns the event listener registrations for this element. Used by the engine's event-target resolver to wire up dispatch.

func (*TableCellElement) Hidden

func (b *TableCellElement) Hidden(v bool) *Self

Hidden sets or clears the hidden state and returns *Self.

func (*TableCellElement) IntrinsicStyle

func (b *TableCellElement) IntrinsicStyle() style.Style

IntrinsicStyle returns the UA-mandated forced style for this element. Properties set here have the highest cascade precedence; authors cannot override them via Style(). Most elements return an empty style.S(). Replaced and compound elements return a sparse Style with UA-forced properties (e.g. Display:InlineBlock, OverflowX:Clip). See ADR-010.

func (*TableCellElement) IsCursorNavigable

func (b *TableCellElement) IsCursorNavigable() bool

IsCursorNavigable reports whether the element is cursor-navigable.

func (*TableCellElement) IsDirtyStyle

func (b *TableCellElement) IsDirtyStyle() bool

IsDirtyStyle reports whether this element's style needs re-resolution.

func (*TableCellElement) IsHidden

func (b *TableCellElement) IsHidden() bool

IsHidden reports whether the element is hidden.

func (*TableCellElement) Listeners

func (b *TableCellElement) Listeners() []PendingListener

Listeners returns the set of event listeners registered on this element.

func (*TableCellElement) MoveCaret

func (b *TableCellElement) MoveCaret(dir dom.Direction) (boundaryReached bool)

MoveCaret satisfies the dom.SpatialCaret interface.

func (*TableCellElement) OnBlur

func (b *TableCellElement) OnBlur(fn func(*event.FocusEvent)) *Self

OnBlur registers a typed blur listener and returns *Self.

func (*TableCellElement) OnClick

func (b *TableCellElement) OnClick(fn func(*event.MouseEvent)) *Self

OnClick registers a typed click listener and returns *Self.

func (*TableCellElement) OnConnect

func (b *TableCellElement) OnConnect(fn func()) *Self

OnConnect registers fn to run each time the element enters the live document.

func (*TableCellElement) OnConnected

func (b *TableCellElement) OnConnected()

func (*TableCellElement) OnDisconnect

func (b *TableCellElement) OnDisconnect(fn func()) *Self

OnDisconnect registers fn to run just before the element leaves the live document.

func (*TableCellElement) OnDisconnected

func (b *TableCellElement) OnDisconnected()

func (*TableCellElement) OnEvent

func (b *TableCellElement) OnEvent(typ event.EventType, fn event.Listener) *Self

OnEvent registers fn as a listener for event of type typ and returns *Self. Listeners are stored on the element and retrieved by the engine's event-target resolver during dispatch setup. Nil handlers are ignored.

func (*TableCellElement) OnFocus

func (b *TableCellElement) OnFocus(fn func(*event.FocusEvent)) *Self

OnFocus registers a typed focus listener and returns *Self.

func (*TableCellElement) OnKey

func (b *TableCellElement) OnKey(combo string, fn func(*event.KeyEvent)) *Self

OnKey registers a keydown listener filtered by combo via event.KeyEvent.MatchString and returns *Self.

func (*TableCellElement) OnKeyDown

func (b *TableCellElement) OnKeyDown(fn func(*event.KeyEvent)) *Self

OnKeyDown registers a typed keydown listener and returns *Self.

func (*TableCellElement) OnKeyPress

func (b *TableCellElement) OnKeyPress(fn func(*event.KeyEvent)) *Self

OnKeyPress registers a typed keypress listener and returns *Self.

func (*TableCellElement) OnKeyUp

func (b *TableCellElement) OnKeyUp(fn func(*event.KeyEvent)) *Self

OnKeyUp registers a typed keyup listener and returns *Self.

func (*TableCellElement) OnMouseDown

func (b *TableCellElement) OnMouseDown(fn func(*event.MouseEvent)) *Self

OnMouseDown registers a typed mousedown listener and returns *Self.

func (*TableCellElement) OnMouseEnter

func (b *TableCellElement) OnMouseEnter(fn func(*event.MouseEvent)) *Self

OnMouseEnter registers a typed mouseenter listener and returns *Self.

func (*TableCellElement) OnMouseLeave

func (b *TableCellElement) OnMouseLeave(fn func(*event.MouseEvent)) *Self

OnMouseLeave registers a typed mouseleave listener and returns *Self.

func (*TableCellElement) OnMouseMove

func (b *TableCellElement) OnMouseMove(fn func(*event.MouseEvent)) *Self

OnMouseMove registers a typed mousemove listener and returns *Self.

func (*TableCellElement) OnMouseUp

func (b *TableCellElement) OnMouseUp(fn func(*event.MouseEvent)) *Self

OnMouseUp registers a typed mouseup listener and returns *Self.

func (*TableCellElement) OnPress

func (b *TableCellElement) OnPress(fn func()) *Self

OnPress registers a zero-argument activation listener on click (including keyboard Enter/Space activation on buttons) and returns *Self.

func (*TableCellElement) OnSelectionChange

func (b *TableCellElement) OnSelectionChange(fn func(*event.SelectionChangeEvent)) *Self

OnSelectionChange registers a typed selectionchange listener and returns *Self.

func (*TableCellElement) OnWheelEvent

func (b *TableCellElement) OnWheelEvent(fn func(*event.WheelEvent)) *Self

OnWheelEvent registers a typed wheel listener and returns *Self. Named OnWheelEvent to avoid colliding with event.Scrollable's OnWheel method.

func (*TableCellElement) RawStyle

func (b *TableCellElement) RawStyle() style.Style

RawStyle returns the author-set style for this element.

func (*TableCellElement) Ref

func (b *TableCellElement) Ref(dst **Self) *Self

Ref stores a pointer to the concrete element into dst (if non-nil) and returns *Self.

func (*TableCellElement) ResetCaret

func (b *TableCellElement) ResetCaret(dir dom.Direction)

ResetCaret satisfies the dom.SpatialCaret interface.

func (*TableCellElement) RowSpan

func (td *TableCellElement) RowSpan() int

RowSpan returns the number of rows the cell spans.

func (*TableCellElement) ScrollbarX

func (b *TableCellElement) ScrollbarX(v bool) *Self

ScrollbarX enables or disables the horizontal scrollbar and returns *Self.

func (*TableCellElement) ScrollbarY

func (b *TableCellElement) ScrollbarY(v bool) *Self

ScrollbarY enables or disables the vertical scrollbar and returns *Self.

func (*TableCellElement) SetColSpan

func (td *TableCellElement) SetColSpan(span int) *TableCellElement

SetColSpan sets the number of columns the cell should span.

func (*TableCellElement) SetCursorNavigable

func (b *TableCellElement) SetCursorNavigable(v bool)

SetCursorNavigable sets whether the element is cursor-navigable.

func (*TableCellElement) SetHidden

func (b *TableCellElement) SetHidden(v bool)

SetHidden sets or clears the hidden state and marks style dirty.

func (*TableCellElement) SetRowSpan

func (td *TableCellElement) SetRowSpan(span int) *TableCellElement

SetRowSpan sets the number of rows the cell should span.

func (*TableCellElement) SetStyle

func (b *TableCellElement) SetStyle(s style.Style)

SetStyle replaces the element's style wholesale and marks style dirty.

func (*TableCellElement) SetText

func (b *TableCellElement) SetText(text string) *Self

SetText replaces the element's children with a single text node containing text, updating an existing sole text child in place when possible, and returns *Self.

func (*TableCellElement) SetTextf

func (b *TableCellElement) SetTextf(format string, args ...any) *Self

SetTextf formats text with fmt.Sprintf and passes the result to [SetText].

func (*TableCellElement) Style

func (b *TableCellElement) Style(s style.Style) *Self

Style replaces the element's style wholesale and returns *Self. Calling Style twice discards the first call; style composition belongs at the style.Style value level via Style.Merge.

func (*TableCellElement) Unwrap

func (b *TableCellElement) Unwrap() dom.Node

Unwrap returns the underlying dom.Node.

func (*TableCellElement) WithClass

func (b *TableCellElement) WithClass(class string) *Self

WithClass sets the string classification tag and returns *Self.

func (*TableCellElement) WithID

func (b *TableCellElement) WithID(id string) *Self

WithID sets the element's identifier and returns *Self.

func (*TableCellElement) WithTabIndex

func (b *TableCellElement) WithTabIndex(index int) *Self

WithTabIndex sets the tab index on the element and returns *Self.

type TableElement

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

TableElement represents a table element.

func NewTable

func NewTable(doc dom.Document) *TableElement

NewTable creates a new table element.

func Table

func Table(children ...any) *TableElement

Table creates a new table element with the given children.

Example
package main

import (
	"fmt"
	"strings"

	"github.com/masterkeysrd/kite/dom"
	"github.com/masterkeysrd/kite/element"
	"github.com/masterkeysrd/kite/style"
	"github.com/masterkeysrd/kite/testenv"
)

func printScreen(root dom.Element) {
	env := testenv.New(nil, 24, 8)
	defer env.Close()

	env.Mount(root)
	env.Flush()

	for line := range strings.SplitSeq(strings.TrimRight(env.DumpText(), " \n"), "\n") {
		fmt.Println(strings.TrimSpace(line))
	}
}

func main() {
	cell := style.S().Border(style.SingleBorder())
	table := element.Table(
		element.THead(element.TR(element.TD("Task").Style(cell))),
		element.TBody(element.TR(element.TD("Test").Style(cell))),
	)

	printScreen(table)
}
Output:
┌────┐
│Task│
├────┤
│Test│
└────┘

func (*TableElement) AddChild

func (b *TableElement) AddChild(child dom.Node) *Self

AddChild adds child as the last child of this element and returns the element itself for fluent chaining.

func (*TableElement) Animate

func (b *TableElement) Animate(
	from, to style.Style,
	opts animation.Options,
) *animation.Playback

Animate interpolates style properties from start to end on the element over opts.Duration using the document window's frame clock. Unrelated author styles are preserved via sparse merging, and the animation cancels automatically if the element disconnects from the document.

func (*TableElement) CursorNavigable

func (b *TableElement) CursorNavigable(v bool) *Self

CursorNavigable enables character-level caret navigation and text selection on this element.

func (*TableElement) DefaultStyle

func (b *TableElement) DefaultStyle() style.Style

DefaultStyle returns the element-type default style.

func (*TableElement) DispatchEvent

func (b *TableElement) DispatchEvent(e event.Event)

DispatchEvent fires an event that propagates through the DOM tree.

func (*TableElement) EventListeners

func (b *TableElement) EventListeners() []PendingListener

EventListeners returns the event listener registrations for this element. Used by the engine's event-target resolver to wire up dispatch.

func (*TableElement) Hidden

func (b *TableElement) Hidden(v bool) *Self

Hidden sets or clears the hidden state and returns *Self.

func (*TableElement) IntrinsicStyle

func (b *TableElement) IntrinsicStyle() style.Style

IntrinsicStyle returns the UA-mandated forced style for this element. Properties set here have the highest cascade precedence; authors cannot override them via Style(). Most elements return an empty style.S(). Replaced and compound elements return a sparse Style with UA-forced properties (e.g. Display:InlineBlock, OverflowX:Clip). See ADR-010.

func (*TableElement) IsCursorNavigable

func (b *TableElement) IsCursorNavigable() bool

IsCursorNavigable reports whether the element is cursor-navigable.

func (*TableElement) IsDirtyStyle

func (b *TableElement) IsDirtyStyle() bool

IsDirtyStyle reports whether this element's style needs re-resolution.

func (*TableElement) IsHidden

func (b *TableElement) IsHidden() bool

IsHidden reports whether the element is hidden.

func (*TableElement) Listeners

func (b *TableElement) Listeners() []PendingListener

Listeners returns the set of event listeners registered on this element.

func (*TableElement) MoveCaret

func (b *TableElement) MoveCaret(dir dom.Direction) (boundaryReached bool)

MoveCaret satisfies the dom.SpatialCaret interface.

func (*TableElement) OnBlur

func (b *TableElement) OnBlur(fn func(*event.FocusEvent)) *Self

OnBlur registers a typed blur listener and returns *Self.

func (*TableElement) OnClick

func (b *TableElement) OnClick(fn func(*event.MouseEvent)) *Self

OnClick registers a typed click listener and returns *Self.

func (*TableElement) OnConnect

func (b *TableElement) OnConnect(fn func()) *Self

OnConnect registers fn to run each time the element enters the live document.

func (*TableElement) OnConnected

func (b *TableElement) OnConnected()

func (*TableElement) OnDisconnect

func (b *TableElement) OnDisconnect(fn func()) *Self

OnDisconnect registers fn to run just before the element leaves the live document.

func (*TableElement) OnDisconnected

func (b *TableElement) OnDisconnected()

func (*TableElement) OnEvent

func (b *TableElement) OnEvent(typ event.EventType, fn event.Listener) *Self

OnEvent registers fn as a listener for event of type typ and returns *Self. Listeners are stored on the element and retrieved by the engine's event-target resolver during dispatch setup. Nil handlers are ignored.

func (*TableElement) OnFocus

func (b *TableElement) OnFocus(fn func(*event.FocusEvent)) *Self

OnFocus registers a typed focus listener and returns *Self.

func (*TableElement) OnKey

func (b *TableElement) OnKey(combo string, fn func(*event.KeyEvent)) *Self

OnKey registers a keydown listener filtered by combo via event.KeyEvent.MatchString and returns *Self.

func (*TableElement) OnKeyDown

func (b *TableElement) OnKeyDown(fn func(*event.KeyEvent)) *Self

OnKeyDown registers a typed keydown listener and returns *Self.

func (*TableElement) OnKeyPress

func (b *TableElement) OnKeyPress(fn func(*event.KeyEvent)) *Self

OnKeyPress registers a typed keypress listener and returns *Self.

func (*TableElement) OnKeyUp

func (b *TableElement) OnKeyUp(fn func(*event.KeyEvent)) *Self

OnKeyUp registers a typed keyup listener and returns *Self.

func (*TableElement) OnMouseDown

func (b *TableElement) OnMouseDown(fn func(*event.MouseEvent)) *Self

OnMouseDown registers a typed mousedown listener and returns *Self.

func (*TableElement) OnMouseEnter

func (b *TableElement) OnMouseEnter(fn func(*event.MouseEvent)) *Self

OnMouseEnter registers a typed mouseenter listener and returns *Self.

func (*TableElement) OnMouseLeave

func (b *TableElement) OnMouseLeave(fn func(*event.MouseEvent)) *Self

OnMouseLeave registers a typed mouseleave listener and returns *Self.

func (*TableElement) OnMouseMove

func (b *TableElement) OnMouseMove(fn func(*event.MouseEvent)) *Self

OnMouseMove registers a typed mousemove listener and returns *Self.

func (*TableElement) OnMouseUp

func (b *TableElement) OnMouseUp(fn func(*event.MouseEvent)) *Self

OnMouseUp registers a typed mouseup listener and returns *Self.

func (*TableElement) OnPress

func (b *TableElement) OnPress(fn func()) *Self

OnPress registers a zero-argument activation listener on click (including keyboard Enter/Space activation on buttons) and returns *Self.

func (*TableElement) OnSelectionChange

func (b *TableElement) OnSelectionChange(fn func(*event.SelectionChangeEvent)) *Self

OnSelectionChange registers a typed selectionchange listener and returns *Self.

func (*TableElement) OnWheelEvent

func (b *TableElement) OnWheelEvent(fn func(*event.WheelEvent)) *Self

OnWheelEvent registers a typed wheel listener and returns *Self. Named OnWheelEvent to avoid colliding with event.Scrollable's OnWheel method.

func (*TableElement) RawStyle

func (b *TableElement) RawStyle() style.Style

RawStyle returns the author-set style for this element.

func (*TableElement) Ref

func (b *TableElement) Ref(dst **Self) *Self

Ref stores a pointer to the concrete element into dst (if non-nil) and returns *Self.

func (*TableElement) ResetCaret

func (b *TableElement) ResetCaret(dir dom.Direction)

ResetCaret satisfies the dom.SpatialCaret interface.

func (*TableElement) ScrollbarX

func (b *TableElement) ScrollbarX(v bool) *Self

ScrollbarX enables or disables the horizontal scrollbar and returns *Self.

func (*TableElement) ScrollbarY

func (b *TableElement) ScrollbarY(v bool) *Self

ScrollbarY enables or disables the vertical scrollbar and returns *Self.

func (*TableElement) SetCursorNavigable

func (b *TableElement) SetCursorNavigable(v bool)

SetCursorNavigable sets whether the element is cursor-navigable.

func (*TableElement) SetHidden

func (b *TableElement) SetHidden(v bool)

SetHidden sets or clears the hidden state and marks style dirty.

func (*TableElement) SetStyle

func (b *TableElement) SetStyle(s style.Style)

SetStyle replaces the element's style wholesale and marks style dirty.

func (*TableElement) SetText

func (b *TableElement) SetText(text string) *Self

SetText replaces the element's children with a single text node containing text, updating an existing sole text child in place when possible, and returns *Self.

func (*TableElement) SetTextf

func (b *TableElement) SetTextf(format string, args ...any) *Self

SetTextf formats text with fmt.Sprintf and passes the result to [SetText].

func (*TableElement) Style

func (b *TableElement) Style(s style.Style) *Self

Style replaces the element's style wholesale and returns *Self. Calling Style twice discards the first call; style composition belongs at the style.Style value level via Style.Merge.

func (*TableElement) Unwrap

func (b *TableElement) Unwrap() dom.Node

Unwrap returns the underlying dom.Node.

func (*TableElement) WithClass

func (b *TableElement) WithClass(class string) *Self

WithClass sets the string classification tag and returns *Self.

func (*TableElement) WithID

func (b *TableElement) WithID(id string) *Self

WithID sets the element's identifier and returns *Self.

func (*TableElement) WithTabIndex

func (b *TableElement) WithTabIndex(index int) *Self

WithTabIndex sets the tab index on the element and returns *Self.

type TableFooterElement

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

TableFooterElement represents a table footer group element.

func NewTableFooter

func NewTableFooter(doc dom.Document) *TableFooterElement

NewTableFooter creates a new table footer group element.

func TFoot

func TFoot(children ...any) *TableFooterElement

TFoot creates a new table footer group element with the given children.

func TableFooter

func TableFooter(children ...any) *TableFooterElement

TableFooter is an alias for TFoot.

func (*TableFooterElement) AddChild

func (b *TableFooterElement) AddChild(child dom.Node) *Self

AddChild adds child as the last child of this element and returns the element itself for fluent chaining.

func (*TableFooterElement) Animate

func (b *TableFooterElement) Animate(
	from, to style.Style,
	opts animation.Options,
) *animation.Playback

Animate interpolates style properties from start to end on the element over opts.Duration using the document window's frame clock. Unrelated author styles are preserved via sparse merging, and the animation cancels automatically if the element disconnects from the document.

func (*TableFooterElement) CursorNavigable

func (b *TableFooterElement) CursorNavigable(v bool) *Self

CursorNavigable enables character-level caret navigation and text selection on this element.

func (*TableFooterElement) DefaultStyle

func (b *TableFooterElement) DefaultStyle() style.Style

DefaultStyle returns the element-type default style.

func (*TableFooterElement) DispatchEvent

func (b *TableFooterElement) DispatchEvent(e event.Event)

DispatchEvent fires an event that propagates through the DOM tree.

func (*TableFooterElement) EventListeners

func (b *TableFooterElement) EventListeners() []PendingListener

EventListeners returns the event listener registrations for this element. Used by the engine's event-target resolver to wire up dispatch.

func (*TableFooterElement) Hidden

func (b *TableFooterElement) Hidden(v bool) *Self

Hidden sets or clears the hidden state and returns *Self.

func (*TableFooterElement) IntrinsicStyle

func (b *TableFooterElement) IntrinsicStyle() style.Style

IntrinsicStyle returns the UA-mandated forced style for this element. Properties set here have the highest cascade precedence; authors cannot override them via Style(). Most elements return an empty style.S(). Replaced and compound elements return a sparse Style with UA-forced properties (e.g. Display:InlineBlock, OverflowX:Clip). See ADR-010.

func (*TableFooterElement) IsCursorNavigable

func (b *TableFooterElement) IsCursorNavigable() bool

IsCursorNavigable reports whether the element is cursor-navigable.

func (*TableFooterElement) IsDirtyStyle

func (b *TableFooterElement) IsDirtyStyle() bool

IsDirtyStyle reports whether this element's style needs re-resolution.

func (*TableFooterElement) IsHidden

func (b *TableFooterElement) IsHidden() bool

IsHidden reports whether the element is hidden.

func (*TableFooterElement) Listeners

func (b *TableFooterElement) Listeners() []PendingListener

Listeners returns the set of event listeners registered on this element.

func (*TableFooterElement) MoveCaret

func (b *TableFooterElement) MoveCaret(dir dom.Direction) (boundaryReached bool)

MoveCaret satisfies the dom.SpatialCaret interface.

func (*TableFooterElement) OnBlur

func (b *TableFooterElement) OnBlur(fn func(*event.FocusEvent)) *Self

OnBlur registers a typed blur listener and returns *Self.

func (*TableFooterElement) OnClick

func (b *TableFooterElement) OnClick(fn func(*event.MouseEvent)) *Self

OnClick registers a typed click listener and returns *Self.

func (*TableFooterElement) OnConnect

func (b *TableFooterElement) OnConnect(fn func()) *Self

OnConnect registers fn to run each time the element enters the live document.

func (*TableFooterElement) OnConnected

func (b *TableFooterElement) OnConnected()

func (*TableFooterElement) OnDisconnect

func (b *TableFooterElement) OnDisconnect(fn func()) *Self

OnDisconnect registers fn to run just before the element leaves the live document.

func (*TableFooterElement) OnDisconnected

func (b *TableFooterElement) OnDisconnected()

func (*TableFooterElement) OnEvent

func (b *TableFooterElement) OnEvent(typ event.EventType, fn event.Listener) *Self

OnEvent registers fn as a listener for event of type typ and returns *Self. Listeners are stored on the element and retrieved by the engine's event-target resolver during dispatch setup. Nil handlers are ignored.

func (*TableFooterElement) OnFocus

func (b *TableFooterElement) OnFocus(fn func(*event.FocusEvent)) *Self

OnFocus registers a typed focus listener and returns *Self.

func (*TableFooterElement) OnKey

func (b *TableFooterElement) OnKey(combo string, fn func(*event.KeyEvent)) *Self

OnKey registers a keydown listener filtered by combo via event.KeyEvent.MatchString and returns *Self.

func (*TableFooterElement) OnKeyDown

func (b *TableFooterElement) OnKeyDown(fn func(*event.KeyEvent)) *Self

OnKeyDown registers a typed keydown listener and returns *Self.

func (*TableFooterElement) OnKeyPress

func (b *TableFooterElement) OnKeyPress(fn func(*event.KeyEvent)) *Self

OnKeyPress registers a typed keypress listener and returns *Self.

func (*TableFooterElement) OnKeyUp

func (b *TableFooterElement) OnKeyUp(fn func(*event.KeyEvent)) *Self

OnKeyUp registers a typed keyup listener and returns *Self.

func (*TableFooterElement) OnMouseDown

func (b *TableFooterElement) OnMouseDown(fn func(*event.MouseEvent)) *Self

OnMouseDown registers a typed mousedown listener and returns *Self.

func (*TableFooterElement) OnMouseEnter

func (b *TableFooterElement) OnMouseEnter(fn func(*event.MouseEvent)) *Self

OnMouseEnter registers a typed mouseenter listener and returns *Self.

func (*TableFooterElement) OnMouseLeave

func (b *TableFooterElement) OnMouseLeave(fn func(*event.MouseEvent)) *Self

OnMouseLeave registers a typed mouseleave listener and returns *Self.

func (*TableFooterElement) OnMouseMove

func (b *TableFooterElement) OnMouseMove(fn func(*event.MouseEvent)) *Self

OnMouseMove registers a typed mousemove listener and returns *Self.

func (*TableFooterElement) OnMouseUp

func (b *TableFooterElement) OnMouseUp(fn func(*event.MouseEvent)) *Self

OnMouseUp registers a typed mouseup listener and returns *Self.

func (*TableFooterElement) OnPress

func (b *TableFooterElement) OnPress(fn func()) *Self

OnPress registers a zero-argument activation listener on click (including keyboard Enter/Space activation on buttons) and returns *Self.

func (*TableFooterElement) OnSelectionChange

func (b *TableFooterElement) OnSelectionChange(fn func(*event.SelectionChangeEvent)) *Self

OnSelectionChange registers a typed selectionchange listener and returns *Self.

func (*TableFooterElement) OnWheelEvent

func (b *TableFooterElement) OnWheelEvent(fn func(*event.WheelEvent)) *Self

OnWheelEvent registers a typed wheel listener and returns *Self. Named OnWheelEvent to avoid colliding with event.Scrollable's OnWheel method.

func (*TableFooterElement) RawStyle

func (b *TableFooterElement) RawStyle() style.Style

RawStyle returns the author-set style for this element.

func (*TableFooterElement) Ref

func (b *TableFooterElement) Ref(dst **Self) *Self

Ref stores a pointer to the concrete element into dst (if non-nil) and returns *Self.

func (*TableFooterElement) ResetCaret

func (b *TableFooterElement) ResetCaret(dir dom.Direction)

ResetCaret satisfies the dom.SpatialCaret interface.

func (*TableFooterElement) ScrollbarX

func (b *TableFooterElement) ScrollbarX(v bool) *Self

ScrollbarX enables or disables the horizontal scrollbar and returns *Self.

func (*TableFooterElement) ScrollbarY

func (b *TableFooterElement) ScrollbarY(v bool) *Self

ScrollbarY enables or disables the vertical scrollbar and returns *Self.

func (*TableFooterElement) SetCursorNavigable

func (b *TableFooterElement) SetCursorNavigable(v bool)

SetCursorNavigable sets whether the element is cursor-navigable.

func (*TableFooterElement) SetHidden

func (b *TableFooterElement) SetHidden(v bool)

SetHidden sets or clears the hidden state and marks style dirty.

func (*TableFooterElement) SetStyle

func (b *TableFooterElement) SetStyle(s style.Style)

SetStyle replaces the element's style wholesale and marks style dirty.

func (*TableFooterElement) SetText

func (b *TableFooterElement) SetText(text string) *Self

SetText replaces the element's children with a single text node containing text, updating an existing sole text child in place when possible, and returns *Self.

func (*TableFooterElement) SetTextf

func (b *TableFooterElement) SetTextf(format string, args ...any) *Self

SetTextf formats text with fmt.Sprintf and passes the result to [SetText].

func (*TableFooterElement) Style

func (b *TableFooterElement) Style(s style.Style) *Self

Style replaces the element's style wholesale and returns *Self. Calling Style twice discards the first call; style composition belongs at the style.Style value level via Style.Merge.

func (*TableFooterElement) Unwrap

func (b *TableFooterElement) Unwrap() dom.Node

Unwrap returns the underlying dom.Node.

func (*TableFooterElement) WithClass

func (b *TableFooterElement) WithClass(class string) *Self

WithClass sets the string classification tag and returns *Self.

func (*TableFooterElement) WithID

func (b *TableFooterElement) WithID(id string) *Self

WithID sets the element's identifier and returns *Self.

func (*TableFooterElement) WithTabIndex

func (b *TableFooterElement) WithTabIndex(index int) *Self

WithTabIndex sets the tab index on the element and returns *Self.

type TableHeaderElement

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

TableHeaderElement represents a table header group element.

func NewTableHeader

func NewTableHeader(doc dom.Document) *TableHeaderElement

NewTableHeader creates a new table header group element.

func THead

func THead(children ...any) *TableHeaderElement

THead creates a new table header group element with the given children.

func TableHeader

func TableHeader(children ...any) *TableHeaderElement

TableHeader is an alias for THead.

func (*TableHeaderElement) AddChild

func (b *TableHeaderElement) AddChild(child dom.Node) *Self

AddChild adds child as the last child of this element and returns the element itself for fluent chaining.

func (*TableHeaderElement) Animate

func (b *TableHeaderElement) Animate(
	from, to style.Style,
	opts animation.Options,
) *animation.Playback

Animate interpolates style properties from start to end on the element over opts.Duration using the document window's frame clock. Unrelated author styles are preserved via sparse merging, and the animation cancels automatically if the element disconnects from the document.

func (*TableHeaderElement) CursorNavigable

func (b *TableHeaderElement) CursorNavigable(v bool) *Self

CursorNavigable enables character-level caret navigation and text selection on this element.

func (*TableHeaderElement) DefaultStyle

func (b *TableHeaderElement) DefaultStyle() style.Style

DefaultStyle returns the element-type default style.

func (*TableHeaderElement) DispatchEvent

func (b *TableHeaderElement) DispatchEvent(e event.Event)

DispatchEvent fires an event that propagates through the DOM tree.

func (*TableHeaderElement) EventListeners

func (b *TableHeaderElement) EventListeners() []PendingListener

EventListeners returns the event listener registrations for this element. Used by the engine's event-target resolver to wire up dispatch.

func (*TableHeaderElement) Hidden

func (b *TableHeaderElement) Hidden(v bool) *Self

Hidden sets or clears the hidden state and returns *Self.

func (*TableHeaderElement) IntrinsicStyle

func (b *TableHeaderElement) IntrinsicStyle() style.Style

IntrinsicStyle returns the UA-mandated forced style for this element. Properties set here have the highest cascade precedence; authors cannot override them via Style(). Most elements return an empty style.S(). Replaced and compound elements return a sparse Style with UA-forced properties (e.g. Display:InlineBlock, OverflowX:Clip). See ADR-010.

func (*TableHeaderElement) IsCursorNavigable

func (b *TableHeaderElement) IsCursorNavigable() bool

IsCursorNavigable reports whether the element is cursor-navigable.

func (*TableHeaderElement) IsDirtyStyle

func (b *TableHeaderElement) IsDirtyStyle() bool

IsDirtyStyle reports whether this element's style needs re-resolution.

func (*TableHeaderElement) IsHidden

func (b *TableHeaderElement) IsHidden() bool

IsHidden reports whether the element is hidden.

func (*TableHeaderElement) Listeners

func (b *TableHeaderElement) Listeners() []PendingListener

Listeners returns the set of event listeners registered on this element.

func (*TableHeaderElement) MoveCaret

func (b *TableHeaderElement) MoveCaret(dir dom.Direction) (boundaryReached bool)

MoveCaret satisfies the dom.SpatialCaret interface.

func (*TableHeaderElement) OnBlur

func (b *TableHeaderElement) OnBlur(fn func(*event.FocusEvent)) *Self

OnBlur registers a typed blur listener and returns *Self.

func (*TableHeaderElement) OnClick

func (b *TableHeaderElement) OnClick(fn func(*event.MouseEvent)) *Self

OnClick registers a typed click listener and returns *Self.

func (*TableHeaderElement) OnConnect

func (b *TableHeaderElement) OnConnect(fn func()) *Self

OnConnect registers fn to run each time the element enters the live document.

func (*TableHeaderElement) OnConnected

func (b *TableHeaderElement) OnConnected()

func (*TableHeaderElement) OnDisconnect

func (b *TableHeaderElement) OnDisconnect(fn func()) *Self

OnDisconnect registers fn to run just before the element leaves the live document.

func (*TableHeaderElement) OnDisconnected

func (b *TableHeaderElement) OnDisconnected()

func (*TableHeaderElement) OnEvent

func (b *TableHeaderElement) OnEvent(typ event.EventType, fn event.Listener) *Self

OnEvent registers fn as a listener for event of type typ and returns *Self. Listeners are stored on the element and retrieved by the engine's event-target resolver during dispatch setup. Nil handlers are ignored.

func (*TableHeaderElement) OnFocus

func (b *TableHeaderElement) OnFocus(fn func(*event.FocusEvent)) *Self

OnFocus registers a typed focus listener and returns *Self.

func (*TableHeaderElement) OnKey

func (b *TableHeaderElement) OnKey(combo string, fn func(*event.KeyEvent)) *Self

OnKey registers a keydown listener filtered by combo via event.KeyEvent.MatchString and returns *Self.

func (*TableHeaderElement) OnKeyDown

func (b *TableHeaderElement) OnKeyDown(fn func(*event.KeyEvent)) *Self

OnKeyDown registers a typed keydown listener and returns *Self.

func (*TableHeaderElement) OnKeyPress

func (b *TableHeaderElement) OnKeyPress(fn func(*event.KeyEvent)) *Self

OnKeyPress registers a typed keypress listener and returns *Self.

func (*TableHeaderElement) OnKeyUp

func (b *TableHeaderElement) OnKeyUp(fn func(*event.KeyEvent)) *Self

OnKeyUp registers a typed keyup listener and returns *Self.

func (*TableHeaderElement) OnMouseDown

func (b *TableHeaderElement) OnMouseDown(fn func(*event.MouseEvent)) *Self

OnMouseDown registers a typed mousedown listener and returns *Self.

func (*TableHeaderElement) OnMouseEnter

func (b *TableHeaderElement) OnMouseEnter(fn func(*event.MouseEvent)) *Self

OnMouseEnter registers a typed mouseenter listener and returns *Self.

func (*TableHeaderElement) OnMouseLeave

func (b *TableHeaderElement) OnMouseLeave(fn func(*event.MouseEvent)) *Self

OnMouseLeave registers a typed mouseleave listener and returns *Self.

func (*TableHeaderElement) OnMouseMove

func (b *TableHeaderElement) OnMouseMove(fn func(*event.MouseEvent)) *Self

OnMouseMove registers a typed mousemove listener and returns *Self.

func (*TableHeaderElement) OnMouseUp

func (b *TableHeaderElement) OnMouseUp(fn func(*event.MouseEvent)) *Self

OnMouseUp registers a typed mouseup listener and returns *Self.

func (*TableHeaderElement) OnPress

func (b *TableHeaderElement) OnPress(fn func()) *Self

OnPress registers a zero-argument activation listener on click (including keyboard Enter/Space activation on buttons) and returns *Self.

func (*TableHeaderElement) OnSelectionChange

func (b *TableHeaderElement) OnSelectionChange(fn func(*event.SelectionChangeEvent)) *Self

OnSelectionChange registers a typed selectionchange listener and returns *Self.

func (*TableHeaderElement) OnWheelEvent

func (b *TableHeaderElement) OnWheelEvent(fn func(*event.WheelEvent)) *Self

OnWheelEvent registers a typed wheel listener and returns *Self. Named OnWheelEvent to avoid colliding with event.Scrollable's OnWheel method.

func (*TableHeaderElement) RawStyle

func (b *TableHeaderElement) RawStyle() style.Style

RawStyle returns the author-set style for this element.

func (*TableHeaderElement) Ref

func (b *TableHeaderElement) Ref(dst **Self) *Self

Ref stores a pointer to the concrete element into dst (if non-nil) and returns *Self.

func (*TableHeaderElement) ResetCaret

func (b *TableHeaderElement) ResetCaret(dir dom.Direction)

ResetCaret satisfies the dom.SpatialCaret interface.

func (*TableHeaderElement) ScrollbarX

func (b *TableHeaderElement) ScrollbarX(v bool) *Self

ScrollbarX enables or disables the horizontal scrollbar and returns *Self.

func (*TableHeaderElement) ScrollbarY

func (b *TableHeaderElement) ScrollbarY(v bool) *Self

ScrollbarY enables or disables the vertical scrollbar and returns *Self.

func (*TableHeaderElement) SetCursorNavigable

func (b *TableHeaderElement) SetCursorNavigable(v bool)

SetCursorNavigable sets whether the element is cursor-navigable.

func (*TableHeaderElement) SetHidden

func (b *TableHeaderElement) SetHidden(v bool)

SetHidden sets or clears the hidden state and marks style dirty.

func (*TableHeaderElement) SetStyle

func (b *TableHeaderElement) SetStyle(s style.Style)

SetStyle replaces the element's style wholesale and marks style dirty.

func (*TableHeaderElement) SetText

func (b *TableHeaderElement) SetText(text string) *Self

SetText replaces the element's children with a single text node containing text, updating an existing sole text child in place when possible, and returns *Self.

func (*TableHeaderElement) SetTextf

func (b *TableHeaderElement) SetTextf(format string, args ...any) *Self

SetTextf formats text with fmt.Sprintf and passes the result to [SetText].

func (*TableHeaderElement) Style

func (b *TableHeaderElement) Style(s style.Style) *Self

Style replaces the element's style wholesale and returns *Self. Calling Style twice discards the first call; style composition belongs at the style.Style value level via Style.Merge.

func (*TableHeaderElement) Unwrap

func (b *TableHeaderElement) Unwrap() dom.Node

Unwrap returns the underlying dom.Node.

func (*TableHeaderElement) WithClass

func (b *TableHeaderElement) WithClass(class string) *Self

WithClass sets the string classification tag and returns *Self.

func (*TableHeaderElement) WithID

func (b *TableHeaderElement) WithID(id string) *Self

WithID sets the element's identifier and returns *Self.

func (*TableHeaderElement) WithTabIndex

func (b *TableHeaderElement) WithTabIndex(index int) *Self

WithTabIndex sets the tab index on the element and returns *Self.

type TableRowElement

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

TableRowElement represents a table row element.

func NewTableRow

func NewTableRow(doc dom.Document) *TableRowElement

NewTableRow creates a new table row element.

func TR

func TR(children ...any) *TableRowElement

TR creates a new table row element with the given children.

func (*TableRowElement) AddChild

func (b *TableRowElement) AddChild(child dom.Node) *Self

AddChild adds child as the last child of this element and returns the element itself for fluent chaining.

func (*TableRowElement) Animate

func (b *TableRowElement) Animate(
	from, to style.Style,
	opts animation.Options,
) *animation.Playback

Animate interpolates style properties from start to end on the element over opts.Duration using the document window's frame clock. Unrelated author styles are preserved via sparse merging, and the animation cancels automatically if the element disconnects from the document.

func (*TableRowElement) CursorNavigable

func (b *TableRowElement) CursorNavigable(v bool) *Self

CursorNavigable enables character-level caret navigation and text selection on this element.

func (*TableRowElement) DefaultStyle

func (b *TableRowElement) DefaultStyle() style.Style

DefaultStyle returns the element-type default style.

func (*TableRowElement) DispatchEvent

func (b *TableRowElement) DispatchEvent(e event.Event)

DispatchEvent fires an event that propagates through the DOM tree.

func (*TableRowElement) EventListeners

func (b *TableRowElement) EventListeners() []PendingListener

EventListeners returns the event listener registrations for this element. Used by the engine's event-target resolver to wire up dispatch.

func (*TableRowElement) Hidden

func (b *TableRowElement) Hidden(v bool) *Self

Hidden sets or clears the hidden state and returns *Self.

func (*TableRowElement) IntrinsicStyle

func (b *TableRowElement) IntrinsicStyle() style.Style

IntrinsicStyle returns the UA-mandated forced style for this element. Properties set here have the highest cascade precedence; authors cannot override them via Style(). Most elements return an empty style.S(). Replaced and compound elements return a sparse Style with UA-forced properties (e.g. Display:InlineBlock, OverflowX:Clip). See ADR-010.

func (*TableRowElement) IsCursorNavigable

func (b *TableRowElement) IsCursorNavigable() bool

IsCursorNavigable reports whether the element is cursor-navigable.

func (*TableRowElement) IsDirtyStyle

func (b *TableRowElement) IsDirtyStyle() bool

IsDirtyStyle reports whether this element's style needs re-resolution.

func (*TableRowElement) IsHidden

func (b *TableRowElement) IsHidden() bool

IsHidden reports whether the element is hidden.

func (*TableRowElement) Listeners

func (b *TableRowElement) Listeners() []PendingListener

Listeners returns the set of event listeners registered on this element.

func (*TableRowElement) MoveCaret

func (b *TableRowElement) MoveCaret(dir dom.Direction) (boundaryReached bool)

MoveCaret satisfies the dom.SpatialCaret interface.

func (*TableRowElement) OnBlur

func (b *TableRowElement) OnBlur(fn func(*event.FocusEvent)) *Self

OnBlur registers a typed blur listener and returns *Self.

func (*TableRowElement) OnClick

func (b *TableRowElement) OnClick(fn func(*event.MouseEvent)) *Self

OnClick registers a typed click listener and returns *Self.

func (*TableRowElement) OnConnect

func (b *TableRowElement) OnConnect(fn func()) *Self

OnConnect registers fn to run each time the element enters the live document.

func (*TableRowElement) OnConnected

func (b *TableRowElement) OnConnected()

func (*TableRowElement) OnDisconnect

func (b *TableRowElement) OnDisconnect(fn func()) *Self

OnDisconnect registers fn to run just before the element leaves the live document.

func (*TableRowElement) OnDisconnected

func (b *TableRowElement) OnDisconnected()

func (*TableRowElement) OnEvent

func (b *TableRowElement) OnEvent(typ event.EventType, fn event.Listener) *Self

OnEvent registers fn as a listener for event of type typ and returns *Self. Listeners are stored on the element and retrieved by the engine's event-target resolver during dispatch setup. Nil handlers are ignored.

func (*TableRowElement) OnFocus

func (b *TableRowElement) OnFocus(fn func(*event.FocusEvent)) *Self

OnFocus registers a typed focus listener and returns *Self.

func (*TableRowElement) OnKey

func (b *TableRowElement) OnKey(combo string, fn func(*event.KeyEvent)) *Self

OnKey registers a keydown listener filtered by combo via event.KeyEvent.MatchString and returns *Self.

func (*TableRowElement) OnKeyDown

func (b *TableRowElement) OnKeyDown(fn func(*event.KeyEvent)) *Self

OnKeyDown registers a typed keydown listener and returns *Self.

func (*TableRowElement) OnKeyPress

func (b *TableRowElement) OnKeyPress(fn func(*event.KeyEvent)) *Self

OnKeyPress registers a typed keypress listener and returns *Self.

func (*TableRowElement) OnKeyUp

func (b *TableRowElement) OnKeyUp(fn func(*event.KeyEvent)) *Self

OnKeyUp registers a typed keyup listener and returns *Self.

func (*TableRowElement) OnMouseDown

func (b *TableRowElement) OnMouseDown(fn func(*event.MouseEvent)) *Self

OnMouseDown registers a typed mousedown listener and returns *Self.

func (*TableRowElement) OnMouseEnter

func (b *TableRowElement) OnMouseEnter(fn func(*event.MouseEvent)) *Self

OnMouseEnter registers a typed mouseenter listener and returns *Self.

func (*TableRowElement) OnMouseLeave

func (b *TableRowElement) OnMouseLeave(fn func(*event.MouseEvent)) *Self

OnMouseLeave registers a typed mouseleave listener and returns *Self.

func (*TableRowElement) OnMouseMove

func (b *TableRowElement) OnMouseMove(fn func(*event.MouseEvent)) *Self

OnMouseMove registers a typed mousemove listener and returns *Self.

func (*TableRowElement) OnMouseUp

func (b *TableRowElement) OnMouseUp(fn func(*event.MouseEvent)) *Self

OnMouseUp registers a typed mouseup listener and returns *Self.

func (*TableRowElement) OnPress

func (b *TableRowElement) OnPress(fn func()) *Self

OnPress registers a zero-argument activation listener on click (including keyboard Enter/Space activation on buttons) and returns *Self.

func (*TableRowElement) OnSelectionChange

func (b *TableRowElement) OnSelectionChange(fn func(*event.SelectionChangeEvent)) *Self

OnSelectionChange registers a typed selectionchange listener and returns *Self.

func (*TableRowElement) OnWheelEvent

func (b *TableRowElement) OnWheelEvent(fn func(*event.WheelEvent)) *Self

OnWheelEvent registers a typed wheel listener and returns *Self. Named OnWheelEvent to avoid colliding with event.Scrollable's OnWheel method.

func (*TableRowElement) RawStyle

func (b *TableRowElement) RawStyle() style.Style

RawStyle returns the author-set style for this element.

func (*TableRowElement) Ref

func (b *TableRowElement) Ref(dst **Self) *Self

Ref stores a pointer to the concrete element into dst (if non-nil) and returns *Self.

func (*TableRowElement) ResetCaret

func (b *TableRowElement) ResetCaret(dir dom.Direction)

ResetCaret satisfies the dom.SpatialCaret interface.

func (*TableRowElement) ScrollbarX

func (b *TableRowElement) ScrollbarX(v bool) *Self

ScrollbarX enables or disables the horizontal scrollbar and returns *Self.

func (*TableRowElement) ScrollbarY

func (b *TableRowElement) ScrollbarY(v bool) *Self

ScrollbarY enables or disables the vertical scrollbar and returns *Self.

func (*TableRowElement) SetCursorNavigable

func (b *TableRowElement) SetCursorNavigable(v bool)

SetCursorNavigable sets whether the element is cursor-navigable.

func (*TableRowElement) SetHidden

func (b *TableRowElement) SetHidden(v bool)

SetHidden sets or clears the hidden state and marks style dirty.

func (*TableRowElement) SetStyle

func (b *TableRowElement) SetStyle(s style.Style)

SetStyle replaces the element's style wholesale and marks style dirty.

func (*TableRowElement) SetText

func (b *TableRowElement) SetText(text string) *Self

SetText replaces the element's children with a single text node containing text, updating an existing sole text child in place when possible, and returns *Self.

func (*TableRowElement) SetTextf

func (b *TableRowElement) SetTextf(format string, args ...any) *Self

SetTextf formats text with fmt.Sprintf and passes the result to [SetText].

func (*TableRowElement) Style

func (b *TableRowElement) Style(s style.Style) *Self

Style replaces the element's style wholesale and returns *Self. Calling Style twice discards the first call; style composition belongs at the style.Style value level via Style.Merge.

func (*TableRowElement) Unwrap

func (b *TableRowElement) Unwrap() dom.Node

Unwrap returns the underlying dom.Node.

func (*TableRowElement) WithClass

func (b *TableRowElement) WithClass(class string) *Self

WithClass sets the string classification tag and returns *Self.

func (*TableRowElement) WithID

func (b *TableRowElement) WithID(id string) *Self

WithID sets the element's identifier and returns *Self.

func (*TableRowElement) WithTabIndex

func (b *TableRowElement) WithTabIndex(index int) *Self

WithTabIndex sets the tab index on the element and returns *Self.

type TextAreaElement

type TextAreaElement struct {
	TextControlBase[*TextAreaElement]
	// contains filtered or unexported fields
}

TextAreaElement is a multi-line text-input widget implemented as a UA shadow host (ADR-009).

func NewTextArea

func NewTextArea(doc dom.Document, initialValue string) *TextAreaElement

NewTextArea creates a new TextAreaElement owned by doc with an optional initial value.

func TextArea

func TextArea(initialValue string) *TextAreaElement

TextArea creates a new TextAreaElement using the orphan document.

func (*TextAreaElement) AddChild

func (b *TextAreaElement) AddChild(child dom.Node) *Self

AddChild adds child as the last child of this element and returns the element itself for fluent chaining.

func (*TextAreaElement) Animate

func (b *TextAreaElement) Animate(
	from, to style.Style,
	opts animation.Options,
) *animation.Playback

Animate interpolates style properties from start to end on the element over opts.Duration using the document window's frame clock. Unrelated author styles are preserved via sparse merging, and the animation cancels automatically if the element disconnects from the document.

func (*TextAreaElement) Blur

func (txa *TextAreaElement) Blur()

func (*TextAreaElement) Buffer

func (txa *TextAreaElement) Buffer() *text.Buffer

Buffer returns the underlying text.Buffer.

func (*TextAreaElement) CursorNavigable

func (b *TextAreaElement) CursorNavigable(v bool) *Self

CursorNavigable enables character-level caret navigation and text selection on this element.

func (*TextAreaElement) DefaultStyle

func (b *TextAreaElement) DefaultStyle() style.Style

DefaultStyle returns the element-type default style.

func (*TextAreaElement) Disabled

func (txa *TextAreaElement) Disabled(v bool) *TextAreaElement

func (*TextAreaElement) DispatchEvent

func (b *TextAreaElement) DispatchEvent(e event.Event)

DispatchEvent fires an event that propagates through the DOM tree.

func (*TextAreaElement) EventListeners

func (b *TextAreaElement) EventListeners() []PendingListener

EventListeners returns the event listener registrations for this element. Used by the engine's event-target resolver to wire up dispatch.

func (*TextAreaElement) Focus

func (txa *TextAreaElement) Focus()

func (*TextAreaElement) Hidden

func (b *TextAreaElement) Hidden(v bool) *Self

Hidden sets or clears the hidden state and returns *Self.

func (*TextAreaElement) IntrinsicStyle

func (txa *TextAreaElement) IntrinsicStyle() style.Style

func (*TextAreaElement) IsCursorNavigable

func (b *TextAreaElement) IsCursorNavigable() bool

IsCursorNavigable reports whether the element is cursor-navigable.

func (*TextAreaElement) IsDirtyStyle

func (b *TextAreaElement) IsDirtyStyle() bool

IsDirtyStyle reports whether this element's style needs re-resolution.

func (*TextAreaElement) IsDisabled

func (txa *TextAreaElement) IsDisabled() bool

func (*TextAreaElement) IsFocusable

func (txa *TextAreaElement) IsFocusable() bool

func (*TextAreaElement) IsHidden

func (b *TextAreaElement) IsHidden() bool

IsHidden reports whether the element is hidden.

func (*TextAreaElement) Listeners

func (b *TextAreaElement) Listeners() []PendingListener

Listeners returns the set of event listeners registered on this element.

func (*TextAreaElement) MoveCaret

func (b *TextAreaElement) MoveCaret(dir dom.Direction) (boundaryReached bool)

MoveCaret satisfies the dom.SpatialCaret interface.

func (*TextAreaElement) Name

func (txa *TextAreaElement) Name() string

Name returns the form control name.

func (*TextAreaElement) OnBlur

func (b *TextAreaElement) OnBlur(fn func(*event.FocusEvent)) *Self

OnBlur registers a typed blur listener and returns *Self.

func (*TextAreaElement) OnChange

func (txa *TextAreaElement) OnChange(fn func(string)) *TextAreaElement

OnChange registers a callback invoked with the new text on user-initiated buffer edits, never on programmatic SetValue calls.

func (*TextAreaElement) OnClick

func (b *TextAreaElement) OnClick(fn func(*event.MouseEvent)) *Self

OnClick registers a typed click listener and returns *Self.

func (*TextAreaElement) OnConnect

func (b *TextAreaElement) OnConnect(fn func()) *Self

OnConnect registers fn to run each time the element enters the live document.

func (*TextAreaElement) OnConnected

func (b *TextAreaElement) OnConnected()

func (*TextAreaElement) OnDisconnect

func (b *TextAreaElement) OnDisconnect(fn func()) *Self

OnDisconnect registers fn to run just before the element leaves the live document.

func (*TextAreaElement) OnDisconnected

func (b *TextAreaElement) OnDisconnected()

func (*TextAreaElement) OnEvent

func (b *TextAreaElement) OnEvent(typ event.EventType, fn event.Listener) *Self

OnEvent registers fn as a listener for event of type typ and returns *Self. Listeners are stored on the element and retrieved by the engine's event-target resolver during dispatch setup. Nil handlers are ignored.

func (*TextAreaElement) OnFocus

func (b *TextAreaElement) OnFocus(fn func(*event.FocusEvent)) *Self

OnFocus registers a typed focus listener and returns *Self.

func (*TextAreaElement) OnKey

func (b *TextAreaElement) OnKey(combo string, fn func(*event.KeyEvent)) *Self

OnKey registers a keydown listener filtered by combo via event.KeyEvent.MatchString and returns *Self.

func (*TextAreaElement) OnKeyDown

func (b *TextAreaElement) OnKeyDown(fn func(*event.KeyEvent)) *Self

OnKeyDown registers a typed keydown listener and returns *Self.

func (*TextAreaElement) OnKeyPress

func (b *TextAreaElement) OnKeyPress(fn func(*event.KeyEvent)) *Self

OnKeyPress registers a typed keypress listener and returns *Self.

func (*TextAreaElement) OnKeyUp

func (b *TextAreaElement) OnKeyUp(fn func(*event.KeyEvent)) *Self

OnKeyUp registers a typed keyup listener and returns *Self.

func (*TextAreaElement) OnMouseDown

func (b *TextAreaElement) OnMouseDown(fn func(*event.MouseEvent)) *Self

OnMouseDown registers a typed mousedown listener and returns *Self.

func (*TextAreaElement) OnMouseEnter

func (b *TextAreaElement) OnMouseEnter(fn func(*event.MouseEvent)) *Self

OnMouseEnter registers a typed mouseenter listener and returns *Self.

func (*TextAreaElement) OnMouseLeave

func (b *TextAreaElement) OnMouseLeave(fn func(*event.MouseEvent)) *Self

OnMouseLeave registers a typed mouseleave listener and returns *Self.

func (*TextAreaElement) OnMouseMove

func (b *TextAreaElement) OnMouseMove(fn func(*event.MouseEvent)) *Self

OnMouseMove registers a typed mousemove listener and returns *Self.

func (*TextAreaElement) OnMouseUp

func (b *TextAreaElement) OnMouseUp(fn func(*event.MouseEvent)) *Self

OnMouseUp registers a typed mouseup listener and returns *Self.

func (*TextAreaElement) OnPress

func (b *TextAreaElement) OnPress(fn func()) *Self

OnPress registers a zero-argument activation listener on click (including keyboard Enter/Space activation on buttons) and returns *Self.

func (*TextAreaElement) OnSelectionChange

func (b *TextAreaElement) OnSelectionChange(fn func(*event.SelectionChangeEvent)) *Self

OnSelectionChange registers a typed selectionchange listener and returns *Self.

func (*TextAreaElement) OnWheel

func (txa *TextAreaElement) OnWheel(e *event.WheelEvent)

OnWheel implements event.Scrollable.

func (*TextAreaElement) OnWheelEvent

func (b *TextAreaElement) OnWheelEvent(fn func(*event.WheelEvent)) *Self

OnWheelEvent registers a typed wheel listener and returns *Self. Named OnWheelEvent to avoid colliding with event.Scrollable's OnWheel method.

func (*TextAreaElement) RawStyle

func (b *TextAreaElement) RawStyle() style.Style

RawStyle returns the author-set style for this element.

func (*TextAreaElement) Ref

func (b *TextAreaElement) Ref(dst **Self) *Self

Ref stores a pointer to the concrete element into dst (if non-nil) and returns *Self.

func (*TextAreaElement) ResetCaret

func (b *TextAreaElement) ResetCaret(dir dom.Direction)

ResetCaret satisfies the dom.SpatialCaret interface.

func (*TextAreaElement) ScrollbarX

func (b *TextAreaElement) ScrollbarX(v bool) *Self

ScrollbarX enables or disables the horizontal scrollbar and returns *Self.

func (*TextAreaElement) ScrollbarY

func (b *TextAreaElement) ScrollbarY(v bool) *Self

ScrollbarY enables or disables the vertical scrollbar and returns *Self.

func (*TextAreaElement) SetCursorNavigable

func (b *TextAreaElement) SetCursorNavigable(v bool)

SetCursorNavigable sets whether the element is cursor-navigable.

func (*TextAreaElement) SetDisabled

func (txa *TextAreaElement) SetDisabled(v bool)

func (*TextAreaElement) SetHidden

func (b *TextAreaElement) SetHidden(v bool)

SetHidden sets or clears the hidden state and marks style dirty.

func (*TextAreaElement) SetStyle

func (b *TextAreaElement) SetStyle(s style.Style)

SetStyle replaces the element's style wholesale and marks style dirty.

func (*TextAreaElement) SetText

func (b *TextAreaElement) SetText(text string) *Self

SetText replaces the element's children with a single text node containing text, updating an existing sole text child in place when possible, and returns *Self.

func (*TextAreaElement) SetTextf

func (b *TextAreaElement) SetTextf(format string, args ...any) *Self

SetTextf formats text with fmt.Sprintf and passes the result to [SetText].

func (*TextAreaElement) SetValue

func (txa *TextAreaElement) SetValue(v string) *TextAreaElement

SetValue replaces the buffer content.

func (*TextAreaElement) Style

func (b *TextAreaElement) Style(s style.Style) *Self

Style replaces the element's style wholesale and returns *Self. Calling Style twice discards the first call; style composition belongs at the style.Style value level via Style.Merge.

func (*TextAreaElement) SyncBuffer

func (txa *TextAreaElement) SyncBuffer()

SyncBuffer propagates the current buffer state to the UA text node.

func (*TextAreaElement) Text

func (txa *TextAreaElement) Text() string

Text returns the current text value of the textarea.

func (*TextAreaElement) TextContent

func (txa *TextAreaElement) TextContent() string

TextContent returns the current text value of the textarea, satisfying the dom.Node interface.

func (*TextAreaElement) Unwrap

func (b *TextAreaElement) Unwrap() dom.Node

Unwrap returns the underlying dom.Node.

func (*TextAreaElement) Value

func (txa *TextAreaElement) Value() any

Value returns the current text value.

func (*TextAreaElement) WithClass

func (b *TextAreaElement) WithClass(class string) *Self

WithClass sets the string classification tag and returns *Self.

func (*TextAreaElement) WithID

func (b *TextAreaElement) WithID(id string) *Self

WithID sets the element's identifier and returns *Self.

func (*TextAreaElement) WithName

func (txa *TextAreaElement) WithName(name string) *TextAreaElement

WithName sets the form control name and returns the TextAreaElement.

func (*TextAreaElement) WithPlaceholder

func (txa *TextAreaElement) WithPlaceholder(p string) *TextAreaElement

WithPlaceholder sets the placeholder text and returns the TextAreaElement.

func (*TextAreaElement) WithPlaceholderStyle

func (txa *TextAreaElement) WithPlaceholderStyle(s style.Style) *TextAreaElement

WithPlaceholderStyle sets the style for the placeholder and returns the TextAreaElement.

func (*TextAreaElement) WithTabIndex

func (b *TextAreaElement) WithTabIndex(index int) *Self

WithTabIndex sets the tab index on the element and returns *Self.

type TextControlBase

type TextControlBase[T Element] struct {
	ContentElement dom.Element
	// contains filtered or unexported fields
}

func (*TextControlBase[T]) Buffer

func (b *TextControlBase[T]) Buffer() *text.Buffer

Buffer returns the underlying editor buffer.

func (*TextControlBase[T]) CaretPosition

func (b *TextControlBase[T]) CaretPosition() geom.Point

CaretPosition returns the unscrolled caret cell relative to the control's border box.

func (*TextControlBase[T]) HandleDefaultAction

func (b *TextControlBase[T]) HandleDefaultAction(ev event.Event)

HandleDefaultAction performs post-dispatch default actions for the text control (e.g., inserting pasted text) unless a listener called PreventDefault().

func (*TextControlBase[T]) InitTextControlBase

func (b *TextControlBase[T]) InitTextControlBase(
	host T,
	ContentElement dom.Element,
	buf *text.Buffer,
	isMultiline bool,
	sync func(),
)

InitTextControlBase initialises the base with its dependencies. host is the outer dom.Element (the shadow host for the control). ContentElement is the inner block element whose IFC children form the text layout. buf is the editor buffer. isMultiline distinguishes textarea (true) from input (false). sync is the concrete element's sync callback.

func (*TextControlBase[T]) ProvidesCursor

func (b *TextControlBase[T]) ProvidesCursor() bool

ProvidesCursor implements dom.Element.

func (*TextControlBase[T]) ScrollCursorIntoView

func (b *TextControlBase[T]) ScrollCursorIntoView()

ScrollCursorIntoView implements dom.Element.

func (*TextControlBase[T]) SelectedText

func (b *TextControlBase[T]) SelectedText() string

SelectedText returns the text currently covered by the local selection.

func (*TextControlBase[T]) SelectionRange

func (b *TextControlBase[T]) SelectionRange() (int, int)

SelectionRange returns the current selection start and end byte offsets.

func (*TextControlBase[T]) SetSelectionRange

func (b *TextControlBase[T]) SetSelectionRange(start, end int)

SetSelectionRange sets the selection to the given byte offsets. It moves the cursor to end and triggers a sync.

func (*TextControlBase[T]) SyncBuffer

func (b *TextControlBase[T]) SyncBuffer()

SyncBuffer propagates the current buffer state to the UA text node and marks layout dirty. Call this after any direct mutation of Buffer().

func (*TextControlBase[T]) UpdateSelectionRange

func (b *TextControlBase[T]) UpdateSelectionRange()

UpdateSelectionRange programmatically updates the document's selection based on the control's local selectionStart/selectionEnd offsets. It maps byte offsets to (Node, runeOffset) pairs within the UA subtree.

func (*TextControlBase[T]) WireTextControlEvents

func (b *TextControlBase[T]) WireTextControlEvents()

WireTextControlEvents wires up default key bindings and mouse events.

type TextElement

type TextElement struct {
	dom.TextNode
}

TextElement represents a text node in the logical tree.

func NewText

func NewText(doc dom.Document, data string) *TextElement

NewText creates a new text node.

func Text

func Text(data string) *TextElement

Text creates a new text node with the given data.

func (*TextElement) Data

func (t *TextElement) Data() string

func (*TextElement) SetData

func (t *TextElement) SetData(data string)

func (*TextElement) Unwrap

func (t *TextElement) Unwrap() dom.Node

type UnorderedListElement

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

UnorderedListElement represents a list of items where the order does not matter (<ul>).

func NewUnorderedList

func NewUnorderedList(doc dom.Document) *UnorderedListElement

NewUnorderedList creates a new unordered list.

func UL

func UL(children ...any) *UnorderedListElement

UL creates a new unordered list with the given children.

Example
package main

import (
	"fmt"
	"strings"

	"github.com/masterkeysrd/kite/dom"
	"github.com/masterkeysrd/kite/element"
	"github.com/masterkeysrd/kite/testenv"
)

func printScreen(root dom.Element) {
	env := testenv.New(nil, 24, 8)
	defer env.Close()

	env.Mount(root)
	env.Flush()

	for line := range strings.SplitSeq(strings.TrimRight(env.DumpText(), " \n"), "\n") {
		fmt.Println(strings.TrimSpace(line))
	}
}

func main() {
	list := element.UL(
		element.LI("Tea"),
		element.LI("Coffee"),
	)

	printScreen(list)
}
Output:
• Tea
• Coffee

func (*UnorderedListElement) AddChild

func (b *UnorderedListElement) AddChild(child dom.Node) *Self

AddChild adds child as the last child of this element and returns the element itself for fluent chaining.

func (*UnorderedListElement) Animate

func (b *UnorderedListElement) Animate(
	from, to style.Style,
	opts animation.Options,
) *animation.Playback

Animate interpolates style properties from start to end on the element over opts.Duration using the document window's frame clock. Unrelated author styles are preserved via sparse merging, and the animation cancels automatically if the element disconnects from the document.

func (*UnorderedListElement) CursorNavigable

func (b *UnorderedListElement) CursorNavigable(v bool) *Self

CursorNavigable enables character-level caret navigation and text selection on this element.

func (*UnorderedListElement) DefaultStyle

func (b *UnorderedListElement) DefaultStyle() style.Style

DefaultStyle returns the element-type default style.

func (*UnorderedListElement) DispatchEvent

func (b *UnorderedListElement) DispatchEvent(e event.Event)

DispatchEvent fires an event that propagates through the DOM tree.

func (*UnorderedListElement) EventListeners

func (b *UnorderedListElement) EventListeners() []PendingListener

EventListeners returns the event listener registrations for this element. Used by the engine's event-target resolver to wire up dispatch.

func (*UnorderedListElement) Hidden

func (b *UnorderedListElement) Hidden(v bool) *Self

Hidden sets or clears the hidden state and returns *Self.

func (*UnorderedListElement) IntrinsicStyle

func (b *UnorderedListElement) IntrinsicStyle() style.Style

IntrinsicStyle returns the UA-mandated forced style for this element. Properties set here have the highest cascade precedence; authors cannot override them via Style(). Most elements return an empty style.S(). Replaced and compound elements return a sparse Style with UA-forced properties (e.g. Display:InlineBlock, OverflowX:Clip). See ADR-010.

func (*UnorderedListElement) IsCursorNavigable

func (b *UnorderedListElement) IsCursorNavigable() bool

IsCursorNavigable reports whether the element is cursor-navigable.

func (*UnorderedListElement) IsDirtyStyle

func (b *UnorderedListElement) IsDirtyStyle() bool

IsDirtyStyle reports whether this element's style needs re-resolution.

func (*UnorderedListElement) IsHidden

func (b *UnorderedListElement) IsHidden() bool

IsHidden reports whether the element is hidden.

func (*UnorderedListElement) Listeners

func (b *UnorderedListElement) Listeners() []PendingListener

Listeners returns the set of event listeners registered on this element.

func (*UnorderedListElement) MoveCaret

func (b *UnorderedListElement) MoveCaret(dir dom.Direction) (boundaryReached bool)

MoveCaret satisfies the dom.SpatialCaret interface.

func (*UnorderedListElement) OnBlur

func (b *UnorderedListElement) OnBlur(fn func(*event.FocusEvent)) *Self

OnBlur registers a typed blur listener and returns *Self.

func (*UnorderedListElement) OnClick

func (b *UnorderedListElement) OnClick(fn func(*event.MouseEvent)) *Self

OnClick registers a typed click listener and returns *Self.

func (*UnorderedListElement) OnConnect

func (b *UnorderedListElement) OnConnect(fn func()) *Self

OnConnect registers fn to run each time the element enters the live document.

func (*UnorderedListElement) OnConnected

func (b *UnorderedListElement) OnConnected()

func (*UnorderedListElement) OnDisconnect

func (b *UnorderedListElement) OnDisconnect(fn func()) *Self

OnDisconnect registers fn to run just before the element leaves the live document.

func (*UnorderedListElement) OnDisconnected

func (b *UnorderedListElement) OnDisconnected()

func (*UnorderedListElement) OnEvent

func (b *UnorderedListElement) OnEvent(typ event.EventType, fn event.Listener) *Self

OnEvent registers fn as a listener for event of type typ and returns *Self. Listeners are stored on the element and retrieved by the engine's event-target resolver during dispatch setup. Nil handlers are ignored.

func (*UnorderedListElement) OnFocus

func (b *UnorderedListElement) OnFocus(fn func(*event.FocusEvent)) *Self

OnFocus registers a typed focus listener and returns *Self.

func (*UnorderedListElement) OnKey

func (b *UnorderedListElement) OnKey(combo string, fn func(*event.KeyEvent)) *Self

OnKey registers a keydown listener filtered by combo via event.KeyEvent.MatchString and returns *Self.

func (*UnorderedListElement) OnKeyDown

func (b *UnorderedListElement) OnKeyDown(fn func(*event.KeyEvent)) *Self

OnKeyDown registers a typed keydown listener and returns *Self.

func (*UnorderedListElement) OnKeyPress

func (b *UnorderedListElement) OnKeyPress(fn func(*event.KeyEvent)) *Self

OnKeyPress registers a typed keypress listener and returns *Self.

func (*UnorderedListElement) OnKeyUp

func (b *UnorderedListElement) OnKeyUp(fn func(*event.KeyEvent)) *Self

OnKeyUp registers a typed keyup listener and returns *Self.

func (*UnorderedListElement) OnMouseDown

func (b *UnorderedListElement) OnMouseDown(fn func(*event.MouseEvent)) *Self

OnMouseDown registers a typed mousedown listener and returns *Self.

func (*UnorderedListElement) OnMouseEnter

func (b *UnorderedListElement) OnMouseEnter(fn func(*event.MouseEvent)) *Self

OnMouseEnter registers a typed mouseenter listener and returns *Self.

func (*UnorderedListElement) OnMouseLeave

func (b *UnorderedListElement) OnMouseLeave(fn func(*event.MouseEvent)) *Self

OnMouseLeave registers a typed mouseleave listener and returns *Self.

func (*UnorderedListElement) OnMouseMove

func (b *UnorderedListElement) OnMouseMove(fn func(*event.MouseEvent)) *Self

OnMouseMove registers a typed mousemove listener and returns *Self.

func (*UnorderedListElement) OnMouseUp

func (b *UnorderedListElement) OnMouseUp(fn func(*event.MouseEvent)) *Self

OnMouseUp registers a typed mouseup listener and returns *Self.

func (*UnorderedListElement) OnPress

func (b *UnorderedListElement) OnPress(fn func()) *Self

OnPress registers a zero-argument activation listener on click (including keyboard Enter/Space activation on buttons) and returns *Self.

func (*UnorderedListElement) OnSelectionChange

func (b *UnorderedListElement) OnSelectionChange(fn func(*event.SelectionChangeEvent)) *Self

OnSelectionChange registers a typed selectionchange listener and returns *Self.

func (*UnorderedListElement) OnWheelEvent

func (b *UnorderedListElement) OnWheelEvent(fn func(*event.WheelEvent)) *Self

OnWheelEvent registers a typed wheel listener and returns *Self. Named OnWheelEvent to avoid colliding with event.Scrollable's OnWheel method.

func (*UnorderedListElement) RawStyle

func (b *UnorderedListElement) RawStyle() style.Style

RawStyle returns the author-set style for this element.

func (*UnorderedListElement) Ref

func (b *UnorderedListElement) Ref(dst **Self) *Self

Ref stores a pointer to the concrete element into dst (if non-nil) and returns *Self.

func (*UnorderedListElement) ResetCaret

func (b *UnorderedListElement) ResetCaret(dir dom.Direction)

ResetCaret satisfies the dom.SpatialCaret interface.

func (*UnorderedListElement) ScrollbarX

func (b *UnorderedListElement) ScrollbarX(v bool) *Self

ScrollbarX enables or disables the horizontal scrollbar and returns *Self.

func (*UnorderedListElement) ScrollbarY

func (b *UnorderedListElement) ScrollbarY(v bool) *Self

ScrollbarY enables or disables the vertical scrollbar and returns *Self.

func (*UnorderedListElement) SetCursorNavigable

func (b *UnorderedListElement) SetCursorNavigable(v bool)

SetCursorNavigable sets whether the element is cursor-navigable.

func (*UnorderedListElement) SetHidden

func (b *UnorderedListElement) SetHidden(v bool)

SetHidden sets or clears the hidden state and marks style dirty.

func (*UnorderedListElement) SetStyle

func (b *UnorderedListElement) SetStyle(s style.Style)

SetStyle replaces the element's style wholesale and marks style dirty.

func (*UnorderedListElement) SetText

func (b *UnorderedListElement) SetText(text string) *Self

SetText replaces the element's children with a single text node containing text, updating an existing sole text child in place when possible, and returns *Self.

func (*UnorderedListElement) SetTextf

func (b *UnorderedListElement) SetTextf(format string, args ...any) *Self

SetTextf formats text with fmt.Sprintf and passes the result to [SetText].

func (*UnorderedListElement) Style

func (b *UnorderedListElement) Style(s style.Style) *Self

Style replaces the element's style wholesale and returns *Self. Calling Style twice discards the first call; style composition belongs at the style.Style value level via Style.Merge.

func (*UnorderedListElement) Unwrap

func (b *UnorderedListElement) Unwrap() dom.Node

Unwrap returns the underlying dom.Node.

func (*UnorderedListElement) WithClass

func (b *UnorderedListElement) WithClass(class string) *Self

WithClass sets the string classification tag and returns *Self.

func (*UnorderedListElement) WithID

func (b *UnorderedListElement) WithID(id string) *Self

WithID sets the element's identifier and returns *Self.

func (*UnorderedListElement) WithTabIndex

func (b *UnorderedListElement) WithTabIndex(index int) *Self

WithTabIndex sets the tab index on the element and returns *Self.

Jump to

Keyboard shortcuts

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