UIElement Docs Version 0.13.3

🔗 📚 API Reference

Functions, types, and constants

🔗 Component

Create a Web Component of type Component with reactive properties that extend ComponentProps.

  • component defines a custom element with reactive properties and declarative effects

🔗 Signals

Create a signal of type Signal.

Helper functions:

🔗 Attribute Parsers

Declare how attributes are parsed. Functions returning AttributeParser that will be used to create State signals as writable reactive properties on the component.

  • asBoolean parses boolean attributes (presence indicates true)
  • asEnum parses string attributes constrained to specific values
  • asInteger parses integer attributes with validation
  • asJSON parses JSON attributes into JavaScript objects
  • asNumber parses numeric attributes as floating-point numbers
  • asString parses string attributes

🔗 Signal Producers

Declare how signals are initialized. Functions returning type SignalProducer that will be used to create Computed signals as read-only reactive properties on the component.

  • fromContext consumes a context value from nearest ancestor context provider component
  • fromEvents creates a computed signal from event transformers on descendant elements
  • fromSelector creates a computed signal of descentant elements matching a CSS selector

🔗 Effects

Declare effects of type Effect to be applied when signals change:

🔗 DOM Utilities

Functions to work with descendant elements:

  • read reads properties from a descendant element, waiting for components to be upgraded
  • reduced creates a computed signal from a reducer function
  • requireDescendant requires a descendant element to exist and returns it, otherwise throws an error