input-sim
Advanced tools
Comparing version 2.0.4 to 2.0.5
@@ -189,3 +189,3 @@ (function() { | ||
}(); | ||
var tmp$index$$$__Object$defineProperties = Object.defineProperties; | ||
var $$index$$$__Object$defineProperties = Object.defineProperties; | ||
@@ -199,3 +199,3 @@ /** | ||
*/ | ||
var tmp$index$$Affinity = { | ||
var $$index$$Affinity = { | ||
UPSTREAM: 0, | ||
@@ -213,3 +213,3 @@ DOWNSTREAM: 1, | ||
*/ | ||
function tmp$index$$isWordChar(chr) { | ||
function $$index$$isWordChar(chr) { | ||
return chr && /^\w$/.test(chr); | ||
@@ -227,7 +227,7 @@ } | ||
*/ | ||
function tmp$index$$hasLeftWordBreakAtIndex(text, index) { | ||
function $$index$$hasLeftWordBreakAtIndex(text, index) { | ||
if (index === 0) { | ||
return true; | ||
} else { | ||
return !tmp$index$$isWordChar(text[index - 1]) && tmp$index$$isWordChar(text[index]); | ||
return !$$index$$isWordChar(text[index - 1]) && $$index$$isWordChar(text[index]); | ||
} | ||
@@ -245,11 +245,11 @@ } | ||
*/ | ||
function tmp$index$$hasRightWordBreakAtIndex(text, index) { | ||
function $$index$$hasRightWordBreakAtIndex(text, index) { | ||
if (index === text.length - 1) { | ||
return true; | ||
} else { | ||
return tmp$index$$isWordChar(text[index]) && !tmp$index$$isWordChar(text[index + 1]); | ||
return $$index$$isWordChar(text[index]) && !$$index$$isWordChar(text[index + 1]); | ||
} | ||
} | ||
var tmp$index$$Input = function() { | ||
var $$index$$Input = function() { | ||
"use strict"; | ||
@@ -264,3 +264,3 @@ | ||
this.shouldCancelEvents = true; | ||
this.selectionAffinity = tmp$index$$Affinity.NONE; | ||
this.selectionAffinity = $$index$$Affinity.NONE; | ||
@@ -276,3 +276,3 @@ if(value) { | ||
tmp$index$$$__Object$defineProperties(Input.prototype, { | ||
$$index$$$__Object$defineProperties(Input.prototype, { | ||
clearSelection: { | ||
@@ -470,4 +470,4 @@ value: function() { | ||
switch (this.selectionAffinity) { | ||
case tmp$index$$Affinity.UPSTREAM: | ||
case tmp$index$$Affinity.NONE: | ||
case $$index$$Affinity.UPSTREAM: | ||
case $$index$$Affinity.NONE: | ||
// 12<34 56|78 => <1234 56|78 | ||
@@ -477,3 +477,3 @@ range.length += range.start; | ||
break; | ||
case tmp$index$$Affinity.DOWNSTREAM: | ||
case $$index$$Affinity.DOWNSTREAM: | ||
// 12|34 56>78 => <12|34 5678 | ||
@@ -484,3 +484,3 @@ range.length = range.start; | ||
} | ||
this.setSelectedRangeWithAffinity(range, tmp$index$$Affinity.UPSTREAM); | ||
this.setSelectedRangeWithAffinity(range, $$index$$Affinity.UPSTREAM); | ||
}, | ||
@@ -497,4 +497,4 @@ | ||
switch (this.selectionAffinity) { | ||
case tmp$index$$Affinity.UPSTREAM: | ||
case tmp$index$$Affinity.NONE: | ||
case $$index$$Affinity.UPSTREAM: | ||
case $$index$$Affinity.NONE: | ||
// 12<34 56|78 => <1234 56|78 | ||
@@ -504,3 +504,3 @@ range.length += range.start; | ||
break; | ||
case tmp$index$$Affinity.DOWNSTREAM: | ||
case $$index$$Affinity.DOWNSTREAM: | ||
// 12|34 56>78 => 12|34 5678 | ||
@@ -510,3 +510,3 @@ range.length = 0; | ||
} | ||
this.setSelectedRangeWithAffinity(range, tmp$index$$Affinity.UPSTREAM); | ||
this.setSelectedRangeWithAffinity(range, $$index$$Affinity.UPSTREAM); | ||
}, | ||
@@ -534,3 +534,3 @@ | ||
range.start = 0; | ||
this.setSelectedRangeWithAffinity(range, tmp$index$$Affinity.UPSTREAM); | ||
this.setSelectedRangeWithAffinity(range, $$index$$Affinity.UPSTREAM); | ||
}, | ||
@@ -550,3 +550,3 @@ | ||
}; | ||
this.setSelectedRangeWithAffinity(range, tmp$index$$Affinity.NONE); | ||
this.setSelectedRangeWithAffinity(range, $$index$$Affinity.NONE); | ||
}, | ||
@@ -572,7 +572,7 @@ | ||
var end = this.text().length; | ||
if (this.selectionAffinity === tmp$index$$Affinity.UPSTREAM) { | ||
if (this.selectionAffinity === $$index$$Affinity.UPSTREAM) { | ||
range.start += range.length; | ||
} | ||
range.length = end - range.start; | ||
this.setSelectedRangeWithAffinity(range, tmp$index$$Affinity.DOWNSTREAM); | ||
this.setSelectedRangeWithAffinity(range, $$index$$Affinity.DOWNSTREAM); | ||
}, | ||
@@ -589,8 +589,8 @@ | ||
switch (this.selectionAffinity) { | ||
case tmp$index$$Affinity.DOWNSTREAM: | ||
case tmp$index$$Affinity.NONE: | ||
case $$index$$Affinity.DOWNSTREAM: | ||
case $$index$$Affinity.NONE: | ||
// 12|34 56>78 => 12|34 5678> | ||
range.length = this.text().length - range.start; | ||
break; | ||
case tmp$index$$Affinity.UPSTREAM: | ||
case $$index$$Affinity.UPSTREAM: | ||
// 12<34 56|78 => 12|34 5678 | ||
@@ -601,3 +601,3 @@ range.start += range.length; | ||
} | ||
this.setSelectedRangeWithAffinity(range, tmp$index$$Affinity.DOWNSTREAM); | ||
this.setSelectedRangeWithAffinity(range, $$index$$Affinity.DOWNSTREAM); | ||
}, | ||
@@ -624,3 +624,3 @@ | ||
range.length = this.text().length - range.start; | ||
this.setSelectedRangeWithAffinity(range, tmp$index$$Affinity.DOWNSTREAM); | ||
this.setSelectedRangeWithAffinity(range, $$index$$Affinity.DOWNSTREAM); | ||
}, | ||
@@ -641,3 +641,3 @@ | ||
} | ||
this.setSelectedRangeWithAffinity(range, tmp$index$$Affinity.NONE); | ||
this.setSelectedRangeWithAffinity(range, $$index$$Affinity.NONE); | ||
}, | ||
@@ -654,9 +654,9 @@ | ||
switch (this.selectionAffinity) { | ||
case tmp$index$$Affinity.UPSTREAM: | ||
case tmp$index$$Affinity.NONE: | ||
this.selectionAffinity = tmp$index$$Affinity.UPSTREAM; | ||
case $$index$$Affinity.UPSTREAM: | ||
case $$index$$Affinity.NONE: | ||
this.selectionAffinity = $$index$$Affinity.UPSTREAM; | ||
range.start--; | ||
range.length++; | ||
break; | ||
case tmp$index$$Affinity.DOWNSTREAM: | ||
case $$index$$Affinity.DOWNSTREAM: | ||
range.length--; | ||
@@ -688,5 +688,5 @@ break; | ||
switch (this.selectionAffinity) { | ||
case tmp$index$$Affinity.UPSTREAM: | ||
case tmp$index$$Affinity.NONE: | ||
this.selectionAffinity = tmp$index$$Affinity.UPSTREAM; | ||
case $$index$$Affinity.UPSTREAM: | ||
case $$index$$Affinity.NONE: | ||
this.selectionAffinity = $$index$$Affinity.UPSTREAM; | ||
var start = this._lastWordBreakBeforeIndex(range.start - 1); | ||
@@ -696,3 +696,3 @@ range.length += range.start - start; | ||
break; | ||
case tmp$index$$Affinity.DOWNSTREAM: | ||
case $$index$$Affinity.DOWNSTREAM: | ||
var end = this._lastWordBreakBeforeIndex(range.start + range.length); | ||
@@ -728,3 +728,3 @@ if (end < range.start) { | ||
range.start = 0; | ||
this.setSelectedRangeWithAffinity(range, tmp$index$$Affinity.UPSTREAM); | ||
this.setSelectedRangeWithAffinity(range, $$index$$Affinity.UPSTREAM); | ||
}, | ||
@@ -746,3 +746,3 @@ | ||
} | ||
this.setSelectedRangeWithAffinity(range, tmp$index$$Affinity.NONE); | ||
this.setSelectedRangeWithAffinity(range, $$index$$Affinity.NONE); | ||
}, | ||
@@ -759,9 +759,9 @@ | ||
switch (this.selectionAffinity) { | ||
case tmp$index$$Affinity.UPSTREAM: | ||
case $$index$$Affinity.UPSTREAM: | ||
range.start++; | ||
range.length--; | ||
break; | ||
case tmp$index$$Affinity.DOWNSTREAM: | ||
case tmp$index$$Affinity.NONE: | ||
this.selectionAffinity = tmp$index$$Affinity.DOWNSTREAM; | ||
case $$index$$Affinity.DOWNSTREAM: | ||
case $$index$$Affinity.NONE: | ||
this.selectionAffinity = $$index$$Affinity.DOWNSTREAM; | ||
range.length++; | ||
@@ -796,8 +796,8 @@ break; | ||
switch (this.selectionAffinity) { | ||
case tmp$index$$Affinity.UPSTREAM: | ||
case $$index$$Affinity.UPSTREAM: | ||
start = Math.min(this._nextWordBreakAfterIndex(start), end); | ||
break; | ||
case tmp$index$$Affinity.DOWNSTREAM: | ||
case tmp$index$$Affinity.NONE: | ||
this.selectionAffinity = tmp$index$$Affinity.DOWNSTREAM; | ||
case $$index$$Affinity.DOWNSTREAM: | ||
case $$index$$Affinity.NONE: | ||
this.selectionAffinity = $$index$$Affinity.DOWNSTREAM; | ||
end = this._nextWordBreakAfterIndex(range.start + range.length); | ||
@@ -828,3 +828,3 @@ break; | ||
range.length = this.text().length - range.start; | ||
this.setSelectedRangeWithAffinity(range, tmp$index$$Affinity.DOWNSTREAM); | ||
this.setSelectedRangeWithAffinity(range, $$index$$Affinity.DOWNSTREAM); | ||
}, | ||
@@ -844,3 +844,3 @@ | ||
this.setText(text); | ||
this.setSelectedRangeWithAffinity(range, tmp$index$$Affinity.NONE); | ||
this.setSelectedRangeWithAffinity(range, $$index$$Affinity.NONE); | ||
}, | ||
@@ -857,3 +857,3 @@ | ||
for (var i = 0, l = text.length; i < l; i++) { | ||
if (tmp$index$$hasRightWordBreakAtIndex(text, i)) { | ||
if ($$index$$hasRightWordBreakAtIndex(text, i)) { | ||
result.push(i + 1); | ||
@@ -875,3 +875,3 @@ } | ||
length: this.text().length | ||
}, tmp$index$$Affinity.NONE); | ||
}, $$index$$Affinity.NONE); | ||
}, | ||
@@ -935,3 +935,3 @@ | ||
} | ||
this.selectionAffinity = range.length === 0 ? tmp$index$$Affinity.NONE : affinity; | ||
this.selectionAffinity = range.length === 0 ? $$index$$Affinity.NONE : affinity; | ||
return this._selectedRange; | ||
@@ -948,8 +948,8 @@ }, | ||
switch (this.selectionAffinity) { | ||
case tmp$index$$Affinity.UPSTREAM: | ||
case $$index$$Affinity.UPSTREAM: | ||
return range.start + range.length; | ||
case tmp$index$$Affinity.DOWNSTREAM: | ||
case $$index$$Affinity.DOWNSTREAM: | ||
return range.start; | ||
default: | ||
return tmp$index$$Affinity.NONE; | ||
return $$index$$Affinity.NONE; | ||
} | ||
@@ -1013,3 +1013,3 @@ }, | ||
for (var i = 0, l = text.length; i < l; i++) { | ||
if (tmp$index$$hasLeftWordBreakAtIndex(text, i)) { | ||
if ($$index$$hasLeftWordBreakAtIndex(text, i)) { | ||
result.push(i); | ||
@@ -1048,4 +1048,4 @@ } | ||
var tmp$index$$InputSim = { | ||
Input: tmp$index$$Input, | ||
var input$sim$umd$$InputSim = { | ||
Input: $$index$$Input, | ||
KEYS: $$keybindings$$KEYS, | ||
@@ -1056,9 +1056,9 @@ keyBindingsForPlatform: $$keybindings$$keyBindingsForPlatform | ||
if (typeof define === 'function' && define.amd) { | ||
define(function() { return tmp$index$$InputSim; }); | ||
define(function() { return input$sim$umd$$InputSim; }); | ||
} else if (typeof module !== 'undefined' && module.exports) { | ||
module.exports = tmp$index$$InputSim; | ||
module.exports = input$sim$umd$$InputSim; | ||
} else if (typeof window !== 'undefined') { | ||
window.InputSim = tmp$index$$InputSim; | ||
window.InputSim = input$sim$umd$$InputSim; | ||
} else { | ||
this.InputSim = tmp$index$$InputSim; | ||
this.InputSim = input$sim$umd$$InputSim; | ||
} | ||
@@ -1065,0 +1065,0 @@ }).call(this); |
@@ -1160,16 +1160,3 @@ import { KEYS, keyBindingsForPlatform } from './keybindings'; | ||
var InputSim = { | ||
Input: Input, | ||
KEYS: KEYS, | ||
keyBindingsForPlatform: keyBindingsForPlatform | ||
}; | ||
export { Input, KEYS, keyBindingsForPlatform }; | ||
if (typeof define === 'function' && define.amd) { | ||
define(function() { return InputSim; }); | ||
} else if (typeof module !== 'undefined' && module.exports) { | ||
module.exports = InputSim; | ||
} else if (typeof window !== 'undefined') { | ||
window.InputSim = InputSim; | ||
} else { | ||
this.InputSim = InputSim; | ||
} |
{ | ||
"name": "input-sim", | ||
"version": "2.0.4", | ||
"version": "2.0.5", | ||
"description": "Simulate keyboard events and selection ranges for inputs", | ||
"main": "dist/index.js", | ||
"jsnext:main": "lib/index.js", | ||
"scripts": { | ||
@@ -39,2 +40,2 @@ "build": "make", | ||
} | ||
} | ||
} |
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
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
297958
36
3456
1