Help us shape the future of Go! Take the 2026 Go Developer Survey

attrhook

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidAttributeName reports an attribute hook returning a name that
	// does not match ^[a-z][a-z0-9-]*$.
	ErrInvalidAttributeName = errors.New("invalid attribute name")
	// ErrAttributeConflict reports an attribute hook returning a name that
	// Compono already writes on the target element.
	ErrAttributeConflict = errors.New("attribute conflicts with a built-in attribute")
)

Functions

This section is empty.

Types

type AttributeHookFunc

type AttributeHookFunc func(builtin string, stack []Frame) map[string]string

AttributeHookFunc is invoked once for every built-in component render. It receives the built-in name and the current frame stack and returns the extra HTML attributes to write on the rendered element.

type Frame

type Frame struct {
	Name      string
	Kind      FrameKind
	ScopePath []string
}

Frame is a single component definition on the render stack. Name is the component name, Kind its origin and ScopePath, for global frames, the names of the enclosing global component definitions ordered outermost first. For root globals ScopePath is a non-nil empty slice; for local frames it is nil.

type FrameKind

type FrameKind string

FrameKind identifies the origin of a Frame on the render stack.

const (
	// FrameBuiltin marks a built-in component frame.
	FrameBuiltin FrameKind = "builtin"
	// FrameGlobal marks a frame produced by a global component definition.
	FrameGlobal FrameKind = "global"
	// FrameLocal marks a frame produced by a local component definition.
	FrameLocal FrameKind = "local"
)

Jump to

Keyboard shortcuts

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