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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@c4h/chuci

v0.1.0

Published

Standalone multimedia swiper and viewer web components

Readme

Chuci (楚辞)

CI npm version License: MIT

A standalone multimedia swiper and viewer web components library extracted from Quyuan. Provides touch-enabled carousel and multimedia viewers without any framework dependencies.

Features

  • 🚀 Framework-agnostic: Pure Web Components, works with any framework or vanilla JS
  • 📱 Touch-enabled: Built on Swiper.js for smooth touch interactions
  • 🎬 Multiple media types: Support for images, panoramas, videos, YouTube, 3D models, and Gaussian splats
  • 🔧 Zero dependencies: All dependencies are bundled (no Lit dependency)
  • 📦 Lightweight: Optimized bundle size with tree-shaking support
  • 🛠️ TypeScript: Full TypeScript support with type definitions

Installation

npm install @c4h/chuci

Usage

Basic Swiper

<cc-swiper>
  <cc-swiper-slide 
    thumbnail-url="thumb1.jpg" 
    image-url="full1.jpg" 
    image-type="image"
    caption="First image">
  </cc-swiper-slide>
  <cc-swiper-slide 
    thumbnail-url="thumb2.jpg" 
    image-url="full2.jpg" 
    image-type="image"
    caption="Second image">
  </cc-swiper-slide>
</cc-swiper>

<script type="module">
  import '@c4h/chuci'
</script>

Programmatic Usage

import '@c4h/chuci';

// Get swiper element
const swiper = document.querySelector('cc-swiper');

// Open viewer programmatically
swiper.openViewer('path/to/image.jpg', 'image', 0);

// Listen to slide changes
swiper.addEventListener('slidechange', (e) => {
  console.log('Current slide:', e.detail.activeIndex);
});

With Thumbnails Gallery

<cc-swiper has-thumb>
  <cc-swiper-slide thumbnail-url="..." image-url="..." image-type="image"></cc-swiper-slide>
  <cc-swiper-slide thumbnail-url="..." image-url="..." image-type="image"></cc-swiper-slide>
</cc-swiper>

Autoplay

<cc-swiper autoplay>
  <!-- slides -->
</cc-swiper>

Supported Media Types

  • image: Regular images (jpg, png, gif, etc.)
  • panorama: 360° panoramic images
  • youtube: YouTube videos (provide YouTube URL)
  • video: HTML5 videos (mp4, webm, etc.)
  • 3dmodel: 3D models (OBJ/MTL format)
  • gaussian: Gaussian splatting files (.splat, .ply)

Components

<cc-swiper>

Main carousel component.

Attributes:

  • has-thumb: Show thumbnail gallery
  • autoplay: Enable autoplay

Methods:

  • openViewer(imageUrl: string, imageType: string, slideIndex?: number): Programmatically open viewer

Events:

  • slidechange: Fired when slide changes

<cc-swiper-slide>

Individual slide component.

Attributes:

  • thumbnail-url: URL for thumbnail image
  • image-url: URL for full media
  • image-type: Media type (see supported types above)
  • caption: Optional caption text

Viewer Components

All viewer components inherit from CcViewerBase and support:

Methods:

  • open(url: string): Open viewer with media
  • close(): Close viewer

Properties:

  • showPrevButton: Show/hide previous button
  • showNextButton: Show/hide next button

Media-specific Examples

3D Model Viewer

<cc-swiper-slide 
  thumbnail-url="thumb.jpg"
  image-url="model.obj"
  image-type="3dmodel"
  material-url="model.mtl"
  debug-mode="true"
  camera-position="0,1,5"
  camera-target="0,0,0"
  show-texture="true">
</cc-swiper-slide>

Gaussian Splatting Viewer

<cc-swiper-slide
  thumbnail-url="thumb.jpg"
  image-url="scene.splat"
  image-type="gaussian"
  debug-mode="true"
  camera-position="0,0,10">
</cc-swiper-slide>

YouTube Video

<cc-swiper-slide
  thumbnail-url="thumb.jpg"
  image-url="https://www.youtube.com/watch?v=VIDEO_ID"
  image-type="youtube">
</cc-swiper-slide>

Styling

CSS Custom Properties:

cc-swiper {
  --cc-slider-theme-color: #007aff;
  --cc-slider-navigation-color: #007aff;
}

cc-viewer {
  --cc-viewer-z-index: 1000;
}

Browser Support

Works in all modern browsers that support Web Components:

  • Chrome/Edge 79+
  • Firefox 63+
  • Safari 12.1+

Development

# Install dependencies
pnpm install

# Start development server
pnpm run dev

# Run tests
pnpm test

# Build library
pnpm run build

License

MIT License - see LICENSE file for details.

Migration from Quyuan

If you're migrating from the original Quyuan implementation:

  1. Change imports from quyuan to @c4h/chuci
  2. Component names remain the same (cc-swiper, cc-swiper-slide, etc.)
  3. 3D model URLs no longer use pipe-separated format:
    <!-- Old -->
    <cc-swiper-slide image-url="model.obj|model.mtl" ...>
       
    <!-- New -->
    <cc-swiper-slide image-url="model.obj" material-url="model.mtl" ...>

Credits

Extracted from Quyuan by Code for History.