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

trillion-widget

v0.40.5

Published

Trillion AR Widget

Downloads

1,310

Readme

Trillion AR Widget

This is Trillion AR Widget that allow you to integrate Trillion SDK in your site. For more information please visit https://trillion.jewelry

Installing

Using npm:

npm install trillion-widget

Using yarn:

yarn add trillion-widget

How to use:

First of all get your API key from https://dashboard.trillion.jewelry/integration

Then you need to create an empty div element for widget initialization. For example:

 <div id="trillion-widget"></div>

Then, in your js code (don't forget to set your API key):

import {TrillionWidgetApp} from "trillion-widget"

const elem = document.getElementById('trillion-widget')
const trillionWidget = new TrillionWidgetApp()
trillionWidget.init(elem)
trillionWidget.setServiceActivationKey("YOUR_API_KEY_HERE")
trillionWidget.setJewelryID('demo-pendant-ar')
trillionWidget.setJewelryType('necklace')
trillionWidget.refresh()

For typescript:

const elem = document.getElementById('trillion-widget') as HTMLElement

Instance methods

  • trillionWidget#init() - Create widget on the provided HTML element
  • trillionWidget#setServiceActivationKey(KEY) - Set API key for app
  • trillionWidget#refresh() - reload widget after changing parameters
  • trillionWidget#setWidgetMode(mode) - Set widget mode (basic, ring_carousel, two_hands)
  • trillionWidget#getWidgetMode(mode) - Get current widget mode
  • trillionWidget#setJewelryID(sku) - Set the id(SKU) of the jewelry to load
  • trillionWidget#getJewelryID() - Get the id(SKU) of the uploaded jewelry
  • trillionWidget#setCarousel(sku[]) - Set a group of jewelry. If set, the widget shows selector with all elements of the group and ignores jewelry from setJewelryID By default, widget will load first element of the group
  • trillionWidget#getCarousel() - Get a group of jewelry
  • trillionWidget#setJewelryType(type) - Set the jewelry type (earrings, ring, necklace) to load. Deprecated, type will be detected automatically
  • trillionWidget#getJewelryType() - Get the uploaded jewelry type. Deprecated, type will be detected automatically
  • trillionWidget#setUsePerformanceCheck(use) - use performance check
  • trillionWidget#getUsePerformanceCheck() - get performance check
  • trillionWidget#setLanguage(language) - set language. Available languages: 'en', 'kr', 'ru'
  • trillionWidget#getLanguage() - get language
  • trillionWidget#useExternalUi() - Hide native UI
  • trillionWidget#getScreenshot() - Get screenshot

Ring carousel

Setting up the carousel mode:

trillionWidget.setWidgetMode("ring_carousel") // Enables carousel mode
trillionWidget.setCarousel(["ring-sku-1", "ring-sku-2", "..."]) // Sets the SKUs of rings used

Custom

If you want to control switching between carousel items yourself, you can hide the native UI and manually update the currently selected carousel item. For example:

trillionWidget.useExternalUi(true)
trillionWidget.refresh()

customButton1.addEventListener('click', () => {
  trillionWidget.updateCarouselItem('ring-sku-1')
})
customButton2.addEventListener('click', () => {
  trillionWidget.updateCarouselItem('ring-sku-2')
})

Using CDN to get Trillion Widget

use this pattern: unpkg.com/:package@:version/:file

For example:

import {TrillionWidgetApp} from "https://sdk.trillion.jewelry/widget/latest/trillion-widget.js"

React component

This library also provides the React component for widget.

How to use

import component:

import { TrillionWidget, JewelryTypeName } from "trillion-widget";

use somewhere in your React application:

function MyComponent() {
  return (
    <div className="MyComponent">
        <TrillionWidget jewelryId={'demo-earrings'} jewelryType={JewelryTypeName.Earrings}/>
    </div>
  )
}