A library of reactive primitives (observables, computed values) with automatic memory management and RxJS interoperability.
npm install @knyt/artisan
🖌️ A reactive foundation for modern web solutions.
Lightweight observables—memory-safe, microtask-optimized, and rigorously type-safe.
This package is part of Knyt, a toolkit designed to simplify modern web development.



!Built with TypeScript
!Runs Everywhere
- Framework-independent foundation
- Prevents memory leaks by design
- Efficient microtask-based update scheduling
- Comprehensive and reliable TypeScript support
#### Core Reactivity Features
- Automatic memory management – Weak references ensure unused subscriptions are cleaned up to prevent memory leaks
- Observable values – Reactive references that can be subscribed to and updated
- Auto-updating derived values - Computed properties that stay synchronized with their sources
- Optimized change handling - Batches updates efficiently using microtasks
- RxJS interoperability – Smoothly integrates with RxJS and similar observable libraries
#### Supporting Features
- DOM/CSS type safety - Runtime validation for elements, nodes and CSS rules
- Middleware utilities – Tools for building strongly-typed, async-ready processing pipelines
- Essential utilities - Optimized equality checks, debouncing and TypeScript helpers
Documentation is available at knyt.dev, including a guide on observables.
``ts
import { isDocumentFragment, mapRef, ref } from "knyt";
// Create a reactive reference
const count$ = ref(0);
// Create a derived (computed) reference
const label$ = mapRef(count$, (n) => Count is: ${n});
const log = (text: string) => {
console.info(text);
};
// Subscribe to changes
const subscription = label$.subscribe(log);
// Update the original reference
count$.set(2); // Console: Count is: 2
`
You can use this package by installing either the Knyt Toolkit or this standalone package.
_Knyt Toolkit:_
`sh`
npm install knyt
_Standalone:_
`sh``
npm install @knyt/artisan
See the CHANGELOG for a list of changes.
This package is licensed under the BSD 3-Clause License.
This project is supported by Sables Applications LLC as part of its open-source initiatives.