Documentation
¶
Overview ¶
Package widget defines visual component contracts, states, and layout.
It travels inside the WASM binary, so it carries zero style logic and zero emission.
Index ¶
Constants ¶
const ( PartLabel = Part("label") PartInput = Part("input") PartError = Part("error") PartRadioGroup = Part("radio-group") )
Parts of the field. The names are generic by design: Part is local to its widget and only becomes a class through a Name, so "label" here produces "tw-field__label" and never collides with the "label" of another widget.
const NameField = Name("tw-field")
NameField is the shared anatomy of the form field.
It is emitted by github.com/tinywasm/form (which builds the markup) and styled by github.com/tinywasm/components/fieldset (which is the global skin of the forms). It lives here because it crosses the boundary between these two libraries, and neither can own it without the other depending on it.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Class ¶
type Class string
Class is a CSS class name. It has NO public constructor: the only way to obtain one is to derive it from a Name. This ensures markup and stylesheet agree by construction.
type Cue ¶
type Cue uint8
Cue is a state that the BROWSER possesses. It is only styled; it cannot be written from Go — which is why it is a separate type and has no Attr().
type Dismissible ¶
type Dismissible interface{ Dismiss() }
type Expandable ¶
type Expandable interface{ Expand(open bool) }
type Kind ¶
type Kind uint8
Kind is the type of widget according to WAI-ARIA Authoring Practices. It determines the role, valid states, and expected keyboard interactions. Closed by design: if a widget does not fit any pattern, it is almost always two widgets.
func (Kind) Allows ¶ added in v0.4.0
Allows returns whether the given state is meaningful for the Kind.
type Layer ¶ added in v0.4.0
type Layer uint8
Layer is the stacking level of a pattern. It is an enum, not a css.Token: this package travels inside the WASM binary and must not import css. widget/style maps it to the --z-* catalog.
type Name ¶
type Name string
Name identifies a widget. It is the prefix of EVERY class it emits, so two widgets cannot collide even if they choose the same part name.
type Part ¶
type Part string
Part is a named slot of a widget's anatomy (Open UI vocabulary). It is local to the widget: e.g. "row", "menu", "header". It never carries a prefix.
type Selectable ¶
type Selectable interface{ Select(id string) }
Capabilities — each hook asserts only the capability it needs.