3.8.6 • Published 1 year ago
@cds.id/splat-viewer v3.8.6
@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-viewerUsage
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 Prop | Web Component Attribute | Type | Default | Description |
|---|---|---|---|---|
| src | src | string | required | URL to the splat file |
| isAnimate | animate | boolean | false | Enable animation |
| className | class | string | '' | Additional CSS classes |
| thumbnail | thumbnail | string | undefined | Loading 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
- Clone the repository:
git clone https://github.com/yourusername/splat-viewer.git- Install dependencies:
npm install- Start development server:
npm run dev- Build for npm:
npm run build:libTesting 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-viewerScripts
npm run dev- Start development servernpm run build:lib- Build for npmnpm run clean- Clean build directorynpm run lint- Run ESLintnpm 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
1 year ago
3.8.5
1 year ago
3.8.4
1 year ago
3.8.3
1 year ago
3.8.2
1 year ago
3.8.1
1 year ago
3.8.0
1 year ago
3.7.1
1 year ago
3.7.0
1 year ago
3.6.2
1 year ago
3.6.1
1 year ago
3.6.0
1 year ago
3.5.3
1 year ago
3.5.2
1 year ago
3.5.1
1 year ago
3.5.0
1 year ago
3.4.1
1 year ago
3.4.0
1 year ago
3.3.1
1 year ago
3.3.0
1 year ago
3.2.1
1 year ago
3.2.0
1 year ago
3.1.0
1 year ago
3.0.0
1 year ago
2.3.0
1 year ago
2.2.1
2 years ago
2.2.0
2 years ago
2.1.0
2 years ago