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

ec-lib-test

v1.4.7

Published

Vue 3 component library with TestCard and TestGPT components

Readme

ec-lib-test

Vue 3 component library with TestCard and TestGPT components.

Installation

npm install ec-lib-test

Peer Dependencies

Note: Peer dependencies are only required when using the library in Vue 3 projects. Web components (see below) bundle all dependencies and don't require peer dependencies.

When using in Vue 3 projects, this library requires the following peer dependencies:

  • vue ^3.0.0
  • pinia ^2.0.0 or ^3.0.0

Make sure to install them in your project:

npm install vue pinia

Usage

In Vue 3 Projects

Option 1: Install as Plugin (Global Registration)

import { createApp } from 'vue'
import { createPinia } from 'pinia'
import EcLibTest from 'ec-lib-test'
import 'ec-lib-test/dist/ec-lib-test.css'

const app = createApp(App)
app.use(createPinia()) // Required for TestGPT component
app.use(EcLibTest)
app.mount('#app')

Then use components in your templates:

<template>
  <div>
    <TestCard 
      title="My Card"
      description="Card description"
      action="Click Me"
      @action-click="handleClick"
    />
    
    <TestGPT 
      :secret-key="apiKey"
      model="gpt-4o-mini"
      :max-tokens="300"
    />
  </div>
</template>

Option 2: Import Individual Components

<script setup>
import { TestCard, TestGPT } from 'ec-lib-test'
import 'ec-lib-test/dist/ec-lib-test.css'
</script>

<template>
  <TestCard 
    title="My Card"
    description="Card description"
    @action-click="handleClick"
  />
  
  <TestGPT 
    :secret-key="apiKey"
    model="gpt-4o-mini"
  />
</template>

As Script Tag (HTML/JavaScript)

<!DOCTYPE html>
<html>
<head>
  <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
  <script src="https://unpkg.com/pinia@2/dist/pinia.iife.js"></script>
  <script src="https://unpkg.com/ec-lib-test/dist/ec-lib-test.umd.js"></script>
  <link rel="stylesheet" href="https://unpkg.com/ec-lib-test/dist/ec-lib-test.css">
</head>
<body>
  <div id="app">
    <test-card 
      title="My Card"
      description="Card description"
      action="Click Me"
    ></test-card>
    
    <test-gpt 
      :secret-key="apiKey"
      model="gpt-4o-mini"
    ></test-gpt>
  </div>

  <script>
    const { createApp } = Vue
    const { createPinia } = Pinia
    
    const app = createApp({
      data() {
        return {
          apiKey: 'your-api-key-here'
        }
      }
    })
    
    app.use(createPinia())
    app.use(EcLibTest)
    app.mount('#app')
  </script>
</body>
</html>

As Web Components (Vanilla HTML/JavaScript - Framework Agnostic)

The library also provides web components that can be used in any HTML page without requiring Vue or Pinia. This is perfect for vanilla JavaScript projects or when you want to use the components without a framework.

Note: Web components are built separately and include all dependencies bundled, so no additional setup is required.

<!DOCTYPE html>
<html>
<head>
  <script type="module">
    import { registerWebComponents } from 'https://unpkg.com/ec-lib-test@latest/dist/vue-expedite-lib-web-components.es.js';
    registerWebComponents();
  </script>
</head>
<body>
  <!-- TestCard component -->
  <vue-expedite-test-card 
    title="My Card Title" 
    description="This is a test card description"
    action="Click Me"
  ></vue-expedite-test-card>

  <!-- TestGPT component -->
  <vue-expedite-test-gpt 
    secret-key="your-api-key-here"
    model="gpt-3.5-turbo"
    max-tokens="300"
    placeholder="Enter your message..."
  ></vue-expedite-test-gpt>

  <script>
    // Listen to events from TestCard
    document.querySelector('vue-expedite-test-card').addEventListener('action-click', () => {
      console.log('Card action clicked!');
    });
  </script>
</body>
</html>

Important Notes for Web Components:

  • Props are passed as HTML attributes using kebab-case (e.g., secretKey becomes secret-key, maxTokens becomes max-tokens)
  • Events can be listened to using standard DOM event listeners
  • CSS is automatically injected into the shadow DOM, so no additional stylesheet link is needed
  • The web components are self-contained and include all dependencies (Vue, Pinia, etc.) bundled

Building Web Components:

The web components need to be built separately. You can build them using:

npm run build:web-components

Or build both the main library and web components:

npm run build:all

This will generate:

  • dist/vue-expedite-lib-web-components.es.js (ES module)
  • dist/vue-expedite-lib-web-components.umd.js (UMD module)
  • dist/style.css (Styles - automatically loaded by components)

Note: The web components files are only generated when you run the build command. Make sure to build them before publishing or using the web components.

Components

TestCard

A card component with title, description, and action button.

Props:

  • title (String, required): Card title
  • description (String, optional): Card description
  • action (String, optional): Action button text (default: "Action")

Events:

  • action-click: Emitted when action button is clicked

Example:

<TestCard 
  title="Welcome"
  description="This is a test card"
  action="Get Started"
  @action-click="handleClick"
/>

TestGPT

A GPT chat component that integrates with OpenAI API.

Props:

  • secretKey (String, optional): OpenAI API secret key
  • model (String, optional): GPT model to use (default: "gpt-3.5-turbo")
  • maxTokens (Number, optional): Maximum tokens for response (default: 300)
  • placeholder (String, optional): Input placeholder text (default: "Enter your message...")

Note: The secretKey can also be set via the Pinia store. See Store Usage below.

Example:

<TestGPT 
  :secret-key="apiKey"
  model="gpt-4o-mini"
  :max-tokens="500"
  placeholder="Ask me anything..."
/>

Store Usage

The library includes a Pinia store (useRootStore) that can be used to manage the GPT secret key globally:

import { useRootStore } from 'ec-lib-test'

const store = useRootStore()
store.setSecretKey('your-api-key-here')

// Use in component
const response = await store.getGptResponse(
  [{ role: 'user', content: 'Hello' }],
  'gpt-4o-mini',
  300
)

Development

# Install dependencies
npm install

# Run dev server
npm run dev

# Build library only
npm run build

# Build web components only
npm run build:web-components

# Build both library and web components
npm run build:all

License

MIT