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 🙏

© 2024 – Pkg Stats / Ryan Hefner

sticky-horse

v1.0.91

Published

Real-time user tracking, cursor sharing, and feedback system

Downloads

3,252

Readme

Sticky Horse

A powerful real-time collaboration toolkit for React applications. Add cursor tracking, feedback systems, and real-time presence to your app in minutes.

Features

  • 👥 Real-time cursor tracking and sharing
  • 💬 Interactive feedback system with comments
  • 📝 Sticky notes for collaborative annotations
  • 🎯 Laser pointer for presentations
  • 👤 User presence tracking

Installation

npm install @mohammedsaid/sticky-horse
# or
yarn add @mohammedsaid/sticky-horse

Quick Start

  1. Initialize StickyHorse in your app:
import { initStickyHorse, StickyHorseProvider } from '@mohammedsaid/sticky-horse';
// Import the styles
import '@mohammedsaid/sticky-horse/dist/styles.css';

// Initialize with your API key (get it from the dashboard)
initStickyHorse({
  apiKey: 'your-api-key',
  socketUrl: 'your-socket-url',
  onUserJoin: (user) => {
    console.log('User joined:', user);
  },
  onUserLeave: (user) => {
    console.log('User left:', user);
  }
});

// Wrap your app with the provider
function App() {
  return (
    <StickyHorseProvider>
      <YourApp />
    </StickyHorseProvider>
  );
}
  1. Add cursor tracking to any component:
import { withTracking } from '@mohammedsaid/sticky-horse';

function YourComponent() {
  return <div>Your content here</div>;
}

export default withTracking(YourComponent, '/page-path');
  1. Use the feedback system:
import { UserFeedbackOverlay } from '@mohammedsaid/sticky-horse';

function YourPage() {
  return (
    <div>
      <YourContent />
      <UserFeedbackOverlay />
    </div>
  );
}
  1. Access StickyHorse features in your components:
import { useStickyHorse } from '@mohammedsaid/sticky-horse';

function YourComponent() {
  const { activeUsers, comments, stickyNotes, addComment } = useStickyHorse();

  return (
    <div>
      <h2>Active Users: {activeUsers.length}</h2>
      {/* Your UI */}
    </div>
  );
}

Styles

StickyHorse uses Tailwind CSS for styling. Make sure to:

  1. Import the styles in your app:
import '@mohammedsaid/sticky-horse/dist/styles.css';
  1. If you're using Tailwind CSS in your project, add StickyHorse to your content paths in tailwind.config.js:
module.exports = {
  content: [
    // ... your other content paths
    './node_modules/@mohammedsaid/sticky-horse/dist/**/*.{js,jsx,ts,tsx}'
  ],
  // ... rest of your config
}

API Reference

Components

  • withTracking(Component, pagePath): HOC to add cursor tracking
  • UserFeedbackOverlay: Component for feedback system
  • CursorOverlay: Component for showing other users' cursors
  • LaserCursorTrail: Component for laser pointer feature

Hooks

  • useStickyHorse(): Access all StickyHorse features
  • useCursorTracking(): Hook for cursor tracking
  • usePageTracking(): Hook for page presence

Configuration

The initStickyHorse function accepts the following options:

interface StickyHorseConfig {
  apiKey: string;
  socketUrl: string;
  onUserJoin?: (user: User) => void;
  onUserLeave?: (user: User) => void;
  onComment?: (comment: Comment) => void;
  onStickyNote?: (note: StickyNote) => void;
  onCursorMove?: (cursor: CursorData) => void;
}

License

MIT