Comparing version 1.2.2 to 2.0.0
# Caret Pos | ||
# Version 2.0.0 - 2020-06-02 | ||
- Renamed UMD module from `caret-pos` to `caretPos` | ||
- Updated packages | ||
# Version 1.2.2 - 2020-02-08 | ||
@@ -4,0 +8,0 @@ - Added typings |
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : | ||
typeof define === 'function' && define.amd ? define(['exports'], factory) : | ||
(factory((global['caret-pos'] = {}))); | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : | ||
typeof define === 'function' && define.amd ? define(['exports'], factory) : | ||
(global = global || self, factory(global.caretPos = {})); | ||
}(this, (function (exports) { 'use strict'; | ||
var attributes = ['borderBottomWidth', 'borderLeftWidth', 'borderRightWidth', 'borderTopStyle', 'borderRightStyle', 'borderBottomStyle', 'borderLeftStyle', 'borderTopWidth', 'boxSizing', 'fontFamily', 'fontSize', 'fontWeight', 'height', 'letterSpacing', 'lineHeight', 'marginBottom', 'marginLeft', 'marginRight', 'marginTop', 'outlineWidth', 'overflow', 'overflowX', 'overflowY', 'paddingBottom', 'paddingLeft', 'paddingRight', 'paddingTop', 'textAlign', 'textOverflow', 'textTransform', 'whiteSpace', 'wordBreak', 'wordWrap']; | ||
/** | ||
* Create a mirror | ||
* | ||
* @param {Element} element The element | ||
* @param {string} html The html | ||
* | ||
* @return {object} The mirror object | ||
*/ | ||
var createMirror = function createMirror(element, html) { | ||
var attributes = ['borderBottomWidth', 'borderLeftWidth', 'borderRightWidth', 'borderTopStyle', 'borderRightStyle', 'borderBottomStyle', 'borderLeftStyle', 'borderTopWidth', 'boxSizing', 'fontFamily', 'fontSize', 'fontWeight', 'height', 'letterSpacing', 'lineHeight', 'marginBottom', 'marginLeft', 'marginRight', 'marginTop', 'outlineWidth', 'overflow', 'overflowX', 'overflowY', 'paddingBottom', 'paddingLeft', 'paddingRight', 'paddingTop', 'textAlign', 'textOverflow', 'textTransform', 'whiteSpace', 'wordBreak', 'wordWrap']; | ||
/** | ||
* The mirror element | ||
*/ | ||
var mirror = document.createElement('div'); | ||
/** | ||
* Create the CSS for the mirror object | ||
* Create a mirror | ||
* | ||
* @return {object} The style object | ||
* @param {Element} element The element | ||
* @param {string} html The html | ||
* | ||
* @return {object} The mirror object | ||
*/ | ||
var mirrorCss = function mirrorCss() { | ||
var css = { | ||
position: 'absolute', | ||
left: -9999, | ||
top: 0, | ||
zIndex: -2000 | ||
}; | ||
if (element.tagName === 'TEXTAREA') { | ||
attributes.push('width'); | ||
} | ||
var createMirror = function createMirror(element, html) { | ||
/** | ||
* The mirror element | ||
*/ | ||
var mirror = document.createElement('div'); | ||
/** | ||
* Create the CSS for the mirror object | ||
* | ||
* @return {object} The style object | ||
*/ | ||
attributes.forEach(function (attr) { | ||
css[attr] = getComputedStyle(element)[attr]; | ||
}); | ||
var mirrorCss = function mirrorCss() { | ||
var css = { | ||
position: 'absolute', | ||
left: -9999, | ||
top: 0, | ||
zIndex: -2000 | ||
}; | ||
return css; | ||
}; | ||
if (element.tagName === 'TEXTAREA') { | ||
attributes.push('width'); | ||
} | ||
/** | ||
* Initialize the mirror | ||
* | ||
* @param {string} html The html | ||
* | ||
* @return {void} | ||
*/ | ||
var initialize = function initialize(html) { | ||
var styles = mirrorCss(); | ||
Object.keys(styles).forEach(function (key) { | ||
mirror.style[key] = styles[key]; | ||
}); | ||
mirror.innerHTML = html; | ||
element.parentNode.insertBefore(mirror, element.nextSibling); | ||
}; | ||
/** | ||
* Get the rect | ||
* | ||
* @return {Rect} The bounding rect | ||
*/ | ||
var rect = function rect() { | ||
var marker = mirror.ownerDocument.getElementById('caret-position-marker'); | ||
var boundingRect = { | ||
left: marker.offsetLeft, | ||
top: marker.offsetTop, | ||
height: marker.offsetHeight | ||
attributes.forEach(function (attr) { | ||
css[attr] = getComputedStyle(element)[attr]; | ||
}); | ||
return css; | ||
}; | ||
mirror.parentNode.removeChild(mirror); | ||
/** | ||
* Initialize the mirror | ||
* | ||
* @param {string} html The html | ||
* | ||
* @return {void} | ||
*/ | ||
return boundingRect; | ||
}; | ||
initialize(html); | ||
var initialize = function initialize(html) { | ||
var styles = mirrorCss(); | ||
Object.keys(styles).forEach(function (key) { | ||
mirror.style[key] = styles[key]; | ||
}); | ||
mirror.innerHTML = html; | ||
element.parentNode.insertBefore(mirror, element.nextSibling); | ||
}; | ||
/** | ||
* Get the rect | ||
* | ||
* @return {Rect} The bounding rect | ||
*/ | ||
return { | ||
rect: rect | ||
}; | ||
}; | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { | ||
return typeof obj; | ||
} : function (obj) { | ||
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; | ||
}; | ||
var rect = function rect() { | ||
var marker = mirror.ownerDocument.getElementById('caret-position-marker'); | ||
var boundingRect = { | ||
left: marker.offsetLeft, | ||
top: marker.offsetTop, | ||
height: marker.offsetHeight | ||
}; | ||
mirror.parentNode.removeChild(mirror); | ||
return boundingRect; | ||
}; | ||
/** | ||
* Check if a DOM Element is content editable | ||
* | ||
* @param {Element} element The DOM element | ||
* | ||
* @return {bool} If it is content editable | ||
*/ | ||
var isContentEditable = function isContentEditable(element) { | ||
return !!(element.contentEditable ? element.contentEditable === 'true' : element.getAttribute('contenteditable') === 'true'); | ||
}; | ||
/** | ||
* Get the context from settings passed in | ||
* | ||
* @param {object} settings The settings object | ||
* | ||
* @return {object} window and document | ||
*/ | ||
var getContext = function getContext() { | ||
var settings = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
var customPos = settings.customPos, | ||
iframe = settings.iframe, | ||
noShadowCaret = settings.noShadowCaret; | ||
if (iframe) { | ||
initialize(html); | ||
return { | ||
iframe: iframe, | ||
window: iframe.contentWindow, | ||
document: iframe.contentDocument || iframe.contentWindow.document, | ||
noShadowCaret: noShadowCaret, | ||
customPos: customPos | ||
rect: rect | ||
}; | ||
} | ||
return { | ||
window: window, | ||
document: document, | ||
noShadowCaret: noShadowCaret, | ||
customPos: customPos | ||
}; | ||
}; | ||
/** | ||
* Get the offset of an element | ||
* | ||
* @param {Element} element The DOM element | ||
* @param {object} ctx The context | ||
* | ||
* @return {object} top and left | ||
*/ | ||
var getOffset = function getOffset(element, ctx) { | ||
var win = ctx && ctx.window || window; | ||
var doc = ctx && ctx.document || document; | ||
var rect = element.getBoundingClientRect(); | ||
var docEl = doc.documentElement; | ||
var scrollLeft = win.pageXOffset || docEl.scrollLeft; | ||
var scrollTop = win.pageYOffset || docEl.scrollTop; | ||
function _typeof(obj) { | ||
"@babel/helpers - typeof"; | ||
return { | ||
top: rect.top + scrollTop, | ||
left: rect.left + scrollLeft | ||
}; | ||
}; | ||
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { | ||
_typeof = function (obj) { | ||
return typeof obj; | ||
}; | ||
} else { | ||
_typeof = function (obj) { | ||
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; | ||
}; | ||
} | ||
/** | ||
* Check if a value is an object | ||
* | ||
* @param {any} value The value to check | ||
* | ||
* @return {bool} If it is an object | ||
*/ | ||
var isObject = function isObject(value) { | ||
return (typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object' && value !== null; | ||
}; | ||
return _typeof(obj); | ||
} | ||
/** | ||
* Create a Input caret object. | ||
* | ||
* @param {Element} element The element | ||
* @param {Object} ctx The context | ||
*/ | ||
var createInputCaret = function createInputCaret(element, ctx) { | ||
/** | ||
* Get the current position | ||
* Check if a DOM Element is content editable | ||
* | ||
* @returns {int} The caret position | ||
* @param {Element} element The DOM element | ||
* | ||
* @return {bool} If it is content editable | ||
*/ | ||
var getPos = function getPos() { | ||
return element.selectionStart; | ||
var isContentEditable = function isContentEditable(element) { | ||
return !!(element.contentEditable ? element.contentEditable === 'true' : element.getAttribute('contenteditable') === 'true'); | ||
}; | ||
/** | ||
* Set the position | ||
* Get the context from settings passed in | ||
* | ||
* @param {int} pos The position | ||
* @param {object} settings The settings object | ||
* | ||
* @return {Element} The element | ||
* @return {object} window and document | ||
*/ | ||
var setPos = function setPos(pos) { | ||
element.setSelectionRange(pos, pos); | ||
return element; | ||
var getContext = function getContext() { | ||
var settings = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
var customPos = settings.customPos, | ||
iframe = settings.iframe, | ||
noShadowCaret = settings.noShadowCaret; | ||
if (iframe) { | ||
return { | ||
iframe: iframe, | ||
window: iframe.contentWindow, | ||
document: iframe.contentDocument || iframe.contentWindow.document, | ||
noShadowCaret: noShadowCaret, | ||
customPos: customPos | ||
}; | ||
} | ||
return { | ||
window: window, | ||
document: document, | ||
noShadowCaret: noShadowCaret, | ||
customPos: customPos | ||
}; | ||
}; | ||
/** | ||
* The offset | ||
* Get the offset of an element | ||
* | ||
* @param {int} pos The position | ||
* @param {Element} element The DOM element | ||
* @param {object} ctx The context | ||
* | ||
* @return {object} The offset | ||
* @return {object} top and left | ||
*/ | ||
var getOffset$$1 = function getOffset$$1(pos) { | ||
var rect = getOffset(element); | ||
var position = getPosition(pos); | ||
var getOffset = function getOffset(element, ctx) { | ||
var win = ctx && ctx.window || window; | ||
var doc = ctx && ctx.document || document; | ||
var rect = element.getBoundingClientRect(); | ||
var docEl = doc.documentElement; | ||
var scrollLeft = win.pageXOffset || docEl.scrollLeft; | ||
var scrollTop = win.pageYOffset || docEl.scrollTop; | ||
return { | ||
top: rect.top + position.top + ctx.document.body.scrollTop, | ||
left: rect.left + position.left + ctx.document.body.scrollLeft, | ||
height: position.height | ||
top: rect.top + scrollTop, | ||
left: rect.left + scrollLeft | ||
}; | ||
}; | ||
/** | ||
* Get the current position | ||
* Check if a value is an object | ||
* | ||
* @param {int} pos The position | ||
* @param {any} value The value to check | ||
* | ||
* @return {object} The position | ||
* @return {bool} If it is an object | ||
*/ | ||
var getPosition = function getPosition(pos) { | ||
var format = function format(val) { | ||
var value = val.replace(/<|>|`|"|&/g, '?').replace(/\r\n|\r|\n/g, '<br/>'); | ||
return value; | ||
var isObject = function isObject(value) { | ||
return _typeof(value) === 'object' && value !== null; | ||
}; | ||
/** | ||
* Create a Input caret object. | ||
* | ||
* @param {Element} element The element | ||
* @param {Object} ctx The context | ||
*/ | ||
var createInputCaret = function createInputCaret(element, ctx) { | ||
/** | ||
* Get the current position | ||
* | ||
* @returns {int} The caret position | ||
*/ | ||
var getPos = function getPos() { | ||
return element.selectionStart; | ||
}; | ||
/** | ||
* Set the position | ||
* | ||
* @param {int} pos The position | ||
* | ||
* @return {Element} The element | ||
*/ | ||
if (ctx.customPos || ctx.customPos === 0) { | ||
pos = ctx.customPos; | ||
} | ||
var position = pos === undefined ? getPos() : pos; | ||
var startRange = element.value.slice(0, position); | ||
var endRange = element.value.slice(position); | ||
var html = '<span style="position: relative; display: inline;">' + format(startRange) + '</span>'; | ||
html += '<span id="caret-position-marker" style="position: relative; display: inline;">|</span>'; | ||
html += '<span style="position: relative; display: inline;">' + format(endRange) + '</span>'; | ||
var setPos = function setPos(pos) { | ||
element.setSelectionRange(pos, pos); | ||
return element; | ||
}; | ||
/** | ||
* The offset | ||
* | ||
* @param {int} pos The position | ||
* | ||
* @return {object} The offset | ||
*/ | ||
var mirror = createMirror(element, html); | ||
var rect = mirror.rect(); | ||
rect.pos = getPos(); | ||
return rect; | ||
}; | ||
var getOffset$1 = function getOffset$1(pos) { | ||
var rect = getOffset(element); | ||
var position = getPosition(pos); | ||
return { | ||
top: rect.top + position.top + ctx.document.body.scrollTop, | ||
left: rect.left + position.left + ctx.document.body.scrollLeft, | ||
height: position.height | ||
}; | ||
}; | ||
/** | ||
* Get the current position | ||
* | ||
* @param {int} pos The position | ||
* | ||
* @return {object} The position | ||
*/ | ||
return { | ||
getPos: getPos, | ||
setPos: setPos, | ||
getOffset: getOffset$$1, | ||
getPosition: getPosition | ||
var getPosition = function getPosition(pos) { | ||
var format = function format(val) { | ||
var value = val.replace(/<|>|`|"|&/g, '?').replace(/\r\n|\r|\n/g, '<br/>'); | ||
return value; | ||
}; | ||
if (ctx.customPos || ctx.customPos === 0) { | ||
pos = ctx.customPos; | ||
} | ||
var position = pos === undefined ? getPos() : pos; | ||
var startRange = element.value.slice(0, position); | ||
var endRange = element.value.slice(position); | ||
var html = "<span style=\"position: relative; display: inline;\">".concat(format(startRange), "</span>"); | ||
html += '<span id="caret-position-marker" style="position: relative; display: inline;">|</span>'; | ||
html += "<span style=\"position: relative; display: inline;\">".concat(format(endRange), "</span>"); | ||
var mirror = createMirror(element, html); | ||
var rect = mirror.rect(); | ||
rect.pos = getPos(); | ||
return rect; | ||
}; | ||
return { | ||
getPos: getPos, | ||
setPos: setPos, | ||
getOffset: getOffset$1, | ||
getPosition: getPosition | ||
}; | ||
}; | ||
}; | ||
/** | ||
* Create an Editable Caret | ||
* @param {Element} element The editable element | ||
* @param {object|null} ctx The context | ||
* | ||
* @return {EditableCaret} | ||
*/ | ||
var createEditableCaret = function createEditableCaret(element, ctx) { | ||
/** | ||
* Set the caret position | ||
* Create an Editable Caret | ||
* @param {Element} element The editable element | ||
* @param {object|null} ctx The context | ||
* | ||
* @param {int} pos The position to se | ||
* | ||
* @return {Element} The element | ||
* @return {EditableCaret} | ||
*/ | ||
var setPos = function setPos(pos) { | ||
var sel = ctx.window.getSelection(); | ||
if (sel) { | ||
var offset = 0; | ||
var found = false; | ||
var find = function find(position, parent) { | ||
for (var i = 0; i < parent.childNodes.length; i++) { | ||
var node = parent.childNodes[i]; | ||
if (found) { | ||
break; | ||
} | ||
if (node.nodeType === 3) { | ||
if (offset + node.length >= position) { | ||
found = true; | ||
var range = ctx.document.createRange(); | ||
range.setStart(node, position - offset); | ||
sel.removeAllRanges(); | ||
sel.addRange(range); | ||
var createEditableCaret = function createEditableCaret(element, ctx) { | ||
/** | ||
* Set the caret position | ||
* | ||
* @param {int} pos The position to se | ||
* | ||
* @return {Element} The element | ||
*/ | ||
var setPos = function setPos(pos) { | ||
var sel = ctx.window.getSelection(); | ||
if (sel) { | ||
var offset = 0; | ||
var found = false; | ||
var find = function find(position, parent) { | ||
for (var i = 0; i < parent.childNodes.length; i++) { | ||
var node = parent.childNodes[i]; | ||
if (found) { | ||
break; | ||
} | ||
if (node.nodeType === 3) { | ||
if (offset + node.length >= position) { | ||
found = true; | ||
var range = ctx.document.createRange(); | ||
range.setStart(node, position - offset); | ||
sel.removeAllRanges(); | ||
sel.addRange(range); | ||
break; | ||
} else { | ||
offset += node.length; | ||
} | ||
} else { | ||
offset += node.length; | ||
find(pos, node); | ||
} | ||
} else { | ||
find(pos, node); | ||
} | ||
} | ||
}; | ||
find(pos, element); | ||
} | ||
return element; | ||
}; | ||
/** | ||
* Get the offset | ||
* | ||
* @return {object} The offset | ||
*/ | ||
var getOffset = function getOffset() { | ||
var range = getRange(); | ||
var offset = { | ||
height: 0, | ||
left: 0, | ||
right: 0 | ||
}; | ||
find(pos, element); | ||
} | ||
return element; | ||
}; | ||
if (!range) { | ||
return offset; | ||
} | ||
/** | ||
* Get the offset | ||
* | ||
* @return {object} The offset | ||
*/ | ||
var getOffset = function getOffset() { | ||
var range = getRange(); | ||
var offset = { | ||
height: 0, | ||
left: 0, | ||
right: 0 | ||
var hasCustomPos = ctx.customPos || ctx.customPos === 0; // endContainer in Firefox would be the element at the start of | ||
// the line | ||
if (range.endOffset - 1 > 0 && range.endContainer !== element || hasCustomPos) { | ||
var clonedRange = range.cloneRange(); | ||
var fixedPosition = hasCustomPos ? ctx.customPos : range.endOffset; | ||
clonedRange.setStart(range.endContainer, fixedPosition - 1 < 0 ? 0 : fixedPosition - 1); | ||
clonedRange.setEnd(range.endContainer, fixedPosition); | ||
var rect = clonedRange.getBoundingClientRect(); | ||
offset = { | ||
height: rect.height, | ||
left: rect.left + rect.width, | ||
top: rect.top | ||
}; | ||
clonedRange.detach(); | ||
} | ||
if ((!offset || offset && offset.height === 0) && !ctx.noShadowCaret) { | ||
var _clonedRange = range.cloneRange(); | ||
var shadowCaret = ctx.document.createTextNode('|'); | ||
_clonedRange.insertNode(shadowCaret); | ||
_clonedRange.selectNode(shadowCaret); | ||
var _rect = _clonedRange.getBoundingClientRect(); | ||
offset = { | ||
height: _rect.height, | ||
left: _rect.left, | ||
top: _rect.top | ||
}; | ||
shadowCaret.parentNode.removeChild(shadowCaret); | ||
_clonedRange.detach(); | ||
} | ||
if (offset) { | ||
var doc = ctx.document.documentElement; | ||
offset.top += ctx.window.pageYOffset - (doc.clientTop || 0); | ||
offset.left += ctx.window.pageXOffset - (doc.clientLeft || 0); | ||
} | ||
return offset; | ||
}; | ||
/** | ||
* Get the position | ||
* | ||
* @return {object} The position | ||
*/ | ||
if (!range) { | ||
var getPosition = function getPosition() { | ||
var offset = getOffset(); | ||
var pos = getPos(); | ||
var rect = element.getBoundingClientRect(); | ||
var inputOffset = { | ||
top: rect.top + ctx.document.body.scrollTop, | ||
left: rect.left + ctx.document.body.scrollLeft | ||
}; | ||
offset.left -= inputOffset.left; | ||
offset.top -= inputOffset.top; | ||
offset.pos = pos; | ||
return offset; | ||
} | ||
}; | ||
/** | ||
* Get the range | ||
* | ||
* @return {Range|null} | ||
*/ | ||
var hasCustomPos = ctx.customPos || ctx.customPos === 0; | ||
// endContainer in Firefox would be the element at the start of | ||
// the line | ||
if (range.endOffset - 1 > 0 && range.endContainer !== element || hasCustomPos) { | ||
var getRange = function getRange() { | ||
if (!ctx.window.getSelection) { | ||
return; | ||
} | ||
var sel = ctx.window.getSelection(); | ||
return sel.rangeCount > 0 ? sel.getRangeAt(0) : null; | ||
}; | ||
/** | ||
* Get the caret position | ||
* | ||
* @return {int} The position | ||
*/ | ||
var getPos = function getPos() { | ||
var range = getRange(); | ||
var clonedRange = range.cloneRange(); | ||
var fixedPosition = hasCustomPos ? ctx.customPos : range.endOffset; | ||
clonedRange.setStart(range.endContainer, fixedPosition - 1 < 0 ? 0 : fixedPosition - 1); | ||
clonedRange.setEnd(range.endContainer, fixedPosition); | ||
var rect = clonedRange.getBoundingClientRect(); | ||
offset = { | ||
height: rect.height, | ||
left: rect.left + rect.width, | ||
top: rect.top | ||
}; | ||
clonedRange.selectNodeContents(element); | ||
clonedRange.setEnd(range.endContainer, range.endOffset); | ||
var pos = clonedRange.toString().length; | ||
clonedRange.detach(); | ||
} | ||
return pos; | ||
}; | ||
if ((!offset || offset && offset.height === 0) && !ctx.noShadowCaret) { | ||
var _clonedRange = range.cloneRange(); | ||
var shadowCaret = ctx.document.createTextNode('|'); | ||
_clonedRange.insertNode(shadowCaret); | ||
_clonedRange.selectNode(shadowCaret); | ||
var _rect = _clonedRange.getBoundingClientRect(); | ||
offset = { | ||
height: _rect.height, | ||
left: _rect.left, | ||
top: _rect.top | ||
}; | ||
shadowCaret.parentNode.removeChild(shadowCaret); | ||
_clonedRange.detach(); | ||
} | ||
return { | ||
getPos: getPos, | ||
setPos: setPos, | ||
getPosition: getPosition, | ||
getOffset: getOffset, | ||
getRange: getRange | ||
}; | ||
}; | ||
if (offset) { | ||
var doc = ctx.document.documentElement; | ||
offset.top += ctx.window.pageYOffset - (doc.clientTop || 0); | ||
offset.left += ctx.window.pageXOffset - (doc.clientLeft || 0); | ||
var createCaret = function createCaret(element, ctx) { | ||
if (isContentEditable(element)) { | ||
return createEditableCaret(element, ctx); | ||
} | ||
return offset; | ||
return createInputCaret(element, ctx); | ||
}; | ||
/** | ||
* Get the position | ||
* | ||
* @return {object} The position | ||
*/ | ||
var getPosition = function getPosition() { | ||
var offset = getOffset(); | ||
var pos = getPos(); | ||
var rect = element.getBoundingClientRect(); | ||
var inputOffset = { | ||
top: rect.top + ctx.document.body.scrollTop, | ||
left: rect.left + ctx.document.body.scrollLeft | ||
}; | ||
offset.left -= inputOffset.left; | ||
offset.top -= inputOffset.top; | ||
offset.pos = pos; | ||
var position = function position(element, value) { | ||
var settings = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; | ||
var options = settings; | ||
return offset; | ||
}; | ||
if (isObject(value)) { | ||
options = value; | ||
value = null; | ||
} | ||
/** | ||
* Get the range | ||
* | ||
* @return {Range|null} | ||
*/ | ||
var getRange = function getRange() { | ||
if (!ctx.window.getSelection) { | ||
return; | ||
var ctx = getContext(options); | ||
var caret = createCaret(element, ctx); | ||
if (value || value === 0) { | ||
return caret.setPos(value); | ||
} | ||
var sel = ctx.window.getSelection(); | ||
return sel.rangeCount > 0 ? sel.getRangeAt(0) : null; | ||
return caret.getPosition(); | ||
}; | ||
/** | ||
* Get the caret position | ||
* | ||
* @return {int} The position | ||
* @param {Element} element The DOM element | ||
* @param {number|undefined} value The value to set | ||
* @param {object} settings Any settings for context | ||
*/ | ||
var getPos = function getPos() { | ||
var range = getRange(); | ||
var clonedRange = range.cloneRange(); | ||
clonedRange.selectNodeContents(element); | ||
clonedRange.setEnd(range.endContainer, range.endOffset); | ||
var pos = clonedRange.toString().length; | ||
clonedRange.detach(); | ||
return pos; | ||
}; | ||
var offset = function offset(element, value) { | ||
var settings = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; | ||
var options = settings; | ||
return { | ||
getPos: getPos, | ||
setPos: setPos, | ||
getPosition: getPosition, | ||
getOffset: getOffset, | ||
getRange: getRange | ||
if (isObject(value)) { | ||
options = value; | ||
value = null; | ||
} | ||
var ctx = getContext(options); | ||
var caret = createCaret(element, ctx); | ||
return caret.getOffset(value); | ||
}; | ||
}; | ||
var createCaret = function createCaret(element, ctx) { | ||
if (isContentEditable(element)) { | ||
return createEditableCaret(element, ctx); | ||
} | ||
exports.getOffset = getOffset; | ||
exports.offset = offset; | ||
exports.position = position; | ||
return createInputCaret(element, ctx); | ||
}; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
var position = function position(element, value) { | ||
var settings = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; | ||
var options = settings; | ||
if (isObject(value)) { | ||
options = value; | ||
value = null; | ||
} | ||
var ctx = getContext(options); | ||
var caret = createCaret(element, ctx); | ||
if (value || value === 0) { | ||
return caret.setPos(value); | ||
} | ||
return caret.getPosition(); | ||
}; | ||
/** | ||
* | ||
* @param {Element} element The DOM element | ||
* @param {number|undefined} value The value to set | ||
* @param {object} settings Any settings for context | ||
*/ | ||
var offset = function offset(element, value) { | ||
var settings = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; | ||
var options = settings; | ||
if (isObject(value)) { | ||
options = value; | ||
value = null; | ||
} | ||
var ctx = getContext(options); | ||
var caret = createCaret(element, ctx); | ||
return caret.getOffset(value); | ||
}; | ||
exports.position = position; | ||
exports.offset = offset; | ||
exports.getOffset = getOffset; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
}))); | ||
//# sourceMappingURL=main.js.map |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e["caret-pos"]={})}(this,function(e){"use strict";function c(t,e){var o,n,r,i=document.createElement("div");return o=e,n={position:"absolute",left:-9999,top:0,zIndex:-2e3},"TEXTAREA"===t.tagName&&l.push("width"),l.forEach(function(e){n[e]=getComputedStyle(t)[e]}),r=n,Object.keys(r).forEach(function(e){i.style[e]=r[e]}),i.innerHTML=o,t.parentNode.insertBefore(i,t.nextSibling),{rect:function(){var e=i.ownerDocument.getElementById("caret-position-marker"),t={left:e.offsetLeft,top:e.offsetTop,height:e.offsetHeight};return i.parentNode.removeChild(i),t}}}function f(e){var t=0<arguments.length&&void 0!==e?e:{},o=t.customPos,n=t.iframe,r=t.noShadowCaret;return n?{iframe:n,window:n.contentWindow,document:n.contentDocument||n.contentWindow.document,noShadowCaret:r,customPos:o}:{window:window,document:document,noShadowCaret:r,customPos:o}}function r(e,t){var o=t&&t.window||window,n=t&&t.document||document,r=e.getBoundingClientRect(),i=n.documentElement,f=o.pageXOffset||i.scrollLeft,a=o.pageYOffset||i.scrollTop;return{top:r.top+a,left:r.left+f}}function a(e){return"object"===(void 0===e?"undefined":t(e))&&null!==e}function n(a,d){function l(){return a.selectionStart}var n=function(e){function t(e){return e.replace(/<|>|`|"|&/g,"?").replace(/\r\n|\r|\n/g,"<br/>")}!d.customPos&&0!==d.customPos||(e=d.customPos);var o=void 0===e?l():e,n=a.value.slice(0,o),r=a.value.slice(o),i='<span style="position: relative; display: inline;">'+t(n)+"</span>";i+='<span id="caret-position-marker" style="position: relative; display: inline;">|</span>',i+='<span style="position: relative; display: inline;">'+t(r)+"</span>";var f=c(a,i).rect();return f.pos=l(),f};return{getPos:l,setPos:function(e){return a.setSelectionRange(e,e),a},getOffset:function(e){var t=r(a),o=n(e);return{top:t.top+o.top+d.document.body.scrollTop,left:t.left+o.left+d.document.body.scrollLeft,height:o.height}},getPosition:n}}function i(c,u){function i(){var e=s(),t={height:0,left:0,right:0};if(!e)return t;var o=u.customPos||0===u.customPos;if(0<e.endOffset-1&&e.endContainer!==c||o){var n=e.cloneRange(),r=o?u.customPos:e.endOffset;n.setStart(e.endContainer,r-1<0?0:r-1),n.setEnd(e.endContainer,r);var i=n.getBoundingClientRect();t={height:i.height,left:i.left+i.width,top:i.top},n.detach()}if((!t||t&&0===t.height)&&!u.noShadowCaret){var f=e.cloneRange(),a=u.document.createTextNode("|");f.insertNode(a),f.selectNode(a);var d=f.getBoundingClientRect();t={height:d.height,left:d.left,top:d.top},a.parentNode.removeChild(a),f.detach()}if(t){var l=u.document.documentElement;t.top+=u.window.pageYOffset-(l.clientTop||0),t.left+=u.window.pageXOffset-(l.clientLeft||0)}return t}var s=function(){if(u.window.getSelection){var e=u.window.getSelection();return 0<e.rangeCount?e.getRangeAt(0):null}},f=function(){var e=s(),t=e.cloneRange();t.selectNodeContents(c),t.setEnd(e.endContainer,e.endOffset);var o=t.toString().length;return t.detach(),o};return{getPos:f,setPos:function(f){var a=u.window.getSelection();if(a){var d=0,l=!1;!function e(t,o){for(var n=0;n<o.childNodes.length;n++){var r=o.childNodes[n];if(l)break;if(3===r.nodeType){if(d+r.length>=t){l=!0;var i=u.document.createRange();i.setStart(r,t-d),a.removeAllRanges(),a.addRange(i);break}d+=r.length}else e(f,r)}}(f,c)}return c},getPosition:function(){var e=i(),t=f(),o=c.getBoundingClientRect(),n=o.top+u.document.body.scrollTop,r=o.left+u.document.body.scrollLeft;return e.left-=r,e.top-=n,e.pos=t,e},getOffset:i,getRange:s}}function d(e,t){return(((o=e).contentEditable?"true"===o.contentEditable:"true"===o.getAttribute("contenteditable"))?i:n)(e,t);var o}var l=["borderBottomWidth","borderLeftWidth","borderRightWidth","borderTopStyle","borderRightStyle","borderBottomStyle","borderLeftStyle","borderTopWidth","boxSizing","fontFamily","fontSize","fontWeight","height","letterSpacing","lineHeight","marginBottom","marginLeft","marginRight","marginTop","outlineWidth","overflow","overflowX","overflowY","paddingBottom","paddingLeft","paddingRight","paddingTop","textAlign","textOverflow","textTransform","whiteSpace","wordBreak","wordWrap"],t="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};e.position=function(e,t,o){var n=2<arguments.length&&void 0!==o?o:{};a(t)&&(n=t,t=null);var r=f(n),i=d(e,r);return t||0===t?i.setPos(t):i.getPosition()},e.offset=function(e,t,o){var n=2<arguments.length&&void 0!==o?o:{};a(t)&&(n=t,t=null);var r=f(n);return d(e,r).getOffset(t)},e.getOffset=r,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t=t||self).caretPos={})}(this,function(t){"use strict";function d(e,t){var n,o,r,i=document.createElement("div");return n=t,o={position:"absolute",left:-9999,top:0,zIndex:-2e3},"TEXTAREA"===e.tagName&&a.push("width"),a.forEach(function(t){o[t]=getComputedStyle(e)[t]}),r=o,Object.keys(r).forEach(function(t){i.style[t]=r[t]}),i.innerHTML=n,e.parentNode.insertBefore(i,e.nextSibling),{rect:function(){var t=i.ownerDocument.getElementById("caret-position-marker"),e={left:t.offsetLeft,top:t.offsetTop,height:t.offsetHeight};return i.parentNode.removeChild(i),e}}}var a=["borderBottomWidth","borderLeftWidth","borderRightWidth","borderTopStyle","borderRightStyle","borderBottomStyle","borderLeftStyle","borderTopWidth","boxSizing","fontFamily","fontSize","fontWeight","height","letterSpacing","lineHeight","marginBottom","marginLeft","marginRight","marginTop","outlineWidth","overflow","overflowX","overflowY","paddingBottom","paddingLeft","paddingRight","paddingTop","textAlign","textOverflow","textTransform","whiteSpace","wordBreak","wordWrap"];function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function f(t){var e=0<arguments.length&&void 0!==t?t:{},n=e.customPos,o=e.iframe,r=e.noShadowCaret;return o?{iframe:o,window:o.contentWindow,document:o.contentDocument||o.contentWindow.document,noShadowCaret:r,customPos:n}:{window:window,document:document,noShadowCaret:r,customPos:n}}function r(t,e){var n=e&&e.window||window,o=e&&e.document||document,r=t.getBoundingClientRect(),i=o.documentElement,a=n.pageXOffset||i.scrollLeft,f=n.pageYOffset||i.scrollTop;return{top:r.top+f,left:r.left+a}}function c(t){return"object"===e(t)&&null!==t}function o(f,c){function l(){return f.selectionStart}var o=function(t){function e(t){return t.replace(/<|>|`|"|&/g,"?").replace(/\r\n|\r|\n/g,"<br/>")}!c.customPos&&0!==c.customPos||(t=c.customPos);var n=void 0===t?l():t,o=f.value.slice(0,n),r=f.value.slice(n),i='<span style="position: relative; display: inline;">'.concat(e(o),"</span>");i+='<span id="caret-position-marker" style="position: relative; display: inline;">|</span>',i+='<span style="position: relative; display: inline;">'.concat(e(r),"</span>");var a=d(f,i).rect();return a.pos=l(),a};return{getPos:l,setPos:function(t){return f.setSelectionRange(t,t),f},getOffset:function(t){var e=r(f),n=o(t);return{top:e.top+n.top+c.document.body.scrollTop,left:e.left+n.left+c.document.body.scrollLeft,height:n.height}},getPosition:o}}function i(d,u){function i(){var t=s(),e={height:0,left:0,right:0};if(!t)return e;var n=u.customPos||0===u.customPos;if(0<t.endOffset-1&&t.endContainer!==d||n){var o=t.cloneRange(),r=n?u.customPos:t.endOffset;o.setStart(t.endContainer,r-1<0?0:r-1),o.setEnd(t.endContainer,r);var i=o.getBoundingClientRect();e={height:i.height,left:i.left+i.width,top:i.top},o.detach()}if((!e||e&&0===e.height)&&!u.noShadowCaret){var a=t.cloneRange(),f=u.document.createTextNode("|");a.insertNode(f),a.selectNode(f);var c=a.getBoundingClientRect();e={height:c.height,left:c.left,top:c.top},f.parentNode.removeChild(f),a.detach()}if(e){var l=u.document.documentElement;e.top+=u.window.pageYOffset-(l.clientTop||0),e.left+=u.window.pageXOffset-(l.clientLeft||0)}return e}var s=function(){if(u.window.getSelection){var t=u.window.getSelection();return 0<t.rangeCount?t.getRangeAt(0):null}},a=function(){var t=s(),e=t.cloneRange();e.selectNodeContents(d),e.setEnd(t.endContainer,t.endOffset);var n=e.toString().length;return e.detach(),n};return{getPos:a,setPos:function(a){var f=u.window.getSelection();if(f){var c=0,l=!1;!function t(e,n){for(var o=0;o<n.childNodes.length;o++){var r=n.childNodes[o];if(l)break;if(3===r.nodeType){if(c+r.length>=e){l=!0;var i=u.document.createRange();i.setStart(r,e-c),f.removeAllRanges(),f.addRange(i);break}c+=r.length}else t(a,r)}}(a,d)}return d},getPosition:function(){var t=i(),e=a(),n=d.getBoundingClientRect(),o=n.top+u.document.body.scrollTop,r=n.left+u.document.body.scrollLeft;return t.left-=r,t.top-=o,t.pos=e,t},getOffset:i,getRange:s}}function l(t,e){return(((n=t).contentEditable?"true"===n.contentEditable:"true"===n.getAttribute("contenteditable"))?i:o)(t,e);var n}t.getOffset=r,t.offset=function(t,e,n){var o=2<arguments.length&&void 0!==n?n:{};c(e)&&(o=e,e=null);var r=f(o);return l(t,r).getOffset(e)},t.position=function(t,e,n){var o=2<arguments.length&&void 0!==n?n:{};c(e)&&(o=e,e=null);var r=f(o),i=l(t,r);return e||0===e?i.setPos(e):i.getPosition()},Object.defineProperty(t,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=main.min.js.map |
var attributes = ['borderBottomWidth', 'borderLeftWidth', 'borderRightWidth', 'borderTopStyle', 'borderRightStyle', 'borderBottomStyle', 'borderLeftStyle', 'borderTopWidth', 'boxSizing', 'fontFamily', 'fontSize', 'fontWeight', 'height', 'letterSpacing', 'lineHeight', 'marginBottom', 'marginLeft', 'marginRight', 'marginTop', 'outlineWidth', 'overflow', 'overflowX', 'overflowY', 'paddingBottom', 'paddingLeft', 'paddingRight', 'paddingTop', 'textAlign', 'textOverflow', 'textTransform', 'whiteSpace', 'wordBreak', 'wordWrap']; | ||
/** | ||
@@ -11,4 +10,4 @@ * Create a mirror | ||
*/ | ||
var createMirror = function createMirror(element, html) { | ||
/** | ||
@@ -18,3 +17,2 @@ * The mirror element | ||
var mirror = document.createElement('div'); | ||
/** | ||
@@ -25,2 +23,3 @@ * Create the CSS for the mirror object | ||
*/ | ||
var mirrorCss = function mirrorCss() { | ||
@@ -41,6 +40,4 @@ var css = { | ||
}); | ||
return css; | ||
}; | ||
/** | ||
@@ -53,2 +50,4 @@ * Initialize the mirror | ||
*/ | ||
var initialize = function initialize(html) { | ||
@@ -62,3 +61,2 @@ var styles = mirrorCss(); | ||
}; | ||
/** | ||
@@ -69,2 +67,4 @@ * Get the rect | ||
*/ | ||
var rect = function rect() { | ||
@@ -78,3 +78,2 @@ var marker = mirror.ownerDocument.getElementById('caret-position-marker'); | ||
mirror.parentNode.removeChild(mirror); | ||
return boundingRect; | ||
@@ -84,3 +83,2 @@ }; | ||
initialize(html); | ||
return { | ||
@@ -91,8 +89,18 @@ rect: rect | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { | ||
return typeof obj; | ||
} : function (obj) { | ||
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; | ||
}; | ||
function _typeof(obj) { | ||
"@babel/helpers - typeof"; | ||
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { | ||
_typeof = function (obj) { | ||
return typeof obj; | ||
}; | ||
} else { | ||
_typeof = function (obj) { | ||
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; | ||
}; | ||
} | ||
return _typeof(obj); | ||
} | ||
/** | ||
@@ -108,3 +116,2 @@ * Check if a DOM Element is content editable | ||
}; | ||
/** | ||
@@ -117,2 +124,3 @@ * Get the context from settings passed in | ||
*/ | ||
var getContext = function getContext() { | ||
@@ -141,3 +149,2 @@ var settings = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
}; | ||
/** | ||
@@ -151,2 +158,3 @@ * Get the offset of an element | ||
*/ | ||
var getOffset = function getOffset(element, ctx) { | ||
@@ -159,3 +167,2 @@ var win = ctx && ctx.window || window; | ||
var scrollTop = win.pageYOffset || docEl.scrollTop; | ||
return { | ||
@@ -166,3 +173,2 @@ top: rect.top + scrollTop, | ||
}; | ||
/** | ||
@@ -175,4 +181,5 @@ * Check if a value is an object | ||
*/ | ||
var isObject = function isObject(value) { | ||
return (typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object' && value !== null; | ||
return _typeof(value) === 'object' && value !== null; | ||
}; | ||
@@ -186,4 +193,4 @@ | ||
*/ | ||
var createInputCaret = function createInputCaret(element, ctx) { | ||
/** | ||
@@ -197,3 +204,2 @@ * Get the current position | ||
}; | ||
/** | ||
@@ -206,8 +212,8 @@ * Set the position | ||
*/ | ||
var setPos = function setPos(pos) { | ||
element.setSelectionRange(pos, pos); | ||
return element; | ||
}; | ||
/** | ||
@@ -220,6 +226,7 @@ * The offset | ||
*/ | ||
var getOffset$$1 = function getOffset$$1(pos) { | ||
var getOffset$1 = function getOffset$1(pos) { | ||
var rect = getOffset(element); | ||
var position = getPosition(pos); | ||
return { | ||
@@ -231,3 +238,2 @@ top: rect.top + position.top + ctx.document.body.scrollTop, | ||
}; | ||
/** | ||
@@ -240,2 +246,4 @@ * Get the current position | ||
*/ | ||
var getPosition = function getPosition(pos) { | ||
@@ -254,10 +262,8 @@ var format = function format(val) { | ||
var endRange = element.value.slice(position); | ||
var html = '<span style="position: relative; display: inline;">' + format(startRange) + '</span>'; | ||
var html = "<span style=\"position: relative; display: inline;\">".concat(format(startRange), "</span>"); | ||
html += '<span id="caret-position-marker" style="position: relative; display: inline;">|</span>'; | ||
html += '<span style="position: relative; display: inline;">' + format(endRange) + '</span>'; | ||
html += "<span style=\"position: relative; display: inline;\">".concat(format(endRange), "</span>"); | ||
var mirror = createMirror(element, html); | ||
var rect = mirror.rect(); | ||
rect.pos = getPos(); | ||
return rect; | ||
@@ -269,3 +275,3 @@ }; | ||
setPos: setPos, | ||
getOffset: getOffset$$1, | ||
getOffset: getOffset$1, | ||
getPosition: getPosition | ||
@@ -283,3 +289,2 @@ }; | ||
var createEditableCaret = function createEditableCaret(element, ctx) { | ||
/** | ||
@@ -294,11 +299,15 @@ * Set the caret position | ||
var sel = ctx.window.getSelection(); | ||
if (sel) { | ||
var offset = 0; | ||
var found = false; | ||
var find = function find(position, parent) { | ||
for (var i = 0; i < parent.childNodes.length; i++) { | ||
var node = parent.childNodes[i]; | ||
if (found) { | ||
break; | ||
} | ||
if (node.nodeType === 3) { | ||
@@ -320,2 +329,3 @@ if (offset + node.length >= position) { | ||
}; | ||
find(pos, element); | ||
@@ -326,3 +336,2 @@ } | ||
}; | ||
/** | ||
@@ -333,2 +342,4 @@ * Get the offset | ||
*/ | ||
var getOffset = function getOffset() { | ||
@@ -346,6 +357,5 @@ var range = getRange(); | ||
var hasCustomPos = ctx.customPos || ctx.customPos === 0; | ||
var hasCustomPos = ctx.customPos || ctx.customPos === 0; // endContainer in Firefox would be the element at the start of | ||
// the line | ||
// endContainer in Firefox would be the element at the start of | ||
// the line | ||
if (range.endOffset - 1 > 0 && range.endContainer !== element || hasCustomPos) { | ||
@@ -367,6 +377,11 @@ var clonedRange = range.cloneRange(); | ||
var _clonedRange = range.cloneRange(); | ||
var shadowCaret = ctx.document.createTextNode('|'); | ||
_clonedRange.insertNode(shadowCaret); | ||
_clonedRange.selectNode(shadowCaret); | ||
var _rect = _clonedRange.getBoundingClientRect(); | ||
offset = { | ||
@@ -378,2 +393,3 @@ height: _rect.height, | ||
shadowCaret.parentNode.removeChild(shadowCaret); | ||
_clonedRange.detach(); | ||
@@ -390,3 +406,2 @@ } | ||
}; | ||
/** | ||
@@ -397,2 +412,4 @@ * Get the position | ||
*/ | ||
var getPosition = function getPosition() { | ||
@@ -409,6 +426,4 @@ var offset = getOffset(); | ||
offset.pos = pos; | ||
return offset; | ||
}; | ||
/** | ||
@@ -419,2 +434,4 @@ * Get the range | ||
*/ | ||
var getRange = function getRange() { | ||
@@ -424,7 +441,6 @@ if (!ctx.window.getSelection) { | ||
} | ||
var sel = ctx.window.getSelection(); | ||
return sel.rangeCount > 0 ? sel.getRangeAt(0) : null; | ||
}; | ||
/** | ||
@@ -435,2 +451,4 @@ * Get the caret position | ||
*/ | ||
var getPos = function getPos() { | ||
@@ -443,3 +461,2 @@ var range = getRange(); | ||
clonedRange.detach(); | ||
return pos; | ||
@@ -467,4 +484,4 @@ }; | ||
var settings = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; | ||
var options = settings; | ||
var options = settings; | ||
if (isObject(value)) { | ||
@@ -474,2 +491,3 @@ options = value; | ||
} | ||
var ctx = getContext(options); | ||
@@ -484,3 +502,2 @@ var caret = createCaret(element, ctx); | ||
}; | ||
/** | ||
@@ -492,6 +509,7 @@ * | ||
*/ | ||
var offset = function offset(element, value) { | ||
var settings = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; | ||
var options = settings; | ||
var options = settings; | ||
if (isObject(value)) { | ||
@@ -507,3 +525,3 @@ options = value; | ||
export { position, offset, getOffset }; | ||
export { getOffset, offset, position }; | ||
//# sourceMappingURL=main.js.map |
{ | ||
"name": "caret-pos", | ||
"version": "1.2.2", | ||
"version": "2.0.0", | ||
"description": "Locate the current position of the caret. A plain JavaScript version of Caret.js.", | ||
@@ -34,3 +34,3 @@ "main": "lib/bundle/main.min.js", | ||
}, | ||
"author": "Deshiknaves <deshi@deshiknaves.com> (https://github.com/deshiknaves/)", | ||
"author": "Deshiknaves <nawal.rahim@gmail.com> (https://github.com/deshiknaves/)", | ||
"contributors": [ | ||
@@ -41,32 +41,30 @@ "Aram Drevekenin <grimsniffer@gmail.com> (https://github.com/imsnif/)" | ||
"devDependencies": { | ||
"babel-core": "^6.26.0", | ||
"babel-plugin-transform-es2015-modules-commonjs": "^6.26.0", | ||
"babel-plugin-transform-export-extensions": "^6.22.0", | ||
"babel-plugin-transform-runtime": "^6.23.0", | ||
"babel-preset-env": "^1.6.1", | ||
"babel-preset-es2015": "^6.24.1", | ||
"babel-preset-es2015-rollup": "^3.0.0", | ||
"babel-preset-stage-1": "^6.24.1", | ||
"eslint-plugin-jasmine": "^2.9.1", | ||
"@babel/core": "^7.10.2", | ||
"@babel/plugin-syntax-export-extensions": "^7.0.0-beta.32", | ||
"@babel/plugin-transform-modules-commonjs": "^7.10.1", | ||
"@babel/plugin-transform-runtime": "^7.10.1", | ||
"@babel/preset-env": "^7.10.2", | ||
"@rollup/plugin-babel": "^5.0.2", | ||
"@rollup/plugin-commonjs": "^12.0.0", | ||
"@rollup/plugin-node-resolve": "^8.0.0", | ||
"eslint": "^7.1.0", | ||
"eslint-plugin-jasmine": "^4.1.1", | ||
"gulp": "^4.0.2", | ||
"gulp-rename": "^1.2.2", | ||
"gulp-sourcemaps": "^2.6.4", | ||
"gulp-uglify": "^3.0.0", | ||
"jasmine": "^2.9.0", | ||
"karma": "^4.4.1", | ||
"karma-babel-preprocessor": "^7.0.0", | ||
"karma-chrome-launcher": "^2.2.0", | ||
"karma-jasmine": "^1.1.1", | ||
"karma-rollup-preprocessor": "^5.1.1", | ||
"puppeteer": "^1.7.0", | ||
"rimraf": "^2.6.2", | ||
"rollup": "^0.54.0", | ||
"rollup-plugin-babel": "^3.0.3", | ||
"rollup-plugin-commonjs": "^8.2.6", | ||
"rollup-plugin-eslint": "^4.0.0", | ||
"rollup-plugin-livereload": "^1.0.4", | ||
"rollup-plugin-node-resolve": "^3.0.2", | ||
"rollup-plugin-serve": "^0.4.2" | ||
"gulp-rename": "^2.0.0", | ||
"gulp-sourcemaps": "^2.6.5", | ||
"gulp-uglify": "^3.0.2", | ||
"jasmine": "^3.5.0", | ||
"karma": "^5.0.9", | ||
"karma-babel-preprocessor": "^8.0.1", | ||
"karma-chrome-launcher": "^3.1.0", | ||
"karma-jasmine": "^3.3.1", | ||
"karma-rollup-preprocessor": "^7.0.5", | ||
"puppeteer": "^3.2.0", | ||
"rimraf": "^3.0.2", | ||
"rollup": "^2.12.0", | ||
"rollup-plugin-eslint": "^7.0.0", | ||
"rollup-plugin-livereload": "^1.3.0", | ||
"rollup-plugin-serve": "^1.0.1" | ||
}, | ||
"dependencies": {} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
123041
26
1574