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-piano-roll

v1.2.13

Published

A DAW-like Piano Roll Vue Component.

Downloads

13

Readme

PianoRoll Vue Component

A flexible, highly customizable Piano Roll component for Vue.js. This component allows you to create a piano roll in your Vue application with ease.

Demo

Demo available here and demo source code, here.

Installation

yarn add vue-piano-roll

Usage

Import the component in your Vue application:

import { PianoRoll } from "vue-piano-roll";
import "vue-piano-roll/dist/style.css";

const notes = ref([]);

or

import { PianoRoll, PianoRollNote } from "vue-piano-roll";
import "vue-piano-roll/dist/style.css";

const notes = ref([] as PianoRollNote[]);

Then use the PianoRoll component in your template:

<piano-roll v-model="notes"></piano-roll>

The PianoRoll component requires a v-model binding to an array to function correctly and also supports a variety of optional props:

<piano-roll
  v-model="notes"
  :zoomX="0.5"
  :zoomY="1"
  :currentBeat="0"
  :currentTick="0"
  :ticksPerBeat="4"
  :rangeBottom="'C1'"
  :rangeTop="'G5'"
  :length="80"
  :defaultNoteLength="2"
  :noteHeight="1"
  :noteColor="'#f43f5f'"
  :loop="true"
  :onNoteEvent="handleNoteEvent"
></piano-roll>

Props

| Prop | Type | Default Value | Description | | --------------------- | --------------------- | ----------------------- | ---------------------------------------------------------------------------------------------------------- | | zoomX | Number | 0.5 | Defines the zoom level along the x-axis. | | zoomY | Number | 1 | Defines the zoom level along the y-axis. | | rangeBottom | OctaveNote | "C1" | The lowest note that the piano roll should display. | | rangeTop | OctaveNote | "G5" | The highest note that the piano roll should display. | | currentBeat | Number | -1 | The current beat. | | currentTick | Number | -- | The current tick within the beat. | | ticksPerBeat | Number | 2 | The number of ticks in a beat. | | defaultNoteLength | Number | 1 | The default number of beats in a note. | | noteHeight | Number | 2 | The apparent 3D height of the piano roll notes. | | modelValue | Array | -- | The array of notes for the piano roll. | | length | Number|"infinite" | 80 | The total length of the piano roll. (also supports the string "infinite") | | loop | Boolean | true | If true, the piano roll will loop back to the beginning when it reaches the end. | | noteColor | String | "#f43f5f" | The default color of the piano roll notes. | | backgroundColor | String | "rgb(76, 85, 99)" | The background color of the piano roll. | | incidentalColor | String | "rgb(55, 65, 81)" | The color of the incidentals (sharps and flats) in the piano roll. | | gridColor | String | "rgb(107, 114, 128)" | The color of the grid lines in the piano roll. | | labelColor | String | "rgb(255, 255, 255)" | The color of the note labels in the piano roll. | | labelIncidentalColor | String | "rgb(107, 114, 128)" | The color of the incidental note labels in the piano roll. | | labelBackgroundColor | String | "rgb(107, 114, 128)" | The background color of the note labels in the piano roll. | | labelBorderColor | String | "rgb(75, 85, 99)" | The border color of the note labels in the piano roll. | | borderWidth | Number | 1 | The width of the border around the piano roll. | | shadowColor | String | "rgba(255, 255, 255, 0.3)" | The color of the shadow cast by the notes in the piano roll. | | shadowMap | Array | [] | An array of ShadowMap objects, each defining how shadows appear for a specific note in the piano roll. | | onNoteEvent | Function | -- | A callback function with a NoteEvent argument that includes a list of notes that have started/ended. |

Events

The PianoRoll emits the following events:

| Event | Output Type | Description | | ------------------- | ----------- | --------------------------------------------------------- | | update:modelValue | Array | Emits the updated array of notes when notes are modified. |

Contributing

Contributions are welcome! If you have any issues or

feature requests, please submit an issue on Github.

License

This project is licensed under the MIT License - see the LICENSE.md file for details.