Socket
Socket
Sign inDemoInstall

js-viewport-utils

Package Overview
Dependencies
38
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.1 to 2.0.2

6

changelog.md

@@ -20,1 +20,7 @@ #1.0.0

* Fixed issue when jQuery exists
#2.0.2
* Removed useless lodash dependency
* Fixed test page
* Added Jest tests
* Refactor

692

dist/js-viewport-utils.es5.js

@@ -1,670 +0,27 @@

/**
* lodash (Custom Build) <https://lodash.com/>
* Build: `lodash modularize exports="npm" -o ./`
* Copyright jQuery Foundation and other contributors <https://jquery.org/>
* Released under MIT license <https://lodash.com/license>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
*/
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
/** Used as references for various `Number` constants. */
var MAX_SAFE_INTEGER = 9007199254740991;
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
/** `Object#toString` result references. */
var argsTag = '[object Arguments]',
funcTag = '[object Function]',
genTag = '[object GeneratorFunction]';
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/** Used to detect unsigned integer values. */
var reIsUint = /^(?:0|[1-9]\d*)$/;
var __assign = function() {
__assign = Object.assign || function __assign(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
/**
* A faster alternative to `Function#apply`, this function invokes `func`
* with the `this` binding of `thisArg` and the arguments of `args`.
*
* @private
* @param {Function} func The function to invoke.
* @param {*} thisArg The `this` binding of `func`.
* @param {Array} args The arguments to invoke `func` with.
* @returns {*} Returns the result of `func`.
*/
function apply(func, thisArg, args) {
switch (args.length) {
case 0: return func.call(thisArg);
case 1: return func.call(thisArg, args[0]);
case 2: return func.call(thisArg, args[0], args[1]);
case 3: return func.call(thisArg, args[0], args[1], args[2]);
}
return func.apply(thisArg, args);
}
/**
* The base implementation of `_.times` without support for iteratee shorthands
* or max array length checks.
*
* @private
* @param {number} n The number of times to invoke `iteratee`.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Array} Returns the array of results.
*/
function baseTimes(n, iteratee) {
var index = -1,
result = Array(n);
while (++index < n) {
result[index] = iteratee(index);
}
return result;
}
/** Used for built-in method references. */
var objectProto = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/**
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values.
*/
var objectToString = objectProto.toString;
/** Built-in value references. */
var propertyIsEnumerable = objectProto.propertyIsEnumerable;
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeMax = Math.max;
/**
* Creates an array of the enumerable property names of the array-like `value`.
*
* @private
* @param {*} value The value to query.
* @param {boolean} inherited Specify returning inherited property names.
* @returns {Array} Returns the array of property names.
*/
function arrayLikeKeys(value, inherited) {
// Safari 8.1 makes `arguments.callee` enumerable in strict mode.
// Safari 9 makes `arguments.length` enumerable in strict mode.
var result = (isArray(value) || isArguments(value))
? baseTimes(value.length, String)
: [];
var length = result.length,
skipIndexes = !!length;
for (var key in value) {
if ((inherited || hasOwnProperty.call(value, key)) &&
!(skipIndexes && (key == 'length' || isIndex(key, length)))) {
result.push(key);
}
}
return result;
}
/**
* Used by `_.defaults` to customize its `_.assignIn` use.
*
* @private
* @param {*} objValue The destination value.
* @param {*} srcValue The source value.
* @param {string} key The key of the property to assign.
* @param {Object} object The parent object of `objValue`.
* @returns {*} Returns the value to assign.
*/
function assignInDefaults(objValue, srcValue, key, object) {
if (objValue === undefined ||
(eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
return srcValue;
}
return objValue;
}
/**
* Assigns `value` to `key` of `object` if the existing value is not equivalent
* using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
* for equality comparisons.
*
* @private
* @param {Object} object The object to modify.
* @param {string} key The key of the property to assign.
* @param {*} value The value to assign.
*/
function assignValue(object, key, value) {
var objValue = object[key];
if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
(value === undefined && !(key in object))) {
object[key] = value;
}
}
/**
* The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
*
* @private
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names.
*/
function baseKeysIn(object) {
if (!isObject(object)) {
return nativeKeysIn(object);
}
var isProto = isPrototype(object),
result = [];
for (var key in object) {
if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
result.push(key);
}
}
return result;
}
/**
* The base implementation of `_.rest` which doesn't validate or coerce arguments.
*
* @private
* @param {Function} func The function to apply a rest parameter to.
* @param {number} [start=func.length-1] The start position of the rest parameter.
* @returns {Function} Returns the new function.
*/
function baseRest(func, start) {
start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
return function() {
var args = arguments,
index = -1,
length = nativeMax(args.length - start, 0),
array = Array(length);
while (++index < length) {
array[index] = args[start + index];
}
index = -1;
var otherArgs = Array(start + 1);
while (++index < start) {
otherArgs[index] = args[index];
}
otherArgs[start] = array;
return apply(func, this, otherArgs);
};
}
/**
* Copies properties of `source` to `object`.
*
* @private
* @param {Object} source The object to copy properties from.
* @param {Array} props The property identifiers to copy.
* @param {Object} [object={}] The object to copy properties to.
* @param {Function} [customizer] The function to customize copied values.
* @returns {Object} Returns `object`.
*/
function copyObject(source, props, object, customizer) {
object || (object = {});
var index = -1,
length = props.length;
while (++index < length) {
var key = props[index];
var newValue = customizer
? customizer(object[key], source[key], key, object, source)
: undefined;
assignValue(object, key, newValue === undefined ? source[key] : newValue);
}
return object;
}
/**
* Creates a function like `_.assign`.
*
* @private
* @param {Function} assigner The function to assign values.
* @returns {Function} Returns the new assigner function.
*/
function createAssigner(assigner) {
return baseRest(function(object, sources) {
var index = -1,
length = sources.length,
customizer = length > 1 ? sources[length - 1] : undefined,
guard = length > 2 ? sources[2] : undefined;
customizer = (assigner.length > 3 && typeof customizer == 'function')
? (length--, customizer)
: undefined;
if (guard && isIterateeCall(sources[0], sources[1], guard)) {
customizer = length < 3 ? undefined : customizer;
length = 1;
}
object = Object(object);
while (++index < length) {
var source = sources[index];
if (source) {
assigner(object, source, index, customizer);
}
}
return object;
});
}
/**
* Checks if `value` is a valid array-like index.
*
* @private
* @param {*} value The value to check.
* @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
* @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
*/
function isIndex(value, length) {
length = length == null ? MAX_SAFE_INTEGER : length;
return !!length &&
(typeof value == 'number' || reIsUint.test(value)) &&
(value > -1 && value % 1 == 0 && value < length);
}
/**
* Checks if the given arguments are from an iteratee call.
*
* @private
* @param {*} value The potential iteratee value argument.
* @param {*} index The potential iteratee index or key argument.
* @param {*} object The potential iteratee object argument.
* @returns {boolean} Returns `true` if the arguments are from an iteratee call,
* else `false`.
*/
function isIterateeCall(value, index, object) {
if (!isObject(object)) {
return false;
}
var type = typeof index;
if (type == 'number'
? (isArrayLike(object) && isIndex(index, object.length))
: (type == 'string' && index in object)
) {
return eq(object[index], value);
}
return false;
}
/**
* Checks if `value` is likely a prototype object.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
*/
function isPrototype(value) {
var Ctor = value && value.constructor,
proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
return value === proto;
}
/**
* This function is like
* [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
* except that it includes inherited enumerable properties.
*
* @private
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names.
*/
function nativeKeysIn(object) {
var result = [];
if (object != null) {
for (var key in Object(object)) {
result.push(key);
}
}
return result;
}
/**
* Performs a
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
* comparison between two values to determine if they are equivalent.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
* @example
*
* var object = { 'a': 1 };
* var other = { 'a': 1 };
*
* _.eq(object, object);
* // => true
*
* _.eq(object, other);
* // => false
*
* _.eq('a', 'a');
* // => true
*
* _.eq('a', Object('a'));
* // => false
*
* _.eq(NaN, NaN);
* // => true
*/
function eq(value, other) {
return value === other || (value !== value && other !== other);
}
/**
* Checks if `value` is likely an `arguments` object.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an `arguments` object,
* else `false`.
* @example
*
* _.isArguments(function() { return arguments; }());
* // => true
*
* _.isArguments([1, 2, 3]);
* // => false
*/
function isArguments(value) {
// Safari 8.1 makes `arguments.callee` enumerable in strict mode.
return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&
(!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);
}
/**
* Checks if `value` is classified as an `Array` object.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an array, else `false`.
* @example
*
* _.isArray([1, 2, 3]);
* // => true
*
* _.isArray(document.body.children);
* // => false
*
* _.isArray('abc');
* // => false
*
* _.isArray(_.noop);
* // => false
*/
var isArray = Array.isArray;
/**
* Checks if `value` is array-like. A value is considered array-like if it's
* not a function and has a `value.length` that's an integer greater than or
* equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is array-like, else `false`.
* @example
*
* _.isArrayLike([1, 2, 3]);
* // => true
*
* _.isArrayLike(document.body.children);
* // => true
*
* _.isArrayLike('abc');
* // => true
*
* _.isArrayLike(_.noop);
* // => false
*/
function isArrayLike(value) {
return value != null && isLength(value.length) && !isFunction(value);
}
/**
* This method is like `_.isArrayLike` except that it also checks if `value`
* is an object.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an array-like object,
* else `false`.
* @example
*
* _.isArrayLikeObject([1, 2, 3]);
* // => true
*
* _.isArrayLikeObject(document.body.children);
* // => true
*
* _.isArrayLikeObject('abc');
* // => false
*
* _.isArrayLikeObject(_.noop);
* // => false
*/
function isArrayLikeObject(value) {
return isObjectLike(value) && isArrayLike(value);
}
/**
* Checks if `value` is classified as a `Function` object.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a function, else `false`.
* @example
*
* _.isFunction(_);
* // => true
*
* _.isFunction(/abc/);
* // => false
*/
function isFunction(value) {
// The use of `Object#toString` avoids issues with the `typeof` operator
// in Safari 8-9 which returns 'object' for typed array and other constructors.
var tag = isObject(value) ? objectToString.call(value) : '';
return tag == funcTag || tag == genTag;
}
/**
* Checks if `value` is a valid array-like length.
*
* **Note:** This method is loosely based on
* [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
* @example
*
* _.isLength(3);
* // => true
*
* _.isLength(Number.MIN_VALUE);
* // => false
*
* _.isLength(Infinity);
* // => false
*
* _.isLength('3');
* // => false
*/
function isLength(value) {
return typeof value == 'number' &&
value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
}
/**
* Checks if `value` is the
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
* @example
*
* _.isObject({});
* // => true
*
* _.isObject([1, 2, 3]);
* // => true
*
* _.isObject(_.noop);
* // => true
*
* _.isObject(null);
* // => false
*/
function isObject(value) {
var type = typeof value;
return !!value && (type == 'object' || type == 'function');
}
/**
* Checks if `value` is object-like. A value is object-like if it's not `null`
* and has a `typeof` result of "object".
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
* @example
*
* _.isObjectLike({});
* // => true
*
* _.isObjectLike([1, 2, 3]);
* // => true
*
* _.isObjectLike(_.noop);
* // => false
*
* _.isObjectLike(null);
* // => false
*/
function isObjectLike(value) {
return !!value && typeof value == 'object';
}
/**
* This method is like `_.assignIn` except that it accepts `customizer`
* which is invoked to produce the assigned values. If `customizer` returns
* `undefined`, assignment is handled by the method instead. The `customizer`
* is invoked with five arguments: (objValue, srcValue, key, object, source).
*
* **Note:** This method mutates `object`.
*
* @static
* @memberOf _
* @since 4.0.0
* @alias extendWith
* @category Object
* @param {Object} object The destination object.
* @param {...Object} sources The source objects.
* @param {Function} [customizer] The function to customize assigned values.
* @returns {Object} Returns `object`.
* @see _.assignWith
* @example
*
* function customizer(objValue, srcValue) {
* return _.isUndefined(objValue) ? srcValue : objValue;
* }
*
* var defaults = _.partialRight(_.assignInWith, customizer);
*
* defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
* // => { 'a': 1, 'b': 2 }
*/
var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
copyObject(source, keysIn(source), object, customizer);
});
/**
* Assigns own and inherited enumerable string keyed properties of source
* objects to the destination object for all destination properties that
* resolve to `undefined`. Source objects are applied from left to right.
* Once a property is set, additional values of the same property are ignored.
*
* **Note:** This method mutates `object`.
*
* @static
* @since 0.1.0
* @memberOf _
* @category Object
* @param {Object} object The destination object.
* @param {...Object} [sources] The source objects.
* @returns {Object} Returns `object`.
* @see _.defaultsDeep
* @example
*
* _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
* // => { 'a': 1, 'b': 2 }
*/
var defaults = baseRest(function(args) {
args.push(undefined, assignInDefaults);
return apply(assignInWith, undefined, args);
});
/**
* Creates an array of the own and inherited enumerable property names of `object`.
*
* **Note:** Non-object values are coerced to objects.
*
* @static
* @memberOf _
* @since 3.0.0
* @category Object
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names.
* @example
*
* function Foo() {
* this.a = 1;
* this.b = 2;
* }
*
* Foo.prototype.c = 3;
*
* _.keysIn(new Foo);
* // => ['a', 'b', 'c'] (iteration order is not guaranteed)
*/
function keysIn(object) {
return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
}
var lodash_defaults = defaults;
var JsViewportSides;

@@ -718,3 +75,4 @@ (function (JsViewportSides) {

// TMP VARS
var i, result = !1;
var i;
var result = !1;
// Handle jQuery

@@ -731,3 +89,3 @@ if (typeof jQuery !== "undefined") {

// Build configuration from defaults and user-provided settings and metadata
var config = lodash_defaults({}, options || {}, jsViewportDefaults);
var config = __assign({}, jsViewportDefaults, options);
// Use the window as the container if the user specified the body or a non-element

@@ -734,0 +92,0 @@ if (config.container === document.body || config.container.nodeType !== 1) {

(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(factory((global.jsViewportUtils = {})));
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(factory((global['js-Viewport-Utils'] = {})));
}(this, (function (exports) { 'use strict';
/**
* lodash (Custom Build) <https://lodash.com/>
* Build: `lodash modularize exports="npm" -o ./`
* Copyright jQuery Foundation and other contributors <https://jquery.org/>
* Released under MIT license <https://lodash.com/license>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
*/
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
/** Used as references for various `Number` constants. */
var MAX_SAFE_INTEGER = 9007199254740991;
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
/** `Object#toString` result references. */
var argsTag = '[object Arguments]',
funcTag = '[object Function]',
genTag = '[object GeneratorFunction]';
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/** Used to detect unsigned integer values. */
var reIsUint = /^(?:0|[1-9]\d*)$/;
var __assign = function() {
__assign = Object.assign || function __assign(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
/**
* A faster alternative to `Function#apply`, this function invokes `func`
* with the `this` binding of `thisArg` and the arguments of `args`.
*
* @private
* @param {Function} func The function to invoke.
* @param {*} thisArg The `this` binding of `func`.
* @param {Array} args The arguments to invoke `func` with.
* @returns {*} Returns the result of `func`.
*/
function apply(func, thisArg, args) {
switch (args.length) {
case 0: return func.call(thisArg);
case 1: return func.call(thisArg, args[0]);
case 2: return func.call(thisArg, args[0], args[1]);
case 3: return func.call(thisArg, args[0], args[1], args[2]);
}
return func.apply(thisArg, args);
}
/**
* The base implementation of `_.times` without support for iteratee shorthands
* or max array length checks.
*
* @private
* @param {number} n The number of times to invoke `iteratee`.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Array} Returns the array of results.
*/
function baseTimes(n, iteratee) {
var index = -1,
result = Array(n);
while (++index < n) {
result[index] = iteratee(index);
}
return result;
}
/** Used for built-in method references. */
var objectProto = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/**
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values.
*/
var objectToString = objectProto.toString;
/** Built-in value references. */
var propertyIsEnumerable = objectProto.propertyIsEnumerable;
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeMax = Math.max;
/**
* Creates an array of the enumerable property names of the array-like `value`.
*
* @private
* @param {*} value The value to query.
* @param {boolean} inherited Specify returning inherited property names.
* @returns {Array} Returns the array of property names.
*/
function arrayLikeKeys(value, inherited) {
// Safari 8.1 makes `arguments.callee` enumerable in strict mode.
// Safari 9 makes `arguments.length` enumerable in strict mode.
var result = (isArray(value) || isArguments(value))
? baseTimes(value.length, String)
: [];
var length = result.length,
skipIndexes = !!length;
for (var key in value) {
if ((inherited || hasOwnProperty.call(value, key)) &&
!(skipIndexes && (key == 'length' || isIndex(key, length)))) {
result.push(key);
}
}
return result;
}
/**
* Used by `_.defaults` to customize its `_.assignIn` use.
*
* @private
* @param {*} objValue The destination value.
* @param {*} srcValue The source value.
* @param {string} key The key of the property to assign.
* @param {Object} object The parent object of `objValue`.
* @returns {*} Returns the value to assign.
*/
function assignInDefaults(objValue, srcValue, key, object) {
if (objValue === undefined ||
(eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
return srcValue;
}
return objValue;
}
/**
* Assigns `value` to `key` of `object` if the existing value is not equivalent
* using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
* for equality comparisons.
*
* @private
* @param {Object} object The object to modify.
* @param {string} key The key of the property to assign.
* @param {*} value The value to assign.
*/
function assignValue(object, key, value) {
var objValue = object[key];
if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
(value === undefined && !(key in object))) {
object[key] = value;
}
}
/**
* The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
*
* @private
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names.
*/
function baseKeysIn(object) {
if (!isObject(object)) {
return nativeKeysIn(object);
}
var isProto = isPrototype(object),
result = [];
for (var key in object) {
if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
result.push(key);
}
}
return result;
}
/**
* The base implementation of `_.rest` which doesn't validate or coerce arguments.
*
* @private
* @param {Function} func The function to apply a rest parameter to.
* @param {number} [start=func.length-1] The start position of the rest parameter.
* @returns {Function} Returns the new function.
*/
function baseRest(func, start) {
start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
return function() {
var args = arguments,
index = -1,
length = nativeMax(args.length - start, 0),
array = Array(length);
while (++index < length) {
array[index] = args[start + index];
}
index = -1;
var otherArgs = Array(start + 1);
while (++index < start) {
otherArgs[index] = args[index];
}
otherArgs[start] = array;
return apply(func, this, otherArgs);
(function (JsViewportSides) {
JsViewportSides["ALL"] = "ALL";
JsViewportSides["TOP"] = "TOP";
JsViewportSides["RIGHT"] = "RIGHT";
JsViewportSides["BOTTOM"] = "BOTTOM";
JsViewportSides["LEFT"] = "LEFT";
})(exports.JsViewportSides || (exports.JsViewportSides = {}));
var jsViewportDefaults = {
container: typeof document !== "undefined" ? document.body : window,
sides: [exports.JsViewportSides.ALL],
top: 0,
right: 0,
bottom: 0,
left: 0
};
}
/**
* Copies properties of `source` to `object`.
*
* @private
* @param {Object} source The object to copy properties from.
* @param {Array} props The property identifiers to copy.
* @param {Object} [object={}] The object to copy properties to.
* @param {Function} [customizer] The function to customize copied values.
* @returns {Object} Returns `object`.
*/
function copyObject(source, props, object, customizer) {
object || (object = {});
/**
* Viewport Utils
*
* @description A set of viewport utils
* @author Tony Samperi, tonysamperi.github.io
* @version 2.0.0
* @date 2019-10-03
*/
var jsViewportUtils = (function () {
// IE 8 and lower fail this
var canUseWindowDimensions = typeof window !== "undefined" && window.innerHeight !== undefined;
var viewportUtils = {
/**
* Determines whether an element is within the viewport
* @param {HTMLElement|JQuery<HTMLElement>} elem DOM Element (required)
* @param {JsViewportSettings} options Optional settings
* @return {Boolean} Whether the element was completely within the viewport
*/
inViewport: function (elem, options) {
var _a;
if (!elem || typeof elem !== "object" || elem.nodeType !== 1) {
throw new Error("First argument must be an element!");
}
var containerBoundingRect;
var containerScrollTop;
var containerScrollLeft;
var elemBoundingRect;
var isWindow;
var scrollBarWidths = [0, 0];
var sidesRegex = /^TOP$|^RIGHT$|^BOTTOM$|^LEFT$|^ALL$/;
// TMP VARS
var i;
var result = !1;
// Handle jQuery
if (typeof jQuery !== "undefined") {
if (elem.jquery) {
elem = elem.get(0);
}
// Extract the DOM node from a jQuery collection
if (!!options && !!options.container && options.container.jquery) {
options.container = options.container.get(0);
}
}
// Build configuration from defaults and user-provided settings and metadata
var config = __assign({}, jsViewportDefaults, options);
// Use the window as the container if the user specified the body or a non-element
if (config.container === document.body || config.container.nodeType !== 1) {
config.container = window;
}
// Get the element's bounding rectangle with respect to the viewport
elemBoundingRect = elem.getBoundingClientRect();
isWindow = (config.container === window);
var isSideIn = (_a = {},
_a[exports.JsViewportSides.TOP] = function () {
if (isWindow) {
return (elemBoundingRect.top >= config.top);
}
else {
return (elemBoundingRect.top >= containerScrollTop - (containerScrollTop - containerBoundingRect.top) + config.top);
}
},
_a[exports.JsViewportSides.RIGHT] = function () {
if (isWindow) {
return (elemBoundingRect.right <= (containerBoundingRect.right + containerScrollLeft) - config.right);
}
else {
return (elemBoundingRect.right <= containerBoundingRect.right - scrollBarWidths[0] - config.right);
}
},
_a[exports.JsViewportSides.BOTTOM] = function () {
var containerHeight = 0;
if (isWindow) {
if (canUseWindowDimensions) {
containerHeight = config.container.innerHeight;
}
else if (document && document.documentElement) {
containerHeight = document.documentElement.clientHeight;
}
}
else {
containerHeight = containerBoundingRect.bottom;
}
return (elemBoundingRect.bottom <= containerHeight - scrollBarWidths[1] - config.bottom);
},
_a[exports.JsViewportSides.LEFT] = function () {
if (isWindow) {
return (elemBoundingRect.left >= config.left);
}
else {
return (elemBoundingRect.left >= containerScrollLeft - (containerScrollLeft - containerBoundingRect.left) + config.left);
}
},
// Element is within all four boundaries
_a[exports.JsViewportSides.ALL] = function () {
return (isSideIn.TOP() && isSideIn.BOTTOM() && isSideIn.LEFT() && isSideIn.RIGHT());
},
_a);
// Get viewport dimensions and offsets
if (isWindow) {
containerBoundingRect = document.documentElement.getBoundingClientRect();
containerScrollTop = document.body.scrollTop;
containerScrollLeft = window.scrollX || document.body.scrollLeft;
}
else {
containerBoundingRect = config.container.getBoundingClientRect();
containerScrollTop = config.container.scrollTop;
containerScrollLeft = config.container.scrollLeft;
}
if (containerScrollLeft) {
scrollBarWidths[0] = 18;
}
if (containerScrollTop) {
scrollBarWidths[1] = 16;
}
// Loop through all of the sides
var sides = config.sides;
i = sides.length;
while (i--) {
// Test the element against each side of the viewport that was requested
if (sidesRegex.test(sides[i])) {
if (isSideIn[sides[i]]()) {
result = !0;
}
else {
result = !1;
break;
}
}
}
return result;
},
inViewportTop: function (element) {
return viewportUtils.inViewport(element, { sides: [exports.JsViewportSides.TOP] });
},
inViewportRight: function (element) {
return viewportUtils.inViewport(element, { sides: [exports.JsViewportSides.RIGHT] });
},
inViewportBottom: function (element) {
return viewportUtils.inViewport(element, { sides: [exports.JsViewportSides.BOTTOM] });
},
inViewportLeft: function (element) {
return viewportUtils.inViewport(element, { sides: [exports.JsViewportSides.LEFT] });
}
};
return viewportUtils;
})();
var inViewport = jsViewportUtils.inViewport;
var inViewportTop = jsViewportUtils.inViewportTop;
var inViewportRight = jsViewportUtils.inViewportRight;
var inViewportBottom = jsViewportUtils.inViewportBottom;
var inViewportLeft = jsViewportUtils.inViewportLeft;
var index = -1,
length = props.length;
exports.inViewport = inViewport;
exports.inViewportTop = inViewportTop;
exports.inViewportRight = inViewportRight;
exports.inViewportBottom = inViewportBottom;
exports.inViewportLeft = inViewportLeft;
exports.jsViewportDefaults = jsViewportDefaults;
while (++index < length) {
var key = props[index];
Object.defineProperty(exports, '__esModule', { value: true });
var newValue = customizer
? customizer(object[key], source[key], key, object, source)
: undefined;
assignValue(object, key, newValue === undefined ? source[key] : newValue);
}
return object;
}
/**
* Creates a function like `_.assign`.
*
* @private
* @param {Function} assigner The function to assign values.
* @returns {Function} Returns the new assigner function.
*/
function createAssigner(assigner) {
return baseRest(function(object, sources) {
var index = -1,
length = sources.length,
customizer = length > 1 ? sources[length - 1] : undefined,
guard = length > 2 ? sources[2] : undefined;
customizer = (assigner.length > 3 && typeof customizer == 'function')
? (length--, customizer)
: undefined;
if (guard && isIterateeCall(sources[0], sources[1], guard)) {
customizer = length < 3 ? undefined : customizer;
length = 1;
}
object = Object(object);
while (++index < length) {
var source = sources[index];
if (source) {
assigner(object, source, index, customizer);
}
}
return object;
});
}
/**
* Checks if `value` is a valid array-like index.
*
* @private
* @param {*} value The value to check.
* @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
* @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
*/
function isIndex(value, length) {
length = length == null ? MAX_SAFE_INTEGER : length;
return !!length &&
(typeof value == 'number' || reIsUint.test(value)) &&
(value > -1 && value % 1 == 0 && value < length);
}
/**
* Checks if the given arguments are from an iteratee call.
*
* @private
* @param {*} value The potential iteratee value argument.
* @param {*} index The potential iteratee index or key argument.
* @param {*} object The potential iteratee object argument.
* @returns {boolean} Returns `true` if the arguments are from an iteratee call,
* else `false`.
*/
function isIterateeCall(value, index, object) {
if (!isObject(object)) {
return false;
}
var type = typeof index;
if (type == 'number'
? (isArrayLike(object) && isIndex(index, object.length))
: (type == 'string' && index in object)
) {
return eq(object[index], value);
}
return false;
}
/**
* Checks if `value` is likely a prototype object.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
*/
function isPrototype(value) {
var Ctor = value && value.constructor,
proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
return value === proto;
}
/**
* This function is like
* [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
* except that it includes inherited enumerable properties.
*
* @private
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names.
*/
function nativeKeysIn(object) {
var result = [];
if (object != null) {
for (var key in Object(object)) {
result.push(key);
}
}
return result;
}
/**
* Performs a
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
* comparison between two values to determine if they are equivalent.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
* @example
*
* var object = { 'a': 1 };
* var other = { 'a': 1 };
*
* _.eq(object, object);
* // => true
*
* _.eq(object, other);
* // => false
*
* _.eq('a', 'a');
* // => true
*
* _.eq('a', Object('a'));
* // => false
*
* _.eq(NaN, NaN);
* // => true
*/
function eq(value, other) {
return value === other || (value !== value && other !== other);
}
/**
* Checks if `value` is likely an `arguments` object.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an `arguments` object,
* else `false`.
* @example
*
* _.isArguments(function() { return arguments; }());
* // => true
*
* _.isArguments([1, 2, 3]);
* // => false
*/
function isArguments(value) {
// Safari 8.1 makes `arguments.callee` enumerable in strict mode.
return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&
(!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);
}
/**
* Checks if `value` is classified as an `Array` object.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an array, else `false`.
* @example
*
* _.isArray([1, 2, 3]);
* // => true
*
* _.isArray(document.body.children);
* // => false
*
* _.isArray('abc');
* // => false
*
* _.isArray(_.noop);
* // => false
*/
var isArray = Array.isArray;
/**
* Checks if `value` is array-like. A value is considered array-like if it's
* not a function and has a `value.length` that's an integer greater than or
* equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is array-like, else `false`.
* @example
*
* _.isArrayLike([1, 2, 3]);
* // => true
*
* _.isArrayLike(document.body.children);
* // => true
*
* _.isArrayLike('abc');
* // => true
*
* _.isArrayLike(_.noop);
* // => false
*/
function isArrayLike(value) {
return value != null && isLength(value.length) && !isFunction(value);
}
/**
* This method is like `_.isArrayLike` except that it also checks if `value`
* is an object.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an array-like object,
* else `false`.
* @example
*
* _.isArrayLikeObject([1, 2, 3]);
* // => true
*
* _.isArrayLikeObject(document.body.children);
* // => true
*
* _.isArrayLikeObject('abc');
* // => false
*
* _.isArrayLikeObject(_.noop);
* // => false
*/
function isArrayLikeObject(value) {
return isObjectLike(value) && isArrayLike(value);
}
/**
* Checks if `value` is classified as a `Function` object.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a function, else `false`.
* @example
*
* _.isFunction(_);
* // => true
*
* _.isFunction(/abc/);
* // => false
*/
function isFunction(value) {
// The use of `Object#toString` avoids issues with the `typeof` operator
// in Safari 8-9 which returns 'object' for typed array and other constructors.
var tag = isObject(value) ? objectToString.call(value) : '';
return tag == funcTag || tag == genTag;
}
/**
* Checks if `value` is a valid array-like length.
*
* **Note:** This method is loosely based on
* [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
* @example
*
* _.isLength(3);
* // => true
*
* _.isLength(Number.MIN_VALUE);
* // => false
*
* _.isLength(Infinity);
* // => false
*
* _.isLength('3');
* // => false
*/
function isLength(value) {
return typeof value == 'number' &&
value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
}
/**
* Checks if `value` is the
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
* @example
*
* _.isObject({});
* // => true
*
* _.isObject([1, 2, 3]);
* // => true
*
* _.isObject(_.noop);
* // => true
*
* _.isObject(null);
* // => false
*/
function isObject(value) {
var type = typeof value;
return !!value && (type == 'object' || type == 'function');
}
/**
* Checks if `value` is object-like. A value is object-like if it's not `null`
* and has a `typeof` result of "object".
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
* @example
*
* _.isObjectLike({});
* // => true
*
* _.isObjectLike([1, 2, 3]);
* // => true
*
* _.isObjectLike(_.noop);
* // => false
*
* _.isObjectLike(null);
* // => false
*/
function isObjectLike(value) {
return !!value && typeof value == 'object';
}
/**
* This method is like `_.assignIn` except that it accepts `customizer`
* which is invoked to produce the assigned values. If `customizer` returns
* `undefined`, assignment is handled by the method instead. The `customizer`
* is invoked with five arguments: (objValue, srcValue, key, object, source).
*
* **Note:** This method mutates `object`.
*
* @static
* @memberOf _
* @since 4.0.0
* @alias extendWith
* @category Object
* @param {Object} object The destination object.
* @param {...Object} sources The source objects.
* @param {Function} [customizer] The function to customize assigned values.
* @returns {Object} Returns `object`.
* @see _.assignWith
* @example
*
* function customizer(objValue, srcValue) {
* return _.isUndefined(objValue) ? srcValue : objValue;
* }
*
* var defaults = _.partialRight(_.assignInWith, customizer);
*
* defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
* // => { 'a': 1, 'b': 2 }
*/
var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
copyObject(source, keysIn(source), object, customizer);
});
/**
* Assigns own and inherited enumerable string keyed properties of source
* objects to the destination object for all destination properties that
* resolve to `undefined`. Source objects are applied from left to right.
* Once a property is set, additional values of the same property are ignored.
*
* **Note:** This method mutates `object`.
*
* @static
* @since 0.1.0
* @memberOf _
* @category Object
* @param {Object} object The destination object.
* @param {...Object} [sources] The source objects.
* @returns {Object} Returns `object`.
* @see _.defaultsDeep
* @example
*
* _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
* // => { 'a': 1, 'b': 2 }
*/
var defaults = baseRest(function(args) {
args.push(undefined, assignInDefaults);
return apply(assignInWith, undefined, args);
});
/**
* Creates an array of the own and inherited enumerable property names of `object`.
*
* **Note:** Non-object values are coerced to objects.
*
* @static
* @memberOf _
* @since 3.0.0
* @category Object
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names.
* @example
*
* function Foo() {
* this.a = 1;
* this.b = 2;
* }
*
* Foo.prototype.c = 3;
*
* _.keysIn(new Foo);
* // => ['a', 'b', 'c'] (iteration order is not guaranteed)
*/
function keysIn(object) {
return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
}
var lodash_defaults = defaults;
(function (JsViewportSides) {
JsViewportSides["ALL"] = "ALL";
JsViewportSides["TOP"] = "TOP";
JsViewportSides["RIGHT"] = "RIGHT";
JsViewportSides["BOTTOM"] = "BOTTOM";
JsViewportSides["LEFT"] = "LEFT";
})(exports.JsViewportSides || (exports.JsViewportSides = {}));
var jsViewportDefaults = {
container: typeof document !== "undefined" ? document.body : window,
sides: [exports.JsViewportSides.ALL],
top: 0,
right: 0,
bottom: 0,
left: 0
};
/**
* Viewport Utils
*
* @description A set of viewport utils
* @author Tony Samperi, tonysamperi.github.io
* @version 2.0.0
* @date 2019-10-03
*/
var jsViewportUtils = (function () {
// IE 8 and lower fail this
var canUseWindowDimensions = typeof window !== "undefined" && window.innerHeight !== undefined;
var viewportUtils = {
/**
* Determines whether an element is within the viewport
* @param {HTMLElement|JQuery<HTMLElement>} elem DOM Element (required)
* @param {JsViewportSettings} options Optional settings
* @return {Boolean} Whether the element was completely within the viewport
*/
inViewport: function (elem, options) {
var _a;
if (!elem || typeof elem !== "object" || elem.nodeType !== 1) {
throw new Error("First argument must be an element!");
}
var containerBoundingRect;
var containerScrollTop;
var containerScrollLeft;
var elemBoundingRect;
var isWindow;
var scrollBarWidths = [0, 0];
var sidesRegex = /^TOP$|^RIGHT$|^BOTTOM$|^LEFT$|^ALL$/;
// TMP VARS
var i, result = !1;
// Handle jQuery
if (typeof jQuery !== "undefined") {
if (elem.jquery) {
elem = elem.get(0);
}
// Extract the DOM node from a jQuery collection
if (!!options && !!options.container && options.container.jquery) {
options.container = options.container.get(0);
}
}
// Build configuration from defaults and user-provided settings and metadata
var config = lodash_defaults({}, options || {}, jsViewportDefaults);
// Use the window as the container if the user specified the body or a non-element
if (config.container === document.body || config.container.nodeType !== 1) {
config.container = window;
}
// Get the element's bounding rectangle with respect to the viewport
elemBoundingRect = elem.getBoundingClientRect();
isWindow = (config.container === window);
var isSideIn = (_a = {},
_a[exports.JsViewportSides.TOP] = function () {
if (isWindow) {
return (elemBoundingRect.top >= config.top);
}
else {
return (elemBoundingRect.top >= containerScrollTop - (containerScrollTop - containerBoundingRect.top) + config.top);
}
},
_a[exports.JsViewportSides.RIGHT] = function () {
if (isWindow) {
return (elemBoundingRect.right <= (containerBoundingRect.right + containerScrollLeft) - config.right);
}
else {
return (elemBoundingRect.right <= containerBoundingRect.right - scrollBarWidths[0] - config.right);
}
},
_a[exports.JsViewportSides.BOTTOM] = function () {
var containerHeight = 0;
if (isWindow) {
if (canUseWindowDimensions) {
containerHeight = config.container.innerHeight;
}
else if (document && document.documentElement) {
containerHeight = document.documentElement.clientHeight;
}
}
else {
containerHeight = containerBoundingRect.bottom;
}
return (elemBoundingRect.bottom <= containerHeight - scrollBarWidths[1] - config.bottom);
},
_a[exports.JsViewportSides.LEFT] = function () {
if (isWindow) {
return (elemBoundingRect.left >= config.left);
}
else {
return (elemBoundingRect.left >= containerScrollLeft - (containerScrollLeft - containerBoundingRect.left) + config.left);
}
},
// Element is within all four boundaries
_a[exports.JsViewportSides.ALL] = function () {
return (isSideIn.TOP() && isSideIn.BOTTOM() && isSideIn.LEFT() && isSideIn.RIGHT());
},
_a);
// Get viewport dimensions and offsets
if (isWindow) {
containerBoundingRect = document.documentElement.getBoundingClientRect();
containerScrollTop = document.body.scrollTop;
containerScrollLeft = window.scrollX || document.body.scrollLeft;
}
else {
containerBoundingRect = config.container.getBoundingClientRect();
containerScrollTop = config.container.scrollTop;
containerScrollLeft = config.container.scrollLeft;
}
if (containerScrollLeft) {
scrollBarWidths[0] = 18;
}
if (containerScrollTop) {
scrollBarWidths[1] = 16;
}
// Loop through all of the sides
var sides = config.sides;
i = sides.length;
while (i--) {
// Test the element against each side of the viewport that was requested
if (sidesRegex.test(sides[i])) {
if (isSideIn[sides[i]]()) {
result = !0;
}
else {
result = !1;
break;
}
}
}
return result;
},
inViewportTop: function (element) {
return viewportUtils.inViewport(element, { sides: [exports.JsViewportSides.TOP] });
},
inViewportRight: function (element) {
return viewportUtils.inViewport(element, { sides: [exports.JsViewportSides.RIGHT] });
},
inViewportBottom: function (element) {
return viewportUtils.inViewport(element, { sides: [exports.JsViewportSides.BOTTOM] });
},
inViewportLeft: function (element) {
return viewportUtils.inViewport(element, { sides: [exports.JsViewportSides.LEFT] });
}
};
return viewportUtils;
})();
var inViewport = jsViewportUtils.inViewport;
var inViewportTop = jsViewportUtils.inViewportTop;
var inViewportRight = jsViewportUtils.inViewportRight;
var inViewportBottom = jsViewportUtils.inViewportBottom;
var inViewportLeft = jsViewportUtils.inViewportLeft;
exports.inViewport = inViewport;
exports.inViewportTop = inViewportTop;
exports.inViewportRight = inViewportRight;
exports.inViewportBottom = inViewportBottom;
exports.inViewportLeft = inViewportLeft;
exports.jsViewportDefaults = jsViewportDefaults;
Object.defineProperty(exports, '__esModule', { value: true });
})));
//# sourceMappingURL=js-viewport-utils.umd.js.map

@@ -9,9 +9,8 @@ /**

*/
/// <reference types="jquery" />
import { JsViewportSettings } from "./js-viewport-utils.model";
export * from "./js-viewport-utils.model";
export declare let inViewport: (elem: HTMLElement | JQuery<HTMLElement>, options?: JsViewportSettings | undefined) => boolean;
export declare let inViewportTop: (element: HTMLElement | JQuery<HTMLElement>) => boolean;
export declare let inViewportRight: (element: HTMLElement | JQuery<HTMLElement>) => boolean;
export declare let inViewportBottom: (element: HTMLElement | JQuery<HTMLElement>) => boolean;
export declare let inViewportLeft: (element: HTMLElement | JQuery<HTMLElement>) => boolean;
export declare const inViewport: (elem: HTMLElement | JQuery<HTMLElement>, options?: JsViewportSettings | undefined) => boolean;
export declare const inViewportTop: (element: HTMLElement | JQuery<HTMLElement>) => boolean;
export declare const inViewportRight: (element: HTMLElement | JQuery<HTMLElement>) => boolean;
export declare const inViewportBottom: (element: HTMLElement | JQuery<HTMLElement>) => boolean;
export declare const inViewportLeft: (element: HTMLElement | JQuery<HTMLElement>) => boolean;

@@ -1,5 +0,4 @@

/// <reference types="jquery" />
export interface JsViewportSettings {
container?: Window | HTMLElement | JQuery;
sides: JsViewportSides[];
sides?: JsViewportSides[];
top?: number;

@@ -6,0 +5,0 @@ right?: number;

{
"name": "js-viewport-utils",
"version": "2.0.1",
"version": "2.0.2",
"description": "A set of viewport utils",

@@ -40,7 +40,7 @@ "repository": {

"prebuild": "rimraf dist",
"build": "tsc --module commonjs && rollup -c rollup.config.ts",
"build": "rollup -c rollup.config.js",
"build:docs": "typedoc --out docs --target es6 --theme minimal --mode file src",
"start": "rollup -c rollup.config.ts -w",
"test": "jest --coverage",
"test:watch": "jest --coverage --watch",
"build:watch": "rollup -c rollup.config.js -w",
"test": "jest",
"test:watch": "jest --watch",
"test:prod": "npm run lint && npm run test -- --no-cache",

@@ -74,3 +74,4 @@ "deploy-docs": "ts-node tools/gh-pages-publish",

"/node_modules/",
"/test/"
"/test/",
"/dist/"
],

@@ -85,5 +86,6 @@ "coverageThreshold": {

},
"collectCoverageFrom": [
"src/*.{js,ts}"
]
"globals": {
"window": {},
"document": {}
}
},

@@ -100,39 +102,38 @@ "prettier": {

"devDependencies": {
"@types/jest": "^23.3.2",
"@types/lodash.defaults": "^4.2.6",
"@types/node": "^10.11.0",
"colors": "^1.3.2",
"coveralls": "^3.0.2",
"cross-env": "^5.2.0",
"husky": "^1.0.1",
"jest": "^23.6.0",
"@types/jest": "~23.3.2",
"@types/jquery": "~3.3.31",
"@types/jsdom": "^16.2.5",
"@types/node": "~10.11.0",
"colors": "~1.3.2",
"coveralls": "~3.0.2",
"cross-env": "~5.2.0",
"husky": "~1.0.1",
"jest": "~23.6.0",
"jest-config": "^23.6.0",
"lint-staged": "^8.0.0",
"lodash.camelcase": "^4.3.0",
"prettier": "^1.14.3",
"prompt": "^1.0.0",
"replace-in-file": "^3.4.2",
"rimraf": "^2.6.2",
"rollup": "^0.67.0",
"rollup-plugin-commonjs": "^9.1.8",
"rollup-plugin-json": "^3.1.0",
"rollup-plugin-node-resolve": "^3.4.0",
"rollup-plugin-sourcemaps": "^0.4.2",
"rollup-plugin-typescript2": "^0.18.0",
"shelljs": "^0.8.3",
"travis-deploy-once": "^5.0.9",
"ts-jest": "^23.10.2",
"ts-node": "^7.0.1",
"tslint": "^5.11.0",
"tslint-config-prettier": "^1.15.0",
"tslint-config-standard": "^8.0.1",
"tslint-consistent-codestyle": "^1.16.0",
"typedoc": "^0.12.0",
"typescript": "^3.0.3",
"uglify-js": "^3.6.0"
"jsdom": "^16.4.0",
"lint-staged": "~8.0.0",
"prompt": "~1.0.0",
"replace-in-file": "~3.4.2",
"rimraf": "~2.6.2",
"rollup": "~0.67.0",
"rollup-plugin-commonjs": "~9.1.8",
"rollup-plugin-json": "~3.1.0",
"rollup-plugin-node-resolve": "~3.4.0",
"rollup-plugin-sourcemaps": "~0.4.2",
"rollup-plugin-typescript2": "~0.18.0",
"shelljs": "~0.8.3",
"travis-deploy-once": "~5.0.9",
"ts-jest": "^23.10.5",
"ts-node": "~7.0.1",
"tslint": "~5.11.0",
"tslint-config-prettier": "~1.15.0",
"tslint-config-standard": "~8.0.1",
"tslint-consistent-codestyle": "~1.16.0",
"typedoc": "~0.12.0",
"typescript": "~3.0.3",
"uglify-js": "~3.6.0"
},
"dependencies": {
"lodash.defaults": "^4.2.0",
"@types/jquery": "^3.3.31"
"@types/rollup-plugin-node-resolve": "^4.1.0"
}
}

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

# JS Viewport Utils 2.0.1
# JS Viewport Utils 2.0.2

@@ -38,5 +38,5 @@ Includes:

### In Angular projects
### In Angular projects / Typescript / ES6
```ts
import * as viewportUtils from "js-viewport-utils";
import {inViewport, inViewportBottom} from "js-viewport-utils";
```

@@ -43,0 +43,0 @@

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

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc