3.8.6 • Published 8 months ago

@cds.id/splat-viewer v3.8.6

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

@cds.id/splat-viewer

A React component and Web Component for viewing Gaussian Splats using Three.js. Built on top of @mkkellogg/gaussian-splats-3d.

Features

  • 🎨 React Component and Web Component support
  • 🔄 Animation support
  • 📱 Responsive design
  • 🛠️ Built with React and TypeScript
  • 🎯 Lazy loading with Intersection Observer

Installation

npm install @cds.id/splat-viewer

Usage

As React Component

import { SplatViewer } from '@cds.id/splat-viewer';

function App() {
  return (
    <div style={{ width: '800px', height: '600px' }}>
      <SplatViewer src="https://example.com/your-splat.splat" isAnimate={true} />
    </div>
  );
}

As Web Component

First, register the web component:

import '@cds.id/splat-viewer/web-component';

Then use it in your HTML:

<div style="width: 800px; height: 600px;">
  <splat-viewer src="https://example.com/your-splat.splat" animate></splat-viewer>
</div>

Props/Attributes

React PropWeb Component AttributeTypeDefaultDescription
srcsrcstringrequiredURL to the splat file
isAnimateanimatebooleanfalseEnable animation
classNameclassstring''Additional CSS classes
thumbnailthumbnailstringundefinedLoading thumbnail URL

Container Sizing

The component will adapt to its container size. Always wrap it in a container with defined dimensions:

// React
<div style={{ width: '90vw', height: '400px' }}>
  <SplatViewer src="path/to/splat.splat" />
</div>

<!-- Web Component -->
<div style="width: 90vw; height: 400px;">
  <splat-viewer src="path/to/splat.splat"></splat-viewer>
</div>

Development

  1. Clone the repository:
git clone https://github.com/yourusername/splat-viewer.git
  1. Install dependencies:
npm install
  1. Start development server:
npm run dev
  1. Build for npm:
npm run build:lib

Testing Locally

Test the package locally before publishing:

# In the package directory
npm run build:lib
npm link

# In your test project
npm link @cds.id/splat-viewer

Scripts

  • npm run dev - Start development server
  • npm run build:lib - Build for npm
  • npm run clean - Clean build directory
  • npm run lint - Run ESLint
  • npm run format - Format code with Prettier

Dependencies

Core:

  • React
  • React DOM
  • @mkkellogg/gaussian-splats-3d

Browser Support

  • Chrome (latest)
  • Firefox (latest)
  • Safari (latest)
  • Edge (latest)

Known Issues

  • Type declarations might need manual refresh in some IDEs
  • Web Component requires modern browser support

License

MIT License

Credits

Built with @mkkellogg/gaussian-splats-3d

3.8.6

8 months ago

3.8.5

8 months ago

3.8.4

8 months ago

3.8.3

8 months ago

3.8.2

9 months ago

3.8.1

9 months ago

3.8.0

9 months ago

3.7.1

9 months ago

3.7.0

9 months ago

3.6.2

9 months ago

3.6.1

9 months ago

3.6.0

9 months ago

3.5.3

9 months ago

3.5.2

9 months ago

3.5.1

9 months ago

3.5.0

9 months ago

3.4.1

10 months ago

3.4.0

10 months ago

3.3.1

10 months ago

3.3.0

10 months ago

3.2.1

10 months ago

3.2.0

10 months ago

3.1.0

10 months ago

3.0.0

10 months ago

2.3.0

10 months ago

2.2.1

11 months ago

2.2.0

11 months ago

2.1.0

11 months ago