Skip to content

revskill10/resig.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

20 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Signal-ฮฃ (Signal-Sigma)

Universal Reactive Platform - Everything composes from signals

TypeScript React SolidJS Svelte Vue Qwik

๐ŸŒŸ The Complete Reactive Platform

Signal-ฮฃ is the first truly composable reactive platform where every featureโ€”animations, real-time collaboration, themes, undo/redo, scheduling, drag-drop, offline sync, blocks, streaming, AI integration, and event sourcingโ€”composes naturally from a single primitive: the Signal.

import {
  signal, computed, effect,
  animatedSignal, spring,
  orSet, gCounter,
  createThemeManager,
  createUndoRedoManager,
  createStreamingSignal,
  createWebRTCStream,
  createAIEnhancedSignal,
  createEventSourcedCRDT,
  debouncePlugin, cachePlugin
} from 'resig.js';

// ๐ŸŽฏ Everything starts with signals
const userInput = signal('');
const todos = orSet('user-1');
const theme = signal('light');

// ๐ŸŒŠ Add streaming capabilities
const todoStream = createStreamingSignal([])
  .throttle(100)
  .filter(todos => todos.length > 0);

// ๐ŸŒ Real-time WebRTC collaboration
const collaboration = createWebRTCStream('peer-1');

// ๐Ÿค– AI-enhanced input processing
const aiAssistant = createAIEnhancedSignal(
  userInput.value(),
  'gpt-4',
  { maxTokens: 500, temperature: 0.7 }
);

// ๐Ÿ“š Event sourcing for complete history
const eventSourcedTodos = createEventSourcedCRDT(
  todos,
  { snapshotInterval: 10, compactionStrategy: 'sliding-window' }
);

// ๐ŸŽฌ Add smooth animations
const animatedCount = animatedSignal(
  computed(() => todos.size()),
  spring({ tension: 300 })
);

// ๐ŸŽจ Apply theme transformations
const themedTodos = computed(() =>
  todos.values().map(todo => ({
    ...todo,
    color: theme.value() === 'dark' ? '#fff' : '#000'
  }))
);

// โฐ Add time-travel capabilities
const history = createUndoRedoManager(
  { todos: [], theme: 'light' },
  { maxHistorySize: 50 }
);

// ๐Ÿ”Œ Enhance with plugins across ALL components
const debouncedInput = userInput.pipe(debouncePlugin(300));
const cachedTodos = themedTodos.pipe(cachePlugin('todos', 60000));
const persistentTheme = theme.pipe(persistPlugin('theme'));

// ๐Ÿš€ Everything composes seamlessly
effect(() => {
  console.log(`${animatedCount.value()} todos in ${theme.value()} theme`);
  console.log(`AI confidence: ${aiAssistant.confidence.value()}`);
  console.log(`Event count: ${eventSourcedTodos.getEventCount()}`);
});

๐Ÿงฉ Universal Composability

Every component composes with every other component. Animations work with CRDTs, themes work with undo/redo, plugins work across all systems.

// ๐ŸŽฏ Start with any framework - same code everywhere
import { useSignal, useComputed } from 'resig.js/react'; // or solid, svelte, vue, qwik

function CollaborativeAnimatedTodoApp() {
  // ๐Ÿ“Š Real-time collaborative data
  const todos = useSignal(orSet('user-1'));
  const sharedCounter = useSignal(gCounter('user-1'));

  // ๐ŸŽฌ Smooth animations for all changes
  const animatedCount = useComputed(() =>
    animatedSignal(sharedCounter, spring({ tension: 200 }))
  );

  // ๐ŸŽจ Dynamic theming with CSS variables
  const theme = useSignal(createThemeManager({ defaultTheme: 'auto' }));
  const themedStyles = useComputed(() =>
    theme.getCurrentTheme().map(t => `theme-${t}`)
  );

  // โฐ Undo/redo for all operations
  const history = useSignal(createUndoRedoManager({
    todos: todos.value(),
    counter: sharedCounter.value(),
    theme: theme.getCurrentTheme().value()
  }));

  // ๐Ÿ”Œ Plugins enhance everything
  const debouncedTodos = useComputed(() =>
    todos.pipe(debouncePlugin(300)).pipe(cachePlugin('todos'))
  );

  // ๐Ÿš€ All systems work together seamlessly
  const addTodo = (text) => {
    const command = createCommand('add-todo',
      state => ({ ...state, todos: state.todos.add({ text, id: Date.now() }) }),
      state => ({ ...state, todos: state.todos.remove(todo) })
    );

    history.execute(command);           // โฐ Undoable
    sharedCounter.increment();          // ๐Ÿ“Š Syncs to all users
    animatedCount.trigger();            // ๐ŸŽฌ Smooth animation
    theme.applyToElement(todoElement);  // ๐ŸŽจ Themed styling
  };

  return (
    <div className={themedStyles}>
      <h1>Count: {animatedCount}</h1>
      {debouncedTodos.map(todo => <TodoItem key={todo.id} {...todo} />)}
    </div>
  );
}

๏ฟฝ Quick Start: Build a Complete App in Minutes

npm install resig.js

Real-world Example: Collaborative Task Manager

import {
  useSignal, useComputed, useEffect,
  animatedSignal, spring,
  orSet, createRealtimeSync,
  createThemeManager, createUndoRedoManager,
  createDragContainer,
  debouncePlugin, persistPlugin, cachePlugin
} from 'resig.js/react'; // Works in any framework!

function TaskManager() {
  // ๐Ÿ“Š Real-time collaborative data (CRDTs)
  const sync = useSignal(() => createRealtimeSync({
    channelName: 'task-app',
    nodeId: `user-${Math.random().toString(36).substr(2, 9)}`
  }));

  const tasks = useSignal(() => {
    const taskSet = orSet('user-1');
    sync.registerCRDT('tasks', taskSet);
    return taskSet;
  });

  // ๐ŸŽฌ Smooth animations for all changes
  const taskCount = useComputed(() => tasks.size());
  const animatedCount = useComputed(() =>
    animatedSignal(taskCount, spring({ tension: 300, friction: 30 }))
  );

  // ๐ŸŽจ Dynamic theming with real-time sync
  const themeManager = useSignal(() => createThemeManager({
    defaultTheme: 'auto',
    persistKey: 'task-app-theme',
    autoDetect: true
  }));

  const currentTheme = useComputed(() => themeManager.getCurrentTheme());

  // โฐ Undo/redo for all operations
  const history = useSignal(() => createUndoRedoManager(
    { tasks: [], theme: 'light' },
    { maxHistorySize: 50, persistKey: 'task-history' }
  ));

  // ๐ŸŽฏ Drag-n-drop with operad composition
  const dragContainer = useSignal(() => createDragContainer(
    document.getElementById('task-list'),
    Array.from(tasks.values()),
    {
      itemRenderer: (task) => `
        <div class="task ${task.completed ? 'completed' : ''}">
          <span class="handle">โ‹ฎโ‹ฎ</span>
          <span class="text">${task.text}</span>
          <button class="toggle">${task.completed ? 'โœ“' : 'โ—‹'}</button>
        </div>
      `,
      onReorder: (newTasks, operation) => {
        const command = createCommand('reorder-tasks',
          state => ({ ...state, tasks: newTasks }),
          state => ({ ...state, tasks: Array.from(tasks.values()) })
        );
        history.execute(command);
      }
    }
  ));

  // โšก State machine for complex app state
  const appStateMachine = useSignal(() => createStateMachine('idle', (state, action) => {
    switch (state) {
      case 'idle':
        return action.type === 'START_SYNC' ? 'syncing' :
               action.type === 'START_DRAG' ? 'dragging' :
               action.type === 'OPEN_THEME' ? 'theming' : state;
      case 'syncing':
        return action.type === 'SYNC_COMPLETE' ? 'idle' :
               action.type === 'SYNC_ERROR' ? 'error' : state;
      case 'dragging':
        return action.type === 'DROP_COMPLETE' ? 'idle' :
               action.type === 'DROP_CANCEL' ? 'idle' : state;
      case 'theming':
        return action.type === 'THEME_APPLIED' ? 'idle' : state;
      case 'error':
        return action.type === 'RETRY' ? 'syncing' :
               action.type === 'RESET' ? 'idle' : state;
      default: return state;
    }
  }));

  // ๐Ÿ”Œ Plugins enhance everything across all systems
  const [newTaskText, setNewTaskText] = useSignal('');
  const debouncedText = useComputed(() =>
    newTaskText.pipe(debouncePlugin(300))
  );

  const cachedTasks = useComputed(() =>
    tasks.pipe(cachePlugin('tasks', 60000))
  );

  const persistentTheme = useComputed(() =>
    currentTheme.pipe(persistPlugin('theme'))
  );

  // State machine with plugin enhancements
  const enhancedStateMachine = useComputed(() =>
    appStateMachine.pipe(
      loggerPlugin('app-state'),
      persistPlugin('app-state-backup')
    )
  );

  // ๐Ÿš€ Add task with full composability including state machine
  const addTask = () => {
    if (!debouncedText.trim()) return;

    // State machine coordinates the entire operation
    enhancedStateMachine.send({ type: 'START_SYNC' });

    const task = {
      id: Date.now(),
      text: debouncedText,
      completed: false,
      createdAt: new Date().toISOString()
    };

    try {
      // All systems work together with state machine orchestration:
      const command = createCommand('add-task',
        state => ({ ...state, tasks: state.tasks.add(task) }),
        state => ({ ...state, tasks: state.tasks.remove(task) })
      );

      history.execute(command);        // โฐ Undoable operation
      tasks.add(task);                 // ๐Ÿ“Š Syncs to all users
      setNewTaskText('');              // ๐Ÿ”„ Clear input
      dragContainer.addItem(task);     // ๐ŸŽฏ Update drag container
      // ๐ŸŽฌ Count animates automatically via reactive composition

      enhancedStateMachine.send({ type: 'SYNC_COMPLETE' });
    } catch (error) {
      enhancedStateMachine.send({ type: 'SYNC_ERROR', error });
    }
  };

  // ๐ŸŽจ Theme switching with state machine coordination
  const switchTheme = (themeName) => {
    enhancedStateMachine.send({ type: 'OPEN_THEME' });

    // Create undoable theme change
    const previousTheme = currentTheme.value();
    const themeCommand = createCommand('change-theme',
      state => ({ ...state, theme: themeName }),
      state => ({ ...state, theme: previousTheme })
    );

    history.execute(themeCommand);   // โฐ Theme changes are undoable
    themeManager.setTheme(themeName); // ๐ŸŽจ Apply theme

    // State machine tracks completion
    enhancedStateMachine.send({ type: 'THEME_APPLIED' });

    // Automatically updates: animations, drag-drop, CRDTs, undo/redo
  };

  return (
    <div className={`app theme-${persistentTheme}`}>
      <header>
        <h1>Tasks ({animatedCount})</h1>
        <div className="theme-switcher">
          <button onClick={() => switchTheme('light')}>โ˜€๏ธ</button>
          <button onClick={() => switchTheme('dark')}>๐ŸŒ™</button>
          <button onClick={() => switchTheme('auto')}>๐Ÿ”„</button>
        </div>
      </header>

      <div className="add-task">
        <input
          value={newTaskText}
          onChange={(e) => setNewTaskText(e.target.value)}
          onKeyPress={(e) => e.key === 'Enter' && addTask()}
          placeholder="Add a task..."
        />
        <button onClick={addTask}>Add</button>
      </div>

      <div id="task-list" className="task-list">
        {/* Drag container renders here */}
      </div>

      <footer>
        <button onClick={() => history.undo()} disabled={!history.canUndo()}>
          โ†ถ Undo
        </button>
        <button onClick={() => history.redo()} disabled={!history.canRedo()}>
          โ†ท Redo
        </button>
        <span className="sync-status">
          {sync.getConnectionState().isConnected ? '๐ŸŸข Synced' : '๐Ÿ”ด Offline'}
        </span>
      </footer>
    </div>
  );
}

That's it! You just built a complete collaborative task manager with:

  • โœ… Real-time sync across all users
  • โœ… Smooth animations for all interactions
  • โœ… Drag-n-drop reordering with visual feedback
  • โœ… Dynamic theming with persistence
  • โœ… Undo/redo for all operations
  • โœ… Plugin enhancements across all systems
  • โœ… Works in any framework (React, Solid, Svelte, Vue, Qwik)

๐Ÿ”Œ Universal Plugin System: Enhance Everything

The magic of Signal-ฮฃ: plugins work across ALL components. Apply the same plugin to signals, animations, CRDTs, themes, undo/redo, drag-drop, and more.

import {
  signal, animatedSignal, orSet, createThemeManager, createUndoRedoManager,
  createStateMachine, schedule,
  debouncePlugin, cachePlugin, persistPlugin, loggerPlugin,
  transformPlugin, validatePlugin, filterPlugin
} from 'resig.js';

// ๐ŸŽฏ Create any signal-based component
const userInput = signal('');
const todos = orSet('user-1');
const theme = createThemeManager({ defaultTheme: 'auto' });
const animatedCount = animatedSignal(signal(0), spring());
const history = createUndoRedoManager({ todos: [], theme: 'light' });

// โšก State machine for orchestrating complex workflows
const appStateMachine = createStateMachine('idle', (state, action) => {
  switch (state) {
    case 'idle':
      return action.type === 'START_OPERATION' ? 'processing' :
             action.type === 'START_ANIMATION' ? 'animating' :
             action.type === 'START_SYNC' ? 'syncing' : state;
    case 'processing':
      return action.type === 'COMPLETE' ? 'idle' :
             action.type === 'ERROR' ? 'error' : state;
    case 'animating':
      return action.type === 'ANIMATION_END' ? 'idle' : state;
    case 'syncing':
      return action.type === 'SYNC_COMPLETE' ? 'idle' :
             action.type === 'SYNC_ERROR' ? 'error' : state;
    case 'error':
      return action.type === 'RETRY' ? 'processing' :
             action.type === 'RESET' ? 'idle' : state;
    default: return state;
  }
});

// ๐Ÿ”Œ Apply the SAME plugins to ANY component
const debouncedInput = userInput.pipe(
  debouncePlugin(300),           // Wait 300ms between changes
  validatePlugin(text => text.length > 0), // Only allow non-empty
  loggerPlugin('user-input'),    // Log all changes
  persistPlugin('last-input')    // Save to localStorage
);

const cachedTodos = todos.pipe(
  cachePlugin('todos', 60000),   // Cache for 1 minute
  transformPlugin(todos => todos.filter(t => !t.deleted)), // Remove deleted
  loggerPlugin('todos')          // Log all CRDT operations
);

const persistentTheme = theme.getCurrentTheme().pipe(
  filterPlugin(theme => ['light', 'dark'].includes(theme)), // Valid themes only
  persistPlugin('app-theme'),    // Save theme preference
  loggerPlugin('theme-changes')  // Log theme switches
);

const smoothAnimations = animatedCount.pipe(
  cachePlugin('animation-cache', 1000), // Cache animation frames
  loggerPlugin('animations')     // Log animation performance
);

const enhancedHistory = history.getCurrentState().pipe(
  cachePlugin('history-cache', 30000),  // Cache state snapshots
  validatePlugin(state => state !== null), // Validate states
  loggerPlugin('state-changes')  // Log all state changes
);

// โšก State machine with plugin enhancements
const enhancedStateMachine = appStateMachine.pipe(
  loggerPlugin('state-machine'),        // Log all state transitions
  persistPlugin('app-state'),           // Persist current state
  cachePlugin('state-cache', 10000)     // Cache state transitions
);

// ๐Ÿš€ Plugins compose and work together across ALL systems
const collaborativeAnimatedTodos = todos
  .pipe(cachePlugin('collab-cache', 5000))    // Cache CRDT operations
  .pipe(loggerPlugin('crdt-ops'))             // Log CRDT changes
  .map(todoSet => {
    // State machine coordinates animation triggers
    enhancedStateMachine.send({ type: 'START_ANIMATION' });

    const animated = animatedSignal(         // Convert to animated signal
      signal(todoSet.size()),
      spring({ tension: 200 })
    );

    // Complete animation state
    animated.subscribe(() => {
      enhancedStateMachine.send({ type: 'ANIMATION_END' });
    });

    return animated;
  })
  .pipe(cachePlugin('animation-cache', 1000)) // Cache animations
  .pipe(loggerPlugin('animated-todos'));      // Log animated changes

// ๐ŸŽจ Even complex compositions get full plugin support
const smartThemeSystem = createThemeManager({ defaultTheme: 'auto' })
  .getCurrentTheme()
  .pipe(filterPlugin(theme => theme !== 'invalid'))
  .pipe(transformPlugin(theme => `theme-${theme}`))
  .pipe(persistPlugin('smart-theme'))
  .pipe(cachePlugin('theme-cache', 10000))
  .pipe(loggerPlugin('theme-system'));

๏ฟฝ htmx/Alpine Integration

No-build frontend reactivity:

import { alpineSignal, htmxSignal } from 'resig.js/htmx-alpine';

// Works with Alpine.js
const data = alpineSignal({ count: 0 });

// Works with htmx
const response = htmxSignal('/api/data');

๐ŸŒŠ Streaming & AI Integration

Next-generation reactive programming with streaming and AI:

import {
  createStreamingSignal,
  createWebRTCStream,
  createAIEnhancedSignal,
  createEventSourcedCRDT,
  mergeStreams,
  combineStreams
} from 'resig.js';

// ๐ŸŒŠ Streaming signals with backpressure and throttling
const dataStream = createStreamingSignal(initialData)
  .throttle(100)                    // Limit to 10 updates/second
  .filter(data => data.isValid)     // Only valid data
  .transform(data => processData(data))
  .backpressure('drop');            // Drop excess data

// ๐ŸŒ Real-time WebRTC collaboration
const collaboration = createWebRTCStream('peer-id', {
  iceServers: [{ urls: 'stun:stun.l.google.com:19302' }],
  reconnectAttempts: 5
});

// Broadcast changes to all peers
collaboration.subscribe(message => {
  console.log('Received from peer:', message);
});

// ๐Ÿค– AI-enhanced signals with confidence tracking
const aiAssistant = createAIEnhancedSignal(
  userInput.value(),
  'gpt-4',
  {
    maxTokens: 1000,
    temperature: 0.7,
    streaming: true
  }
);

// Monitor AI processing
aiAssistant.confidence.subscribe(confidence => {
  console.log(`AI confidence: ${confidence * 100}%`);
});

aiAssistant.tokens.subscribe(usage => {
  console.log(`Tokens used: ${usage.total}`);
});

// ๐Ÿ“š Event sourcing with automatic snapshots
const eventSourcedData = createEventSourcedCRDT(
  orSet('node-1'),
  {
    eventStore: indexedDBEventStore('my-app'),
    snapshotInterval: 100,
    compactionStrategy: 'sliding-window'
  }
);

// Replay events from any point in time
const historicalState = await eventSourcedData.replayFrom(timestamp);

// ๐Ÿ”„ Combine multiple streams
const combinedStream = combineStreams({
  user: userStream,
  ai: aiAssistant.output,
  collaboration: collaboration
});

combinedStream.subscribe(({ user, ai, collaboration }) => {
  // All streams synchronized
  updateUI({ user, ai, collaboration });
});

๐Ÿ”ง Advanced Extensions

Mathematical patterns for complex features:

import {
  createDragContainer,     // Operad patterns
  createRealtimeSync,      // Commutative monoids
  createThemeManager,      // Functor maps
  createUndoRedoManager    // Coalgebraic time-travel
} from 'resig.js/extensions';

// Drag-n-drop with operad composition
const dragContainer = createDragContainer(element, items, config);

// Real-time sync with CRDT operations
const sync = createRealtimeSync({ channelName: 'app', nodeId: 'user-1' });

// Theme system with CSS variable mapping
const themes = createThemeManager({ defaultTheme: 'light' });

// Undo/redo with time-travel
const history = createUndoRedoManager(initialState, { maxHistorySize: 100 });

๐ŸŒŸ The Signal-ฮฃ Advantage: True Composability

๐Ÿงฉ Everything Composes with Everything

Component Works With Plugin Support Mathematical Foundation
Signals All systems โœ… Universal Category theory
State Machines ALL components โœ… Universal Finite automata
Animations CRDTs, Themes, Undo/Redo, State Machines โœ… Universal Functors
CRDTs Animations, Themes, History, State Machines โœ… Universal Commutative monoids
Themes All visual components, State Machines โœ… Universal Functor maps
Undo/Redo All state changes, State Machines โœ… Universal Coalgebras
Drag-Drop All UI components, State Machines, Multi-select โœ… Universal Operads
Blocks All UI components โœ… Universal Operads
Offline Sync All data operations, IndexedDB, Conflict resolution โœ… Universal CRDTs
Scheduling All async operations, State Machines โœ… Universal Stream coalgebras
DOM All reactive bindings, State Machines โœ… Universal Reactive streams

๐Ÿ”Œ Plugin System: The Universal Enhancer

// ONE plugin works with EVERY component type
const myPlugin = createPlugin('enhance', (component) => {
  return component.map(value => {
    // Enhance ANY component: signals, animations, CRDTs, themes, etc.
    return enhanceValue(value);
  });
});

// Apply to everything
signal('data').pipe(myPlugin);
animatedSignal(count).pipe(myPlugin);
orSet('user-1').pipe(myPlugin);
themeManager.getCurrentTheme().pipe(myPlugin);
history.getCurrentState().pipe(myPlugin);
dragContainer.getItems().pipe(myPlugin);

๐Ÿš€ Framework Universality

// Same code, any framework
import { useSignal, useComputed } from 'resig.js/react';    // React
import { useSignal, useComputed } from 'resig.js/solid';    // SolidJS
import { useSignal, useComputed } from 'resig.js/svelte';   // Svelte
import { useSignal, useComputed } from 'resig.js/vue';      // Vue
import { useSignal, useComputed } from 'resig.js/qwik';     // Qwik
import { domSignal, bindElement } from 'resig.js/dom';      // Vanilla DOM

// ALL features work in ALL frameworks
const todos = useSignal(orSet('user-1'));                  // CRDTs
const animated = useComputed(() => animatedSignal(count)); // Animations
const theme = useSignal(createThemeManager(config));       // Themes
const history = useSignal(createUndoRedoManager(state));   // Time-travel

๐Ÿš€ Try the Complete Demo

Experience all Signal-ฮฃ features in our comprehensive interactive demo:

cd examples/shared-todo-library/sveltekit-app
npm install
npm run dev

๐ŸŽฏ Demo Features:

  • ๐Ÿ“ก Signals & Effects - Core reactive primitives with computed values
  • ๐Ÿ”Œ Plugin System - Debounce, validate, persist, logger, cache plugins
  • ๐Ÿงฉ Extensions - Drag-drop, real-time sync, theme system, undo-redo
  • ๐Ÿ”„ CRDT Integration - G-Counter, PN-Counter, OR-Set, LWW-Register
  • ๐Ÿงฑ Blocks System - Operad-based UI composition with mathematical guarantees
  • โšก Algebra Demonstrations - Time, state machine, and fetch algebras
  • ๐ŸŽฏ Multi-Item Drag-Drop - Advanced selection with Ctrl+click and Shift+click
  • ๐Ÿ“ก Real-time Collaboration - CRDT-based synchronization with Express server
  • ๐Ÿ“ฑ Offline-First Sync - IndexedDB persistence with automatic conflict resolution

๐ŸŒ Live Demo: https://signal-sigma-demo.vercel.app

๐Ÿ“– User Guide: Complete usage guide with React/Svelte best practices

๐Ÿ“š Learn More

๐ŸŽฏ Signal-ฮฃ vs. The Competition

๐Ÿ“Š Comprehensive Comparison Matrix

Feature Signal-ฮฃ RxJS SolidJS Signals Preact Signals ArrowJS MobX Svelte Stores Vue Reactivity
๐ŸŒ Framework Support โœ… 7+ frameworks + DOM โš ๏ธ Framework agnostic โŒ SolidJS only โš ๏ธ React/Preact โŒ DOM only โš ๏ธ React/Vue โŒ Svelte only โŒ Vue only
๐Ÿ”Œ Universal Plugin System โœ… Works across ALL components โŒ Operator-based only โŒ No plugin system โŒ No plugin system โŒ No plugin system โŒ No plugin system โŒ No plugin system โŒ No plugin system
โšก State Machines โœ… Built-in + composable โŒ External (RxState) โŒ External libs โŒ External libs โŒ Not available โŒ External libs โŒ External libs โŒ External libs
๐ŸŽฌ Animations โœ… Built-in + composable โŒ External libs โŒ External libs โŒ External libs โŒ Not available โŒ External libs โŒ External libs โŒ External libs
๐Ÿ“Š Real-time Collaboration โœ… Built-in CRDTs โŒ External libs โŒ External libs โŒ External libs โŒ Not available โŒ External libs โŒ External libs โŒ External libs
โฐ Time-travel/Undo-Redo โœ… Built-in coalgebraic โŒ External libs โŒ External libs โŒ External libs โŒ Not available โŒ External libs โŒ External libs โŒ External libs
๐ŸŽจ Dynamic Theming โœ… Built-in CSS variables โŒ External libs โŒ External libs โŒ External libs โŒ Not available โŒ External libs โŒ External libs โŒ External libs
๐ŸŽฏ Drag-n-Drop โœ… Built-in operad patterns + multi-select โŒ External libs โŒ External libs โŒ External libs โŒ Not available โŒ External libs โŒ External libs โŒ External libs
๐Ÿงฑ Block System โœ… Built-in operad composition โŒ Not available โŒ Not available โŒ Not available โŒ Not available โŒ Not available โŒ Not available โŒ Not available
๐Ÿ“ฑ Offline Sync โœ… Built-in IndexedDB + conflict resolution โŒ External libs โŒ External libs โŒ External libs โŒ Not available โŒ External libs โŒ External libs โŒ External libs
๐Ÿงฎ Mathematical Foundation โœ… Category theory โš ๏ธ Functional reactive โŒ Ad-hoc โŒ Ad-hoc โŒ Ad-hoc โŒ Ad-hoc โŒ Ad-hoc โŒ Ad-hoc
๐Ÿ”„ Automatic Dependency Tracking โœ… Always automatic โŒ Manual subscriptions โœ… Automatic โœ… Automatic โœ… Automatic โœ… Automatic โœ… Automatic โœ… Automatic
๐Ÿ“ TypeScript Support โœ… Full inference โœ… Good โœ… Excellent โœ… Good โš ๏ธ Basic โœ… Good โœ… Good โœ… Good
๐ŸŒ Pure DOM Support โœ… Native bindings โš ๏ธ Manual DOM โŒ Framework required โŒ Framework required โœ… Native โŒ Framework required โŒ Framework required โŒ Framework required
โšก Performance โœ… Optimized batching โš ๏ธ Can be heavy โœ… Excellent โœ… Good โœ… Lightweight โš ๏ธ Can be heavy โœ… Good โœ… Good
๐Ÿ“ฆ Bundle Size โœ… Tree-shakeable โŒ Large (200kb+) โœ… Small (~10kb) โœ… Small (~5kb) โœ… Tiny (~2kb) โš ๏ธ Medium (~50kb) โœ… Small (~10kb) โœ… Small (~15kb)
๐Ÿ”ง Learning Curve โœ… Consistent patterns โŒ Steep (operators) โœ… Easy โœ… Easy โœ… Very easy โš ๏ธ Medium โœ… Easy โœ… Easy
๐Ÿ—๏ธ Component Composition โœ… Operad patterns โŒ Not available โŒ Basic โŒ Basic โŒ Not available โŒ Basic โŒ Basic โŒ Basic
โฑ๏ธ Scheduling/Debouncing โœ… Built-in + composable โœ… Rich operators โŒ External libs โŒ External libs โŒ Not available โŒ External libs โŒ External libs โŒ External libs
๐Ÿ”„ Hot Reloading โœ… Framework-agnostic โš ๏ธ Framework dependent โœ… SolidJS only โœ… React/Preact โŒ Limited โš ๏ธ Framework dependent โœ… Svelte only โœ… Vue only
๐Ÿ“ฑ SSR Support โœ… Universal โš ๏ธ Complex setup โœ… SolidJS only โœ… React/Preact โŒ Client only โš ๏ธ Framework dependent โœ… Svelte only โœ… Vue only
๐Ÿงช Testing โœ… Framework-agnostic โœ… Good tooling โš ๏ธ SolidJS specific โš ๏ธ React specific โš ๏ธ Limited โš ๏ธ Framework dependent โš ๏ธ Svelte specific โš ๏ธ Vue specific
๐Ÿ”Œ Ecosystem โœ… Growing + universal โœ… Mature โš ๏ธ SolidJS ecosystem โš ๏ธ React ecosystem โŒ Limited โœ… Mature โš ๏ธ Svelte ecosystem โœ… Vue ecosystem

๐Ÿ† Signal-ฮฃ Unique Advantages

โœจ Only Signal-ฮฃ Provides:

  1. ๐ŸŒ True Universality: Same code works in React, Solid, Svelte, Vue, Qwik, Angular, and pure DOM
  2. ๐Ÿ”Œ Universal Plugin System: One plugin enhances ALL component types (signals, animations, CRDTs, state machines, themes)
  3. ๐Ÿงฎ Mathematical Rigor: Category theory foundations ensure correctness and composability
  4. โšก Complete Platform: Built-in animations, CRDTs, state machines, themes, undo/redo, multi-select drag-drop, blocks, offline sync
  5. ๐ŸŽฏ Workflow Orchestration: State machines coordinate all systems seamlessly
  6. ๐Ÿ”„ Cross-Component Composability: Every feature works with every other feature
  7. ๐Ÿ“ฑ Offline-First: Built-in IndexedDB persistence with automatic conflict resolution
  8. ๐Ÿงฑ Block Composition: Operad-based UI block system with mathematical guarantees

๐Ÿ“ˆ Detailed Feature Comparison

Library Strengths Weaknesses Best For
Signal-ฮฃ โœ… Universal, complete platform, mathematical rigor โš ๏ธ Newer ecosystem Universal apps, complex workflows, mathematical correctness
RxJS โœ… Mature, rich operators, functional reactive โŒ Steep learning curve, large bundle, framework-specific integration Complex async flows, experienced teams
SolidJS Signals โœ… Excellent performance, fine-grained reactivity โŒ SolidJS only, limited ecosystem SolidJS applications, performance-critical apps
Preact Signals โœ… Small bundle, React compatibility โŒ React/Preact only, limited features React/Preact apps, bundle size critical
ArrowJS โœ… Tiny size, simple API โŒ DOM only, very limited features Simple DOM manipulation, micro-apps
MobX โœ… Mature, object-oriented, good tooling โŒ Framework-specific, can be complex Object-oriented apps, existing MobX teams
Svelte Stores โœ… Simple, integrated with Svelte โŒ Svelte only, basic features Svelte applications
Vue Reactivity โœ… Integrated with Vue, good performance โŒ Vue only, framework-coupled Vue applications

๐ŸŽฏ Migration Comparison

From Library To Signal-ฮฃ Effort Benefits
RxJS โš ๏ธ Medium Learn new patterns, simpler API โœ… Universal, built-in features, easier learning
SolidJS Signals โœ… Easy Similar concepts, add features โœ… Framework freedom, more features
Preact Signals โœ… Easy Similar API, add features โœ… Framework freedom, complete platform
ArrowJS โœ… Very Easy Add features, keep simplicity โœ… More features, same simplicity
MobX โš ๏ธ Medium Different paradigm โœ… Universal, mathematical guarantees
Svelte Stores โœ… Easy Similar concepts โœ… Framework freedom, more features
Vue Reactivity โœ… Easy Similar concepts โœ… Framework freedom, more features

๐Ÿ’ป Code Comparison: Same Task, Different Libraries

Task: Animated Counter with Persistence and Theming

๐ŸŒŸ Signal-ฮฃ (Complete in one library)
import {
  signal, computed, animatedSignal, spring,
  createThemeManager, persistPlugin, loggerPlugin
} from 'resig.js/react'; // Works in ANY framework

function AnimatedCounter() {
  // All features built-in and composable
  const count = signal(0).pipe(
    persistPlugin('counter'),
    loggerPlugin('counter-changes')
  );

  const animatedCount = computed(() =>
    animatedSignal(count, spring({ tension: 300 }))
  );

  const theme = createThemeManager({ defaultTheme: 'auto' });
  const currentTheme = theme.getCurrentTheme();

  return (
    <div className={`counter theme-${currentTheme}`}>
      <h1>{animatedCount}</h1>
      <button onClick={() => count.set(count.value() + 1)}>+</button>
      <button onClick={() => theme.setTheme('dark')}>๐ŸŒ™</button>
    </div>
  );
}
๐Ÿ“ก RxJS + React (Multiple libraries needed)
import { BehaviorSubject } from 'rxjs';
import { useObservable } from 'rxjs-hooks';
import { useSpring, animated } from '@react-spring/web';
import { useLocalStorage } from 'react-use';
import { ThemeProvider } from 'styled-components';

function AnimatedCounter() {
  // Multiple libraries, complex setup
  const [persistedCount, setPersisted] = useLocalStorage('counter', 0);
  const count$ = new BehaviorSubject(persistedCount);
  const count = useObservable(() => count$, persistedCount);

  const animatedProps = useSpring({
    number: count,
    config: { tension: 300 }
  });

  const increment = () => {
    const newCount = count + 1;
    count$.next(newCount);
    setPersisted(newCount);
    console.log('Counter changed:', newCount); // Manual logging
  };

  return (
    <div className="counter">
      <animated.h1>
        {animatedProps.number.to(n => Math.floor(n))}
      </animated.h1>
      <button onClick={increment}>+</button>
    </div>
  );
}
๐ŸŸฆ SolidJS Signals (SolidJS only)
import { createSignal, createEffect } from 'solid-js';
import { createSpring, animated } from '@solid-spring/core';

function AnimatedCounter() {
  const [count, setCount] = createSignal(0);

  // Manual persistence
  createEffect(() => {
    localStorage.setItem('counter', count().toString());
  });

  // Manual logging
  createEffect(() => {
    console.log('Counter changed:', count());
  });

  // External animation library
  const animatedCount = createSpring(() => ({
    number: count(),
    config: { tension: 300 }
  }));

  return (
    <div class="counter">
      <animated.h1>{animatedCount().number}</animated.h1>
      <button onClick={() => setCount(c => c + 1)}>+</button>
    </div>
  );
}

๐Ÿ“Š Lines of Code & Dependencies

Library Lines External Deps Built-in Features
Signal-ฮฃ 15 lines 0 โœ… Animations, persistence, theming, logging
RxJS + React 30+ lines 4+ โŒ Requires multiple libraries
SolidJS 25+ lines 2+ โŒ Manual persistence, external animations
Preact Signals 30+ lines 3+ โŒ Manual everything, external libs

๐ŸŒŸ Enhanced Shared Todo Library Example

See the complete streaming and AI-enhanced todo application in action:

// examples/shared-todo-library/StreamingTodoApp
import {
  createStreamingSignal,
  createWebRTCStream,
  createAIEnhancedSignal,
  createEventSourcedCRDT,
  indexedDBEventStore
} from 'resig.js';

// ๐ŸŒŠ Streaming todo management with real-time collaboration
const todoApp = {
  // Event sourced CRDT for persistent todos
  todos: createEventSourcedCRDT(
    orSet('user-id'),
    {
      eventStore: indexedDBEventStore('todos'),
      snapshotInterval: 10,
      compactionStrategy: 'sliding-window'
    }
  ),

  // WebRTC collaboration
  collaboration: createWebRTCStream('todo-collab'),

  // AI assistance for todo suggestions
  aiAssistant: createAIEnhancedSignal('', 'gpt-4', {
    maxTokens: 500,
    temperature: 0.7
  }),

  // Streaming filters and transformations
  filteredTodos: createStreamingSignal([])
    .filter(todos => todos.length > 0)
    .throttle(100)
    .transform(todos => todos.sort((a, b) => b.updatedAt - a.updatedAt))
};

// ๐Ÿš€ Works identically in React and SvelteKit!

Features demonstrated:

  • โœ… Real-time WebRTC collaboration between multiple users
  • โœ… AI-powered todo suggestions with confidence tracking
  • โœ… Event sourcing with automatic snapshots and compaction
  • โœ… Streaming data processing with throttling and filtering
  • โœ… Persistent storage with IndexedDB integration
  • โœ… Universal API - same code works in React and SvelteKit

Try it yourself:

cd examples/shared-todo-library
npm run dev:react    # React version
npm run dev:svelte   # SvelteKit version

๐Ÿš€ Get Started

npm install resig.js

Choose your framework and start building:

// React
import { useSignal } from 'resig.js/react';

// SolidJS
import { useSignal } from 'resig.js/solid';

// Svelte
import { useSignal } from 'resig.js/svelte';

// Vue
import { useSignal } from 'resig.js/vue';

// Qwik
import { useSignal } from 'resig.js/qwik';

// Pure DOM (Vanilla JS)
import { domSignal } from 'resig.js/dom';

// Core Signals
import { signal } from 'resig.js';

// ๐ŸŒŸ Get the complete platform with state machine orchestration
import {
  // โšก State machines & workflow orchestration
  createStateMachine, schedule, debounce, throttle,

  // ๐Ÿ“Š Real-time collaboration
  orSet, gCounter, createRealtimeSync,

  // ๐ŸŽฌ Smooth animations
  animatedSignal, spring, keyframes,

  // ๐ŸŽจ Dynamic theming
  createThemeManager, createLightTheme, createDarkTheme,

  // โฐ Time-travel
  createUndoRedoManager, createCommand,

  // ๐ŸŽฏ Drag-n-drop
  createDragContainer,

  // ๐Ÿ”Œ Universal plugins (work with ALL components including state machines)
  debouncePlugin, cachePlugin, persistPlugin, loggerPlugin
} from 'resig.js';

// ๐Ÿš€ Everything works together with state machine coordination
const appStateMachine = createStateMachine('idle', (state, action) => {
  // Orchestrate animations, sync, themes, undo/redo, drag-drop
  switch (state) {
    case 'idle': return action.type === 'START_OPERATION' ? 'processing' : state;
    case 'processing': return action.type === 'COMPLETE' ? 'idle' : state;
    default: return state;
  }
}).pipe(loggerPlugin('app-orchestration'));

Signal-ฮฃ: The only truly universal reactive platform. ๐ŸŒŸ

While others require multiple libraries and framework lock-in, Signal-ฮฃ provides everything built-in: state machines orchestrate animations, sync, themes, undo/redo, drag-dropโ€”all enhanced by universal plugins, across every framework.

Why choose fragmented solutions when you can have mathematical perfection? ๐Ÿงฎโœจ


๐Ÿ“„ License

MIT License - see LICENSE for details.

๐Ÿ™ Acknowledgments

  • Functional Programming Community - For proven patterns and mathematical foundations
  • Framework Authors - For creating the ecosystems we build upon
  • Open Source Contributors - For making reactive programming accessible to everyone

About

The simplest signal library

Resources

License

Stars

Watchers

Forks

Packages

No packages published