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

@convertkit/slate-code

Package Overview
Dependencies
Maintainers
3
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@convertkit/slate-code - npm Package Compare versions

Comparing version 0.0.11 to 0.0.12

408

dist/index.esm.js

@@ -1151,253 +1151,257 @@ import React from 'react';

function unwrapExports(x) {
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x.default : x;
function unwrapExports (x) {
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x.default : x;
}
function createCommonjsModule$1(fn, module) {
return module = {
exports: {}
}, fn(module, module.exports), module.exports;
return module = { exports: {} }, fn(module, module.exports), module.exports;
}
var lib = createCommonjsModule$1(function (module, exports) {
Object.defineProperty(exports, "__esModule", {
value: true
});
/**
* Constants.
*/
var IS_MAC = typeof window != 'undefined' && /Mac|iPod|iPhone|iPad/.test(window.navigator.platform);
var MODIFIERS = {
alt: 'altKey',
control: 'ctrlKey',
meta: 'metaKey',
shift: 'shiftKey'
};
var ALIASES = {
add: '+',
break: 'pause',
cmd: 'meta',
command: 'meta',
ctl: 'control',
ctrl: 'control',
del: 'delete',
down: 'arrowdown',
esc: 'escape',
ins: 'insert',
left: 'arrowleft',
mod: IS_MAC ? 'meta' : 'control',
opt: 'alt',
option: 'alt',
return: 'enter',
right: 'arrowright',
space: ' ',
spacebar: ' ',
up: 'arrowup',
win: 'meta',
windows: 'meta'
};
var CODES = {
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
};
Object.defineProperty(exports, "__esModule", {
value: true
});
for (var f = 1; f < 20; f++) {
CODES['f' + f] = 111 + f;
}
/**
* Is hotkey?
*/
/**
* Constants.
*/
var IS_MAC = typeof window != 'undefined' && /Mac|iPod|iPhone|iPad/.test(window.navigator.platform);
function isHotkey(hotkey, options, event) {
if (options && !('byKey' in options)) {
event = options;
options = null;
}
var MODIFIERS = {
alt: 'altKey',
control: 'ctrlKey',
meta: 'metaKey',
shift: 'shiftKey'
};
if (!Array.isArray(hotkey)) {
hotkey = [hotkey];
}
var ALIASES = {
add: '+',
break: 'pause',
cmd: 'meta',
command: 'meta',
ctl: 'control',
ctrl: 'control',
del: 'delete',
down: 'arrowdown',
esc: 'escape',
ins: 'insert',
left: 'arrowleft',
mod: IS_MAC ? 'meta' : 'control',
opt: 'alt',
option: 'alt',
return: 'enter',
right: 'arrowright',
space: ' ',
spacebar: ' ',
up: 'arrowup',
win: 'meta',
windows: 'meta'
};
var array = hotkey.map(function (string) {
return parseHotkey(string, options);
});
var CODES = {
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
};
var check = function check(e) {
return array.some(function (object) {
return compareHotkey(object, e);
});
};
for (var f = 1; f < 20; f++) {
CODES['f' + f] = 111 + f;
}
var ret = event == null ? check : check(event);
return ret;
}
/**
* Is hotkey?
*/
function isCodeHotkey(hotkey, event) {
return isHotkey(hotkey, event);
function isHotkey(hotkey, options, event) {
if (options && !('byKey' in options)) {
event = options;
options = null;
}
function isKeyHotkey(hotkey, event) {
return isHotkey(hotkey, {
byKey: true
}, event);
if (!Array.isArray(hotkey)) {
hotkey = [hotkey];
}
/**
* Parse.
*/
var array = hotkey.map(function (string) {
return parseHotkey(string, options);
});
var check = function check(e) {
return array.some(function (object) {
return compareHotkey(object, e);
});
};
var ret = event == null ? check : check(event);
return ret;
}
function parseHotkey(hotkey, options) {
var byKey = options && options.byKey;
var ret = {}; // Special case to handle the `+` key since we use it as a separator.
function isCodeHotkey(hotkey, event) {
return isHotkey(hotkey, event);
}
hotkey = hotkey.replace('++', '+add');
var values = hotkey.split('+');
var length = values.length; // Ensure that all the modifiers are set to false unless the hotkey has them.
function isKeyHotkey(hotkey, event) {
return isHotkey(hotkey, { byKey: true }, event);
}
for (var k in MODIFIERS) {
ret[MODIFIERS[k]] = false;
}
/**
* Parse.
*/
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
function parseHotkey(hotkey, options) {
var byKey = options && options.byKey;
var ret = {};
try {
for (var _iterator = values[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var value = _step.value;
var optional = value.endsWith('?');
// Special case to handle the `+` key since we use it as a separator.
hotkey = hotkey.replace('++', '+add');
var values = hotkey.split('+');
var length = values.length;
if (optional) {
value = value.slice(0, -1);
}
// Ensure that all the modifiers are set to false unless the hotkey has them.
var name = toKeyName(value);
var modifier = MODIFIERS[name];
for (var k in MODIFIERS) {
ret[MODIFIERS[k]] = false;
}
if (length === 1 || !modifier) {
if (byKey) {
ret.key = name;
} else {
ret.which = toKeyCode(value);
}
}
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
if (modifier) {
ret[modifier] = optional ? null : true;
try {
for (var _iterator = values[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var value = _step.value;
var optional = value.endsWith('?');
if (optional) {
value = value.slice(0, -1);
}
var name = toKeyName(value);
var modifier = MODIFIERS[name];
if (length === 1 || !modifier) {
if (byKey) {
ret.key = name;
} else {
ret.which = toKeyCode(value);
}
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
if (modifier) {
ret[modifier] = optional ? null : true;
}
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator.return) {
_iterator.return();
}
} finally {
try {
if (!_iteratorNormalCompletion && _iterator.return) {
_iterator.return();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
if (_didIteratorError) {
throw _iteratorError;
}
}
return ret;
}
/**
* Compare.
*/
return ret;
}
function compareHotkey(object, event) {
for (var key in object) {
var expected = object[key];
var actual = void 0;
/**
* Compare.
*/
if (expected == null) {
continue;
}
function compareHotkey(object, event) {
for (var key in object) {
var expected = object[key];
var actual = void 0;
if (key === 'key') {
actual = event.key.toLowerCase();
} else if (key === 'which') {
actual = expected === 91 && event.which === 93 ? 91 : event.which;
} else {
actual = event[key];
}
if (expected == null) {
continue;
}
if (actual == null && expected === false) {
continue;
}
if (key === 'key') {
actual = event.key.toLowerCase();
} else if (key === 'which') {
actual = expected === 91 && event.which === 93 ? 91 : event.which;
} else {
actual = event[key];
}
if (actual !== expected) {
return false;
}
if (actual == null && expected === false) {
continue;
}
return true;
if (actual !== expected) {
return false;
}
}
/**
* Utils.
*/
return true;
}
function toKeyCode(name) {
name = toKeyName(name);
var code = CODES[name] || name.toUpperCase().charCodeAt(0);
return code;
}
/**
* Utils.
*/
function toKeyName(name) {
name = name.toLowerCase();
name = ALIASES[name] || name;
return name;
}
/**
* Export.
*/
function toKeyCode(name) {
name = toKeyName(name);
var code = CODES[name] || name.toUpperCase().charCodeAt(0);
return code;
}
function toKeyName(name) {
name = name.toLowerCase();
name = ALIASES[name] || name;
return name;
}
exports.default = isHotkey;
exports.isHotkey = isHotkey;
exports.isCodeHotkey = isCodeHotkey;
exports.isKeyHotkey = isKeyHotkey;
exports.parseHotkey = parseHotkey;
exports.compareHotkey = compareHotkey;
exports.toKeyCode = toKeyCode;
exports.toKeyName = toKeyName;
/**
* Export.
*/
exports.default = isHotkey;
exports.isHotkey = isHotkey;
exports.isCodeHotkey = isCodeHotkey;
exports.isKeyHotkey = isKeyHotkey;
exports.parseHotkey = parseHotkey;
exports.compareHotkey = compareHotkey;
exports.toKeyCode = toKeyCode;
exports.toKeyName = toKeyName;
});
var isHotkey = unwrapExports(lib);

@@ -1404,0 +1408,0 @@ var lib_1 = lib.isHotkey;

@@ -1156,253 +1156,257 @@ 'use strict';

function unwrapExports(x) {
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x.default : x;
function unwrapExports (x) {
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x.default : x;
}
function createCommonjsModule$1(fn, module) {
return module = {
exports: {}
}, fn(module, module.exports), module.exports;
return module = { exports: {} }, fn(module, module.exports), module.exports;
}
var lib = createCommonjsModule$1(function (module, exports) {
Object.defineProperty(exports, "__esModule", {
value: true
});
/**
* Constants.
*/
var IS_MAC = typeof window != 'undefined' && /Mac|iPod|iPhone|iPad/.test(window.navigator.platform);
var MODIFIERS = {
alt: 'altKey',
control: 'ctrlKey',
meta: 'metaKey',
shift: 'shiftKey'
};
var ALIASES = {
add: '+',
break: 'pause',
cmd: 'meta',
command: 'meta',
ctl: 'control',
ctrl: 'control',
del: 'delete',
down: 'arrowdown',
esc: 'escape',
ins: 'insert',
left: 'arrowleft',
mod: IS_MAC ? 'meta' : 'control',
opt: 'alt',
option: 'alt',
return: 'enter',
right: 'arrowright',
space: ' ',
spacebar: ' ',
up: 'arrowup',
win: 'meta',
windows: 'meta'
};
var CODES = {
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
};
Object.defineProperty(exports, "__esModule", {
value: true
});
for (var f = 1; f < 20; f++) {
CODES['f' + f] = 111 + f;
}
/**
* Is hotkey?
*/
/**
* Constants.
*/
var IS_MAC = typeof window != 'undefined' && /Mac|iPod|iPhone|iPad/.test(window.navigator.platform);
function isHotkey(hotkey, options, event) {
if (options && !('byKey' in options)) {
event = options;
options = null;
}
var MODIFIERS = {
alt: 'altKey',
control: 'ctrlKey',
meta: 'metaKey',
shift: 'shiftKey'
};
if (!Array.isArray(hotkey)) {
hotkey = [hotkey];
}
var ALIASES = {
add: '+',
break: 'pause',
cmd: 'meta',
command: 'meta',
ctl: 'control',
ctrl: 'control',
del: 'delete',
down: 'arrowdown',
esc: 'escape',
ins: 'insert',
left: 'arrowleft',
mod: IS_MAC ? 'meta' : 'control',
opt: 'alt',
option: 'alt',
return: 'enter',
right: 'arrowright',
space: ' ',
spacebar: ' ',
up: 'arrowup',
win: 'meta',
windows: 'meta'
};
var array = hotkey.map(function (string) {
return parseHotkey(string, options);
});
var CODES = {
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
};
var check = function check(e) {
return array.some(function (object) {
return compareHotkey(object, e);
});
};
for (var f = 1; f < 20; f++) {
CODES['f' + f] = 111 + f;
}
var ret = event == null ? check : check(event);
return ret;
}
/**
* Is hotkey?
*/
function isCodeHotkey(hotkey, event) {
return isHotkey(hotkey, event);
function isHotkey(hotkey, options, event) {
if (options && !('byKey' in options)) {
event = options;
options = null;
}
function isKeyHotkey(hotkey, event) {
return isHotkey(hotkey, {
byKey: true
}, event);
if (!Array.isArray(hotkey)) {
hotkey = [hotkey];
}
/**
* Parse.
*/
var array = hotkey.map(function (string) {
return parseHotkey(string, options);
});
var check = function check(e) {
return array.some(function (object) {
return compareHotkey(object, e);
});
};
var ret = event == null ? check : check(event);
return ret;
}
function parseHotkey(hotkey, options) {
var byKey = options && options.byKey;
var ret = {}; // Special case to handle the `+` key since we use it as a separator.
function isCodeHotkey(hotkey, event) {
return isHotkey(hotkey, event);
}
hotkey = hotkey.replace('++', '+add');
var values = hotkey.split('+');
var length = values.length; // Ensure that all the modifiers are set to false unless the hotkey has them.
function isKeyHotkey(hotkey, event) {
return isHotkey(hotkey, { byKey: true }, event);
}
for (var k in MODIFIERS) {
ret[MODIFIERS[k]] = false;
}
/**
* Parse.
*/
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
function parseHotkey(hotkey, options) {
var byKey = options && options.byKey;
var ret = {};
try {
for (var _iterator = values[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var value = _step.value;
var optional = value.endsWith('?');
// Special case to handle the `+` key since we use it as a separator.
hotkey = hotkey.replace('++', '+add');
var values = hotkey.split('+');
var length = values.length;
if (optional) {
value = value.slice(0, -1);
}
// Ensure that all the modifiers are set to false unless the hotkey has them.
var name = toKeyName(value);
var modifier = MODIFIERS[name];
for (var k in MODIFIERS) {
ret[MODIFIERS[k]] = false;
}
if (length === 1 || !modifier) {
if (byKey) {
ret.key = name;
} else {
ret.which = toKeyCode(value);
}
}
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
if (modifier) {
ret[modifier] = optional ? null : true;
try {
for (var _iterator = values[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var value = _step.value;
var optional = value.endsWith('?');
if (optional) {
value = value.slice(0, -1);
}
var name = toKeyName(value);
var modifier = MODIFIERS[name];
if (length === 1 || !modifier) {
if (byKey) {
ret.key = name;
} else {
ret.which = toKeyCode(value);
}
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
if (modifier) {
ret[modifier] = optional ? null : true;
}
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator.return) {
_iterator.return();
}
} finally {
try {
if (!_iteratorNormalCompletion && _iterator.return) {
_iterator.return();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
if (_didIteratorError) {
throw _iteratorError;
}
}
return ret;
}
/**
* Compare.
*/
return ret;
}
function compareHotkey(object, event) {
for (var key in object) {
var expected = object[key];
var actual = void 0;
/**
* Compare.
*/
if (expected == null) {
continue;
}
function compareHotkey(object, event) {
for (var key in object) {
var expected = object[key];
var actual = void 0;
if (key === 'key') {
actual = event.key.toLowerCase();
} else if (key === 'which') {
actual = expected === 91 && event.which === 93 ? 91 : event.which;
} else {
actual = event[key];
}
if (expected == null) {
continue;
}
if (actual == null && expected === false) {
continue;
}
if (key === 'key') {
actual = event.key.toLowerCase();
} else if (key === 'which') {
actual = expected === 91 && event.which === 93 ? 91 : event.which;
} else {
actual = event[key];
}
if (actual !== expected) {
return false;
}
if (actual == null && expected === false) {
continue;
}
return true;
if (actual !== expected) {
return false;
}
}
/**
* Utils.
*/
return true;
}
function toKeyCode(name) {
name = toKeyName(name);
var code = CODES[name] || name.toUpperCase().charCodeAt(0);
return code;
}
/**
* Utils.
*/
function toKeyName(name) {
name = name.toLowerCase();
name = ALIASES[name] || name;
return name;
}
/**
* Export.
*/
function toKeyCode(name) {
name = toKeyName(name);
var code = CODES[name] || name.toUpperCase().charCodeAt(0);
return code;
}
function toKeyName(name) {
name = name.toLowerCase();
name = ALIASES[name] || name;
return name;
}
exports.default = isHotkey;
exports.isHotkey = isHotkey;
exports.isCodeHotkey = isCodeHotkey;
exports.isKeyHotkey = isKeyHotkey;
exports.parseHotkey = parseHotkey;
exports.compareHotkey = compareHotkey;
exports.toKeyCode = toKeyCode;
exports.toKeyName = toKeyName;
/**
* Export.
*/
exports.default = isHotkey;
exports.isHotkey = isHotkey;
exports.isCodeHotkey = isCodeHotkey;
exports.isKeyHotkey = isKeyHotkey;
exports.parseHotkey = parseHotkey;
exports.compareHotkey = compareHotkey;
exports.toKeyCode = toKeyCode;
exports.toKeyName = toKeyName;
});
var isHotkey = unwrapExports(lib);

@@ -1409,0 +1413,0 @@ var lib_1 = lib.isHotkey;

{
"name": "@convertkit/slate-code",
"version": "0.0.11",
"version": "0.0.12",
"description": "A plugin for handling code in the ConvertKit Editor",

@@ -35,6 +35,6 @@ "main": "dist/index.js",

"dependencies": {
"@convertkit/slate-keymap": "^0.1.7",
"@convertkit/slate-keymap": "^0.1.8",
"prismjs": "^1.15.0"
},
"gitHead": "98b7d5cf7047b107fca773a905880713c463d21a"
"gitHead": "6490a67d078d8ab81c5c7e3451e61ef10e4efe75"
}
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