Skip to content
HN On Hacker News ↗

Tyaff

▲ 7 points 13 comments by okovooo 1w ago HN discussion ↗

Pangram verdict · v3.3

We believe that this document is fully AI-generated

99 %

AI likelihood · overall

AI
0% human-written 100% AI-generated
SEGMENTS · HUMAN 0 of 2
SEGMENTS · AI 2 of 2
WORD COUNT 482
PEAK AI % 99% · §2
Analyzed
Jun 30
backend: pangram/v3.3
Segments scanned
2 windows
avg 241 words each
Distribution
0 / 100%
human / AI fraction
Verdict
AI
Pangram v3.3

Article text · 482 words · 2 segments analyzed

Human AI-generated
§1 AI · 98%

Tyaff — VDOM library for JavaScript

A lightweight alternative to React in pure JavaScript (ES6+) with its own virtual DOM and philosophy of minimalism.

Key differences from React

memo() blocks only the current component — children continue their own update chains independently, making optimization predictable Mutable data from any source — a component can read a global store, singleton, or window directly, without props drilling Pull-based context without Provider/Consumer — any component declares itself a provider via context: { key() { ... } }, children request values via this.context(key) Props as first argument — signatures like init(props), memo(props), render({ title, items }) allow destructuring props right in the definition Keys are unique across the entire render — this allows moving components between different parents while preserving instance and state

Main features

Compact and performant — minimal API surface, custom diff/patch algorithm, batching updates via microtask Optimized for bulk operations — reverse, swap, reparenting faster than React Dynamic context tree — hierarchical provider system with automatic propagation through HTML tags Factory-based components — unified creation pattern, automatic method binding, flexible lifecycle Portals with deferred mounting —!mounting into arbitrary DOM containers with anchor nodes Key system — user-defined keys are unique across the entire render, automatic path-based keys Fragment with key — grouping children without wrapper with ability to move groups

Installation

npm install tyaff

Quick start

import { h, Component, mount } from 'tyaff';

const Counter = Component({ count: 0,

increment() { this.update({ count: this.count + 1 }); },

render() { return h('div', null, h('p', null, 'Counter: ' + this.count), h('button', { onClick: this.increment }, '+') ); } });

mount(Counter, document.getElementById('app'));

Example: components with context const ThemeProvider = Component({ theme: 'light',

context: { theme() { return this.theme; }, toggleTheme() { this.theme = this.theme === 'light' ? '

§2 AI · 99%

dark' : 'light'; this.update(); } },

render() { return h('div', null, this.props.children); } });

const ThemedButton = Component({ render() { const theme = this.context('theme'); return h('button', { className: 'btn-' + theme }, 'Button'); } });

mount( h(ThemeProvider, null, h(ThemedButton) ), document.body );

Example: global store

// store.js export const store = { count: 0 };

// app.js import { store } from './store.js'; import { h, Component, mount, refresh } from 'tyaff';

const Counter = Component({ render() { return h('div', null, 'Count: ', store.count); } });

mount(Counter, document.getElementById('app'));

// Update store.count = 55; await refresh(); // all components will re-read the store

Resources

Documentation — full API description, usage examples, lifecycle, context, portals, optimizations Live example — interactive demo in the browser Benchmark — performance comparison tyaff vs React (14 scenarios) Changelog — what’s new in the project

Acknowledgments

This project is a showcase of human-AI collaboration:

Human: architecture, design decisions, code review, vision Qwen: development, optimization, documentation, visual design GLM: development, optimization Gemini: research and analysis (via Search)

Browser Support

Chrome 86+ Firefox 78+ Safari 14+ All modern browsers with ES6 modules support

License

MIT