UIstate
Path-based state management with wildcard subscriptions, async support, and state-driven CSS.
npm i @uistate/core
import { createEventState } from '@uistate/core';
const store = createEventState({ count: 0, user: { name: 'Alice' } });
store.subscribe('user.*', ({ path, value }) => {
console.log(`${path} changed to`, value);
});
store.set('user.name', 'Bob'); // fires subscriber
store.get('user.name'); // 'Bob'
@uistate/core
Reactive store with path-based get/set/subscribe, wildcard listeners, async operations, and query client. ~6 KB, zero dependencies.
@uistate/css
State-driven CSS — write styles as state paths, compile to real CSS rules. Reactive design tokens, typed validation, WCAG contrast enforcement.
@uistate/event-test
Event-sequence testing for UIstate stores. Trigger state changes and assert values, types, and event firings in a chainable API.
@uistate/examples
Working examples: counters, dashboards, async patterns, data tables. Each example is a standalone HTML file.
Ecosystem
| Package | Version | Description |
|---|---|---|
| @uistate/core | 5.5.2 | Path-based state management |
| @uistate/react | 1.0.0 | React adapter hooks |
| @uistate/css | 1.0.0 | CSS-native state via custom properties |
| @uistate/event-test | 1.0.0 | Event-sequence testing |
| @uistate/examples | 1.0.0 | Example applications |
| @uistate/aliases | 1.0.0 | DOM aliases for vanilla JS |
Why UIstate?
- One primitive —
get,set,subscribe. That's the whole API. - Path-based — nested state via dot paths:
user.profile.name - Wildcards —
user.*fires on any child change,*fires on everything - Async built-in —
setAsyncmanages loading/success/error states automatically - Framework-free — works in any browser, with any framework, or with none
- Zero dependencies — ~6 KB total, pure JavaScript
License
@uistate/core and @uistate/css are MIT licensed. @uistate/event-test has a proprietary license (free for personal/OSS use).