
Product
Introducing Tier 1 Reachability: Precision CVE Triage for Enterprise Teams
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
vs-virtual-keyboard
Advanced tools
A **9kb virtual keyboard lib**(with Gzip) written in Typescript to run on top of modern browsers.
A 9kb virtual keyboard lib(with Gzip) written in Typescript to run on top of modern browsers.
You can import the keyboard init function installing as npm package:
npm install vs-virtual-keyboard --save
Or using html <script>
tag with vs-virtual-keyboard.es5 in the src property.
This file can be found on dist directory.
<script src="vs-virtual-keyboard.es5.js"></script>
If you want to use the default querty layout, you need to import the vs-default-keyboard.js
file. It is on layouts directory.
import vsDefaultKeyboard from 'vs-default-keyboard';
A vs-virtual-keyboard.css
file can be found on dist directory. This file contains the
keyboard default responsive layout.
There is an example file on /dist/example.html
.
Basically, all you need to do is invoke the keyboard function. After that, all the inputs focus in will toggle up the keyboard and all the focus out will toggle down the keyboard.
VsVirtualKeyboard({
// Keyboard wrapper class for custom css
wrpClass: 'vs-virtual-keyboard-wrp',
// Keyboard toggle on focus inputs types...
availableInTypes: ['text', 'email'],
// Keyboard layout, vs-default-keyboard.js exports a default querty
layouts: vsDefaultKeyboard,
// !! OPTIONAL !! Action interceptor
interceptor(keyboardState) {
// Auto capitalization
if (((keyboardState.input || {}).value || '').length === 1 &&
keyboardState.layoutName === 'uppercase-querty') {
if (keyboardState.input.dataset.capitalized) {
return keyboardState;
}
keyboardState.layoutName = 'lowercase-querty';
keyboardState.input.dataset.capitalized = '1';
}
return keyboardState;
},
// !! OPTIONAL !! LISTENERS, receives current value and must returns new value
// onChange, onKeyUp, onKeyDown
});
// Numeric
VsVirtualKeyboard({ availableInTypes: ['number'], layouts: vsNumericKeyboard });
The layouts
parameter of keyboard function receives on object with defaultLayout
prop.
It is a string name of the default layout.
The other prop name is layouts
and receives an
array of objects. Each on of these objects haves one name and one array of rows as below.
/**
* NUMERIC
* Numeric keyboard config
*/
const numericKb = [
[...'789'],
[...'456'],
[...'123'],
[
...'.,',
/**
* Backspace is a special key
*/
(() => {
return {
symbol: 'backspace',
action(value) {
value = value+'';
value = value.substr(0, value.length - 1);
return value;
}
}
})()
]
];
/**
* Exports keyboard
*/
export default {
defaultLayout: 'numeric',
layouts: [ { name: 'numeric', rows: numericKb } ]
};
The rows array items can be one string or one object. Being on string means one simple key with string symbol typing the same one.
If it is an object, a symbol can be defined on symbol
property. An image can be defined
on base64Icon
prop. Its optional.
If the property action
is defined, this action will be a function receiving the current
value and returning the new value when the key is typed. Its optional.
Adding a string on layoutShift
property, the key will shift the keyboard layout when
typed. The string layout name needs to be there. Its optional.
The property variations
is another optional one. It is an array of keys (string or object)
that contains variations of the current key (like latin accents). Its optional.
FAQs
A **9kb virtual keyboard lib**(with Gzip) written in Typescript to run on top of modern browsers.
We found that vs-virtual-keyboard demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
Research
/Security News
Ongoing npm supply chain attack spreads to DuckDB: multiple packages compromised with the same wallet-drainer malware.
Security News
The MCP Steering Committee has launched the official MCP Registry in preview, a central hub for discovering and publishing MCP servers.