tindom
v0.1.0
Published
A tiny DOM‑first web framework with modular architecture and lightweight reactivity.
Readme
tindom
A minimalist framework for web applications. Built with a modular architecture - everything in one package, but you use only what you need.
Note: All 0.x.x versions are experimental.
Installation
npm install tindom
# or
bun install tindomQuick Start
Using Signals and Watchers
import { signal, watch } from 'tindom/signal';
// Create a reactive value
const count = signal(0);
// Create a computed value that updates automatically
const doubled = watch(() => count() * 2);
// Update the signal
count(5);
console.log(doubled()); // 10
// Watch for changes
watch(() => count(), (newValue) => {
console.log('Count changed to:', newValue);
});API
signal<T>(value?: T): Signal<T>
Creates a reactive state container that notifies watchers when the value changes.
Parameters:
value(optional): Initial value of the signal
Returns:
- A callable signal - call with no arguments to read, call with a value to update
Example:
const count = signal(0);
console.log(count()); // read: 0
count(5); // write: 5watch<T>(fn: () => T, callback?: (value: T) => void): Watch<T>
Tracks reactive dependencies and reruns a function when sources change. Optionally invokes a callback on updates.
Parameters:
fn: Function that returns a value. Dependencies are automatically tracked when signals are accessed.callback(optional): Function called with the new value whenever the watched value changes
Returns:
- A callable watch - call with no arguments to read the current value
Example:
const a = signal(2);
const b = signal(3);
// Computed value
const sum = watch(() => a() + b());
console.log(sum()); // 5
// With callback
watch(
() => a() + b(),
(newSum) => console.log('Sum is now:', newSum)
);
a(10); // Triggers callback: "Sum is now: 13"Planned Features
- tindom/dom - DOM generation without virtual DOM
- tindom/reactive - Support for reactive objects
- tindom/ui - Predefined UI components (form, dialog, etc.)
- tindom/router - Route-based application rendering
License
MIT
Project logic written by humans. AI is used only for code review, test generation, and documentation improvements.
