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

viewer-3d-lit

v0.0.34

Published

Viewer 3d is a simple 3d viewer for 3d models. It is based on three.js and is written in typescript. Use to load and view 3d models in the browser.

Downloads

12

Readme

VIEWER-3D

Viewer 3d is a simple 3d viewer for 3d models. It is based on three.js and is written in typescript. Use to load and view 3d models in the browser.

Installing

npm i viewer-3d-lit

Import

Importing in HTML

<script type="module">
  import './node_modules/viewer-3d-lit/dist/viewer-3d-lit.js'
</script>
<!-- or -->
<script type="module" src="../dist/viewer-3d-lit.js"></script>

Importing in React

import { Viewer3dReact } from '../../dist/viewer-3d-lit'

Use

Using in HTML

<viewer-3d
  object="models/obj/PignaOC.obj"
  texture="models/textures/PignaOC.png"
  background="models/textures/studio_small_09_4k.hdr"
>
  not showing (coming soon)
</viewer-3d>

Using in ReactJS

const App = () => (
  <div>
    <Viewer3dReact
      object='models/obj/PignaOC.obj' // local dir or http endpoint
      texture='models/textures/PignaOC.png' // local dir or http endpoint
      background='models/textures/studio_small_09_4k.hdr' // local dir or http endpoint
    />
  </div>
)

Simple model: https://people.sc.fsu.edu/~jburkardt/data/obj/obj.html Simple background: https://polyhaven.com/ https://www.hdri-hub.com/hdrishop/freesamples/

to use http approach in localhost and have CORS error launch chrome in disable-web-security mode open -na Google\ Chrome --args --user-data-dir=/tmp/temporary-chrome-profile-dir --disable-web-security --disable-site-isolation-trials

{properties}:

  object: "string",     // .obj | .fbx | .json  file
  texture: "string",    // .png                 file
  background: "string"  // .hdr                 file
  • object property is required.
    • type string is the path that contains the model, the type of model is generated from extension. You can set the path from cdn or locally. Supported type:
  • texture property is optional - if you don't specify the texture is generated.
    • type string is the path that contains the model, the type of model is generated from extension. You can set the path from cdn or locally. Supported type:
      • type THREE.Texture directly pass the model to the component.( ** )
  • background property is optional - if you don't specify set the default backgrou
    • type string is the path that contains the model, the type of model is generated from extension. You can set the path from cdn or locally. Supported type:

( * ) --> THREE.ObjectLoader

( ** ) --> THREE.TextureLoader

( *** ) --> THREE.DataTextureLoader

Override Style

  • --viewer-3d-primary --> primary color

  • --viewer-3d-secondary --> secondary color

<style>
  viewer-3d {
    --viewer-3d-primary: lightgreen;
    --viewer-3d-secondary: red;
  }
</style>

Custom Event

If is in the

  • viewer-click (event sample)
<script>
  const el = document.querySelector('viewer-3d')
  el.addEventListener('viewer-click', () => {
    console.log('viewer-click')
  })
</script>