Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

slate-hotkeys

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

slate-hotkeys - npm Package Compare versions

Comparing version 0.2.6 to 0.2.7

12

dist/slate-hotkeys.js

@@ -168,3 +168,3 @@ (function (global, factory) {

if (length == 1 || !modifier) {
if (length === 1 || !modifier) {
if (byKey) {

@@ -180,8 +180,2 @@ ret.key = name;

}
// If there's only one key, and it's not a modifier, ignore the shift key
// because it will already be taken into accout by the `event.key` value.
if (length == 1 && !modifier && byKey) {
ret.shiftKey = null;
}
}

@@ -221,4 +215,4 @@ } catch (err) {

actual = event.key.toLowerCase();
} else if (key == 'which') {
actual = expected == 91 && event.which == 93 ? 91 : event.which;
} else if (key === 'which') {
actual = expected === 91 && event.which === 93 ? 91 : event.which;
} else {

@@ -225,0 +219,0 @@ actual = event[key];

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.SlateHotkeys={})}(this,function(e){"use strict";var t,r,o=(function(e,t){Object.defineProperty(t,"__esModule",{value:!0});for(var r={alt:"altKey",control:"ctrlKey",meta:"metaKey",shift:"shiftKey"},o={add:"+",break:"pause",cmd:"meta",command:"meta",ctl:"control",ctrl:"control",del:"delete",down:"arrowdown",esc:"escape",ins:"insert",left:"arrowleft",mod:"undefined"!=typeof window&&/Mac|iPod|iPhone|iPad/.test(window.navigator.platform)?"meta":"control",opt:"alt",option:"alt",return:"enter",right:"arrowright",space:" ",spacebar:" ",up:"arrowup",win:"meta",windows:"meta"},n={backspace:8,tab:9,enter:13,shift:16,control:17,alt:18,pause:19,capslock:20,escape:27," ":32,pageup:33,pagedown:34,end:35,home:36,arrowleft:37,arrowup:38,arrowright:39,arrowdown:40,insert:45,delete:46,meta:91,numlock:144,scrolllock:145,";":186,"=":187,",":188,"-":189,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,"'":222},a=1;a<20;a++)n["f"+a]=111+a;function i(e,t,r){!t||"byKey"in t||(r=t,t=null),Array.isArray(e)||(e=[e]);var o=e.map(function(e){return d(e,t)}),n=function(e){return o.some(function(t){return l(t,e)})};return null==r?n:n(r)}function d(e,t){var o=t&&t.byKey,n={},a=(e=e.replace("++","+add")).split("+"),i=a.length;for(var d in r)n[r[d]]=!1;var l=!0,s=!1,u=void 0;try{for(var y,p=a[Symbol.iterator]();!(l=(y=p.next()).done);l=!0){var w=y.value,m=w.endsWith("?");m&&(w=w.slice(0,-1));var v=f(w),h=r[v];1!=i&&h||(o?n.key=v:n.which=c(w)),h&&(n[h]=!m||null),1==i&&!h&&o&&(n.shiftKey=null)}}catch(e){s=!0,u=e}finally{try{!l&&p.return&&p.return()}finally{if(s)throw u}}return n}function l(e,t){for(var r in e){var o=e[r],n=void 0;if(null!=o&&((null!=(n="key"===r?t.key.toLowerCase():"which"==r?91==o&&93==t.which?91:t.which:t[r])||!1!==o)&&n!==o))return!1}return!0}function c(e){return e=f(e),n[e]||e.toUpperCase().charCodeAt(0)}function f(e){return e=e.toLowerCase(),e=o[e]||e}t.default=i,t.isHotkey=i,t.isCodeHotkey=function(e,t){return i(e,t)},t.isKeyHotkey=function(e,t){return i(e,{byKey:!0},t)},t.parseHotkey=d,t.compareHotkey=l,t.toKeyCode=c,t.toKeyName=f}(t={exports:{}},t.exports),t.exports);(r=o)&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")&&r.default;o.isHotkey,o.isCodeHotkey;var n=o.isKeyHotkey,a=(o.parseHotkey,o.compareHotkey,o.toKeyCode,o.toKeyName,"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e}),i="object"===("undefined"==typeof window?"undefined":a(window))&&"object"===("undefined"==typeof document?"undefined":a(document))&&9===document.nodeType,d=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],o=!0,n=!1,a=void 0;try{for(var i,d=e[Symbol.iterator]();!(o=(i=d.next()).done)&&(r.push(i.value),!t||r.length!==t);o=!0);}catch(e){n=!0,a=e}finally{try{!o&&d.return&&d.return()}finally{if(n)throw a}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();if(i){var l=!0,c=!1,f=void 0;try{for(var s,u=[["edge",/Edge\/([0-9\._]+)/],["chrome",/(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["firefox",/Firefox\/([0-9\.]+)(?:\s|$)/],["opera",/Opera\/([0-9\.]+)(?:\s|$)/],["opera",/OPR\/([0-9\.]+)(:?\s|$)$/],["ie",/Trident\/7\.0.*rv\:([0-9\.]+)\).*Gecko$/],["ie",/MSIE\s([0-9\.]+);.*Trident\/[4-7].0/],["ie",/MSIE\s(7\.0)/],["android",/Android\s([0-9\.]+)/],["safari",/Version\/([0-9\._]+).*Safari/]][Symbol.iterator]();!(l=(s=u.next()).done);l=!0){var y=d(s.value,2);y[0];if(y[1].test(window.navigator.userAgent))break}}catch(e){c=!0,f=e}finally{try{!l&&u.return&&u.return()}finally{if(c)throw f}}}var p=void 0;if(i){var w=!0,m=!1,v=void 0;try{for(var h,b=[["ios",/os ([\.\_\d]+) like mac os/i],["macos",/mac os x/i],["android",/android/i],["firefoxos",/mozilla\/[a-z\.\_\d]+ \((?:mobile)|(?:tablet)/i],["windows",/windows\s*(?:nt)?\s*([\.\_\d]+)/i]][Symbol.iterator]();!(w=(h=b.next()).done);w=!0){var k=d(h.value,2),g=k[0];if(k[1].test(window.navigator.userAgent)){p=g;break}}}catch(e){m=!0,v=e}finally{try{!w&&b.return&&b.return()}finally{if(m)throw v}}}var x=[["inputeventslevel1",function(e){return"inputType"in(e.InputEvent?new InputEvent("input"):{})}],["inputeventslevel2",function(e){var t=e.document.createElement("div");return t.contentEditable=!0,"onbeforeinput"in t}]],S=[];if(i){var K=!0,B=!1,C=void 0;try{for(var F,H=x[Symbol.iterator]();!(K=(F=H.next()).done);K=!0){var O=d(F.value,2),_=O[0];(0,O[1])(window)&&S.push(_)}}catch(e){B=!0,C=e}finally{try{!K&&H.return&&H.return()}finally{if(B)throw C}}}var j="ios"===p,E="macos"===p,W=(S.includes("inputeventslevel1"),S.includes("inputeventslevel2"),{bold:"mod+b",compose:["down","left","right","up","backspace","enter"],moveBackward:"left",moveForward:"right",moveWordBackward:"ctrl+left",moveWordForward:"ctrl+right",deleteBackward:"shift?+backspace",deleteForward:"shift?+delete",extendBackward:"shift+left",extendForward:"shift+right",italic:"mod+i",splitBlock:"shift?+enter",undo:"mod+z"}),A={moveLineBackward:"opt+up",moveLineForward:"opt+down",moveWordBackward:"opt+left",moveWordForward:"opt+right",deleteBackward:["ctrl+backspace","ctrl+h"],deleteForward:["ctrl+delete","ctrl+d"],deleteLineBackward:"cmd+shift?+backspace",deleteLineForward:["cmd+shift?+delete","ctrl+k"],deleteWordBackward:"opt+shift?+backspace",deleteWordForward:"opt+shift?+delete",extendLineBackward:"opt+shift+up",extendLineForward:"opt+shift+down",redo:"cmd+shift+z",transposeCharacter:"ctrl+t"},L={deleteWordBackward:"ctrl+shift?+backspace",deleteWordForward:"ctrl+shift?+delete",redo:"ctrl+y"},P={},M=j||E,$=!M;[].concat(Object.keys(W)).concat(Object.keys(A)).concat(Object.keys(L)).forEach(function(e){var t="is"+e[0].toUpperCase()+e.slice(1);if(!P[t]){var r=W[e],o=A[e],a=L[e],i=r&&n(r),d=o&&n(o),l=a&&n(a);P[t]=function(e){return!(!i||!i(e))||(!!(M&&d&&d(e))||!!($&&l&&l(e)))}}}),e.default=P,Object.defineProperty(e,"__esModule",{value:!0})});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.SlateHotkeys={})}(this,function(e){"use strict";var t,r,o=(function(e,t){Object.defineProperty(t,"__esModule",{value:!0});for(var r={alt:"altKey",control:"ctrlKey",meta:"metaKey",shift:"shiftKey"},o={add:"+",break:"pause",cmd:"meta",command:"meta",ctl:"control",ctrl:"control",del:"delete",down:"arrowdown",esc:"escape",ins:"insert",left:"arrowleft",mod:"undefined"!=typeof window&&/Mac|iPod|iPhone|iPad/.test(window.navigator.platform)?"meta":"control",opt:"alt",option:"alt",return:"enter",right:"arrowright",space:" ",spacebar:" ",up:"arrowup",win:"meta",windows:"meta"},n={backspace:8,tab:9,enter:13,shift:16,control:17,alt:18,pause:19,capslock:20,escape:27," ":32,pageup:33,pagedown:34,end:35,home:36,arrowleft:37,arrowup:38,arrowright:39,arrowdown:40,insert:45,delete:46,meta:91,numlock:144,scrolllock:145,";":186,"=":187,",":188,"-":189,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,"'":222},a=1;a<20;a++)n["f"+a]=111+a;function i(e,t,r){!t||"byKey"in t||(r=t,t=null),Array.isArray(e)||(e=[e]);var o=e.map(function(e){return d(e,t)}),n=function(e){return o.some(function(t){return c(t,e)})};return null==r?n:n(r)}function d(e,t){var o=t&&t.byKey,n={},a=(e=e.replace("++","+add")).split("+"),i=a.length;for(var d in r)n[r[d]]=!1;var c=!0,s=!1,u=void 0;try{for(var p,y=a[Symbol.iterator]();!(c=(p=y.next()).done);c=!0){var w=p.value,m=w.endsWith("?");m&&(w=w.slice(0,-1));var v=f(w),h=r[v];1!==i&&h||(o?n.key=v:n.which=l(w)),h&&(n[h]=!m||null)}}catch(e){s=!0,u=e}finally{try{!c&&y.return&&y.return()}finally{if(s)throw u}}return n}function c(e,t){for(var r in e){var o=e[r],n=void 0;if(null!=o&&((null!=(n="key"===r?t.key.toLowerCase():"which"===r?91===o&&93===t.which?91:t.which:t[r])||!1!==o)&&n!==o))return!1}return!0}function l(e){return e=f(e),n[e]||e.toUpperCase().charCodeAt(0)}function f(e){return e=e.toLowerCase(),e=o[e]||e}t.default=i,t.isHotkey=i,t.isCodeHotkey=function(e,t){return i(e,t)},t.isKeyHotkey=function(e,t){return i(e,{byKey:!0},t)},t.parseHotkey=d,t.compareHotkey=c,t.toKeyCode=l,t.toKeyName=f}(t={exports:{}},t.exports),t.exports);(r=o)&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")&&r.default;o.isHotkey,o.isCodeHotkey;var n=o.isKeyHotkey,a=(o.parseHotkey,o.compareHotkey,o.toKeyCode,o.toKeyName,"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e}),i="object"===("undefined"==typeof window?"undefined":a(window))&&"object"===("undefined"==typeof document?"undefined":a(document))&&9===document.nodeType,d=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],o=!0,n=!1,a=void 0;try{for(var i,d=e[Symbol.iterator]();!(o=(i=d.next()).done)&&(r.push(i.value),!t||r.length!==t);o=!0);}catch(e){n=!0,a=e}finally{try{!o&&d.return&&d.return()}finally{if(n)throw a}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();if(i){var c=!0,l=!1,f=void 0;try{for(var s,u=[["edge",/Edge\/([0-9\._]+)/],["chrome",/(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["firefox",/Firefox\/([0-9\.]+)(?:\s|$)/],["opera",/Opera\/([0-9\.]+)(?:\s|$)/],["opera",/OPR\/([0-9\.]+)(:?\s|$)$/],["ie",/Trident\/7\.0.*rv\:([0-9\.]+)\).*Gecko$/],["ie",/MSIE\s([0-9\.]+);.*Trident\/[4-7].0/],["ie",/MSIE\s(7\.0)/],["android",/Android\s([0-9\.]+)/],["safari",/Version\/([0-9\._]+).*Safari/]][Symbol.iterator]();!(c=(s=u.next()).done);c=!0){var p=d(s.value,2);p[0];if(p[1].test(window.navigator.userAgent))break}}catch(e){l=!0,f=e}finally{try{!c&&u.return&&u.return()}finally{if(l)throw f}}}var y=void 0;if(i){var w=!0,m=!1,v=void 0;try{for(var h,b=[["ios",/os ([\.\_\d]+) like mac os/i],["macos",/mac os x/i],["android",/android/i],["firefoxos",/mozilla\/[a-z\.\_\d]+ \((?:mobile)|(?:tablet)/i],["windows",/windows\s*(?:nt)?\s*([\.\_\d]+)/i]][Symbol.iterator]();!(w=(h=b.next()).done);w=!0){var k=d(h.value,2),g=k[0];if(k[1].test(window.navigator.userAgent)){y=g;break}}}catch(e){m=!0,v=e}finally{try{!w&&b.return&&b.return()}finally{if(m)throw v}}}var x=[["inputeventslevel1",function(e){return"inputType"in(e.InputEvent?new InputEvent("input"):{})}],["inputeventslevel2",function(e){var t=e.document.createElement("div");return t.contentEditable=!0,"onbeforeinput"in t}]],S=[];if(i){var K=!0,B=!1,C=void 0;try{for(var F,H=x[Symbol.iterator]();!(K=(F=H.next()).done);K=!0){var O=d(F.value,2),_=O[0];(0,O[1])(window)&&S.push(_)}}catch(e){B=!0,C=e}finally{try{!K&&H.return&&H.return()}finally{if(B)throw C}}}var j="ios"===y,E="macos"===y,W=(S.includes("inputeventslevel1"),S.includes("inputeventslevel2"),{bold:"mod+b",compose:["down","left","right","up","backspace","enter"],moveBackward:"left",moveForward:"right",moveWordBackward:"ctrl+left",moveWordForward:"ctrl+right",deleteBackward:"shift?+backspace",deleteForward:"shift?+delete",extendBackward:"shift+left",extendForward:"shift+right",italic:"mod+i",splitBlock:"shift?+enter",undo:"mod+z"}),A={moveLineBackward:"opt+up",moveLineForward:"opt+down",moveWordBackward:"opt+left",moveWordForward:"opt+right",deleteBackward:["ctrl+backspace","ctrl+h"],deleteForward:["ctrl+delete","ctrl+d"],deleteLineBackward:"cmd+shift?+backspace",deleteLineForward:["cmd+shift?+delete","ctrl+k"],deleteWordBackward:"opt+shift?+backspace",deleteWordForward:"opt+shift?+delete",extendLineBackward:"opt+shift+up",extendLineForward:"opt+shift+down",redo:"cmd+shift+z",transposeCharacter:"ctrl+t"},L={deleteWordBackward:"ctrl+shift?+backspace",deleteWordForward:"ctrl+shift?+delete",redo:"ctrl+y"},P={},M=j||E,$=!M;[].concat(Object.keys(W)).concat(Object.keys(A)).concat(Object.keys(L)).forEach(function(e){var t="is"+e[0].toUpperCase()+e.slice(1);if(!P[t]){var r=W[e],o=A[e],a=L[e],i=r&&n(r),d=o&&n(o),c=a&&n(a);P[t]=function(e){return!(!i||!i(e))||(!!(M&&d&&d(e))||!!($&&c&&c(e)))}}}),e.default=P,Object.defineProperty(e,"__esModule",{value:!0})});
{
"name": "slate-hotkeys",
"description": "A set of function to detect common keypresses in a platform-agnostic way",
"version": "0.2.6",
"version": "0.2.7",
"license": "MIT",

@@ -16,3 +16,3 @@ "repository": "git://github.com/ianstormtaylor/slate.git",

"dependencies": {
"is-hotkey": "^0.1.3",
"is-hotkey": "0.1.4",
"slate-dev-environment": "^0.2.0"

@@ -19,0 +19,0 @@ },

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc