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

@1houseglobal/chat-react

v2.1.0

Published

React embeddable chat component for 1 HOUSE Global

Readme

@1house/chat-react

React embeddable chat component for 1HOUSE LiveChat with Twitch-style UI and image caching.

Features

  • 🎨 Twitch-style chat interface
  • 📺 NEW: TwitchStream component - Complete streaming interface with video/iframe support
  • 🌓 Dark & Light themes
  • 🖼️ Automatic image caching
  • 💬 Real-time messaging
  • 👥 User list with avatars
  • ⌨️ Typing indicators
  • 📱 Responsive design
  • 🎯 TypeScript support

Installation

npm install @1house/chat-react

Usage

TwitchStream Component (NEW!)

The TwitchStream component provides a complete Twitch-style streaming interface with integrated chat:

import { TwitchStream } from '@1house/chat-react';

function App() {
  return (
    <TwitchStream
      // LiveChat props
      apiKey="your-api-key"
      serverUrl="ws://localhost:8080"
      userId="user123"
      username="viewer"
      roomId="lobby"
      
      // Stream info
      streamTitle="Live Coding Session - Building a Chat App"
      streamerName="DeveloperName"
      viewerCount={150}
      isLive={true}
      
      // Video content
      videoSrc="https://example.com/stream.mp4"
      autoPlay={true}
      muted={true}
      
      // Customization
      streamerAvatar="https://example.com/avatar.jpg"
      chatWidth="24rem"
      headerColor="#171719"
    />
  );
}

Basic LiveChat Implementation

import { LiveChat } from '@1house/chat-react';

function App() {
  return (
    <LiveChat
      serverUrl="ws://localhost:8080"
      userId="user123"
      username="JohnDoe"
    />
  );
}

With All Options

import { LiveChat } from '@1house/chat-react';

function App() {
  return (
    <LiveChat
      serverUrl="ws://localhost:8080"
      userId="user123"
      username="JohnDoe"
      roomId="gaming"
      avatar="https://example.com/avatar.jpg"
      theme="dark"
      maxHeight="600px"
      onConnect={() => console.log('Connected!')}
      onDisconnect={() => console.log('Disconnected')}
      onMessage={(message) => console.log('New message:', message)}
      onError={(error) => console.error('Error:', error)}
    />
  );
}

Embedded in a Layout

<div style={{ display: 'flex', height: '100vh' }}>
  <main style={{ flex: 1 }}>
    {/* Your main content */}
  </main>
  <aside style={{ width: '350px' }}>
    <LiveChat
      serverUrl="ws://localhost:8080"
      userId={currentUser.id}
      username={currentUser.name}
      avatar={currentUser.avatar}
      theme="dark"
      maxHeight="100vh"
    />
  </aside>
</div>

Props

TwitchStream Component Props

| Prop | Type | Required | Default | Description | |------|------|----------|---------|-------------| | LiveChat Props | | | | | | apiKey | string | ✅ | - | LiveChat API key | | serverUrl | string | ✅ | - | WebSocket server URL | | userId | string | ✅ | - | Unique user identifier | | username | string | ✅ | - | Display name | | roomId | string | ❌ | 'lobby' | Chat room ID | | role | 'user' | 'moderator' | 'admin' | ❌ | 'user' | User role | | theme | 'light' | 'dark' | ❌ | 'dark' | Chat theme | | maxHeight | string | ❌ | '100%' | Maximum chat height | | onConnect | () => void | ❌ | - | Connection callback | | onDisconnect | () => void | ❌ | - | Disconnection callback | | onMessage | (message) => void | ❌ | - | New message callback | | onError | (error) => void | ❌ | - | Error callback | | Stream Props | | | | | | streamTitle | string | ✅ | - | Main stream title | | streamerName | string | ✅ | - | Streamer's name | | viewerCount | number | ❌ | 0 | Current viewer count | | isLive | boolean | ❌ | true | Whether stream is live | | Video/Content Props | | | | | | videoSrc | string | ❌ | - | Video source URL | | iframeSrc | string | ❌ | - | Iframe source URL (alternative to video) | | videoPoster | string | ❌ | - | Video poster image | | autoPlay | boolean | ❌ | true | Auto-play video | | muted | boolean | ❌ | true | Mute video by default | | loop | boolean | ❌ | true | Loop video | | controls | boolean | ❌ | true | Show video controls | | videoFit | 'contain' | 'cover' | 'fill' | 'scale-down' | 'none' | ❌ | 'cover' | Video scaling behavior | | hideControlsForEmbedded | boolean | ❌ | false | Hide video controls for embedded use | | Customization Props | | | | | | streamerAvatar | string | ❌ | - | Streamer avatar image URL | | showChatToggle | boolean | ❌ | true | Show chat toggle button | | chatWidth | string | ❌ | '24rem' | Chat overlay width | | headerColor | string | ❌ | '#171719' | Header background color | | className | string | ❌ | - | Additional CSS classes | | Fullscreen Props | | | | | | showFullscreenButton | boolean | ❌ | true | Show fullscreen button | | fullscreenButtonPosition | 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left' | ❌ | 'top-right' | Fullscreen button position | | Typography Props | | | | | | titleFontSize | string | ❌ | '1.125rem' | Stream title font size | | detailsFontSize | string | ❌ | '0.875rem' | Details text font size | | streamerNameFontSize | string | ❌ | '0.875rem' | Streamer name font size | | Chat Props | | | | | | chatSize | 'sm' | 'md' | 'lg' | 'xl' | ❌ | 'md' | Chat message size | | chatAnimation | boolean | ❌ | true | Enable chat slide animations | | Resize and Container Props | | | | | | width | string | number | ❌ | '100%' | Container width | | height | string | number | ❌ | '100vh' | Container height | | minWidth | string | number | ❌ | '320px' | Minimum container width | | minHeight | string | number | ❌ | '200px' | Minimum container height | | maxWidth | string | number | ❌ | 'none' | Maximum container width | | maxHeight | string | number | ❌ | 'none' | Maximum container height | | resizable | boolean | ❌ | false | Enable manual resizing | | containerStyle | React.CSSProperties | ❌ | - | Additional container styles |

LiveChat Component Props

| Prop | Type | Required | Default | Description | |------|------|----------|---------|-------------| | serverUrl | string | ✅ | - | WebSocket server URL | | userId | string | ✅ | - | Unique user identifier | | username | string | ✅ | - | Display name | | roomId | string | ❌ | 'default' | Chat room ID | | avatar | string | ❌ | - | User avatar URL | | theme | 'light' | 'dark' | ❌ | 'dark' | UI theme | | maxHeight | string | ❌ | '600px' | Maximum container height | | onConnect | () => void | ❌ | - | Connection callback | | onDisconnect | () => void | ❌ | - | Disconnection callback | | onMessage | (message) => void | ❌ | - | New message callback | | onError | (error) => void | ❌ | - | Error callback |

Advanced Usage

Using Hooks Directly

import { useWebSocket, useChatStore } from '@1house/chat-react';

function CustomChat() {
  const { sendMessage } = useWebSocket({
    serverUrl: 'ws://localhost:8080',
    userId: 'user123',
    username: 'JohnDoe'
  });

  const { messages, users, isConnected } = useChatStore();

  return (
    <div>
      <h3>Custom Chat UI</h3>
      <div>Status: {isConnected ? 'Connected' : 'Disconnected'}</div>
      <div>Users: {users.length}</div>
      {messages.map(msg => (
        <div key={msg.id}>{msg.username}: {msg.content}</div>
      ))}
    </div>
  );
}

Image Caching

import { useImageCache } from '@1house/chat-react';

function CustomAvatar({ imageUrl }) {
  const { getCachedImage, preloadImage } = useImageCache();

  // Preload image
  useEffect(() => {
    preloadImage(imageUrl);
  }, [imageUrl]);

  return <img src={getCachedImage(imageUrl)} alt="Avatar" />;
}

Styling

The component comes with built-in styles. If you need to customize, you can override the CSS classes:

.livechat-container {
  /* Your custom styles */
}

.chat-message {
  /* Custom message styles */
}

Development

# Install dependencies
npm install

# Development mode
npm run dev

# Build
npm run build

License

MIT