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

@momsfriendlydevco/vitel

v1.14.1

Published

Various, pickable Vue@3 / Vite modules and components

Downloads

368

Readme

@MomsFriendlyDevCo/Vitel

Various, pickable Vue@3 / Vite modules and components.

A collection of useful Components, Directives, Filters and Services

Documentation & Demo

Glossary & Terms used

This NPM module, commit history and various other documentation surrounding it uses shorthand notation to refer to different types of export:

  • Components are referred to as a DOM like element - e.g. <widget/>
  • Directives are always single strings with a v- prefix - e.g. v-href
  • Filters are prefixed with | indicating its a pipable function - e.g. |currency
  • Services are prefixed with $ indicating that its a globally available entity - e.g. $toast

Components

Naming convention: <my-component/> Each component is a standard Vue3 SFC file with a <script/>, <template> and optional <style/> block.

Components can be imported from the @momsfriendlydevco/vitel/component/* path.

Example:

// Vue App creation preamble
import {createApp} from 'vue'
import App from './App.vue';
let app = createApp(App);

import Date from '@momsfriendlydevco/vitel/component/date';
app.component('Date', Date);

Directives

Naming convention: v-my-directive Directives are elements which can be applied in multiple to the same Vue component or DOM element.

Components can be imported from the @momsfriendlydevco/vitel/directives/* path.

Example:

// Vue App creation preamble
import {createApp} from 'vue'
import App from './App.vue';
let app = createApp(App);

import vHref from '@momsfriendlydevco/vitel/directives/v-href';
app.directive('href', vHref);

Filters

Naming convention: |myFilter Filters are pure JavaScript functions called with a single data input + options object.

Filters can be imported from the @momsfriendlydevco/vitel/filters/* path.

Example:

// Vue App creation preamble
import {createApp} from 'vue'
import App from './App.vue';
let app = createApp(App);

// Install Vitel against our app to provide `app.filter`
import Vitel from '@momsfriendlydevco/vitel';
app.use(Vitel);

// Import a filter
import List from '@momsfriendlydevco/vitel/filters/list';
app.filter('List', List);

// Use within vanilla JavaScript:
console.log( List(['Foo', 'Bar', 'Baz']) );

// Or within a Vue Component:
this.$filters.list(['Foo', 'Bar', 'Baz']);
// or within a Vue Template:
{{$filters.list(['Foo', 'Bar', 'Baz'])}}
{{$filters.pipe(['Foo', 'Bar', 'Baz'], 'list')}}

Services

Naming convention: $myService Services are very similar to standard Vue Components except that:

  • Services need loading with app.service(NAME, SPEC, OPTIONS) or wrapping in the @momsfriendlydevco/vitel/service function
  • Services are "headless" - they do not have any template or render function
  • They are singleton instances - only one of each service exists within your app at any time (by default anyway)
  • They are setup against every component automatically as $serviceName
  • If a service requires an async created() lifecycle sequence, ready (a boolean) and promise() (a function which returns when the created process has completed) are also automatically provided
  • A debug(...msg) method is injected automatically into all services, when initalizing with debug: true this will be activated to output information to the console otherwise it will be a no-op function
  • The debug() method can also accept a function which will only run if debugging is enabled - this is useful to prevent any debug specific formatting that wouldn't run in production. Any output returned by the inner function would be output as if it were called with vm.debug() directly

Services can be imported from the @momsfriendlydevco/vitel/services/* path.

Example using the Vitel extender (recommended)

// Vue App creation preamble
import {createApp} from 'vue'
import App from './App.vue';
let app = createApp(App);

// Install Vitel against our app to provide `app.service`
import Vitel from '@momsfriendlydevco/vitel';
app.use(Vitel);

// Import the $toast service
import Toast from '@momsfriendlydevco/vitel/services/toast';
app.service('$toast', Toast, {
    // options, if any
});

Example using the Service Wrapper

// Vue App creation preamble
import {createApp} from 'vue'
import App from './App.vue';
let app = createApp(App);

// Import the $toast service + pass it our app so it can install itself
import Service from '@momsfriendlydevco/vitel/services/service';
import Toast from '@momsfriendlydevco/vitel/services/toast';
Service(Toast, {app}); // Toast now available in all components as `vm.$toast`

Utils

Various utility JavaScript files. These are generally used by other components but are exposed as imports if needed.