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

@trifle/trifle-hub

v1.0.119

Published

Vue component library for Trifle Hub

Readme

TrifleHub Documentation 👀

Installation

Install the TrifleHub plugin using npm or yarn:

# Using npm
npm install @trifle/trifle-hub

# Using yarn
yarn add @trifle/trifle-hub

This prevents your bundler from including peer dependencies in your build, reducing bundle size and avoiding version conflicts.

Configuration and Setup

Import and register the TrifleHub plugin in your Vue application:

import { createApp } from 'vue'
import App from './App.vue'
import { TrifleHubVuePlugin } from '@trifle/trifle-hub'

const app = createApp(App)

// Configure and install the TrifleHub plugin
app.use(TrifleHubVuePlugin, {
  // Required: ReOWN AppKit configuration
  reownConfig: {
    appId: 'your-app-id'
    // Other ReOWN AppKit configuration options
  },

  connectors: [],

  // Optional: Backend URL (defaults to 'https://bot-staging.trifle.life')
  backendUrl: 'https://bot-staging.trifle.life',

  // Optional: Set the default page to show when the hub is opened for the first time
  defaultPage: 'games' // or any valid page key (e.g., 'welcome', 'account', etc.)

  // Optional: For development use, you can hook into an existing Pinia instance
  devHookPiniaInstance: existingPiniaInstance
})

app.mount('#app')

About defaultPage:

  • The defaultPage option allows you to specify which page should be shown the first time a user opens the hub (if no page is set in the route or sessionStorage).
  • If not specified, it defaults to 'welcome'.
  • Valid values are any of the page keys defined in your hub (e.g., 'games', 'leaderboard', 'account', etc.).

Add the TrifleHub component to your app layout:

<template>
  <div id="app">
    <!-- Your app content -->
    <TrifleHub position="bottom-left" />
  </div>
</template>

<script setup>
// The component is registered globally
</script>

Available Provide/Inject Resources

The TrifleHub plugin provides several resources via Vue's provide/inject system:

| Injection Key | Type | Description | | -------------------------- | ------ | ------------------------------------------- | | 'TrifleHub/wagmiConfig' | Object | Wagmi configuration for wallet interactions | | 'TrifleHub/appKit' | Object | ReOWN AppKit instance | | 'TrifleHub/store' | Object | Authentication store (Pinia) | | 'trifleHubInternalPinia' | Object | Internal Pinia instance | | 'TrifleHub/defaultPage' | String | The default page key for the hub |

TrifleHub Component Resources

These are provided by the TrifleHub component when it's mounted:

| Injection Key | Type | Description | | ------------------------------------ | ------------------------- | -------------------------------------------------- | | 'hub' | Object | Hub controller with the following properties: | |   hubOpen | Ref | Reactive state for hub visibility | |   openHub(page?) | Function | Open the hub, optionally to a specific page | |   closeHub() | Function | Close the hub | | 'account' | Object | Account information with the following properties: | |   address | ComputedRef<string|null> | Current wallet address | |   chainId | ComputedRef<number|null> | Current chain ID | |   isConnected | ComputedRef | Whether wallet is connected | |   isConnecting | ComputedRef | Whether wallet is connecting | | 'accountModal' | Object | Wallet interaction methods: | |   disconnect() | Function | Disconnect the wallet | |   openAccountModal() | Function | Open the wallet connection modal | |   enforceConnection() | Function | Ensure wallet is connected | |   signDiscordId(message) | Function | Sign a message for Discord auth |

Page Navigation

TrifleHub provides a simple navigation system through the injected hub object. You can use this to open specific pages or close the hub.

Available Pages

The following pages are available for navigation:

  • welcome - Welcome page (not shown in menu)
  • games - Games page
  • leaderboard - Leaderboard page
  • earn - Earn page
  • account - Account page
  • theme - Theme settings (not shown in menu)

Navigating Between Pages

You can navigate between pages using the hub object:

// In a Vue component
import { inject } from 'vue'

export default {
  setup() {
    // Get the hub controller
    const hub = inject('hub')

    // Function to open a specific page
    const openAccountPage = () => {
      hub.openHub('account')
    }

    // Function to close the hub
    const closeHub = () => {
      hub.closeHub()
    }

    return { openAccountPage, closeHub }
  }
}

Auth Store Methods

The authentication store (inject('TrifleHub/store')) provides several methods for managing user authentication:

| Method | Description | | --------------------------------- | ------------------------------------------ | | connectDiscord() | Initiate Discord authentication | | connectWallet() | Connect to a wallet | | authenticateWithWallet(address) | Authenticate with a connected wallet | | disconnect() | Disconnect all authentication methods | | updateUsername(newUsername) | Update the user's username | | fetchUserStatus() | Get the latest user status from the server |

Example Usage

Here's a complete example of a component that interacts with TrifleHub:

<template>
  <div>
    <button @click="openAccountPage">Open Account</button>
    <button @click="openLeaderboard">Open Leaderboard</button>
    <button @click="closeHub">Close Hub</button>
  </div>
</template>

<script>
import { inject } from 'vue'

export default {
  setup() {
    const hub = inject('hub')

    const openAccountPage = () => {
      hub.openHub('account')
    }

    const openLeaderboard = () => {
      hub.openHub('leaderboard')
    }

    const closeHub = () => {
      hub.closeHub()
    }

    return {
      openAccountPage,
      openLeaderboard,
      closeHub
    }
  }
}
</script>