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

virtualkeyboard-vr-ready

v1.0.1

Published

A virtual keyboard heavily inspired by Google's Gboard. Build with WebXR/VR in mind.

Downloads

28

Readme

npm version Follow me on Twitter:Eriks Twitter

VirtualKeyboard-VR-Ready

A virtual keyboard heavily inspired by Google's Gboard. Build with WebXR/VR in mind. Multi-language and Swipe & Suggestion support.

Examples:

NPM Install

npm install virtualkeyboard-vr-ready

Usage

import * as VRKeyboard from 'virtualkeyboard-vr-ready'
// optionally you could grab the vrkeyboard.umd.js (build folder) and attach it to your HTML and access the VRKeyboard with window.VRKeyboard.

Documentation

Methods

init(config);

Example configuration (all fields are optional):

var config = {
	resolution:1.0,
	aspect: 1/0.8,
	margin:5,
	fontSize:16,
	buttonHeight: 40,
	buttonRadius: 5,
	language:'en', // the default language
	languages:['en', 'fr', 'es', 'ru'],
	font:'sans-serif',
	align: 'center', // center or bottom
	colors:{
		idle:"#3f4a52",
		hover:"#2d343a",
		down:"#5cb0a7",
		text:"#ffffff",
	},
	keyShadow:{
		shadowColor:"rgba(0, 0, 0, .3)",
		shadowBlur:1,
		shadowOffsetX:1,
		shadowOffsetY:1,
	},
	popupShadow:{
		shadowColor:"rgba(0, 0, 0, .3)",
		shadowBlur:4,
		shadowOffsetX:0,
		shadowOffsetY:2,
	},
	holdPopupTime:300,
	bkspIntervalTime:50,
	shiftDoubleTapTimeout:300,

	// swipe settings
	swipe:true, // defaults to true
	swipeMinimumAngleDifference:Math.PI/4, // 30 degree
	swipeMinimumDistance:20,
	swipeDrawingLifeTime:500,
	swipeDrawingSize:6,
	swipeLoadingFontSize:12,
	suggestionCrawlStep:100, // how many words the application processes per tick (higher == lower performance)
}

getCanvas()

Returns the draw canvas

selectLanguage(language)

language:string

Selects the keyboard language, available options: 'en', 'ru'

setLayout(name)

name:string

Selects the keyboard layout, available options: 'num', 'nump', 'sym'

setMouseDown(down, [x], [y])

down: boolean

[optional] x: number

[optional] y: number

Sets the mouse down state, and optionally also sets the position

setMousePosFromUV(x, y)

x: number between 0 - 1

y: number between 0 - 1

Sets the mouse position based on a UV

setScreenSizeInPixels(width, height, devicePixelRatio)

width: number

height: number

devicePixelRatio: number

Sets the width and height of the render canvas + the resolution based on the devicePixelRatio

  • if the provided height is smaller then the minimum height required the minimum height will be set

setScreenSizeFromAspectRatio()

Sets the size from the aspect property provided in the init() function. The setScreenSizeFromAspectRatio() is automatically called on init.

getTextureDirty()

TextureDirty will be set to true when the image has changed. You need to set textureDirty to false yourself when you update your texture.

setTextureDirty(dirty)

dirty: boolean Sets the textureDirty property on the VRKeyboard.

addListeners()

Adds mouse / touch listeners to the canvas. Only works if the canvas is displayed in the dom. (will not work for ThreeJS)

resetSuggestionInput()

Resets the suggestion state, useful when switching between text elements and wanting to clear the old state