Synapse UI is a revolutionary framework-agnostic UI library built on biological principles.
Components are modeled as neurons that communicate through signals, creating a self-sufficient,
neural-inspired architecture.
🔥 Framework Agnostic
No React, Vue, or Angular required. Pure TypeScript implementation.
🧬 Biologically Inspired
Components map to neurons with dendrites, soma, and axons.
⚡ Self-Sufficient
Components manage lifecycle, state, events, and rendering.
🔒 Type-Safe
Full TypeScript support with strict type checking.
334Total Tests
71%Pass Rate
4K+Lines of Code
8+Components
🎨 Button Component
Neural-inspired button with press states and signal emission. Extends SensoryNeuron to capture user interactions.
Container component with validation and submission. Extends InterneuronUI to orchestrate child components.
Code Example
import { Form, Input } from '@synapse-framework/core/ui';
const loginForm = new Form({
id: 'login-form',
type: 'cortical',
threshold: 0.5,
props: {
title: 'Login',
onSubmit: async (data) => {
console.log('Form data:', data);
// Submit to API
},
validation: {
email: (value) => {
if (!value) return 'Email is required';
if (!value.includes('@')) return 'Invalid email';
return null;
},
password: (value) => {
if (!value) return 'Password is required';
if (value.length < 8) return 'Password too short';
return null;
},
},
},
initialState: {
values: {},
errors: {},
submitting: false,
},
});
🧬 State Management: VisualAstrocyte
Redux-like state management with time-travel debugging, memoized selectors, and wildcard subscriptions.
import { VisualAstrocyte } from '@synapse-framework/core/ui';
const stateManager = new VisualAstrocyte({
id: 'app-state',
maxHistorySize: 50,
enableTimeTravel: true,
});
await stateManager.activate();
// Set nested state
stateManager.setState('user.profile.name', 'Alice');
stateManager.setState('user.profile.age', 30);
// Get state
const name = stateManager.getState('user.profile.name');
// Subscribe to changes
stateManager.subscribe('user.profile.name', (newValue, oldValue) => {
console.log(`Name changed from ${oldValue} to ${newValue}`);
});
// Wildcard subscriptions
stateManager.subscribe('user.*', (newValue) => {
console.log('User data changed:', newValue);
});
// Time-travel debugging
stateManager.undo();
stateManager.redo();
stateManager.jumpToState(5);
Features
Nested state paths with dot notation
Wildcard subscriptions for reactive updates
Memoized selectors for derived state
Time-travel debugging (undo/redo/jump)
State snapshots for persistence
Middleware support for transformations
59 comprehensive tests
⚡ Rendering Optimization: VisualOligodendrocyte
Component memoization, Virtual DOM diffing, and performance tracking. Inspired by oligodendrocytes that myelinate neurons for faster signal transmission.