dom-helpers
Advanced tools
Comparing version 2.4.0 to 3.0.0
'use strict'; | ||
var babelHelpers = require('./util/babelHelpers.js'); | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = activeElement; | ||
exports.__esModule = true; | ||
var _ownerDocument = require('./ownerDocument'); | ||
/** | ||
* document.activeElement | ||
*/ | ||
exports['default'] = activeElement; | ||
var _ownerDocument2 = _interopRequireDefault(_ownerDocument); | ||
var _ownerDocument = require('./ownerDocument'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var _ownerDocument2 = babelHelpers.interopRequireDefault(_ownerDocument); | ||
function activeElement() { | ||
var doc = arguments[0] === undefined ? document : arguments[0]; | ||
var doc = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : (0, _ownerDocument2.default)(); | ||
try { | ||
return doc.activeElement; | ||
} catch (e) {} | ||
} catch (e) {/* ie throws if no active element */} | ||
} | ||
module.exports = exports['default']; |
'use strict'; | ||
var hasClass = require('./hasClass'); | ||
module.exports = function addClass(element, className) { | ||
if (element.classList) element.classList.add(className);else if (!hasClass(element)) element.className = element.className + ' ' + className; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = addClass; | ||
var _hasClass = require('./hasClass'); | ||
var _hasClass2 = _interopRequireDefault(_hasClass); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function addClass(element, className) { | ||
if (element.classList) element.classList.add(className);else if (!(0, _hasClass2.default)(element)) element.className = element.className + ' ' + className; | ||
} | ||
module.exports = exports['default']; |
@@ -1,4 +0,10 @@ | ||
'use strict'; | ||
module.exports = function hasClass(element, className) { | ||
if (element.classList) return !!className && element.classList.contains(className);else return (' ' + element.className + ' ').indexOf(' ' + className + ' ') !== -1; | ||
}; | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = hasClass; | ||
function hasClass(element, className) { | ||
if (element.classList) return !!className && element.classList.contains(className);else return (" " + element.className + " ").indexOf(" " + className + " ") !== -1; | ||
} | ||
module.exports = exports["default"]; |
'use strict'; | ||
module.exports = { | ||
addClass: require('./addClass'), | ||
removeClass: require('./removeClass'), | ||
hasClass: require('./hasClass') | ||
}; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.hasClass = exports.removeClass = exports.addClass = undefined; | ||
var _addClass = require('./addClass'); | ||
var _addClass2 = _interopRequireDefault(_addClass); | ||
var _removeClass = require('./removeClass'); | ||
var _removeClass2 = _interopRequireDefault(_removeClass); | ||
var _hasClass = require('./hasClass'); | ||
var _hasClass2 = _interopRequireDefault(_hasClass); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
exports.addClass = _addClass2.default; | ||
exports.removeClass = _removeClass2.default; | ||
exports.hasClass = _hasClass2.default; | ||
exports.default = { addClass: _addClass2.default, removeClass: _removeClass2.default, hasClass: _hasClass2.default }; |
'use strict'; | ||
var contains = require('../query/contains'), | ||
qsa = require('../query/querySelectorAll'); | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = filterEvents; | ||
module.exports = function (selector, handler) { | ||
return function (e) { | ||
var _contains = require('../query/contains'); | ||
var _contains2 = _interopRequireDefault(_contains); | ||
var _querySelectorAll = require('../query/querySelectorAll'); | ||
var _querySelectorAll2 = _interopRequireDefault(_querySelectorAll); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function filterEvents(selector, handler) { | ||
return function filterHandler(e) { | ||
var top = e.currentTarget, | ||
target = e.target, | ||
matches = qsa(top, selector); | ||
matches = (0, _querySelectorAll2.default)(top, selector); | ||
if (matches.some(function (match) { | ||
return contains(match, target); | ||
return (0, _contains2.default)(match, target); | ||
})) handler.call(this, e); | ||
}; | ||
}; | ||
} | ||
module.exports = exports['default']; |
'use strict'; | ||
var on = require('./on'), | ||
off = require('./off'), | ||
filter = require('./filter'); | ||
module.exports = { on: on, off: off, filter: filter }; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.listen = exports.filter = exports.off = exports.on = undefined; | ||
var _on = require('./on'); | ||
var _on2 = _interopRequireDefault(_on); | ||
var _off = require('./off'); | ||
var _off2 = _interopRequireDefault(_off); | ||
var _filter = require('./filter'); | ||
var _filter2 = _interopRequireDefault(_filter); | ||
var _listen = require('./listen'); | ||
var _listen2 = _interopRequireDefault(_listen); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
exports.on = _on2.default; | ||
exports.off = _off2.default; | ||
exports.filter = _filter2.default; | ||
exports.listen = _listen2.default; | ||
exports.default = { on: _on2.default, off: _off2.default, filter: _filter2.default, listen: _listen2.default }; |
'use strict'; | ||
var canUseDOM = require('../util/inDOM'); | ||
var off = function off() {}; | ||
if (canUseDOM) { | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
off = (function () { | ||
var _inDOM = require('../util/inDOM'); | ||
var _inDOM2 = _interopRequireDefault(_inDOM); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var off = function off() {}; | ||
if (_inDOM2.default) { | ||
off = function () { | ||
if (document.addEventListener) return function (node, eventName, handler, capture) { | ||
@@ -14,5 +21,6 @@ return node.removeEventListener(eventName, handler, capture || false); | ||
}; | ||
})(); | ||
}(); | ||
} | ||
module.exports = off; | ||
exports.default = off; | ||
module.exports = exports['default']; |
'use strict'; | ||
var canUseDOM = require('../util/inDOM'); | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var _inDOM = require('../util/inDOM'); | ||
var _inDOM2 = _interopRequireDefault(_inDOM); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var on = function on() {}; | ||
if (_inDOM2.default) { | ||
on = function () { | ||
if (canUseDOM) { | ||
on = (function () { | ||
if (document.addEventListener) return function (node, eventName, handler, capture) { | ||
@@ -13,5 +22,6 @@ return node.addEventListener(eventName, handler, capture || false); | ||
}; | ||
})(); | ||
}(); | ||
} | ||
module.exports = on; | ||
exports.default = on; | ||
module.exports = exports['default']; |
58
index.js
'use strict'; | ||
var babelHelpers = require('./util/babelHelpers.js'); | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.requestAnimationFrame = exports.ownerWindow = exports.ownerDocument = exports.activeElement = exports.query = exports.events = exports.style = undefined; | ||
var style = require('./style'), | ||
events = require('./events'), | ||
query = require('./query'), | ||
activeElement = require('./activeElement'), | ||
ownerDocument = require('./ownerDocument'), | ||
ownerWindow = require('./ownerWindow'); | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
module.exports = babelHelpers._extends({}, style, events, query, { | ||
var _style = require('./style'); | ||
activeElement: activeElement, | ||
ownerDocument: ownerDocument, | ||
ownerWindow: ownerWindow, | ||
var _style2 = _interopRequireDefault(_style); | ||
requestAnimationFrame: require('./util/requestAnimationFrame') | ||
var _events = require('./events'); | ||
var _events2 = _interopRequireDefault(_events); | ||
var _query = require('./query'); | ||
var _query2 = _interopRequireDefault(_query); | ||
var _activeElement = require('./activeElement'); | ||
var _activeElement2 = _interopRequireDefault(_activeElement); | ||
var _ownerDocument = require('./ownerDocument'); | ||
var _ownerDocument2 = _interopRequireDefault(_ownerDocument); | ||
var _ownerWindow = require('./ownerWindow'); | ||
var _ownerWindow2 = _interopRequireDefault(_ownerWindow); | ||
var _requestAnimationFrame = require('./util/requestAnimationFrame'); | ||
var _requestAnimationFrame2 = _interopRequireDefault(_requestAnimationFrame); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
exports.style = _style2.default; | ||
exports.events = _events2.default; | ||
exports.query = _query2.default; | ||
exports.activeElement = _activeElement2.default; | ||
exports.ownerDocument = _ownerDocument2.default; | ||
exports.ownerWindow = _ownerWindow2.default; | ||
exports.requestAnimationFrame = _requestAnimationFrame2.default; | ||
exports.default = _extends({}, _events2.default, _query2.default, { | ||
style: _style2.default, | ||
activeElement: _activeElement2.default, | ||
ownerDocument: _ownerDocument2.default, | ||
ownerWindow: _ownerWindow2.default, | ||
requestAnimationFrame: _requestAnimationFrame2.default | ||
}); |
"use strict"; | ||
exports.__esModule = true; | ||
exports["default"] = ownerDocument; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = ownerDocument; | ||
function ownerDocument(node) { | ||
return node && node.ownerDocument || document; | ||
} | ||
module.exports = exports["default"]; |
'use strict'; | ||
var babelHelpers = require('./util/babelHelpers.js'); | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = ownerWindow; | ||
exports.__esModule = true; | ||
exports['default'] = ownerWindow; | ||
var _ownerDocument = require('./ownerDocument'); | ||
var _ownerDocument2 = babelHelpers.interopRequireDefault(_ownerDocument); | ||
var _ownerDocument2 = _interopRequireDefault(_ownerDocument); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function ownerWindow(node) { | ||
var doc = (0, _ownerDocument2['default'])(node); | ||
var doc = (0, _ownerDocument2.default)(node); | ||
return doc && doc.defaultView || doc.parentWindow; | ||
} | ||
module.exports = exports['default']; |
{ | ||
"name": "dom-helpers", | ||
"version": "2.4.0", | ||
"version": "3.0.0", | ||
"description": "tiny modular DOM lib for ie8+ ", | ||
@@ -26,9 +26,3 @@ "author": { | ||
"css" | ||
], | ||
"scripts": { | ||
"test": "karma start --single-run", | ||
"tdd": "karma start", | ||
"clean": "gulp clean", | ||
"build": "gulp build" | ||
} | ||
} | ||
] | ||
} |
'use strict'; | ||
var babelHelpers = require('../util/babelHelpers.js'); | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = closest; | ||
exports.__esModule = true; | ||
exports['default'] = closest; | ||
var _matches = require('./matches'); | ||
var _matches2 = babelHelpers.interopRequireDefault(_matches); | ||
var _matches2 = _interopRequireDefault(_matches); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var isDoc = function isDoc(obj) { | ||
@@ -17,3 +19,3 @@ return obj != null && obj.nodeType === obj.DOCUMENT_NODE; | ||
function closest(node, selector, context) { | ||
while (node && (isDoc(node) || !(0, _matches2['default'])(node, selector))) { | ||
while (node && (isDoc(node) || !(0, _matches2.default)(node, selector))) { | ||
node = node !== context && !isDoc(node) ? node.parentNode : undefined; | ||
@@ -23,3 +25,2 @@ } | ||
} | ||
module.exports = exports['default']; |
'use strict'; | ||
var canUseDOM = require('../util/inDOM'); | ||
var contains = (function () { | ||
var root = canUseDOM && document.documentElement; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var _inDOM = require('../util/inDOM'); | ||
var _inDOM2 = _interopRequireDefault(_inDOM); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
exports.default = function () { | ||
var root = _inDOM2.default && document.documentElement; | ||
return root && root.contains ? function (context, node) { | ||
@@ -18,4 +27,4 @@ return context.contains(node); | ||
}; | ||
})(); | ||
}(); | ||
module.exports = contains; | ||
module.exports = exports['default']; |
'use strict'; | ||
var offset = require('./offset'), | ||
getWindow = require('./isWindow'); | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = height; | ||
module.exports = function height(node, client) { | ||
var win = getWindow(node); | ||
return win ? win.innerHeight : client ? node.clientHeight : offset(node).height; | ||
}; | ||
var _offset = require('./offset'); | ||
var _offset2 = _interopRequireDefault(_offset); | ||
var _isWindow = require('./isWindow'); | ||
var _isWindow2 = _interopRequireDefault(_isWindow); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function height(node, client) { | ||
var win = (0, _isWindow2.default)(node); | ||
return win ? win.innerHeight : client ? node.clientHeight : (0, _offset2.default)(node).height; | ||
} | ||
module.exports = exports['default']; |
'use strict'; | ||
module.exports = { | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.closest = exports.querySelectorAll = exports.scrollTop = exports.scrollParent = exports.contains = exports.position = exports.offsetParent = exports.offset = exports.width = exports.height = exports.matches = undefined; | ||
matches: require('./matches'), | ||
var _matches = require('./matches'); | ||
height: require('./height'), | ||
var _matches2 = _interopRequireDefault(_matches); | ||
width: require('./width'), | ||
var _height = require('./height'); | ||
offset: require('./offset'), | ||
var _height2 = _interopRequireDefault(_height); | ||
offsetParent: require('./offsetParent'), | ||
var _width = require('./width'); | ||
position: require('./position'), | ||
var _width2 = _interopRequireDefault(_width); | ||
contains: require('./contains'), | ||
var _offset = require('./offset'); | ||
scrollParent: require('./scrollParent'), | ||
var _offset2 = _interopRequireDefault(_offset); | ||
scrollTop: require('./scrollTop'), | ||
var _offsetParent = require('./offsetParent'); | ||
querySelectorAll: require('./querySelectorAll'), | ||
var _offsetParent2 = _interopRequireDefault(_offsetParent); | ||
closest: require('./closest') | ||
var _position = require('./position'); | ||
var _position2 = _interopRequireDefault(_position); | ||
var _contains = require('./contains'); | ||
var _contains2 = _interopRequireDefault(_contains); | ||
var _scrollParent = require('./scrollParent'); | ||
var _scrollParent2 = _interopRequireDefault(_scrollParent); | ||
var _scrollTop = require('./scrollTop'); | ||
var _scrollTop2 = _interopRequireDefault(_scrollTop); | ||
var _querySelectorAll = require('./querySelectorAll'); | ||
var _querySelectorAll2 = _interopRequireDefault(_querySelectorAll); | ||
var _closest = require('./closest'); | ||
var _closest2 = _interopRequireDefault(_closest); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
exports.matches = _matches2.default; | ||
exports.height = _height2.default; | ||
exports.width = _width2.default; | ||
exports.offset = _offset2.default; | ||
exports.offsetParent = _offsetParent2.default; | ||
exports.position = _position2.default; | ||
exports.contains = _contains2.default; | ||
exports.scrollParent = _scrollParent2.default; | ||
exports.scrollTop = _scrollTop2.default; | ||
exports.querySelectorAll = _querySelectorAll2.default; | ||
exports.closest = _closest2.default; | ||
exports.default = { | ||
matches: _matches2.default, | ||
height: _height2.default, | ||
width: _width2.default, | ||
offset: _offset2.default, | ||
offsetParent: _offsetParent2.default, | ||
position: _position2.default, | ||
contains: _contains2.default, | ||
scrollParent: _scrollParent2.default, | ||
scrollTop: _scrollTop2.default, | ||
querySelectorAll: _querySelectorAll2.default, | ||
closest: _closest2.default | ||
}; |
@@ -1,5 +0,10 @@ | ||
'use strict'; | ||
"use strict"; | ||
module.exports = function getWindow(node) { | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = getWindow; | ||
function getWindow(node) { | ||
return node === node.window ? node : node.nodeType === 9 ? node.defaultView || node.parentWindow : false; | ||
}; | ||
} | ||
module.exports = exports["default"]; |
'use strict'; | ||
var canUseDOM = require('../util/inDOM'), | ||
qsa = require('./querySelectorAll'), | ||
matches; | ||
if (canUseDOM) { | ||
var body = document.body, | ||
nativeMatch = body.matches || body.matchesSelector || body.webkitMatchesSelector || body.mozMatchesSelector || body.msMatchesSelector; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
matches = nativeMatch ? function (node, selector) { | ||
return nativeMatch.call(node, selector); | ||
} : ie8MatchesSelector; | ||
var _inDOM = require('../util/inDOM'); | ||
var _inDOM2 = _interopRequireDefault(_inDOM); | ||
var _querySelectorAll = require('./querySelectorAll'); | ||
var _querySelectorAll2 = _interopRequireDefault(_querySelectorAll); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var matches = void 0; | ||
if (_inDOM2.default) { | ||
(function () { | ||
var body = document.body; | ||
var nativeMatch = body.matches || body.matchesSelector || body.webkitMatchesSelector || body.mozMatchesSelector || body.msMatchesSelector; | ||
matches = nativeMatch ? function (node, selector) { | ||
return nativeMatch.call(node, selector); | ||
} : ie8MatchesSelector; | ||
})(); | ||
} | ||
module.exports = matches; | ||
exports.default = matches; | ||
function ie8MatchesSelector(node, selector) { | ||
var matches = qsa(node.document || node.ownerDocument, selector), | ||
var matches = (0, _querySelectorAll2.default)(node.document || node.ownerDocument, selector), | ||
i = 0; | ||
while (matches[i] && matches[i] !== node) i++; | ||
return !!matches[i]; | ||
} | ||
while (matches[i] && matches[i] !== node) { | ||
i++; | ||
}return !!matches[i]; | ||
} | ||
module.exports = exports['default']; |
'use strict'; | ||
var contains = require('./contains'), | ||
getWindow = require('./isWindow'), | ||
ownerDocument = require('../ownerDocument'); | ||
module.exports = function offset(node) { | ||
var doc = ownerDocument(node), | ||
win = getWindow(doc), | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = offset; | ||
var _contains = require('./contains'); | ||
var _contains2 = _interopRequireDefault(_contains); | ||
var _isWindow = require('./isWindow'); | ||
var _isWindow2 = _interopRequireDefault(_isWindow); | ||
var _ownerDocument = require('../ownerDocument'); | ||
var _ownerDocument2 = _interopRequireDefault(_ownerDocument); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function offset(node) { | ||
var doc = (0, _ownerDocument2.default)(node), | ||
win = (0, _isWindow2.default)(doc), | ||
docElem = doc && doc.documentElement, | ||
@@ -15,3 +31,3 @@ box = { top: 0, left: 0, height: 0, width: 0 }; | ||
// Make sure it's not a disconnected DOM node | ||
if (!contains(docElem, node)) return box; | ||
if (!(0, _contains2.default)(docElem, node)) return box; | ||
@@ -31,2 +47,3 @@ if (node.getBoundingClientRect !== undefined) box = node.getBoundingClientRect(); | ||
return box; | ||
}; | ||
} | ||
module.exports = exports['default']; |
'use strict'; | ||
var babelHelpers = require('../util/babelHelpers.js'); | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = offsetParent; | ||
exports.__esModule = true; | ||
exports['default'] = offsetParent; | ||
var _ownerDocument = require('../ownerDocument'); | ||
var _ownerDocument2 = babelHelpers.interopRequireDefault(_ownerDocument); | ||
var _ownerDocument2 = _interopRequireDefault(_ownerDocument); | ||
var _style = require('../style'); | ||
var _style2 = babelHelpers.interopRequireDefault(_style); | ||
var _style2 = _interopRequireDefault(_style); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function nodeName(node) { | ||
@@ -21,6 +23,6 @@ return node.nodeName && node.nodeName.toLowerCase(); | ||
function offsetParent(node) { | ||
var doc = (0, _ownerDocument2['default'])(node), | ||
var doc = (0, _ownerDocument2.default)(node), | ||
offsetParent = node && node.offsetParent; | ||
while (offsetParent && nodeName(node) !== 'html' && (0, _style2['default'])(offsetParent, 'position') === 'static') { | ||
while (offsetParent && nodeName(node) !== 'html' && (0, _style2.default)(offsetParent, 'position') === 'static') { | ||
offsetParent = offsetParent.offsetParent; | ||
@@ -31,3 +33,2 @@ } | ||
} | ||
module.exports = exports['default']; |
'use strict'; | ||
var babelHelpers = require('../util/babelHelpers.js'); | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
exports['default'] = position; | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
exports.default = position; | ||
var _offset = require('./offset'); | ||
var _offset2 = babelHelpers.interopRequireDefault(_offset); | ||
var _offset2 = _interopRequireDefault(_offset); | ||
var _offsetParent = require('./offsetParent'); | ||
var _offsetParent2 = babelHelpers.interopRequireDefault(_offsetParent); | ||
var _offsetParent2 = _interopRequireDefault(_offsetParent); | ||
var _scrollTop = require('./scrollTop'); | ||
var _scrollTop2 = babelHelpers.interopRequireDefault(_scrollTop); | ||
var _scrollTop2 = _interopRequireDefault(_scrollTop); | ||
var _scrollLeft = require('./scrollLeft'); | ||
var _scrollLeft2 = babelHelpers.interopRequireDefault(_scrollLeft); | ||
var _scrollLeft2 = _interopRequireDefault(_scrollLeft); | ||
var _style = require('../style'); | ||
var _style2 = babelHelpers.interopRequireDefault(_style); | ||
var _style2 = _interopRequireDefault(_style); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function nodeName(node) { | ||
@@ -38,21 +43,20 @@ return node.nodeName && node.nodeName.toLowerCase(); | ||
// because it is its only offset parent | ||
if ((0, _style2['default'])(node, 'position') === 'fixed') { | ||
if ((0, _style2.default)(node, 'position') === 'fixed') { | ||
offset = node.getBoundingClientRect(); | ||
} else { | ||
offsetParent = offsetParent || (0, _offsetParent2['default'])(node); | ||
offset = (0, _offset2['default'])(node); | ||
offsetParent = offsetParent || (0, _offsetParent2.default)(node); | ||
offset = (0, _offset2.default)(node); | ||
if (nodeName(offsetParent) !== 'html') parentOffset = (0, _offset2['default'])(offsetParent); | ||
if (nodeName(offsetParent) !== 'html') parentOffset = (0, _offset2.default)(offsetParent); | ||
parentOffset.top += parseInt((0, _style2['default'])(offsetParent, 'borderTopWidth'), 10) - (0, _scrollTop2['default'])(offsetParent) || 0; | ||
parentOffset.left += parseInt((0, _style2['default'])(offsetParent, 'borderLeftWidth'), 10) - (0, _scrollLeft2['default'])(offsetParent) || 0; | ||
parentOffset.top += parseInt((0, _style2.default)(offsetParent, 'borderTopWidth'), 10) - (0, _scrollTop2.default)(offsetParent) || 0; | ||
parentOffset.left += parseInt((0, _style2.default)(offsetParent, 'borderLeftWidth'), 10) - (0, _scrollLeft2.default)(offsetParent) || 0; | ||
} | ||
// Subtract parent offsets and node margins | ||
return babelHelpers._extends({}, offset, { | ||
top: offset.top - parentOffset.top - (parseInt((0, _style2['default'])(node, 'marginTop'), 10) || 0), | ||
left: offset.left - parentOffset.left - (parseInt((0, _style2['default'])(node, 'marginLeft'), 10) || 0) | ||
return _extends({}, offset, { | ||
top: offset.top - parentOffset.top - (parseInt((0, _style2.default)(node, 'marginTop'), 10) || 0), | ||
left: offset.left - parentOffset.left - (parseInt((0, _style2.default)(node, 'marginLeft'), 10) || 0) | ||
}); | ||
} | ||
module.exports = exports['default']; |
'use strict'; | ||
// Zepto.js | ||
// (c) 2010-2015 Thomas Fuchs | ||
// Zepto.js may be freely distributed under the MIT license. | ||
var simpleSelectorRE = /^[\w-]*$/, | ||
toArray = Function.prototype.bind.call(Function.prototype.call, [].slice); | ||
module.exports = function qsa(element, selector) { | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = qsa; | ||
// Zepto.js | ||
// (c) 2010-2015 Thomas Fuchs | ||
// Zepto.js may be freely distributed under the MIT license. | ||
var simpleSelectorRE = /^[\w-]*$/; | ||
var toArray = Function.prototype.bind.call(Function.prototype.call, [].slice); | ||
function qsa(element, selector) { | ||
var maybeID = selector[0] === '#', | ||
@@ -27,2 +32,3 @@ maybeClass = selector[0] === '.', | ||
return toArray(element.querySelectorAll(selector)); | ||
}; | ||
} | ||
module.exports = exports['default']; |
'use strict'; | ||
var getWindow = require('./isWindow'); | ||
module.exports = function scrollTop(node, val) { | ||
var win = getWindow(node); | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = scrollTop; | ||
var _isWindow = require('./isWindow'); | ||
var _isWindow2 = _interopRequireDefault(_isWindow); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function scrollTop(node, val) { | ||
var win = (0, _isWindow2.default)(node); | ||
if (val === undefined) return win ? 'pageXOffset' in win ? win.pageXOffset : win.document.documentElement.scrollLeft : node.scrollLeft; | ||
if (win) win.scrollTo(val, 'pageYOffset' in win ? win.pageYOffset : win.document.documentElement.scrollTop);else node.scrollLeft = val; | ||
}; | ||
} | ||
module.exports = exports['default']; |
'use strict'; | ||
var css = require('../style'), | ||
height = require('./height'); | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = scrollPrarent; | ||
module.exports = function scrollPrarent(node) { | ||
var position = css(node, 'position'), | ||
var _style = require('../style'); | ||
var _style2 = _interopRequireDefault(_style); | ||
var _height = require('./height'); | ||
var _height2 = _interopRequireDefault(_height); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function scrollPrarent(node) { | ||
var position = (0, _style2.default)(node, 'position'), | ||
excludeStatic = position === 'absolute', | ||
@@ -15,11 +27,12 @@ ownerDoc = node.ownerDocument; | ||
var isStatic = excludeStatic && css(node, 'position') === 'static', | ||
style = css(node, 'overflow') + css(node, 'overflow-y') + css(node, 'overflow-x'); | ||
var isStatic = excludeStatic && (0, _style2.default)(node, 'position') === 'static', | ||
style = (0, _style2.default)(node, 'overflow') + (0, _style2.default)(node, 'overflow-y') + (0, _style2.default)(node, 'overflow-x'); | ||
if (isStatic) continue; | ||
if (/(auto|scroll)/.test(style) && height(node) < node.scrollHeight) return node; | ||
if (/(auto|scroll)/.test(style) && (0, _height2.default)(node) < node.scrollHeight) return node; | ||
} | ||
return document; | ||
}; | ||
} | ||
module.exports = exports['default']; |
'use strict'; | ||
var getWindow = require('./isWindow'); | ||
module.exports = function scrollTop(node, val) { | ||
var win = getWindow(node); | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = scrollTop; | ||
var _isWindow = require('./isWindow'); | ||
var _isWindow2 = _interopRequireDefault(_isWindow); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function scrollTop(node, val) { | ||
var win = (0, _isWindow2.default)(node); | ||
if (val === undefined) return win ? 'pageYOffset' in win ? win.pageYOffset : win.document.documentElement.scrollTop : node.scrollTop; | ||
if (win) win.scrollTo('pageXOffset' in win ? win.pageXOffset : win.document.documentElement.scrollLeft, val);else node.scrollTop = val; | ||
}; | ||
} | ||
module.exports = exports['default']; |
'use strict'; | ||
var offset = require('./offset'), | ||
getWindow = require('./isWindow'); | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = width; | ||
module.exports = function width(node, client) { | ||
var win = getWindow(node); | ||
return win ? win.innerWidth : client ? node.clientWidth : offset(node).width; | ||
}; | ||
var _offset = require('./offset'); | ||
var _offset2 = _interopRequireDefault(_offset); | ||
var _isWindow = require('./isWindow'); | ||
var _isWindow2 = _interopRequireDefault(_isWindow); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function width(node, client) { | ||
var win = (0, _isWindow2.default)(node); | ||
return win ? win.innerWidth : client ? node.clientWidth : (0, _offset2.default)(node).width; | ||
} | ||
module.exports = exports['default']; |
'use strict'; | ||
var babelHelpers = require('../util/babelHelpers.js'); | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = _getComputedStyle; | ||
var _utilCamelizeStyle = require('../util/camelizeStyle'); | ||
var _camelizeStyle = require('../util/camelizeStyle'); | ||
var _utilCamelizeStyle2 = babelHelpers.interopRequireDefault(_utilCamelizeStyle); | ||
var _camelizeStyle2 = _interopRequireDefault(_camelizeStyle); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var rposition = /^(top|right|bottom|left)$/; | ||
var rnumnonpx = /^([+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|))(?!px)[a-z%]+$/i; | ||
module.exports = function _getComputedStyle(node) { | ||
function _getComputedStyle(node) { | ||
if (!node) throw new TypeError('No Element passed to `getComputedStyle()`'); | ||
var doc = node.ownerDocument; | ||
return 'defaultView' in doc ? doc.defaultView.opener ? node.ownerDocument.defaultView.getComputedStyle(node, null) : window.getComputedStyle(node, null) : { //ie 8 "magic" from: https://github.com/jquery/jquery/blob/1.11-stable/src/css/curCSS.js#L72 | ||
return 'defaultView' in doc ? doc.defaultView.opener ? node.ownerDocument.defaultView.getComputedStyle(node, null) : window.getComputedStyle(node, null) : { | ||
//ie 8 "magic" from: https://github.com/jquery/jquery/blob/1.11-stable/src/css/curCSS.js#L72 | ||
getPropertyValue: function getPropertyValue(prop) { | ||
var style = node.style; | ||
prop = (0, _utilCamelizeStyle2['default'])(prop); | ||
prop = (0, _camelizeStyle2.default)(prop); | ||
@@ -48,2 +54,3 @@ if (prop == 'float') prop = 'styleFloat'; | ||
}; | ||
}; | ||
} | ||
module.exports = exports['default']; |
'use strict'; | ||
var camelize = require('../util/camelizeStyle'), | ||
hyphenate = require('../util/hyphenateStyle'), | ||
_getComputedStyle = require('./getComputedStyle'), | ||
removeStyle = require('./removeStyle'); | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = style; | ||
var has = Object.prototype.hasOwnProperty; | ||
var _camelizeStyle = require('../util/camelizeStyle'); | ||
module.exports = function style(node, property, value) { | ||
var css = '', | ||
props = property; | ||
var _camelizeStyle2 = _interopRequireDefault(_camelizeStyle); | ||
var _hyphenateStyle = require('../util/hyphenateStyle'); | ||
var _hyphenateStyle2 = _interopRequireDefault(_hyphenateStyle); | ||
var _getComputedStyle2 = require('./getComputedStyle'); | ||
var _getComputedStyle3 = _interopRequireDefault(_getComputedStyle2); | ||
var _removeStyle = require('./removeStyle'); | ||
var _removeStyle2 = _interopRequireDefault(_removeStyle); | ||
var _properties = require('../transition/properties'); | ||
var _isTransform = require('../transition/isTransform'); | ||
var _isTransform2 = _interopRequireDefault(_isTransform); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function style(node, property, value) { | ||
var css = ''; | ||
var transforms = ''; | ||
var props = property; | ||
if (typeof property === 'string') { | ||
if (value === undefined) return node.style[camelize(property)] || _getComputedStyle(node).getPropertyValue(hyphenate(property));else (props = {})[property] = value; | ||
if (value === undefined) { | ||
return node.style[(0, _camelizeStyle2.default)(property)] || (0, _getComputedStyle3.default)(node).getPropertyValue((0, _hyphenateStyle2.default)(property)); | ||
} else { | ||
(props = {})[property] = value; | ||
} | ||
} | ||
for (var key in props) if (has.call(props, key)) { | ||
!props[key] && props[key] !== 0 ? removeStyle(node, hyphenate(key)) : css += hyphenate(key) + ':' + props[key] + ';'; | ||
Object.keys(props).forEach(function (key) { | ||
var value = props[key]; | ||
if (!value && value !== 0) { | ||
(0, _removeStyle2.default)(node, (0, _hyphenateStyle2.default)(key)); | ||
} else if ((0, _isTransform2.default)(key)) { | ||
transforms += key + '(' + value + ') '; | ||
} else { | ||
css += (0, _hyphenateStyle2.default)(key) + ': ' + value + ';'; | ||
} | ||
}); | ||
if (transforms) { | ||
css += _properties.transform + ': ' + transforms + ';'; | ||
} | ||
node.style.cssText += ';' + css; | ||
}; | ||
} | ||
module.exports = exports['default']; |
'use strict'; | ||
module.exports = function removeStyle(node, key) { | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = removeStyle; | ||
function removeStyle(node, key) { | ||
return 'removeProperty' in node.style ? node.style.removeProperty(key) : node.style.removeAttribute(key); | ||
}; | ||
} | ||
module.exports = exports['default']; |
'use strict'; | ||
var transition = require('./properties'), | ||
style = require('../style'); | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
module.exports = function onEnd(node, handler, duration) { | ||
var _properties = require('./properties'); | ||
var _properties2 = _interopRequireDefault(_properties); | ||
var _style = require('../style'); | ||
var _style2 = _interopRequireDefault(_style); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function onEnd(node, handler, duration) { | ||
var fakeEvent = { | ||
@@ -13,6 +24,6 @@ target: node, | ||
if (!transition.end) duration = 0;else if (duration == null) duration = parseDuration(node) || 0; | ||
if (!_properties2.default.end) duration = 0;else if (duration == null) duration = parseDuration(node) || 0; | ||
if (transition.end) { | ||
node.addEventListener(transition.end, done, false); | ||
if (_properties2.default.end) { | ||
node.addEventListener(_properties2.default.end, done, false); | ||
@@ -27,14 +38,18 @@ backup = setTimeout(function () { | ||
clearTimeout(backup); | ||
event.target.removeEventListener(transition.end, done); | ||
event.target.removeEventListener(_properties2.default.end, done); | ||
handler.call(this); | ||
} | ||
}; | ||
} | ||
module.exports._parseDuration = parseDuration; | ||
onEnd._parseDuration = parseDuration; | ||
exports.default = onEnd; | ||
function parseDuration(node) { | ||
var str = style(node, transition.duration), | ||
var str = (0, _style2.default)(node, _properties2.default.duration), | ||
mult = str.indexOf('ms') === -1 ? 1000 : 1; | ||
return parseFloat(str) * mult; | ||
} | ||
} | ||
module.exports = exports['default']; |
'use strict'; | ||
module.exports = { | ||
end: require('./end'), | ||
properties: require('./properties') | ||
}; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.properties = exports.end = undefined; | ||
var _end = require('./end'); | ||
var _end2 = _interopRequireDefault(_end); | ||
var _properties = require('./properties'); | ||
var _properties2 = _interopRequireDefault(_properties); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
exports.end = _end2.default; | ||
exports.properties = _properties2.default; | ||
exports.default = { end: _end2.default, properties: _properties2.default }; |
'use strict'; | ||
var canUseDOM = require('../util/inDOM'); | ||
var has = Object.prototype.hasOwnProperty, | ||
transform = 'transform', | ||
transition = {}, | ||
transitionTiming, | ||
transitionDuration, | ||
transitionProperty, | ||
transitionDelay; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.transitionEnd = exports.transitionDuration = exports.transitionDelay = exports.transitionTiming = exports.transitionProperty = exports.transform = undefined; | ||
if (canUseDOM) { | ||
transition = getTransitionProperties(); | ||
var _inDOM = require('../util/inDOM'); | ||
transform = transition.prefix + transform; | ||
var _inDOM2 = _interopRequireDefault(_inDOM); | ||
transitionProperty = transition.prefix + 'transition-property'; | ||
transitionDuration = transition.prefix + 'transition-duration'; | ||
transitionDelay = transition.prefix + 'transition-delay'; | ||
transitionTiming = transition.prefix + 'transition-timing-function'; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var transform = 'transform'; | ||
var prefix = void 0, | ||
transitionEnd = void 0; | ||
var transitionTiming = void 0, | ||
transitionDuration = void 0; | ||
var transitionProperty = void 0, | ||
transitionDelay = void 0; | ||
if (_inDOM2.default) { | ||
var _getTransitionPropert = getTransitionProperties(); | ||
prefix = _getTransitionPropert.prefix; | ||
exports.transitionEnd = transitionEnd = _getTransitionPropert.transitionEnd; | ||
exports.transform = transform = prefix + '-' + transform; | ||
exports.transitionProperty = transitionProperty = prefix + '-transition-property'; | ||
exports.transitionDuration = transitionDuration = prefix + '-transition-duration'; | ||
exports.transitionDelay = transitionDelay = prefix + '-transition-delay'; | ||
exports.transitionTiming = transitionTiming = prefix + '-transition-timing-function'; | ||
} | ||
module.exports = { | ||
exports.transform = transform; | ||
exports.transitionProperty = transitionProperty; | ||
exports.transitionTiming = transitionTiming; | ||
exports.transitionDelay = transitionDelay; | ||
exports.transitionDuration = transitionDuration; | ||
exports.transitionEnd = transitionEnd; | ||
exports.default = { | ||
transform: transform, | ||
end: transition.end, | ||
end: transitionEnd, | ||
property: transitionProperty, | ||
@@ -32,6 +51,7 @@ timing: transitionTiming, | ||
function getTransitionProperties() { | ||
var endEvent, | ||
prefix = '', | ||
transitions = { | ||
var transitionEnd = void 0; | ||
var prefix = ''; | ||
var eventNames = { | ||
O: 'otransitionend', | ||
@@ -44,14 +64,15 @@ Moz: 'transitionend', | ||
var element = document.createElement('div'); | ||
for (var vendor in transitions) if (has.call(transitions, vendor)) { | ||
if (element.style[vendor + 'TransitionProperty'] !== undefined) { | ||
prefix = '-' + vendor.toLowerCase() + '-'; | ||
endEvent = transitions[vendor]; | ||
break; | ||
for (var vendor in eventNames) { | ||
if (eventNames.hasOwnProperty(vendor)) { | ||
if (element.style[vendor + 'TransitionProperty'] !== undefined) { | ||
prefix = '-' + vendor.toLowerCase(); | ||
transitionEnd = eventNames[vendor]; | ||
break; | ||
} | ||
} | ||
} | ||
}if (!transitionEnd && element.style.transitionProperty !== undefined) transitionEnd = 'transitionend'; | ||
if (!endEvent && element.style.transitionProperty !== undefined) endEvent = 'transitionend'; | ||
element = null; | ||
return { end: endEvent, prefix: prefix }; | ||
return { transitionEnd: transitionEnd, prefix: prefix }; | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = camelize; | ||
var rHyphen = /-(.)/g; | ||
module.exports = function camelize(string) { | ||
function camelize(string) { | ||
return string.replace(rHyphen, function (_, chr) { | ||
return chr.toUpperCase(); | ||
}); | ||
}; | ||
} | ||
module.exports = exports["default"]; |
@@ -1,13 +0,22 @@ | ||
/** | ||
* Copyright 2014-2015, Facebook, Inc. | ||
* All rights reserved. | ||
* https://github.com/facebook/react/blob/2aeb8a2a6beb00617a4217f7f8284924fa2ad819/src/vendor/core/camelizeStyleName.js | ||
*/ | ||
'use strict'; | ||
var camelize = require('./camelize'); | ||
var msPattern = /^-ms-/; | ||
module.exports = function camelizeStyleName(string) { | ||
return camelize(string.replace(msPattern, 'ms-')); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = camelizeStyleName; | ||
var _camelize = require('./camelize'); | ||
var _camelize2 = _interopRequireDefault(_camelize); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var msPattern = /^-ms-/; /** | ||
* Copyright 2014-2015, Facebook, Inc. | ||
* All rights reserved. | ||
* https://github.com/facebook/react/blob/2aeb8a2a6beb00617a4217f7f8284924fa2ad819/src/vendor/core/camelizeStyleName.js | ||
*/ | ||
function camelizeStyleName(string) { | ||
return (0, _camelize2.default)(string.replace(msPattern, 'ms-')); | ||
} | ||
module.exports = exports['default']; |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = hyphenate; | ||
var rUpper = /([A-Z])/g; | ||
module.exports = function hyphenate(string) { | ||
function hyphenate(string) { | ||
return string.replace(rUpper, '-$1').toLowerCase(); | ||
}; | ||
} | ||
module.exports = exports['default']; |
@@ -1,14 +0,23 @@ | ||
/** | ||
* Copyright 2013-2014, Facebook, Inc. | ||
* All rights reserved. | ||
* https://github.com/facebook/react/blob/2aeb8a2a6beb00617a4217f7f8284924fa2ad819/src/vendor/core/hyphenateStyleName.js | ||
*/ | ||
'use strict'; | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = hyphenateStyleName; | ||
var hyphenate = require("./hyphenate"); | ||
var msPattern = /^ms-/; | ||
var _hyphenate = require('./hyphenate'); | ||
module.exports = function hyphenateStyleName(string) { | ||
return hyphenate(string).replace(msPattern, "-ms-"); | ||
}; | ||
var _hyphenate2 = _interopRequireDefault(_hyphenate); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var msPattern = /^ms-/; /** | ||
* Copyright 2013-2014, Facebook, Inc. | ||
* All rights reserved. | ||
* https://github.com/facebook/react/blob/2aeb8a2a6beb00617a4217f7f8284924fa2ad819/src/vendor/core/hyphenateStyleName.js | ||
*/ | ||
function hyphenateStyleName(string) { | ||
return (0, _hyphenate2.default)(string).replace(msPattern, '-ms-'); | ||
} | ||
module.exports = exports['default']; |
'use strict'; | ||
module.exports = !!(typeof window !== 'undefined' && window.document && window.document.createElement); | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = !!(typeof window !== 'undefined' && window.document && window.document.createElement); | ||
module.exports = exports['default']; |
'use strict'; | ||
var canUseDOM = require('./inDOM'); | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var vendors = ['', 'webkit', 'moz', 'o', 'ms'], | ||
cancel = 'clearTimeout', | ||
raf = fallback, | ||
compatRaf; | ||
var _inDOM = require('./inDOM'); | ||
var _inDOM2 = _interopRequireDefault(_inDOM); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var vendors = ['', 'webkit', 'moz', 'o', 'ms']; | ||
var cancel = 'clearTimeout'; | ||
var raf = fallback; | ||
var compatRaf = void 0; | ||
var getKey = function getKey(vendor, k) { | ||
@@ -14,3 +22,3 @@ return vendor + (!vendor ? k : k[0].toUpperCase() + k.substr(1)) + 'AnimationFrame'; | ||
if (canUseDOM) { | ||
if (_inDOM2.default) { | ||
vendors.some(function (vendor) { | ||
@@ -21,3 +29,3 @@ var rafKey = getKey(vendor, 'request'); | ||
cancel = getKey(vendor, 'cancel'); | ||
return raf = function (cb) { | ||
return raf = function raf(cb) { | ||
return window[rafKey](cb); | ||
@@ -41,3 +49,3 @@ }; | ||
compatRaf = function (cb) { | ||
compatRaf = function compatRaf(cb) { | ||
return raf(cb); | ||
@@ -49,2 +57,3 @@ }; | ||
module.exports = compatRaf; | ||
exports.default = compatRaf; | ||
module.exports = exports['default']; |
'use strict'; | ||
var canUseDOM = require('./inDOM'); | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var size; | ||
module.exports = function (recalc) { | ||
exports.default = function (recalc) { | ||
if (!size || recalc) { | ||
if (canUseDOM) { | ||
if (_inDOM2.default) { | ||
var scrollDiv = document.createElement('div'); | ||
@@ -25,2 +25,12 @@ | ||
return size; | ||
}; | ||
}; | ||
var _inDOM = require('./inDOM'); | ||
var _inDOM2 = _interopRequireDefault(_inDOM); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var size = void 0; | ||
module.exports = exports['default']; |
'use strict'; | ||
var getOffset = require('../query/offset'), | ||
height = require('../query/height'), | ||
getScrollParent = require('../query/scrollParent'), | ||
scrollTop = require('../query/scrollTop'), | ||
raf = require('./requestAnimationFrame'), | ||
getWindow = require('../query/isWindow'); | ||
module.exports = function scrollTo(selected, scrollParent) { | ||
var offset = getOffset(selected), | ||
poff = { top: 0, left: 0 }, | ||
list, | ||
listScrollTop, | ||
selectedTop, | ||
isWin, | ||
selectedHeight, | ||
listHeight, | ||
bottom; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = scrollTo; | ||
if (!selected) return; | ||
var _offset = require('../query/offset'); | ||
list = scrollParent || getScrollParent(selected); | ||
isWin = getWindow(list); | ||
listScrollTop = scrollTop(list); | ||
var _offset2 = _interopRequireDefault(_offset); | ||
listHeight = height(list, true); | ||
isWin = getWindow(list); | ||
var _height = require('../query/height'); | ||
if (!isWin) poff = getOffset(list); | ||
var _height2 = _interopRequireDefault(_height); | ||
offset = { | ||
top: offset.top - poff.top, | ||
left: offset.left - poff.left, | ||
height: offset.height, | ||
width: offset.width | ||
}; | ||
var _scrollParent = require('../query/scrollParent'); | ||
selectedHeight = offset.height; | ||
selectedTop = offset.top + (isWin ? 0 : listScrollTop); | ||
bottom = selectedTop + selectedHeight; | ||
var _scrollParent2 = _interopRequireDefault(_scrollParent); | ||
listScrollTop = listScrollTop > selectedTop ? selectedTop : bottom > listScrollTop + listHeight ? bottom - listHeight : listScrollTop; | ||
var _scrollTop = require('../query/scrollTop'); | ||
var id = raf(function () { | ||
return scrollTop(list, listScrollTop); | ||
}); | ||
var _scrollTop2 = _interopRequireDefault(_scrollTop); | ||
return function () { | ||
return raf.cancel(id); | ||
}; | ||
}; | ||
var _requestAnimationFrame = require('./requestAnimationFrame'); | ||
var _requestAnimationFrame2 = _interopRequireDefault(_requestAnimationFrame); | ||
var _isWindow = require('../query/isWindow'); | ||
var _isWindow2 = _interopRequireDefault(_isWindow); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function scrollTo(selected, scrollParent) { | ||
var offset = (0, _offset2.default)(selected); | ||
var poff = { top: 0, left: 0 }; | ||
var list = void 0, | ||
listScrollTop = void 0, | ||
selectedTop = void 0, | ||
isWin = void 0; | ||
var selectedHeight = void 0, | ||
listHeight = void 0, | ||
bottom = void 0; | ||
if (!selected) return; | ||
list = scrollParent || (0, _scrollParent2.default)(selected); | ||
isWin = (0, _isWindow2.default)(list); | ||
listScrollTop = (0, _scrollTop2.default)(list); | ||
listHeight = (0, _height2.default)(list, true); | ||
isWin = (0, _isWindow2.default)(list); | ||
if (!isWin) poff = (0, _offset2.default)(list); | ||
offset = { | ||
top: offset.top - poff.top, | ||
left: offset.left - poff.left, | ||
height: offset.height, | ||
width: offset.width | ||
}; | ||
selectedHeight = offset.height; | ||
selectedTop = offset.top + (isWin ? 0 : listScrollTop); | ||
bottom = selectedTop + selectedHeight; | ||
listScrollTop = listScrollTop > selectedTop ? selectedTop : bottom > listScrollTop + listHeight ? bottom - listHeight : listScrollTop; | ||
var id = (0, _requestAnimationFrame2.default)(function () { | ||
return (0, _scrollTop2.default)(list, listScrollTop); | ||
}); | ||
return function () { | ||
return _requestAnimationFrame2.default.cancel(id); | ||
}; | ||
} | ||
module.exports = exports['default']; |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
47191
45
987
0
91
1