🔗 📚 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:
- dangerouslySetInnerHTML sets inner HTML content from a signal
- emitEvent dispatches custom events when signals change
- insertOrRemoveElement conditionally inserts or removes elements
- on attaches event listeners to elements
- pass passes signal values to descendant component properties
- provideContexts provides context values to descendant components
- setAttribute sets element attributes from signals
- setProperty sets element properties from signals
- setStyle sets CSS styles from signals
- setText sets text content from signals
- show conditionally shows or hides elements
- toggleAttribute toggles attributes based on signal values
- toggleClass toggles CSS classes based on signal values
- updateElement base function for updating elements, used for setText, show, toggleClass, toggleAttribute, setAttribute, setProperty, setStyle
🔗 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