npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@kcaitech/vextra-coop

v1.0.0

Published

vextra cooperation module

Downloads

4

Readme

Vextra Cooperation Module

License: AGPL-3.0 npm version TypeScript

A collaborative editing module based on CRDT (Conflict-Free Replicated Data Types), specifically designed for the Vextra design tool ecosystem. Supports real-time collaborative editing, conflict resolution, and version management.

🚀 Features

  • Real-time Collaborative Editing: Based on CRDT algorithms, supports multi-user simultaneous editing
  • Automatic Conflict Resolution: Automatically handles concurrent editing conflicts without manual merging
  • Version Management: Complete operation history and version control
  • Undo/Redo: Supports local and collaborative undo/redo operations
  • Network Synchronization: Configurable network layer supporting various collaboration scenarios
  • Type Safety: Fully written in TypeScript with complete type definitions

📦 Installation

npm install @kcaitech/vextra-coop

🔧 Quick Start

Basic Usage

import { CoopRepository } from '@kcaitech/vextra-coop';
import { Document, TransactDataGuard } from '@kcaitech/vextra-core';

// Create collaborative repository
const document = new Document();
const repo = new TransactDataGuard();
const coopRepo = new CoopRepository(document, repo);

// Start editing operation
const operator = coopRepo.start('Add text');
// ... perform editing operations
coopRepo.commit();

Network Collaboration Setup

import { INet } from '@kcaitech/vextra-coop';

class CustomNetwork implements INet {
    hasConnected(): boolean {
        return true;
    }
    
    async pullCmds(from: number, to?: number): Promise<Cmd[]> {
        // Implement logic to pull commands from server
        return [];
    }
    
    async postCmds(cmds: Cmd[], serial: (cmds: Cmd[]) => string): Promise<boolean> {
        // Implement logic to push commands to server
        return true;
    }
    
    watchCmds(watcher: (cmds: Cmd[]) => void) {
        // Implement logic to watch remote commands
        return () => {};
    }
    
    watchError(watcher: (errorInfo: any) => void): void {
        // Implement error watching logic
    }
}

// Set up network layer
const network = new CustomNetwork();
coopRepo.setNet(network);

🏗️ Architecture Design

Core Components

  • CoopRepository: Main collaborative repository class managing all collaborative operations
  • CmdMgr: Command manager handling command synchronization and conflict resolution
  • CRDT Algorithms: Conflict resolution algorithms based on array and tree structures
  • Network Layer: Pluggable network interface supporting various collaboration protocols

Data Flow

User Operation → Local Command → Command Merging → Network Sync → Remote Application
    ↓
Undo/Redo ← Version Management ← Conflict Resolution ← Remote Commands

📚 API Documentation

CoopRepository

Main collaborative repository class providing complete collaborative editing functionality.

Methods

  • start(description: string, selectionupdater?: Function): Start editing operation
  • commit(mergetype?: CmdMergeType): Commit current editing
  • undo(): Undo operation
  • redo(): Redo operation
  • canUndo(): Check if undo is possible
  • canRedo(): Check if redo is possible
  • setNet(net: INet): Set network layer
  • receive(cmds: Cmd[]): Receive remote commands

INet Interface

Network layer interface for implementing custom network communication.

Required Methods

  • hasConnected(): Check network connection status
  • pullCmds(from: number, to?: number): Pull commands
  • postCmds(cmds: Cmd[], serial: Function): Push commands
  • watchCmds(watcher: Function): Watch remote commands
  • watchError(watcher: Function): Watch for errors

Operation Types

  • OpType.Array: Array operations
  • OpType.Idset: Set operations
  • OpType.CrdtArr: CRDT array operations
  • OpType.CrdtTree: CRDT tree operations

🧪 Testing

Run test suite:

npm test

Run in development mode (watch file changes):

npm run dev

🏗️ Build

Build production version:

npm run build

📄 License

This project is licensed under the AGPL-3.0 License.

🤝 Contributing

Issues and Pull Requests are welcome! Please ensure:

  1. Code follows project coding standards
  2. New features include corresponding tests
  3. Update relevant documentation

📖 Related Documentation

🔗 Links


KCai Technology - Making Design Collaboration Simpler