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

@universal-interface/components

v1.0.17

Published

Universal Interface Components for Vue.js

Downloads

84

Readme

Universal Interface Components

A collection of Vue.js components for building admin interfaces and dashboards.

Installation

npm install @universal-interface/components

Usage

As a Plugin

import Vue from 'vue'
import ElementPlus from 'element-plus'
import UniversalInterface from '@universal-interface/components'

// Element Plus is required for these components
Vue.use(ElementPlus)
Vue.use(UniversalInterface)

Individual Components

import { Account, Order, Product } from '@universal-interface/components'

export default {
  components: {
    Account,
    Order,
    Product
  }
}

Components

View Components

  • Account - Account management interface
  • Order - Order management interface
  • Product - Product management interface
  • Market - Product market display
  • Template - Template management interface
  • Canvas - Canvas editor component
  • CanvasViewer - Canvas viewer component
  • Detail - Template detail view
  • Dashboard - Dashboard overview
  • Login - Login form
  • Users - User management interface
  • Roles - Role management interface
  • Consts - Constants configuration interface
  • StatusExample - Status constants usage example
  • AppView - Main application view

Layout Components

  • Layout - Main layout container with sidebar and header
  • Sidebar - Navigation sidebar with menu items
  • Breadcrumb - Breadcrumb navigation with user dropdown

Event Handling

Most components emit events for handling user interactions:

  • success - When an operation completes successfully
  • error - When an error occurs
  • confirm - When user confirmation is required
  • warning - When a warning should be displayed
  • info - When informational messages should be displayed

Example:

<template>
  <Account 
    @success="handleSuccess"
    @error="handleError"
    @confirm="handleConfirm"
  />
</template>

<script>
import { Account } from '@universal-interface/components'

export default {
  components: { Account },
  methods: {
    handleSuccess(message) {
      this.$message.success(message)
    },
    handleError(message) {
      this.$message.error(message)
    },
    handleConfirm(config) {
      this.$confirm(config.message, config.title, {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        if (config.onConfirm) config.onConfirm()
      }).catch(() => {
        if (config.onCancel) config.onCancel()
      })
    }
  }
}
</script>

API Integration

Components accept API implementations as props, allowing you to customize data fetching:

<template>
  <Account :account-api="customAccountApi" />
</template>

<script>
import { Account } from '@universal-interface/components'

export default {
  components: { Account },
  data() {
    return {
      customAccountApi: {
        list: (params) => {
          // Your custom implementation
          return Promise.resolve({ code: 200, data: { list: [], total: 0 } })
        },
        update: (data) => {
          // Your custom implementation
          return Promise.resolve({ code: 200, message: 'Success' })
        }
        // ... other methods
      }
    }
  }
}
</script>

Layout Components Usage

Layout components can be used to create a complete admin interface:

<template>
  <Layout>
    <router-view />
  </Layout>
</template>

<script>
import { Layout } from '@universal-interface/components'

export default {
  components: { Layout }
}
</script>

The layout components accept props for customization:

<template>
  <Layout :sidebar-collapsed="sidebarCollapsed">
    <Sidebar 
      :routes="routes"
      :current-path="currentPath"
      :collapsed="sidebarCollapsed"
      @toggle-collapse="handleToggleCollapse"
      @menu-select="handleMenuSelect"
    />
    <Breadcrumb 
      :user-info="userInfo"
      :matched-routes="matchedRoutes"
      @logout="handleLogout"
      @profile="handleProfile"
    />
  </Layout>
</template>

Building and Publishing to npm

Prerequisites

Before building and publishing, ensure you have:

  1. An npm account (create one at https://www.npmjs.com/signup if you don't have one)
  2. Logged in to npm registry locally:
    npm login

Building the Package

To build the package for distribution:

npm run build

This will:

  • Compile all Vue components
  • Generate three output formats:
    • ES Module (index.esm.js)
    • CommonJS (index.js)
    • UMD (index.min.js)
  • Extract and bundle CSS styles
  • Generate source maps for debugging

The built files will be located in the dist/ directory.

Publishing to npm

  1. Update the version in package.json:

    npm version patch  # for bug fixes
    npm version minor  # for new features
    npm version major  # for breaking changes

    Or manually update the version field in package.json.

  2. Publish the package:

    npm publish

    For scoped packages (like @universal-interface/components), make sure to set the access level:

    npm publish --access public

Publishing to a Private Registry

If you want to publish to a private npm registry:

  1. Set the registry URL:

    npm config set registry https://your-private-registry.com/
  2. Publish as usual:

    npm publish

Testing Before Publishing

To test the package locally before publishing:

  1. Link the package:

    npm link
  2. In another project, link to this package:

    npm link @universal-interface/components
  3. Test the components in your project.

  4. When finished testing, unlink:

    npm unlink @universal-interface/components

Dependencies

This package depends on the following libraries:

  • vue ^2.6.14
  • element-plus ^2.4.0
  • vue-cookies ^1.7.4
  • vue-json-viewer ^2.2.22
  • vuedraggable ^2.24.3

Make sure to install these dependencies in your project:

npm install vue element-plus vue-cookies vue-json-viewer vuedraggable

Development

To run the example:

npm run example

To build the package:

npm run build

License

MIT