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

vue-custom-console

v1.0.4

Published

custom console system for Vue based on console.js

Downloads

19

Readme

Vue Custom Console npm version

Vue command console component can executes user's custom commands and display the result.

It's based on console.js v.1.2.2, and console.js dev tells that is for game console.

Features

  • console.js v1.2.2 features.
  • hotKeyDisable
  • elementShown vs systemShow mode

Usage

Import And Register this plugin in your app:

<script>
import console from 'vue-custom-console'
Vue.use(console)

new Vue("some options");
</script>

use <v-custom-console> inside template:

<template>
    ......
  <v-custom-console />
    ......
</template>

Options

videoGameConsole

Make Console Like Video Game Console. You can press hotKey ~ to show console.

Default value is false.

When no props value or videoGameConsole = false :

When props value set true :

<template>
    ......
<v-custom-console 
  :videoGameConsole="true"
  :hotKeyDisable="false"
/>
    ......
</template>

You should use this options with :hotKeyDisable="false"

hotKeyDisable

Default hotKey feature is disabled. but when you set videoGameConsole to true, you should enabled hotKey features like below:

<template>
    ......
  <v-custom-console 
    :hotKeyDisable="true"
  />
    ......
</template>

settings

Override default console.js's settings.

  1. Define custom options
<script>
export default{
    data(){
        return {
            overSettings : {
              commands: {
                support () {
                  // Do stuff here to initially setup your command
                  return {
                    // Guide is what shows up in the help system
                    guide: 'Contact a client speciailist',
                    // command is what gets executed when they type the command
                    command () {
                      // return is what is finally sent back to the console as output
                      return 'Contacting a client solutions specialist, hold on...'
                    }
                  }
                },
                reboot () {
                  return {
                    guide: 'Restarts the program',
                    command () {
                      setTimeout(function () { location.reload() }, 1000)
                      return '<span style="color: red">Rebooting...</span>'
                    }
                  }
                }
              }
            }
        }
    }
}

</script>
  1. Pass it to settings props:
<tempalte>
    <v-custom-console :settings="this.overSettings"/>
</tempalte>

below is props overridable and it's default value:

    cmd: '', // The current console command
    logs: [], // The log stack
    history: [],
    historySelector: 0,
    commands: {},
    isShown: false,
    consolePos: 0,
    hotkey: 192 // default 192 `~'
    onShow: null,
    onHide: null,
    onEnter: null,
    onToggle: null,
    placeholder: 'Command?',
    helpCmd: 'guide',
    defaultHandler: null,
    caseSensitive: false,
    historySize: 256,
    welcome: `You can replace this welcome message by using &lt;v-console :settings="yourSettings" /><br>
    Add commands to the console by simply adding a commands: {} to your components!<br/>
    Check the github repo for structure. Any component can mixin as many commands as you need!<br/>
    press up or down for history!<br/>`