API Reference#

Complete reference for all SignalX (sigx) exports. SignalX re-exports everything from:

  • @sigx/reactivity - Reactive primitives
  • @sigx/runtime-core - Component system
  • @sigx/runtime-dom - DOM rendering

Quick Navigation#

Reactivity#

Components#

  • component - Define component
  • Fragment - Render without wrapper
  • lazy - Lazy load component
  • Defer - Chunk-loading boundary
  • Portal - Render to different DOM location

Data Loading#

  • useData - Keyed async read, SSR-transferable
  • useAction - Async write, triggered by run()
  • all - Combine reads into one state
  • useStream - Progressive text streaming
  • errorScope - Subtree error boundary

Lifecycle#

Dependency Injection#

App & Plugins#

Advanced#

Types#

Import#

All APIs are available from the main sigx package:

TSX
import { 
    // Reactivity
    signal, effect, computed, watch,
    batch, untrack, toRaw, isReactive, effectScope,
    toSignal, toSignals,
    
    // Components
    component, Fragment, lazy, Defer, Portal,
    
    // Data loading
    useData, useAction, all, useStream, errorScope,
    
    // Lifecycle
    onMounted, onUnmounted, onCreated, onUpdated,
    
    // DI
    provide, inject, createInjectable, defineProvide,
    
    // App
    defineApp,
    
    // Types
    type Define, ComponentRef, Exposed,
    
    // Advanced
    defineFactory, createTopic, createTopicGroup, toSubscriber,
    type Lifetime
} from 'sigx';

The inspection-only topic registry for tooling lives on its own entry:

TSX
import { getTopic, listTopics, subscribeTopics, onTopicCreated } from '@sigx/runtime-core/inspect';

TypeScript#

SignalX is written in TypeScript and provides full type inference. All component props, events, slots, and exposed APIs are fully typed.

TSX
// Full type safety
type MyProps = 
    & Define.Prop<'name', string, true>
    & Define.Prop<'count', number>
    & Define.Event<'change', number>
    & Define.Slot<'header'>
    & Define.Expose<{ reset: () => void }>;

const MyComponent = component<MyProps>(({ props, emit, slots, expose }) => {
    // props.name is string (required)
    // props.count is number | undefined (optional)
    // emit('change', 5) is type-checked
    // slots.header is typed correctly
    
    expose({ reset: () => {} }); // Type-checked
    
    return () => <div>{props.name}</div>;
});