diff --git a/packages/overlayscrollbars/dist/overlayscrollbars.esm.js b/packages/overlayscrollbars/dist/overlayscrollbars.esm.js
index 6efd00f..a4fb9a1 100644
--- a/packages/overlayscrollbars/dist/overlayscrollbars.esm.js
+++ b/packages/overlayscrollbars/dist/overlayscrollbars.esm.js
@@ -31,6 +31,9 @@ const removeAttr = (elm, attrName) => {
function scrollLeft(elm, value) {
return getSetProp('scrollLeft', 0, elm, value);
}
+function scrollTop(elm, value) {
+ return getSetProp('scrollTop', 0, elm, value);
+}
const rnothtmlwhite = /[^\x20\t\r\n\f]+/g;
@@ -78,6 +81,13 @@ const from = (arr) => {
});
return result;
};
+const runEach = (arr) => {
+ if (arr instanceof Set) {
+ arr.forEach((fn) => fn && fn());
+ } else {
+ each(arr, (fn) => fn && fn());
+ }
+};
const contents = (elm) => (elm ? from(elm.childNodes) : []);
const parent = (elm) => (elm ? elm.parentElement : null);
@@ -117,6 +127,9 @@ const before = (parentElm, preferredAnchor, insertedElms) => {
const appendChildren = (node, children) => {
before(node, null, children);
};
+const prependChildren = (node, children) => {
+ before(node, node && node.firstChild, children);
+};
const removeElements = (nodes) => {
if (isArrayLike(nodes)) {
each(from(nodes), (e) => removeElements(e));
@@ -160,6 +173,60 @@ const clientSize = (elm) =>
: zeroObj;
const getBoundingClientRect = (elm) => elm.getBoundingClientRect();
+let passiveEventsSupport;
+
+const supportPassiveEvents = () => {
+ if (passiveEventsSupport === undefined) {
+ passiveEventsSupport = false;
+
+ try {
+ window.addEventListener(
+ 'test',
+ null,
+ Object.defineProperty({}, 'passive', {
+ get: function () {
+ passiveEventsSupport = true;
+ },
+ })
+ );
+ } catch (e) {}
+ }
+
+ return passiveEventsSupport;
+};
+
+const off = (target, eventNames, listener, capture) => {
+ each(eventNames.split(' '), (eventName) => {
+ target.removeEventListener(eventName, listener, capture);
+ });
+};
+const on = (target, eventNames, listener, options) => {
+ const doSupportPassiveEvents = supportPassiveEvents();
+ const passive = (doSupportPassiveEvents && options && options._passive) || false;
+ const capture = (options && options._capture) || false;
+ const once = (options && options._once) || false;
+ const offListeners = [];
+ const nativeOptions = doSupportPassiveEvents
+ ? {
+ passive,
+ capture,
+ }
+ : capture;
+ each(eventNames.split(' '), (eventName) => {
+ const finalListener = once
+ ? (evt) => {
+ target.removeEventListener(eventName, finalListener, capture);
+ listener && listener(evt);
+ }
+ : listener;
+ offListeners.push(off.bind(null, target, eventName, finalListener, capture));
+ target.addEventListener(eventName, finalListener, nativeOptions);
+ });
+ return runEach.bind(0, offListeners);
+};
+const stopPropagation = (evt) => evt.stopPropagation();
+const preventDefault = (evt) => evt.preventDefault();
+
const hasOwnProperty = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
const keys = (obj) => (obj ? Object.keys(obj) : []);
@@ -228,44 +295,6 @@ const absoluteCoordinates = (elm) => {
: zeroObj$1;
};
-function _classPrivateFieldGet(receiver, privateMap) {
- var descriptor = privateMap.get(receiver);
-
- if (!descriptor) {
- throw new TypeError('attempted to get private field on non-instance');
- }
-
- if (descriptor.get) {
- return descriptor.get.call(receiver);
- }
-
- return descriptor.value;
-}
-
-var classPrivateFieldGet = _classPrivateFieldGet;
-
-function _classPrivateFieldSet(receiver, privateMap, value) {
- var descriptor = privateMap.get(receiver);
-
- if (!descriptor) {
- throw new TypeError('attempted to set private field on non-instance');
- }
-
- if (descriptor.set) {
- descriptor.set.call(receiver, value);
- } else {
- if (!descriptor.writable) {
- throw new TypeError('attempted to set read only private field');
- }
-
- descriptor.value = value;
- }
-
- return value;
-}
-
-var classPrivateFieldSet = _classPrivateFieldSet;
-
const firstLetterToUpper = (str) => str.charAt(0).toUpperCase() + str.slice(1);
const jsPrefixes = ['WebKit', 'Moz', 'O', 'MS', 'webkit', 'moz', 'o', 'ms'];
const jsCache = {};
@@ -334,10 +363,11 @@ const optionsTemplateTypes = ['boolean', 'number', 'string', 'array', 'object',
return result;
}, {});
+let environmentInstance;
const { abs, round } = Math;
-const envornmentElmId = 'os-envornment';
+const environmentElmId = 'os-environment';
-const nativeScrollbarSize = (body, measureElm) => {
+const getNativeScrollbarSize = (body, measureElm) => {
appendChildren(body, measureElm);
const cSize = clientSize(measureElm);
const oSize = offsetSize(measureElm);
@@ -347,7 +377,7 @@ const nativeScrollbarSize = (body, measureElm) => {
};
};
-const nativeScrollbarStyling = (testElm) => {
+const getNativeScrollbarStyling = (testElm) => {
let result = false;
addClass(testElm, 'os-viewport-native-scrollbars-invisible');
@@ -359,7 +389,7 @@ const nativeScrollbarStyling = (testElm) => {
return result;
};
-const rtlScrollBehavior = (parentElm, childElm) => {
+const getRtlScrollBehavior = (parentElm, childElm) => {
const strHidden = 'hidden';
style(parentElm, {
overflowX: strHidden,
@@ -377,25 +407,7 @@ const rtlScrollBehavior = (parentElm, childElm) => {
};
};
-const passiveEvents = () => {
- let supportsPassive = false;
-
- try {
- window.addEventListener(
- 'test',
- null,
- Object.defineProperty({}, 'passive', {
- get: function () {
- supportsPassive = true;
- },
- })
- );
- } catch (e) {}
-
- return supportsPassive;
-};
-
-const windowDPR = () => {
+const getWindowDPR = () => {
const dDPI = window.screen.deviceXDPI || 0;
const sDPI = window.screen.logicalXDPI || 1;
return window.devicePixelRatio || dDPI / sDPI;
@@ -407,96 +419,225 @@ const diffBiggerThanOne = (valOne, valTwo) => {
return !(absValOne === absValTwo || absValOne + 1 === absValTwo || absValOne - 1 === absValTwo);
};
-var _onChangedListener = new WeakMap();
+const createEnvironment = () => {
+ const { body } = document;
+ const envDOM = createDOM(`
`);
+ const envElm = envDOM[0];
+ const envChildElm = envElm.firstChild;
+ const onChangedListener = new Set();
+ const nativeScrollBarSize = getNativeScrollbarSize(body, envElm);
+ const nativeScrollbarIsOverlaid = {
+ x: nativeScrollBarSize.x === 0,
+ y: nativeScrollBarSize.y === 0,
+ };
+ const env = {
+ _autoUpdateLoop: false,
+ _nativeScrollbarSize: nativeScrollBarSize,
+ _nativeScrollbarIsOverlaid: nativeScrollbarIsOverlaid,
+ _nativeScrollbarStyling: getNativeScrollbarStyling(envElm),
+ _rtlScrollBehavior: getRtlScrollBehavior(envElm, envChildElm),
-class Environment {
- constructor() {
- _onChangedListener.set(this, {
- writable: true,
- value: void 0,
- });
+ _addListener(listener) {
+ onChangedListener.add(listener);
+ },
- classPrivateFieldSet(this, _onChangedListener, new Set());
+ _removeListener(listener) {
+ onChangedListener.delete(listener);
+ },
+ };
+ removeAttr(envElm, 'style');
+ removeElements(envElm);
- const _self = this;
+ if (!nativeScrollbarIsOverlaid.x || !nativeScrollbarIsOverlaid.y) {
+ let size = windowSize();
+ let dpr = getWindowDPR();
+ let scrollbarSize = nativeScrollBarSize;
+ window.addEventListener('resize', () => {
+ if (onChangedListener.size) {
+ const sizeNew = windowSize();
+ const deltaSize = {
+ w: sizeNew.w - size.w,
+ h: sizeNew.h - size.h,
+ };
+ if (deltaSize.w === 0 && deltaSize.h === 0) return;
+ const deltaAbsSize = {
+ w: abs(deltaSize.w),
+ h: abs(deltaSize.h),
+ };
+ const deltaAbsRatio = {
+ w: abs(round(sizeNew.w / (size.w / 100.0))),
+ h: abs(round(sizeNew.h / (size.h / 100.0))),
+ };
+ const dprNew = getWindowDPR();
+ const deltaIsBigger = deltaAbsSize.w > 2 && deltaAbsSize.h > 2;
+ const difference = !diffBiggerThanOne(deltaAbsRatio.w, deltaAbsRatio.h);
+ const dprChanged = dprNew !== dpr && dpr > 0;
+ const isZoom = deltaIsBigger && difference && dprChanged;
- const { body } = document;
- const envDOM = createDOM(``);
- const envElm = envDOM[0];
- const envChildElm = envElm.firstChild;
- const nScrollBarSize = nativeScrollbarSize(body, envElm);
- const nativeScrollbarIsOverlaid = {
- x: nScrollBarSize.x === 0,
- y: nScrollBarSize.y === 0,
- };
- _self._autoUpdateLoop = false;
- _self._nativeScrollbarSize = nScrollBarSize;
- _self._nativeScrollbarIsOverlaid = nativeScrollbarIsOverlaid;
- _self._nativeScrollbarStyling = nativeScrollbarStyling(envElm);
- _self._rtlScrollBehavior = rtlScrollBehavior(envElm, envChildElm);
- _self._supportPassiveEvents = passiveEvents();
- _self._supportResizeObserver = !!jsAPI('ResizeObserver');
- removeAttr(envElm, 'style');
- removeElements(envElm);
+ if (isZoom) {
+ const newScrollbarSize = (environmentInstance._nativeScrollbarSize = getNativeScrollbarSize(body, envElm));
+ removeElements(envElm);
- if (!nativeScrollbarIsOverlaid.x || !nativeScrollbarIsOverlaid.y) {
- let size = windowSize();
- let dpr = windowDPR();
-
- const onChangedListener = classPrivateFieldGet(this, _onChangedListener);
-
- window.addEventListener('resize', () => {
- if (onChangedListener.size) {
- const sizeNew = windowSize();
- const deltaSize = {
- w: sizeNew.w - size.w,
- h: sizeNew.h - size.h,
- };
- if (deltaSize.w === 0 && deltaSize.h === 0) return;
- const deltaAbsSize = {
- w: abs(deltaSize.w),
- h: abs(deltaSize.h),
- };
- const deltaAbsRatio = {
- w: abs(round(sizeNew.w / (size.w / 100.0))),
- h: abs(round(sizeNew.h / (size.h / 100.0))),
- };
- const dprNew = windowDPR();
- const deltaIsBigger = deltaAbsSize.w > 2 && deltaAbsSize.h > 2;
- const difference = !diffBiggerThanOne(deltaAbsRatio.w, deltaAbsRatio.h);
- const dprChanged = dprNew !== dpr && dpr > 0;
- const isZoom = deltaIsBigger && difference && dprChanged;
- const oldScrollbarSize = _self._nativeScrollbarSize;
- let newScrollbarSize;
-
- if (isZoom) {
- newScrollbarSize = _self._nativeScrollbarSize = nativeScrollbarSize(body, envElm);
- removeElements(envElm);
-
- if (oldScrollbarSize.x !== newScrollbarSize.x || oldScrollbarSize.y !== newScrollbarSize.y) {
- onChangedListener.forEach((listener) => listener && listener(_self));
- }
+ if (scrollbarSize.x !== newScrollbarSize.x || scrollbarSize.y !== newScrollbarSize.y) {
+ runEach(onChangedListener);
}
- size = sizeNew;
- dpr = dprNew;
+ scrollbarSize = newScrollbarSize;
}
- });
+
+ size = sizeNew;
+ dpr = dprNew;
+ }
+ });
+ }
+
+ return env;
+};
+
+const getEnvironment = () => {
+ if (!environmentInstance) {
+ environmentInstance = createEnvironment();
+ }
+
+ return environmentInstance;
+};
+
+const animationStartEventName = 'animationstart';
+const scrollEventName = 'scroll';
+const scrollAmount = 3333333;
+const ResizeObserverConstructor = jsAPI('ResizeObserver');
+const classNameSizeObserver = 'os-size-observer';
+const classNameSizeObserverListener = `${classNameSizeObserver}-listener`;
+const classNameSizeObserverListenerItem = `${classNameSizeObserverListener}-item`;
+const classNameSizeObserverListenerItemFinal = `${classNameSizeObserverListenerItem}-final`;
+const cAF = cancelAnimationFrame;
+const rAF = requestAnimationFrame;
+
+const getDirection = (elm) => style(elm, 'direction');
+
+const createSizeObserver = (target, onSizeChangedCallback, direction) => {
+ const rtlScrollBehavior = getEnvironment()._rtlScrollBehavior;
+
+ const baseElements = createDOM(``);
+ const sizeObserver = baseElements[0];
+ const listenerElement = sizeObserver.firstChild;
+
+ const onSizeChangedCallbackProxy = (dir) => {
+ if (direction) {
+ const rtl = getDirection(sizeObserver) === 'rtl';
+ scrollLeft(sizeObserver, rtl ? (rtlScrollBehavior.n ? -scrollAmount : rtlScrollBehavior.i ? 0 : scrollAmount) : scrollAmount);
+ scrollTop(sizeObserver, scrollAmount);
}
+
+ onSizeChangedCallback(dir === true);
+ };
+
+ const offListeners = [];
+ let appearCallback = onSizeChangedCallbackProxy;
+
+ if (ResizeObserverConstructor) {
+ const resizeObserverInstance = new ResizeObserverConstructor(onSizeChangedCallbackProxy);
+ resizeObserverInstance.observe(listenerElement);
+ } else {
+ const observerElementChildren = createDOM(
+ ``
+ );
+ appendChildren(listenerElement, observerElementChildren);
+ const observerElementChildrenRoot = observerElementChildren[0];
+ const shrinkElement = observerElementChildrenRoot.lastChild;
+ const expandElement = observerElementChildrenRoot.firstChild;
+ const expandElementChild = expandElement == null ? void 0 : expandElement.firstChild;
+ let cacheSize = offsetSize(listenerElement);
+ let currSize = cacheSize;
+ let isDirty = false;
+ let rAFId;
+
+ const reset = () => {
+ scrollLeft(expandElement, scrollAmount);
+ scrollTop(expandElement, scrollAmount);
+ scrollLeft(shrinkElement, scrollAmount);
+ scrollTop(shrinkElement, scrollAmount);
+ };
+
+ const onResized = function onResized() {
+ rAFId = 0;
+ if (!isDirty) return;
+ cacheSize = currSize;
+ onSizeChangedCallbackProxy();
+ };
+
+ const onScroll = (scrollEvent) => {
+ currSize = offsetSize(listenerElement);
+ isDirty = !scrollEvent || currSize.w !== cacheSize.w || currSize.h !== cacheSize.h;
+
+ if (scrollEvent && isDirty && !rAFId) {
+ cAF(rAFId);
+ rAFId = rAF(onResized);
+ } else if (!scrollEvent) onResized();
+
+ reset();
+
+ if (scrollEvent) {
+ preventDefault(scrollEvent);
+ stopPropagation(scrollEvent);
+ }
+
+ return false;
+ };
+
+ offListeners.push(on(expandElement, scrollEventName, onScroll));
+ offListeners.push(on(shrinkElement, scrollEventName, onScroll));
+ style(expandElementChild, {
+ width: scrollAmount,
+ height: scrollAmount,
+ });
+ reset();
+ appearCallback = onScroll;
}
- addListener(listener) {
- classPrivateFieldGet(this, _onChangedListener).add(listener);
+ if (direction) {
+ let dirCache;
+ offListeners.push(
+ on(sizeObserver, scrollEventName, (event) => {
+ const dir = getDirection(sizeObserver);
+ const changed = dir !== dirCache;
+
+ if (changed) {
+ if (dir === 'rtl') {
+ style(listenerElement, {
+ left: 'auto',
+ right: 0,
+ });
+ } else {
+ style(listenerElement, {
+ left: 0,
+ right: 'auto',
+ });
+ }
+
+ dirCache = dir;
+ onSizeChangedCallbackProxy(true);
+ }
+
+ preventDefault(event);
+ stopPropagation(event);
+ return false;
+ })
+ );
}
- removeListener(listener) {
- classPrivateFieldGet(this, _onChangedListener).delete(listener);
- }
-}
+ offListeners.push(on(sizeObserver, animationStartEventName, appearCallback));
+ prependChildren(target, sizeObserver);
+ return () => {
+ runEach(offListeners);
+ removeElements(sizeObserver);
+ };
+};
var index = () => {
return [
- new Environment(),
+ getEnvironment(),
+ createSizeObserver(document.body, () => {}),
createDOM(
'\
\
diff --git a/packages/overlayscrollbars/dist/overlayscrollbars.esm.js.map b/packages/overlayscrollbars/dist/overlayscrollbars.esm.js.map
index b44b784..66b2624 100644
--- a/packages/overlayscrollbars/dist/overlayscrollbars.esm.js.map
+++ b/packages/overlayscrollbars/dist/overlayscrollbars.esm.js.map
@@ -1 +1 @@
-{"version":3,"file":"overlayscrollbars.esm.js","sources":["../src/support/utils/types.ts","../src/support/dom/attribute.ts","../src/support/dom/class.ts","../src/support/utils/array.ts","../src/support/dom/traversal.ts","../src/support/dom/manipulation.ts","../src/support/dom/create.ts","../src/support/dom/dimensions.ts","../src/support/utils/object.ts","../src/support/dom/style.ts","../src/support/dom/offset.ts","../../../node_modules/@babel/runtime/helpers/classPrivateFieldGet.js","../../../node_modules/@babel/runtime/helpers/classPrivateFieldSet.js","../src/support/compatibility/vendors.ts","../src/support/compatibility/apis.ts","../../../node_modules/@babel/runtime/helpers/extends.js","../src/support/options/validation.ts","../src/environment/environment.ts","../src/index.ts"],"sourcesContent":["import { PlainObject } from 'typings';\r\n\r\nexport const type: (obj: any) => string = (obj) => {\r\n if (obj === undefined) return `${obj}`;\r\n if (obj === null) return `${obj}`;\r\n return Object.prototype.toString\r\n .call(obj)\r\n .replace(/^\\[object (.+)\\]$/, '$1')\r\n .toLowerCase();\r\n};\r\n\r\nexport function isNumber(obj: any): obj is number {\r\n return typeof obj === 'number';\r\n}\r\n\r\nexport function isString(obj: any): obj is string {\r\n return typeof obj === 'string';\r\n}\r\n\r\nexport function isBoolean(obj: any): obj is boolean {\r\n return typeof obj === 'boolean';\r\n}\r\n\r\nexport function isFunction(obj: any): obj is (...args: Array
) => unknown {\r\n return typeof obj === 'function';\r\n}\r\n\r\nexport function isUndefined(obj: any): obj is undefined {\r\n return obj === undefined;\r\n}\r\n\r\nexport function isNull(obj: any): obj is null {\r\n return obj === null;\r\n}\r\n\r\nexport function isArray(obj: any): obj is Array {\r\n return Array.isArray(obj);\r\n}\r\n\r\nexport function isObject(obj: any): boolean {\r\n return typeof obj === 'object' && !isArray(obj) && !isNull(obj);\r\n}\r\n\r\n/**\r\n * Returns true if the given object is array like, false otherwise.\r\n * @param obj The Object\r\n */\r\nexport function isArrayLike(obj: any): obj is ArrayLike {\r\n const length = !!obj && obj.length;\r\n return isArray(obj) || (!isFunction(obj) && isNumber(length) && length > -1 && length % 1 == 0); // eslint-disable-line eqeqeq\r\n}\r\n\r\n/**\r\n * Returns true if the given object is a \"plain\" (e.g. { key: value }) object, false otherwise.\r\n * @param obj The Object.\r\n */\r\nexport function isPlainObject(obj: any): obj is PlainObject {\r\n if (!obj || !isObject(obj) || type(obj) !== 'object') return false;\r\n\r\n let key;\r\n const proto = 'prototype';\r\n const { hasOwnProperty } = Object[proto];\r\n const hasOwnConstructor = hasOwnProperty.call(obj, 'constructor');\r\n const hasIsPrototypeOf = obj.constructor && obj.constructor[proto] && hasOwnProperty.call(obj.constructor[proto], 'isPrototypeOf');\r\n\r\n if (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) {\r\n return false;\r\n }\r\n\r\n /* eslint-disable no-restricted-syntax */\r\n for (key in obj) {\r\n /**/\r\n }\r\n /* eslint-enable */\r\n\r\n return isUndefined(key) || hasOwnProperty.call(obj, key);\r\n}\r\n\r\n/**\r\n * Checks whether the given object is a HTMLElement.\r\n * @param obj The object which shall be checked.\r\n */\r\nexport function isHTMLElement(obj: any): obj is HTMLElement {\r\n const instaceOfRightHandSide = window.HTMLElement;\r\n const doInstanceOf = isObject(instaceOfRightHandSide) || isFunction(instaceOfRightHandSide);\r\n return !!(doInstanceOf ? obj instanceof instaceOfRightHandSide : obj && isObject(obj) && obj.nodeType === 1 && isString(obj.nodeName));\r\n}\r\n\r\n/**\r\n * Returns true if the given object is empty, false otherwise.\r\n * @param obj The Object.\r\n */\r\nexport function isEmptyObject(obj: any): boolean {\r\n /* eslint-disable no-restricted-syntax, guard-for-in */\r\n for (const name in obj) return false;\r\n return true;\r\n /* eslint-enable */\r\n}\r\n","import { isUndefined } from 'support/utils/types';\r\n\r\ntype GetSetPropName = 'scrollLeft' | 'scrollTop' | 'value';\r\n\r\nfunction getSetProp(\r\n topLeft: GetSetPropName,\r\n fallback: number | string,\r\n elm: HTMLElement | HTMLInputElement | null,\r\n value?: number | string\r\n): number | string | void {\r\n if (isUndefined(value)) {\r\n return elm ? elm[topLeft] : fallback;\r\n }\r\n elm && (elm[topLeft] = value);\r\n}\r\n\r\n/**\r\n * Gets or sets a attribute with the given attribute of the given element depending whether the value attribute is given.\r\n * Returns null if the element has no attribute with the given name.\r\n * @param elm The element of which the attribute shall be get or set.\r\n * @param attrName The attribute name which shall be get or set.\r\n * @param value The value of the attribute which shall be set.\r\n */\r\nexport function attr(elm: HTMLElement | null, attrName: string): string | null;\r\nexport function attr(elm: HTMLElement | null, attrName: string, value: string): void;\r\nexport function attr(elm: HTMLElement | null, attrName: string, value?: string): string | null | void {\r\n if (isUndefined(value)) {\r\n return elm ? elm.getAttribute(attrName) : null;\r\n }\r\n elm && elm.setAttribute(attrName, value);\r\n}\r\n\r\n/**\r\n * Removes the given attribute from the given element.\r\n * @param elm The element of which the attribute shall be removed.\r\n * @param attrName The attribute name.\r\n */\r\nexport const removeAttr = (elm: Element | null, attrName: string): void => {\r\n elm?.removeAttribute(attrName);\r\n};\r\n\r\n/**\r\n * Gets or sets the scrollLeft value of the given element depending whether the value attribute is given.\r\n * @param elm The element of which the scrollLeft value shall be get or set.\r\n * @param value The scrollLeft value which shall be set.\r\n */\r\nexport function scrollLeft(elm: HTMLElement | null): number;\r\nexport function scrollLeft(elm: HTMLElement | null, value: number): void;\r\nexport function scrollLeft(elm: HTMLElement | null, value?: number): number | void {\r\n return getSetProp('scrollLeft', 0, elm, value) as number;\r\n}\r\n\r\n/**\r\n * Gets or sets the scrollTop value of the given element depending whether the value attribute is given.\r\n * @param elm The element of which the scrollTop value shall be get or set.\r\n * @param value The scrollTop value which shall be set.\r\n */\r\nexport function scrollTop(elm: HTMLElement | null): number;\r\nexport function scrollTop(elm: HTMLElement | null, value: number): void;\r\nexport function scrollTop(elm: HTMLElement | null, value?: number): number | void {\r\n return getSetProp('scrollTop', 0, elm, value) as number;\r\n}\r\n\r\n/**\r\n * Gets or sets the value of the given input element depending whether the value attribute is given.\r\n * @param elm The input element of which the value shall be get or set.\r\n * @param value The value which shall be set.\r\n */\r\nexport function val(elm: HTMLInputElement | null): string;\r\nexport function val(elm: HTMLInputElement | null, value: string): void;\r\nexport function val(elm: HTMLInputElement | null, value?: string): string | void {\r\n return getSetProp('value', '', elm, value) as string;\r\n}\r\n","import { isString } from 'support/utils/types';\r\n\r\nconst rnothtmlwhite = /[^\\x20\\t\\r\\n\\f]+/g;\r\nconst classListAction = (elm: Element | null, className: string, action: (elmClassList: DOMTokenList, clazz: string) => boolean | void): boolean => {\r\n let clazz: string;\r\n let i = 0;\r\n let result = false;\r\n\r\n if (elm && isString(className)) {\r\n const classes: Array = className.match(rnothtmlwhite) || [];\r\n result = classes.length > 0;\r\n while ((clazz = classes[i++])) {\r\n result = (action(elm.classList, clazz) as boolean) && result;\r\n }\r\n }\r\n return result;\r\n};\r\n\r\n/**\r\n * Check whether the given element has the given class name(s).\r\n * @param elm The element.\r\n * @param className The class name(s).\r\n */\r\nexport const hasClass = (elm: Element | null, className: string): boolean =>\r\n classListAction(elm, className, (classList, clazz) => classList.contains(clazz));\r\n\r\n/**\r\n * Adds the given class name(s) to the given element.\r\n * @param elm The element.\r\n * @param className The class name(s) which shall be added. (separated by spaces)\r\n */\r\nexport const addClass = (elm: Element | null, className: string): void => {\r\n classListAction(elm, className, (classList, clazz) => classList.add(clazz));\r\n};\r\n\r\n/**\r\n * Removes the given class name(s) from the given element.\r\n * @param elm The element.\r\n * @param className The class name(s) which shall be removed. (separated by spaces)\r\n */\r\nexport const removeClass = (elm: Element | null, className: string): void => {\r\n classListAction(elm, className, (classList, clazz) => classList.remove(clazz));\r\n};\r\n","import { isArrayLike } from 'support/utils/types';\r\nimport { PlainObject } from 'typings';\r\n\r\n/**\r\n * Iterates through a array or object\r\n * @param arrayLikeOrObject The array or object through which shall be iterated.\r\n * @param callback The function which is responsible for the iteration.\r\n * If the function returns true its treated like a \"continue\" statement.\r\n * If the function returns false its treated like a \"break\" statement.\r\n */\r\nexport function each(\r\n array: Array | ReadonlyArray,\r\n callback: (value: T, indexOrKey: number, source: Array) => boolean | void\r\n): Array | ReadonlyArray;\r\nexport function each(\r\n array: Array | ReadonlyArray | null,\r\n callback: (value: T, indexOrKey: number, source: Array) => boolean | void\r\n): Array | ReadonlyArray | null;\r\nexport function each(\r\n arrayLikeObject: ArrayLike,\r\n callback: (value: T, indexOrKey: number, source: ArrayLike) => boolean | void\r\n): ArrayLike;\r\nexport function each(\r\n arrayLikeObject: ArrayLike | null,\r\n callback: (value: T, indexOrKey: number, source: ArrayLike) => boolean | void\r\n): ArrayLike | null;\r\nexport function each(obj: PlainObject, callback: (value: any, indexOrKey: string, source: PlainObject) => boolean | void): PlainObject;\r\nexport function each(obj: PlainObject | null, callback: (value: any, indexOrKey: string, source: PlainObject) => boolean | void): PlainObject | null;\r\nexport function each(\r\n source: ArrayLike | PlainObject | null,\r\n callback: (value: T | any, indexOrKey: any, source: any) => boolean | void\r\n): Array | ReadonlyArray | ArrayLike | PlainObject | null {\r\n if (isArrayLike(source)) {\r\n for (let i = 0; i < source.length; i++) {\r\n if (callback(source[i], i, source) === false) {\r\n break;\r\n }\r\n }\r\n } else if (source) {\r\n each(Object.keys(source), (key) => callback(source[key], key, source));\r\n }\r\n return source;\r\n}\r\n\r\n/**\r\n * Returns the index of the given inside the given array or -1 if the given item isn't part of the given array.\r\n * @param arr The array.\r\n * @param item The item.\r\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0.\r\n */\r\nexport const indexOf = (arr: Array, item: T, fromIndex?: number): number => arr.indexOf(item, fromIndex);\r\n\r\n/**\r\n * Creates a shallow-copied Array instance from an array-like or iterable object.\r\n * @param arr The object from which the array instance shall be created.\r\n */\r\nexport const from = (arr: ArrayLike) => {\r\n if (Array.from) {\r\n return Array.from(arr);\r\n }\r\n const result: Array = [];\r\n each(arr, (elm) => {\r\n result.push(elm);\r\n });\r\n return result;\r\n};\r\n","import { each, from } from 'support/utils/array';\r\n\r\n/**\r\n * Find all elements with the passed selector, outgoing (and including) the passed element or the document if no element was provided.\r\n * @param selector The selector which has to be searched by.\r\n * @param elm The element from which the search shall be outgoing.\r\n */\r\nexport const find = (selector: string, elm?: Element | null): ReadonlyArray => {\r\n const arr: Array = [];\r\n\r\n each((elm || document).querySelectorAll(selector), (e: Element) => {\r\n arr.push(e);\r\n });\r\n\r\n return arr;\r\n};\r\n\r\n/**\r\n * Find the first element with the passed selector, outgoing (and including) the passed element or the document if no element was provided.\r\n * @param selector The selector which has to be searched by.\r\n * @param elm The element from which the search shall be outgoing.\r\n */\r\nexport const findFirst = (selector: string, elm?: Element | null): Element | null => (elm || document).querySelector(selector);\r\n\r\n/**\r\n * Determines whether the passed element is matching with the passed selector.\r\n * @param elm The element which has to be compared with the passed selector.\r\n * @param selector The selector which has to be compared with the passed element. Additional selectors: ':visible' and ':hidden'.\r\n */\r\nexport const is = (elm: Element | null, selector: string): boolean => (elm ? elm.matches(selector) : false);\r\n\r\n/**\r\n * Returns the children (no text-nodes or comments) of the passed element which are matching the passed selector. An empty array is returned if the passed element is null.\r\n * @param elm The element of which the children shall be returned.\r\n * @param selector The selector which must match with the children elements.\r\n */\r\nexport const children = (elm: Element | null, selector?: string): ReadonlyArray => {\r\n const childs: Array = [];\r\n\r\n each(elm && elm.children, (child: Element) => {\r\n if (selector) {\r\n if (child.matches(selector)) {\r\n childs.push(child);\r\n }\r\n } else {\r\n childs.push(child);\r\n }\r\n });\r\n\r\n return childs;\r\n};\r\n\r\n/**\r\n * Returns the childNodes (incl. text-nodes or comments etc.) of the passed element. An empty array is returned if the passed element is null.\r\n * @param elm The element of which the childNodes shall be returned.\r\n */\r\nexport const contents = (elm: Element | null): ReadonlyArray => (elm ? from(elm.childNodes) : []);\r\n\r\n/**\r\n * Returns the parent element of the passed element, or null if the passed element is null.\r\n * @param elm The element of which the parent element shall be returned.\r\n */\r\nexport const parent = (elm: Node | null): Node | null => (elm ? elm.parentElement : null);\r\n","import { isArrayLike } from 'support/utils/types';\r\nimport { each, from } from 'support/utils/array';\r\nimport { parent } from 'support/dom/traversal';\r\n\r\ntype NodeCollection = ArrayLike | Node | undefined | null;\r\n\r\n/**\r\n * Inserts Nodes before the given preferredAnchor element.\r\n * @param parentElm The parent of the preferredAnchor element or the element which shall be the parent of the inserted Nodes.\r\n * @param preferredAnchor The element before which the Nodes shall be inserted or null if the elements shall be appended at the end.\r\n * @param insertedElms The Nodes which shall be inserted.\r\n */\r\nconst before = (parentElm: Node | null, preferredAnchor: Node | null, insertedElms: NodeCollection): void => {\r\n if (insertedElms) {\r\n let anchor: Node | null = preferredAnchor;\r\n let fragment: DocumentFragment | Node | undefined | null;\r\n\r\n // parent must be defined\r\n if (parentElm) {\r\n if (isArrayLike(insertedElms)) {\r\n fragment = document.createDocumentFragment();\r\n\r\n // append all insertedElms to the fragment and if one of these is the anchor, change the anchor\r\n each(insertedElms, (insertedElm) => {\r\n if (insertedElm === anchor) {\r\n anchor = insertedElm.previousSibling;\r\n }\r\n fragment!.appendChild(insertedElm);\r\n });\r\n } else {\r\n fragment = insertedElms;\r\n }\r\n\r\n // if the preferred anchor isn't null set it to a valid anchor\r\n if (preferredAnchor) {\r\n if (!anchor) {\r\n anchor = parentElm.firstChild;\r\n } else if (anchor !== preferredAnchor) {\r\n anchor = anchor.nextSibling;\r\n }\r\n }\r\n\r\n parentElm.insertBefore(fragment, anchor);\r\n }\r\n }\r\n};\r\n\r\n/**\r\n * Appends the given children at the end of the given Node.\r\n * @param node The Node to which the children shall be appended.\r\n * @param children The Nodes which shall be appended.\r\n */\r\nexport const appendChildren = (node: Node | null, children: NodeCollection): void => {\r\n before(node, null, children);\r\n};\r\n\r\n/**\r\n * Prepends the given children at the start of the given Node.\r\n * @param node The Node to which the children shall be prepended.\r\n * @param children The Nodes which shall be prepended.\r\n */\r\nexport const prependChildren = (node: Node | null, children: NodeCollection): void => {\r\n before(node, node && node.firstChild, children);\r\n};\r\n\r\n/**\r\n * Inserts the given Nodes before the given Node.\r\n * @param node The Node before which the given Nodes shall be inserted.\r\n * @param insertedNodes The Nodes which shall be inserted.\r\n */\r\nexport const insertBefore = (node: Node | null, insertedNodes: NodeCollection): void => {\r\n before(parent(node), node, insertedNodes);\r\n};\r\n\r\n/**\r\n * Inserts the given Nodes after the given Node.\r\n * @param node The Node after which the given Nodes shall be inserted.\r\n * @param insertedNodes The Nodes which shall be inserted.\r\n */\r\nexport const insertAfter = (node: Node | null, insertedNodes: NodeCollection): void => {\r\n before(parent(node), node && node.nextSibling, insertedNodes);\r\n};\r\n\r\n/**\r\n * Removes the given Nodes from their parent.\r\n * @param nodes The Nodes which shall be removed.\r\n */\r\nexport const removeElements = (nodes: NodeCollection): void => {\r\n if (isArrayLike(nodes)) {\r\n each(from(nodes), (e) => removeElements(e));\r\n } else if (nodes) {\r\n const parentElm = parent(nodes);\r\n if (parentElm) {\r\n parentElm.removeChild(nodes);\r\n }\r\n }\r\n};\r\n","import { each } from 'support/utils/array';\r\nimport { contents } from 'support/dom/traversal';\r\nimport { removeElements } from 'support/dom/manipulation';\r\n\r\n/**\r\n * Creates a div DOM node.\r\n */\r\nexport const createDiv = (): HTMLDivElement => document.createElement('div');\r\n\r\n/**\r\n * Creates DOM nodes modeled after the passed html string and returns the root dom nodes as a array.\r\n * @param html The html string after which the DOM nodes shall be created.\r\n */\r\nexport const createDOM = (html: string): ReadonlyArray => {\r\n const createdDiv = createDiv();\r\n createdDiv.innerHTML = html.trim();\r\n\r\n return each(contents(createdDiv), (elm) => removeElements(elm));\r\n};\r\n","import { WH } from 'support/dom';\r\n\r\nconst elementHasDimensions = (elm: HTMLElement): boolean => !!(elm.offsetWidth || elm.offsetHeight || elm.getClientRects().length);\r\nconst zeroObj: WH = {\r\n w: 0,\r\n h: 0,\r\n};\r\n\r\n/**\r\n * Returns the window inner- width and height.\r\n */\r\nexport const windowSize = (): WH => ({\r\n w: window.innerWidth,\r\n h: window.innerHeight,\r\n});\r\n\r\n/**\r\n * Returns the offset- width and height of the passed element. If the element is null the width and height values are 0.\r\n * @param elm The element of which the offset- width and height shall be returned.\r\n */\r\nexport const offsetSize = (elm: HTMLElement | null): WH =>\r\n elm\r\n ? {\r\n w: elm.offsetWidth,\r\n h: elm.offsetHeight,\r\n }\r\n : zeroObj;\r\n\r\n/**\r\n * Returns the client- width and height of the passed element. If the element is null the width and height values are 0.\r\n * @param elm The element of which the client- width and height shall be returned.\r\n */\r\nexport const clientSize = (elm: HTMLElement | null): WH =>\r\n elm\r\n ? {\r\n w: elm.clientWidth,\r\n h: elm.clientHeight,\r\n }\r\n : zeroObj;\r\n\r\n/**\r\n * Returns the BoundingClientRect of the passed element.\r\n * @param elm The element of which the BoundingClientRect shall be returned.\r\n */\r\nexport const getBoundingClientRect = (elm: HTMLElement): DOMRect => elm.getBoundingClientRect();\r\n\r\n/**\r\n * Determines whether the passed element has any dimensions.\r\n * @param elm The element.\r\n */\r\nexport const hasDimensions = (elm: HTMLElement | null): boolean => (elm ? elementHasDimensions(elm as HTMLElement) : false);\r\n","import { isArray, isFunction, isPlainObject, isNull } from 'support/utils/types';\r\nimport { each } from 'support/utils/array';\r\n\r\n/**\r\n * Determines whether the passed object has a property with the passed name.\r\n * @param obj The object.\r\n * @param prop The name of the property.\r\n */\r\nexport const hasOwnProperty = (obj: any, prop: string | number | symbol): boolean => Object.prototype.hasOwnProperty.call(obj, prop);\r\n\r\n/**\r\n * Returns the names of the enumerable string properties and methods of an object.\r\n * @param obj The object of which the properties shall be returned.\r\n */\r\nexport const keys = (obj: any): Array => (obj ? Object.keys(obj) : []);\r\n\r\n// https://github.com/jquery/jquery/blob/master/src/core.js#L116\r\nexport function assignDeep(target: T, object1: U): T & U;\r\nexport function assignDeep(target: T, object1: U, object2: V): T & U & V;\r\nexport function assignDeep(target: T, object1: U, object2: V, object3: W): T & U & V & W;\r\nexport function assignDeep(target: T, object1: U, object2: V, object3: W, object4: X): T & U & V & W & X;\r\nexport function assignDeep(target: T, object1: U, object2: V, object3: W, object4: X, object5: Y): T & U & V & W & X & Y;\r\nexport function assignDeep(\r\n target: T,\r\n object1?: U,\r\n object2?: V,\r\n object3?: W,\r\n object4?: X,\r\n object5?: Y,\r\n object6?: Z\r\n): T & U & V & W & X & Y & Z {\r\n const sources: Array = [object1, object2, object3, object4, object5, object6];\r\n\r\n // Handle case when target is a string or something (possible in deep copy)\r\n if ((typeof target !== 'object' || isNull(target)) && !isFunction(target)) {\r\n target = {} as T;\r\n }\r\n\r\n each(sources, (source) => {\r\n // Extend the base object\r\n each(keys(source), (key) => {\r\n const copy: any = source[key];\r\n\r\n // Prevent Object.prototype pollution\r\n // Prevent never-ending loop\r\n if (target === copy) {\r\n return true;\r\n }\r\n\r\n const copyIsArray = isArray(copy);\r\n\r\n // Recurse if we're merging plain objects or arrays\r\n if (copy && (isPlainObject(copy) || copyIsArray)) {\r\n const src = target[key];\r\n let clone: any = src;\r\n\r\n // Ensure proper type for the source value\r\n if (copyIsArray && !isArray(src)) {\r\n clone = [];\r\n } else if (!copyIsArray && !isPlainObject(src)) {\r\n clone = {};\r\n }\r\n\r\n // Never move original objects, clone them\r\n target[key] = assignDeep(clone, copy) as any;\r\n } else {\r\n target[key] = copy;\r\n }\r\n });\r\n });\r\n\r\n // Return the modified object\r\n return target as any;\r\n}\r\n","import { each, keys } from 'support/utils';\r\nimport { isString, isNumber, isArray } from 'support/utils/types';\r\nimport { PlainObject } from 'typings';\r\n\r\ntype CssStyles = { [key: string]: string | number };\r\nconst cssNumber = {\r\n animationiterationcount: 1,\r\n columncount: 1,\r\n fillopacity: 1,\r\n flexgrow: 1,\r\n flexshrink: 1,\r\n fontweight: 1,\r\n lineheight: 1,\r\n opacity: 1,\r\n order: 1,\r\n orphans: 1,\r\n widows: 1,\r\n zindex: 1,\r\n zoom: 1,\r\n};\r\n\r\nconst adaptCSSVal = (prop: string, val: string | number): string | number => (!cssNumber[prop.toLowerCase()] && isNumber(val) ? `${val}px` : val);\r\nconst getCSSVal = (elm: HTMLElement, computedStyle: CSSStyleDeclaration, prop: string): string =>\r\n /* istanbul ignore next */\r\n computedStyle != null ? computedStyle.getPropertyValue(prop) : elm.style[prop];\r\nconst setCSSVal = (elm: HTMLElement | null, prop: string, val: string | number): void => {\r\n try {\r\n if (elm && elm.style[prop] !== undefined) {\r\n elm.style[prop] = adaptCSSVal(prop, val);\r\n }\r\n } catch (e) {}\r\n};\r\n\r\n/**\r\n * Gets or sets the passed styles to the passed element.\r\n * @param elm The element to which the styles shall be applied to / be read from.\r\n * @param styles The styles which shall be set or read.\r\n */\r\nexport function style(elm: HTMLElement | null, styles: CssStyles): void;\r\nexport function style(elm: HTMLElement | null, styles: string): string;\r\nexport function style(elm: HTMLElement | null, styles: Array | string): { [key: string]: string };\r\nexport function style(elm: HTMLElement | null, styles: CssStyles | Array | string): { [key: string]: string } | string | void {\r\n const getSingleStyle = isString(styles);\r\n const getStyles = isArray(styles) || getSingleStyle;\r\n\r\n if (getStyles) {\r\n let getStylesResult: string | PlainObject = getSingleStyle ? '' : {};\r\n if (elm) {\r\n const computedStyle: CSSStyleDeclaration = window.getComputedStyle(elm, null);\r\n getStylesResult = getSingleStyle\r\n ? getCSSVal(elm, computedStyle, styles as string)\r\n : (styles as Array).reduce((result, key) => {\r\n result[key] = getCSSVal(elm, computedStyle, key as string);\r\n return result;\r\n }, getStylesResult);\r\n }\r\n return getStylesResult;\r\n }\r\n each(keys(styles), (key) => setCSSVal(elm, key, styles[key]));\r\n}\r\n\r\n/**\r\n * Hides the passed element (display: none).\r\n * @param elm The element which shall be hidden.\r\n */\r\nexport const hide = (elm: HTMLElement | null): void => {\r\n style(elm, { display: 'none' });\r\n};\r\n\r\n/**\r\n * Shows the passed element (display: block).\r\n * @param elm The element which shall be shown.\r\n */\r\nexport const show = (elm: HTMLElement | null): void => {\r\n style(elm, { display: 'block' });\r\n};\r\n","import { getBoundingClientRect } from 'support/dom/dimensions';\r\nimport { XY } from 'support/dom';\r\n\r\nconst zeroObj: XY = {\r\n x: 0,\r\n y: 0,\r\n};\r\n\r\n/**\r\n * Returns the offset- left and top coordinates of the passed element relative to the document. If the element is null the top and left values are 0.\r\n * @param elm The element of which the offset- top and left coordinates shall be returned.\r\n */\r\nexport const absoluteCoordinates = (elm: HTMLElement | null): XY => {\r\n const rect = elm ? getBoundingClientRect(elm) : 0;\r\n return rect\r\n ? {\r\n x: rect.left + window.pageYOffset,\r\n y: rect.top + window.pageXOffset,\r\n }\r\n : zeroObj;\r\n};\r\n\r\n/**\r\n * Returns the offset- left and top coordinates of the passed element. If the element is null the top and left values are 0.\r\n * @param elm The element of which the offset- top and left coordinates shall be returned.\r\n */\r\nexport const offsetCoordinates = (elm: HTMLElement | null): XY =>\r\n elm\r\n ? {\r\n x: elm.offsetLeft,\r\n y: elm.offsetTop,\r\n }\r\n : zeroObj;\r\n","function _classPrivateFieldGet(receiver, privateMap) {\n var descriptor = privateMap.get(receiver);\n\n if (!descriptor) {\n throw new TypeError(\"attempted to get private field on non-instance\");\n }\n\n if (descriptor.get) {\n return descriptor.get.call(receiver);\n }\n\n return descriptor.value;\n}\n\nmodule.exports = _classPrivateFieldGet;","function _classPrivateFieldSet(receiver, privateMap, value) {\n var descriptor = privateMap.get(receiver);\n\n if (!descriptor) {\n throw new TypeError(\"attempted to set private field on non-instance\");\n }\n\n if (descriptor.set) {\n descriptor.set.call(receiver, value);\n } else {\n if (!descriptor.writable) {\n throw new TypeError(\"attempted to set read only private field\");\n }\n\n descriptor.value = value;\n }\n\n return value;\n}\n\nmodule.exports = _classPrivateFieldSet;","import { each, hasOwnProperty } from 'support/utils';\r\nimport { createDiv } from 'support/dom';\r\n\r\nconst firstLetterToUpper = (str: string): string => str.charAt(0).toUpperCase() + str.slice(1);\r\nconst getDummyStyle = (): CSSStyleDeclaration => createDiv().style;\r\n\r\n// https://developer.mozilla.org/en-US/docs/Glossary/Vendor_Prefix\r\n\r\nexport const cssPrefixes: ReadonlyArray = ['-webkit-', '-moz-', '-o-', '-ms-'];\r\nexport const jsPrefixes: ReadonlyArray = ['WebKit', 'Moz', 'O', 'MS', 'webkit', 'moz', 'o', 'ms'];\r\n\r\nexport const jsCache: { [key: string]: any } = {};\r\nexport const cssCache: { [key: string]: string } = {};\r\n\r\n/**\r\n * Gets the name of the given CSS property with vendor prefix if it isn't supported without, or undefined if unsupported.\r\n * @param name The name of the CSS property which shall be get.\r\n */\r\nexport const cssProperty = (name: string): string | undefined => {\r\n let result: string | undefined = cssCache[name];\r\n\r\n if (hasOwnProperty(cssCache, name)) {\r\n return result;\r\n }\r\n\r\n const uppercasedName: string = firstLetterToUpper(name);\r\n const elmStyle: CSSStyleDeclaration = getDummyStyle();\r\n\r\n each(cssPrefixes, (prefix: string) => {\r\n const prefixWithoutDashes: string = prefix.replace(/-/g, '');\r\n const resultPossibilities: Array = [\r\n name, // transition\r\n prefix + name, // -webkit-transition\r\n prefixWithoutDashes + uppercasedName, // webkitTransition\r\n firstLetterToUpper(prefixWithoutDashes) + uppercasedName, // WebkitTransition\r\n ];\r\n result = resultPossibilities.find((resultPossibility: string) => elmStyle[resultPossibility] !== undefined);\r\n return !result;\r\n });\r\n\r\n cssCache[name] = result;\r\n return result;\r\n};\r\n\r\n/**\r\n * Get the name of the given CSS property value(s), with vendor prefix if it isn't supported wuthout, or undefined if no value is supported.\r\n * @param property The CSS property to which the CSS property value(s) belong.\r\n * @param values The value(s) separated by spaces which shall be get.\r\n * @param suffix A suffix which is added to each value in case the value is a function or something else more advanced.\r\n */\r\nexport const cssPropertyValue = (property: string, values: string, suffix?: string): string | undefined => {\r\n const name = `${property} ${values}`;\r\n let result: string | undefined = cssCache[name];\r\n\r\n if (hasOwnProperty(cssCache, name)) {\r\n return result;\r\n }\r\n\r\n const dummyStyle: CSSStyleDeclaration = getDummyStyle();\r\n const possbleValues: Array = values.split(' ');\r\n const preparedSuffix: string = suffix || '';\r\n const cssPrefixesWithFirstEmpty = [''].concat(cssPrefixes);\r\n\r\n each(possbleValues, (possibleValue: string) => {\r\n each(cssPrefixesWithFirstEmpty, (prefix: string) => {\r\n const prop = prefix + possibleValue;\r\n dummyStyle.cssText = `${property}:${prop}${preparedSuffix}`;\r\n if (dummyStyle.length) {\r\n result = prop;\r\n return false;\r\n }\r\n });\r\n return !result;\r\n });\r\n\r\n cssCache[name] = result;\r\n return result;\r\n};\r\n\r\n/**\r\n * Get the requested JS function, object or constructor with vendor prefix if it isn't supported without or undefined if unsupported.\r\n * @param name The name of the JS function, object or constructor.\r\n */\r\nexport const jsAPI = (name: string): T | undefined => {\r\n let result: any = jsCache[name] || window[name];\r\n\r\n if (hasOwnProperty(jsCache, name)) {\r\n return result;\r\n }\r\n\r\n each(jsPrefixes, (prefix: string) => {\r\n result = result || window[prefix + firstLetterToUpper(name)];\r\n return !result;\r\n });\r\n\r\n jsCache[name] = result;\r\n return result;\r\n};\r\n","import { jsAPI } from 'support/compatibility/vendors';\r\n\r\nexport const resizeObserver: any | undefined = jsAPI('ResizeObserver');\r\n","function _extends() {\n module.exports = _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}\n\nmodule.exports = _extends;","import { each, indexOf, hasOwnProperty, keys } from 'support/utils';\r\nimport { type, isArray, isUndefined, isEmptyObject, isPlainObject, isString } from 'support/utils/types';\r\nimport { OptionsTemplate, OptionsTemplateTypes, OptionsTemplateType, Func, OptionsValidatedResult } from 'support/options';\r\nimport { PlainObject } from 'typings';\r\n\r\nconst { stringify } = JSON;\r\n\r\n/**\r\n * A prefix and suffix tuple which serves as recognition pattern for template types.\r\n */\r\nconst templateTypePrefixSuffix: readonly [string, string] = ['__TPL_', '_TYPE__'];\r\n/**\r\n * A object which serves as a mapping for \"normal\" types and template types.\r\n * Key = normal type string\r\n * value = template type string\r\n */\r\nconst optionsTemplateTypes: OptionsTemplateTypesDictionary = ['boolean', 'number', 'string', 'array', 'object', 'function', 'null'].reduce(\r\n (result, item) => {\r\n result[item] = templateTypePrefixSuffix[0] + item + templateTypePrefixSuffix[1];\r\n return result;\r\n },\r\n {} as OptionsTemplateTypesDictionary\r\n);\r\n\r\n/**\r\n * Validates the given options object according to the given template object and returns a object which looks like:\r\n * {\r\n * foreign : a object which consists of properties which aren't defined inside the template. (foreign properties)\r\n * validated : a object which consists only of valid properties. (property name is inside the template and value has a correct type)\r\n * }\r\n * @param options The options object which shall be validated.\r\n * @param template The template according to which the options object shall be validated.\r\n * @param optionsDiff When provided the returned validated object will only have properties which are different to this objects properties.\r\n * Example (assume all properties are valid to the template):\r\n * Options object : { a: 'a', b: 'b', c: 'c' }\r\n * optionsDiff object : { a: 'a', b: 'b', c: undefined }\r\n * Returned validated object : { c: 'c' }\r\n * Because the value of the properties a and b didn't change, they aren't included in the returned object.\r\n * Without the optionsDiff object the returned validated object would be: { a: 'a', b: 'b', c: 'c' }\r\n * @param doWriteErrors True if errors shall be logged into the console, false otherwise.\r\n * @param propPath The propertyPath which lead to this object. (used for error logging)\r\n */\r\nconst validateRecursive = (\r\n options: T,\r\n template: OptionsTemplate>,\r\n optionsDiff: T,\r\n doWriteErrors?: boolean,\r\n propPath?: string\r\n): OptionsValidatedResult => {\r\n const validatedOptions: T = {} as T;\r\n const optionsCopy: T = { ...options };\r\n const props = keys(template).filter((prop) => hasOwnProperty(options, prop));\r\n\r\n each(props, (prop: Extract) => {\r\n const optionsDiffValue: any = isUndefined(optionsDiff[prop]) ? {} : optionsDiff[prop];\r\n const optionsValue: any = options[prop];\r\n const templateValue: PlainObject | string | OptionsTemplateTypes | Array = template[prop];\r\n const templateIsComplex = isPlainObject(templateValue);\r\n const propPrefix = propPath ? `${propPath}.` : '';\r\n\r\n // if the template has a object as value, it means that the options are complex (verschachtelt)\r\n if (templateIsComplex && isPlainObject(optionsValue)) {\r\n const validatedResult = validateRecursive(optionsValue, templateValue as PlainObject, optionsDiffValue, doWriteErrors, propPrefix + prop);\r\n validatedOptions[prop] = validatedResult.validated;\r\n optionsCopy[prop] = validatedResult.foreign as any;\r\n\r\n each([optionsCopy, validatedOptions], (value) => {\r\n if (isEmptyObject(value[prop])) {\r\n delete value[prop];\r\n }\r\n });\r\n } else if (!templateIsComplex) {\r\n let isValid = false;\r\n const errorEnumStrings: Array = [];\r\n const errorPossibleTypes: Array = [];\r\n const optionsValueType = type(optionsValue);\r\n const templateValueArr: Array = !isArray(templateValue)\r\n ? [templateValue as string | OptionsTemplateTypes]\r\n : (templateValue as Array);\r\n\r\n each(templateValueArr, (currTemplateType) => {\r\n // if currType value isn't inside possibleTemplateTypes we assume its a enum string value\r\n const isEnumString = indexOf(Object.values(optionsTemplateTypes), currTemplateType) < 0;\r\n if (isEnumString && isString(optionsValue)) {\r\n // split it into a array which contains all possible values for example: [\"yes\", \"no\", \"maybe\"]\r\n const enumStringSplit = currTemplateType.split(' ');\r\n isValid = !!enumStringSplit.find((possibility) => possibility === optionsValue);\r\n\r\n // build error message\r\n errorEnumStrings.push(...enumStringSplit);\r\n } else {\r\n isValid = optionsTemplateTypes[optionsValueType] === currTemplateType;\r\n }\r\n\r\n // build error message\r\n errorPossibleTypes.push(isEnumString ? optionsTemplateTypes.string : currTemplateType);\r\n\r\n // continue if invalid, break if valid\r\n return !isValid;\r\n });\r\n\r\n if (isValid) {\r\n const doStringifyComparison = isArray(optionsValue) || isPlainObject(optionsValue);\r\n if (doStringifyComparison ? stringify(optionsValue) !== stringify(optionsDiffValue) : optionsValue !== optionsDiffValue) {\r\n validatedOptions[prop] = optionsValue;\r\n }\r\n } else if (doWriteErrors) {\r\n console.warn(\r\n `${\r\n `The option \"${propPrefix}${prop}\" wasn't set, because it doesn't accept the type [ ${optionsValueType.toUpperCase()} ] with the value of \"${optionsValue}\".\\r\\n` +\r\n `Accepted types are: [ ${errorPossibleTypes.join(', ').toUpperCase()} ].\\r\\n`\r\n }${errorEnumStrings.length > 0 ? `\\r\\nValid strings are: [ ${errorEnumStrings.join(', ')} ].` : ''}`\r\n );\r\n }\r\n\r\n delete optionsCopy[prop];\r\n }\r\n });\r\n\r\n return {\r\n foreign: optionsCopy,\r\n validated: validatedOptions,\r\n };\r\n};\r\n\r\n/**\r\n * Validates the given options object according to the given template object and returns a object which looks like:\r\n * {\r\n * foreign : a object which consists of properties which aren't defined inside the template. (foreign properties)\r\n * validated : a object which consists only of valid properties. (property name is inside the template and value has a correct type)\r\n * }\r\n * @param options The options object which shall be validated.\r\n * @param template The template according to which the options object shall be validated.\r\n * @param optionsDiff When provided the returned validated object will only have properties which are different to this objects properties.\r\n * Example (assume all properties are valid to the template):\r\n * Options object : { a: 'a', b: 'b', c: 'c' }\r\n * optionsDiff object : { a: 'a', b: 'b', c: undefined }\r\n * Returned validated object : { c: 'c' }\r\n * Because the value of the properties a and b didn't change, they aren't included in the returned object.\r\n * Without the optionsDiff object the returned validated object would be: { a: 'a', b: 'b', c: 'c' }\r\n * @param doWriteErrors True if errors shall be logged into the console, false otherwise.\r\n */\r\nconst validate = (\r\n options: T,\r\n template: OptionsTemplate>,\r\n optionsDiff?: T,\r\n doWriteErrors?: boolean\r\n): OptionsValidatedResult => {\r\n /*\r\n if (!isEmptyObject(foreign) && doWriteErrors)\r\n console.warn(`The following options are discarded due to invalidity:\\r\\n ${window.JSON.stringify(foreign, null, 2)}`);\r\n\r\n //add values, which aren't specified in the template, to the finished validated object to prevent them from being discarded\r\n if (keepForeignProps) {\r\n Object.assign(result.validated, foreign);\r\n }\r\n */\r\n return validateRecursive(options, template, optionsDiff || ({} as T), doWriteErrors || false);\r\n};\r\n\r\nexport { validate, optionsTemplateTypes };\r\n\r\ntype OptionsTemplateTypesDictionary = {\r\n readonly boolean: OptionsTemplateType;\r\n readonly number: OptionsTemplateType;\r\n readonly string: OptionsTemplateType;\r\n readonly array: OptionsTemplateType>;\r\n readonly object: OptionsTemplateType; // eslint-disable-line @typescript-eslint/ban-types\r\n readonly function: OptionsTemplateType;\r\n readonly null: OptionsTemplateType;\r\n};\r\n","import {\r\n createDOM,\r\n addClass,\r\n style,\r\n appendChildren,\r\n clientSize,\r\n absoluteCoordinates,\r\n offsetSize,\r\n scrollLeft,\r\n jsAPI,\r\n XY,\r\n removeAttr,\r\n removeElements,\r\n windowSize,\r\n} from 'support';\r\n\r\ntype OnEnvironmentChanged = (env: Environment) => void;\r\n\r\nconst { abs, round } = Math;\r\nconst envornmentElmId = 'os-envornment';\r\n\r\nconst nativeScrollbarSize = (body: HTMLElement, measureElm: HTMLElement): XY => {\r\n appendChildren(body, measureElm);\r\n const cSize = clientSize(measureElm);\r\n const oSize = offsetSize(measureElm);\r\n\r\n return {\r\n x: oSize.h - cSize.h,\r\n y: oSize.w - cSize.w,\r\n };\r\n};\r\n\r\nconst nativeScrollbarStyling = (testElm: HTMLElement): boolean => {\r\n let result = false;\r\n addClass(testElm, 'os-viewport-native-scrollbars-invisible');\r\n try {\r\n result =\r\n style(testElm, 'scrollbar-width') === 'none' || window.getComputedStyle(testElm, '::-webkit-scrollbar').getPropertyValue('display') === 'none';\r\n } catch (ex) {}\r\n\r\n return result;\r\n};\r\n\r\nconst rtlScrollBehavior = (parentElm: HTMLElement, childElm: HTMLElement): { i: boolean; n: boolean } => {\r\n const strHidden = 'hidden';\r\n style(parentElm, { overflowX: strHidden, overflowY: strHidden, direction: 'rtl' });\r\n scrollLeft(parentElm, 0);\r\n\r\n const parentOffset = absoluteCoordinates(parentElm);\r\n const childOffset = absoluteCoordinates(childElm);\r\n scrollLeft(parentElm, -999); // https://github.com/KingSora/OverlayScrollbars/issues/187\r\n const childOffsetAfterScroll = absoluteCoordinates(childElm);\r\n return {\r\n /**\r\n * origin direction = determines if the zero scroll position is on the left or right side\r\n * 'i' means 'invert' (i === true means that the axis must be inverted to be correct)\r\n * true = on the left side\r\n * false = on the right side\r\n */\r\n i: parentOffset.x === childOffset.x,\r\n /**\r\n * negative = determines if the maximum scroll is positive or negative\r\n * 'n' means 'negate' (n === true means that the axis must be negated to be correct)\r\n * true = negative\r\n * false = positive\r\n */\r\n n: childOffset.x !== childOffsetAfterScroll.x,\r\n };\r\n};\r\n\r\nconst passiveEvents = (): boolean => {\r\n let supportsPassive = false;\r\n try {\r\n /* eslint-disable */\r\n // @ts-ignore\r\n window.addEventListener(\r\n 'test',\r\n null,\r\n Object.defineProperty({}, 'passive', {\r\n get: function () {\r\n supportsPassive = true;\r\n },\r\n })\r\n );\r\n /* eslint-enable */\r\n } catch (e) {}\r\n return supportsPassive;\r\n};\r\n\r\nconst windowDPR = (): number => {\r\n // eslint-disable-next-line\r\n // @ts-ignore\r\n const dDPI = window.screen.deviceXDPI || 0;\r\n // eslint-disable-next-line\r\n // @ts-ignore\r\n const sDPI = window.screen.logicalXDPI || 1;\r\n return window.devicePixelRatio || dDPI / sDPI;\r\n};\r\n\r\nconst diffBiggerThanOne = (valOne: number, valTwo: number): boolean => {\r\n const absValOne = abs(valOne);\r\n const absValTwo = abs(valTwo);\r\n return !(absValOne === absValTwo || absValOne + 1 === absValTwo || absValOne - 1 === absValTwo);\r\n};\r\n\r\nexport class Environment {\r\n #onChangedListener: Set = new Set();\r\n\r\n _autoUpdateLoop!: boolean;\r\n\r\n _nativeScrollbarSize!: XY;\r\n\r\n _nativeScrollbarIsOverlaid!: XY;\r\n\r\n _nativeScrollbarStyling!: boolean;\r\n\r\n _rtlScrollBehavior!: { n: boolean; i: boolean };\r\n\r\n _supportPassiveEvents!: boolean;\r\n\r\n _supportResizeObserver!: boolean;\r\n\r\n constructor() {\r\n const _self = this;\r\n const { body } = document;\r\n const envDOM = createDOM(``);\r\n const envElm = envDOM[0] as HTMLElement;\r\n const envChildElm = envElm.firstChild as HTMLElement;\r\n\r\n const nScrollBarSize = nativeScrollbarSize(body, envElm);\r\n const nativeScrollbarIsOverlaid = {\r\n x: nScrollBarSize.x === 0,\r\n y: nScrollBarSize.y === 0,\r\n };\r\n\r\n _self._autoUpdateLoop = false;\r\n _self._nativeScrollbarSize = nScrollBarSize;\r\n _self._nativeScrollbarIsOverlaid = nativeScrollbarIsOverlaid;\r\n _self._nativeScrollbarStyling = nativeScrollbarStyling(envElm);\r\n _self._rtlScrollBehavior = rtlScrollBehavior(envElm, envChildElm);\r\n _self._supportPassiveEvents = passiveEvents();\r\n _self._supportResizeObserver = !!jsAPI('ResizeObserver');\r\n\r\n removeAttr(envElm, 'style');\r\n removeElements(envElm);\r\n\r\n if (!nativeScrollbarIsOverlaid.x || !nativeScrollbarIsOverlaid.y) {\r\n let size = windowSize();\r\n let dpr = windowDPR();\r\n const onChangedListener = this.#onChangedListener;\r\n\r\n window.addEventListener('resize', () => {\r\n if (onChangedListener.size) {\r\n const sizeNew = windowSize();\r\n const deltaSize = {\r\n w: sizeNew.w - size.w,\r\n h: sizeNew.h - size.h,\r\n };\r\n\r\n if (deltaSize.w === 0 && deltaSize.h === 0) return;\r\n\r\n const deltaAbsSize = {\r\n w: abs(deltaSize.w),\r\n h: abs(deltaSize.h),\r\n };\r\n const deltaAbsRatio = {\r\n w: abs(round(sizeNew.w / (size.w / 100.0))),\r\n h: abs(round(sizeNew.h / (size.h / 100.0))),\r\n };\r\n const dprNew = windowDPR();\r\n const deltaIsBigger = deltaAbsSize.w > 2 && deltaAbsSize.h > 2;\r\n const difference = !diffBiggerThanOne(deltaAbsRatio.w, deltaAbsRatio.h);\r\n const dprChanged = dprNew !== dpr && dpr > 0;\r\n const isZoom = deltaIsBigger && difference && dprChanged;\r\n\r\n const oldScrollbarSize = _self._nativeScrollbarSize;\r\n let newScrollbarSize;\r\n\r\n if (isZoom) {\r\n newScrollbarSize = _self._nativeScrollbarSize = nativeScrollbarSize(body, envElm);\r\n removeElements(envElm);\r\n\r\n if (oldScrollbarSize.x !== newScrollbarSize.x || oldScrollbarSize.y !== newScrollbarSize.y) {\r\n onChangedListener.forEach((listener) => listener && listener(_self));\r\n }\r\n }\r\n\r\n size = sizeNew;\r\n dpr = dprNew;\r\n }\r\n });\r\n }\r\n }\r\n\r\n addListener(listener: OnEnvironmentChanged): void {\r\n this.#onChangedListener.add(listener);\r\n }\r\n\r\n removeListener(listener: OnEnvironmentChanged): void {\r\n this.#onChangedListener.delete(listener);\r\n }\r\n}\r\n","import { createDOM } from 'support/dom';\r\nimport { Environment } from 'environment';\r\n\r\nconst abc = {\r\n a: 1,\r\n b: 1,\r\n c: 1,\r\n};\r\n\r\nexport default () => {\r\n return [\r\n new Environment(),\r\n createDOM(\r\n '\\\r\n \\\r\n
\\\r\n
\\\r\n
\\\r\n
\\\r\n fdfhdfgh\\\r\n
\\\r\n
\\\r\n
\\\r\n
\\\r\n
\\\r\n
\\\r\n
'\r\n ),\r\n ];\r\n};\r\n"],"names":["isNumber","obj","isString","isFunction","isUndefined","undefined","isArray","Array","isArrayLike","length","getSetProp","topLeft","fallback","elm","value","removeAttr","attrName","removeAttribute","scrollLeft","rnothtmlwhite","classListAction","className","action","clazz","i","result","classes","match","classList","addClass","add","each","source","callback","Object","keys","key","from","arr","push","contents","childNodes","parent","parentElement","before","parentElm","preferredAnchor","insertedElms","anchor","fragment","document","createDocumentFragment","insertedElm","previousSibling","appendChild","firstChild","nextSibling","insertBefore","appendChildren","node","children","removeElements","nodes","e","removeChild","createDiv","createElement","createDOM","html","createdDiv","innerHTML","trim","zeroObj","w","h","windowSize","window","innerWidth","innerHeight","offsetSize","offsetWidth","offsetHeight","clientSize","clientWidth","clientHeight","getBoundingClientRect","hasOwnProperty","prop","prototype","call","cssNumber","animationiterationcount","columncount","fillopacity","flexgrow","flexshrink","fontweight","lineheight","opacity","order","orphans","widows","zindex","zoom","adaptCSSVal","val","toLowerCase","getCSSVal","computedStyle","getPropertyValue","style","setCSSVal","styles","getSingleStyle","getStyles","getStylesResult","getComputedStyle","reduce","x","y","absoluteCoordinates","rect","left","pageYOffset","top","pageXOffset","_classPrivateFieldGet","receiver","privateMap","descriptor","get","TypeError","_classPrivateFieldSet","set","writable","firstLetterToUpper","str","charAt","toUpperCase","slice","jsPrefixes","jsCache","jsAPI","name","prefix","resizeObserver","_extends","module","assign","target","arguments","apply","templateTypePrefixSuffix","optionsTemplateTypes","item","abs","round","Math","envornmentElmId","nativeScrollbarSize","body","measureElm","cSize","oSize","nativeScrollbarStyling","testElm","ex","rtlScrollBehavior","childElm","strHidden","overflowX","overflowY","direction","parentOffset","childOffset","childOffsetAfterScroll","n","passiveEvents","supportsPassive","addEventListener","defineProperty","windowDPR","dDPI","screen","deviceXDPI","sDPI","logicalXDPI","devicePixelRatio","diffBiggerThanOne","valOne","valTwo","absValOne","absValTwo","Environment","constructor","Set","_self","envDOM","envElm","envChildElm","nScrollBarSize","nativeScrollbarIsOverlaid","_autoUpdateLoop","_nativeScrollbarSize","_nativeScrollbarIsOverlaid","_nativeScrollbarStyling","_rtlScrollBehavior","_supportPassiveEvents","_supportResizeObserver","size","dpr","onChangedListener","sizeNew","deltaSize","deltaAbsSize","deltaAbsRatio","dprNew","deltaIsBigger","difference","dprChanged","isZoom","oldScrollbarSize","newScrollbarSize","forEach","listener","addListener","removeListener","delete"],"mappings":"SAWgBA,SAASC;AACvB,SAAO,OAAOA,GAAP,KAAe,QAAtB;AACD;SAEeC,SAASD;AACvB,SAAO,OAAOA,GAAP,KAAe,QAAtB;AACD;SAMeE,WAAWF;AACzB,SAAO,OAAOA,GAAP,KAAe,UAAtB;AACD;SAEeG,YAAYH;AAC1B,SAAOA,GAAG,KAAKI,SAAf;AACD;SAMeC,QAAQL;AACtB,SAAOM,KAAK,CAACD,OAAN,CAAcL,GAAd,CAAP;AACD;SAUeO,YAAyCP;AACvD,QAAMQ,MAAM,GAAG,CAAC,CAACR,GAAF,IAASA,GAAG,CAACQ,MAA5B;AACA,SAAOH,OAAO,CAACL,GAAD,CAAP,KAAiB,CAACE,UAAU,CAACF,GAAD,CAAX,IAAoBD,QAAQ,CAACS,MAAD,CAA5B,IAAwCA,MAAM,GAAG,CAAC,CAAlD,IAAuDA,MAAM,GAAG,CAAT,IAA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D;AACF,OAvCD;AAwCD;AACF;;AAEDS,EAAAA,WAAW,CAACD,QAAD;AACT,mDAAwBlM,GAAxB,CAA4BkM,QAA5B;AACD;;AAEDE,EAAAA,cAAc,CAACF,QAAD;AACZ,mDAAwBG,MAAxB,CAA+BH,QAA/B;AACD;;;AC/LH;AACE,SAAO;IACL,IAAI/B,WAAJ,EADK;IAEL9H,SAAS;MACP;;;;;;;;;;;;;;;;;;;;;;IADO;EAFJ,CAAP;AA2BD;;;"}
\ No newline at end of file
+{"version":3,"file":"overlayscrollbars.esm.js","sources":["../src/support/utils/types.ts","../src/support/dom/attribute.ts","../src/support/dom/class.ts","../src/support/utils/array.ts","../src/support/dom/traversal.ts","../src/support/dom/manipulation.ts","../src/support/dom/create.ts","../src/support/dom/dimensions.ts","../src/support/dom/events.ts","../src/support/utils/object.ts","../src/support/dom/style.ts","../src/support/dom/offset.ts","../src/support/compatibility/vendors.ts","../src/support/compatibility/apis.ts","../../../node_modules/@babel/runtime/helpers/extends.js","../src/support/options/validation.ts","../src/environment/environment.ts","../src/overlayscrollbars/observers/SizeObserver.ts","../src/index.ts"],"sourcesContent":["import { PlainObject } from 'typings';\r\n\r\nexport const type: (obj: any) => string = (obj) => {\r\n if (obj === undefined) return `${obj}`;\r\n if (obj === null) return `${obj}`;\r\n return Object.prototype.toString\r\n .call(obj)\r\n .replace(/^\\[object (.+)\\]$/, '$1')\r\n .toLowerCase();\r\n};\r\n\r\nexport function isNumber(obj: any): obj is number {\r\n return typeof obj === 'number';\r\n}\r\n\r\nexport function isString(obj: any): obj is string {\r\n return typeof obj === 'string';\r\n}\r\n\r\nexport function isBoolean(obj: any): obj is boolean {\r\n return typeof obj === 'boolean';\r\n}\r\n\r\nexport function isFunction(obj: any): obj is (...args: Array) => unknown {\r\n return typeof obj === 'function';\r\n}\r\n\r\nexport function isUndefined(obj: any): obj is undefined {\r\n return obj === undefined;\r\n}\r\n\r\nexport function isNull(obj: any): obj is null {\r\n return obj === null;\r\n}\r\n\r\nexport function isArray(obj: any): obj is Array {\r\n return Array.isArray(obj);\r\n}\r\n\r\nexport function isObject(obj: any): boolean {\r\n return typeof obj === 'object' && !isArray(obj) && !isNull(obj);\r\n}\r\n\r\n/**\r\n * Returns true if the given object is array like, false otherwise.\r\n * @param obj The Object\r\n */\r\nexport function isArrayLike(obj: any): obj is ArrayLike {\r\n const length = !!obj && obj.length;\r\n return isArray(obj) || (!isFunction(obj) && isNumber(length) && length > -1 && length % 1 == 0); // eslint-disable-line eqeqeq\r\n}\r\n\r\n/**\r\n * Returns true if the given object is a \"plain\" (e.g. { key: value }) object, false otherwise.\r\n * @param obj The Object.\r\n */\r\nexport function isPlainObject(obj: any): obj is PlainObject {\r\n if (!obj || !isObject(obj) || type(obj) !== 'object') return false;\r\n\r\n let key;\r\n const proto = 'prototype';\r\n const { hasOwnProperty } = Object[proto];\r\n const hasOwnConstructor = hasOwnProperty.call(obj, 'constructor');\r\n const hasIsPrototypeOf = obj.constructor && obj.constructor[proto] && hasOwnProperty.call(obj.constructor[proto], 'isPrototypeOf');\r\n\r\n if (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) {\r\n return false;\r\n }\r\n\r\n /* eslint-disable no-restricted-syntax */\r\n for (key in obj) {\r\n /**/\r\n }\r\n /* eslint-enable */\r\n\r\n return isUndefined(key) || hasOwnProperty.call(obj, key);\r\n}\r\n\r\n/**\r\n * Checks whether the given object is a HTMLElement.\r\n * @param obj The object which shall be checked.\r\n */\r\nexport function isHTMLElement(obj: any): obj is HTMLElement {\r\n const instaceOfRightHandSide = window.HTMLElement;\r\n const doInstanceOf = isObject(instaceOfRightHandSide) || isFunction(instaceOfRightHandSide);\r\n return !!(doInstanceOf ? obj instanceof instaceOfRightHandSide : obj && isObject(obj) && obj.nodeType === 1 && isString(obj.nodeName));\r\n}\r\n\r\n/**\r\n * Returns true if the given object is empty, false otherwise.\r\n * @param obj The Object.\r\n */\r\nexport function isEmptyObject(obj: any): boolean {\r\n /* eslint-disable no-restricted-syntax, guard-for-in */\r\n for (const name in obj) return false;\r\n return true;\r\n /* eslint-enable */\r\n}\r\n","import { isUndefined } from 'support/utils/types';\r\n\r\ntype GetSetPropName = 'scrollLeft' | 'scrollTop' | 'value';\r\n\r\nfunction getSetProp(\r\n topLeft: GetSetPropName,\r\n fallback: number | string,\r\n elm: HTMLElement | HTMLInputElement | null,\r\n value?: number | string\r\n): number | string | void {\r\n if (isUndefined(value)) {\r\n return elm ? elm[topLeft] : fallback;\r\n }\r\n elm && (elm[topLeft] = value);\r\n}\r\n\r\n/**\r\n * Gets or sets a attribute with the given attribute of the given element depending whether the value attribute is given.\r\n * Returns null if the element has no attribute with the given name.\r\n * @param elm The element of which the attribute shall be get or set.\r\n * @param attrName The attribute name which shall be get or set.\r\n * @param value The value of the attribute which shall be set.\r\n */\r\nexport function attr(elm: HTMLElement | null, attrName: string): string | null;\r\nexport function attr(elm: HTMLElement | null, attrName: string, value: string): void;\r\nexport function attr(elm: HTMLElement | null, attrName: string, value?: string): string | null | void {\r\n if (isUndefined(value)) {\r\n return elm ? elm.getAttribute(attrName) : null;\r\n }\r\n elm && elm.setAttribute(attrName, value);\r\n}\r\n\r\n/**\r\n * Removes the given attribute from the given element.\r\n * @param elm The element of which the attribute shall be removed.\r\n * @param attrName The attribute name.\r\n */\r\nexport const removeAttr = (elm: Element | null, attrName: string): void => {\r\n elm?.removeAttribute(attrName);\r\n};\r\n\r\n/**\r\n * Gets or sets the scrollLeft value of the given element depending whether the value attribute is given.\r\n * @param elm The element of which the scrollLeft value shall be get or set.\r\n * @param value The scrollLeft value which shall be set.\r\n */\r\nexport function scrollLeft(elm: HTMLElement | null): number;\r\nexport function scrollLeft(elm: HTMLElement | null, value: number): void;\r\nexport function scrollLeft(elm: HTMLElement | null, value?: number): number | void {\r\n return getSetProp('scrollLeft', 0, elm, value) as number;\r\n}\r\n\r\n/**\r\n * Gets or sets the scrollTop value of the given element depending whether the value attribute is given.\r\n * @param elm The element of which the scrollTop value shall be get or set.\r\n * @param value The scrollTop value which shall be set.\r\n */\r\nexport function scrollTop(elm: HTMLElement | null): number;\r\nexport function scrollTop(elm: HTMLElement | null, value: number): void;\r\nexport function scrollTop(elm: HTMLElement | null, value?: number): number | void {\r\n return getSetProp('scrollTop', 0, elm, value) as number;\r\n}\r\n\r\n/**\r\n * Gets or sets the value of the given input element depending whether the value attribute is given.\r\n * @param elm The input element of which the value shall be get or set.\r\n * @param value The value which shall be set.\r\n */\r\nexport function val(elm: HTMLInputElement | null): string;\r\nexport function val(elm: HTMLInputElement | null, value: string): void;\r\nexport function val(elm: HTMLInputElement | null, value?: string): string | void {\r\n return getSetProp('value', '', elm, value) as string;\r\n}\r\n","import { isString } from 'support/utils/types';\r\n\r\nconst rnothtmlwhite = /[^\\x20\\t\\r\\n\\f]+/g;\r\nconst classListAction = (elm: Element | null, className: string, action: (elmClassList: DOMTokenList, clazz: string) => boolean | void): boolean => {\r\n let clazz: string;\r\n let i = 0;\r\n let result = false;\r\n\r\n if (elm && isString(className)) {\r\n const classes: Array = className.match(rnothtmlwhite) || [];\r\n result = classes.length > 0;\r\n while ((clazz = classes[i++])) {\r\n result = (action(elm.classList, clazz) as boolean) && result;\r\n }\r\n }\r\n return result;\r\n};\r\n\r\n/**\r\n * Check whether the given element has the given class name(s).\r\n * @param elm The element.\r\n * @param className The class name(s).\r\n */\r\nexport const hasClass = (elm: Element | null, className: string): boolean =>\r\n classListAction(elm, className, (classList, clazz) => classList.contains(clazz));\r\n\r\n/**\r\n * Adds the given class name(s) to the given element.\r\n * @param elm The element.\r\n * @param className The class name(s) which shall be added. (separated by spaces)\r\n */\r\nexport const addClass = (elm: Element | null, className: string): void => {\r\n classListAction(elm, className, (classList, clazz) => classList.add(clazz));\r\n};\r\n\r\n/**\r\n * Removes the given class name(s) from the given element.\r\n * @param elm The element.\r\n * @param className The class name(s) which shall be removed. (separated by spaces)\r\n */\r\nexport const removeClass = (elm: Element | null, className: string): void => {\r\n classListAction(elm, className, (classList, clazz) => classList.remove(clazz));\r\n};\r\n","import { isArrayLike } from 'support/utils/types';\r\nimport { PlainObject } from 'typings';\r\n\r\ntype RunEachItem = ((...args: any) => any | any[]) | null | undefined;\r\n\r\n/**\r\n * Iterates through a array or object\r\n * @param arrayLikeOrObject The array or object through which shall be iterated.\r\n * @param callback The function which is responsible for the iteration.\r\n * If the function returns true its treated like a \"continue\" statement.\r\n * If the function returns false its treated like a \"break\" statement.\r\n */\r\nexport function each(\r\n array: Array | ReadonlyArray,\r\n callback: (value: T, indexOrKey: number, source: Array) => boolean | void\r\n): Array | ReadonlyArray;\r\nexport function each(\r\n array: Array | ReadonlyArray | null,\r\n callback: (value: T, indexOrKey: number, source: Array) => boolean | void\r\n): Array | ReadonlyArray | null;\r\nexport function each(\r\n arrayLikeObject: ArrayLike,\r\n callback: (value: T, indexOrKey: number, source: ArrayLike) => boolean | void\r\n): ArrayLike;\r\nexport function each(\r\n arrayLikeObject: ArrayLike | null,\r\n callback: (value: T, indexOrKey: number, source: ArrayLike) => boolean | void\r\n): ArrayLike | null;\r\nexport function each(obj: PlainObject, callback: (value: any, indexOrKey: string, source: PlainObject) => boolean | void): PlainObject;\r\nexport function each(obj: PlainObject | null, callback: (value: any, indexOrKey: string, source: PlainObject) => boolean | void): PlainObject | null;\r\nexport function each(\r\n source: ArrayLike | PlainObject | null,\r\n callback: (value: T, indexOrKey: any, source: any) => boolean | void\r\n): Array | ReadonlyArray | ArrayLike | PlainObject | null {\r\n if (isArrayLike(source)) {\r\n for (let i = 0; i < source.length; i++) {\r\n if (callback(source[i], i, source) === false) {\r\n break;\r\n }\r\n }\r\n } else if (source) {\r\n each(Object.keys(source), (key) => callback(source[key], key, source));\r\n }\r\n return source;\r\n}\r\n\r\n/**\r\n * Returns the index of the given inside the given array or -1 if the given item isn't part of the given array.\r\n * @param arr The array.\r\n * @param item The item.\r\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0.\r\n */\r\nexport const indexOf = (arr: Array, item: T, fromIndex?: number): number => arr.indexOf(item, fromIndex);\r\n\r\n/**\r\n * Creates a shallow-copied Array instance from an array-like or iterable object.\r\n * @param arr The object from which the array instance shall be created.\r\n */\r\nexport const from = (arr: ArrayLike) => {\r\n if (Array.from) {\r\n return Array.from(arr);\r\n }\r\n const result: Array = [];\r\n each(arr, (elm) => {\r\n result.push(elm);\r\n });\r\n return result;\r\n};\r\n\r\n/**\r\n * Calls all functions in the passed array/set of functions.\r\n * @param arr The array filled with function which shall be called.\r\n */\r\nexport const runEach = (arr: ArrayLike | Set): void => {\r\n if (arr instanceof Set) {\r\n arr.forEach((fn) => fn && fn());\r\n } else {\r\n each(arr, (fn) => fn && fn());\r\n }\r\n};\r\n","import { each, from } from 'support/utils/array';\r\n\r\n/**\r\n * Find all elements with the passed selector, outgoing (and including) the passed element or the document if no element was provided.\r\n * @param selector The selector which has to be searched by.\r\n * @param elm The element from which the search shall be outgoing.\r\n */\r\nexport const find = (selector: string, elm?: Element | null): ReadonlyArray => {\r\n const arr: Array = [];\r\n\r\n each((elm || document).querySelectorAll(selector), (e: Element) => {\r\n arr.push(e);\r\n });\r\n\r\n return arr;\r\n};\r\n\r\n/**\r\n * Find the first element with the passed selector, outgoing (and including) the passed element or the document if no element was provided.\r\n * @param selector The selector which has to be searched by.\r\n * @param elm The element from which the search shall be outgoing.\r\n */\r\nexport const findFirst = (selector: string, elm?: Element | null): Element | null => (elm || document).querySelector(selector);\r\n\r\n/**\r\n * Determines whether the passed element is matching with the passed selector.\r\n * @param elm The element which has to be compared with the passed selector.\r\n * @param selector The selector which has to be compared with the passed element. Additional selectors: ':visible' and ':hidden'.\r\n */\r\nexport const is = (elm: Element | null, selector: string): boolean => (elm ? elm.matches(selector) : false);\r\n\r\n/**\r\n * Returns the children (no text-nodes or comments) of the passed element which are matching the passed selector. An empty array is returned if the passed element is null.\r\n * @param elm The element of which the children shall be returned.\r\n * @param selector The selector which must match with the children elements.\r\n */\r\nexport const children = (elm: Element | null, selector?: string): ReadonlyArray => {\r\n const childs: Array = [];\r\n\r\n each(elm && elm.children, (child: Element) => {\r\n if (selector) {\r\n if (child.matches(selector)) {\r\n childs.push(child);\r\n }\r\n } else {\r\n childs.push(child);\r\n }\r\n });\r\n\r\n return childs;\r\n};\r\n\r\n/**\r\n * Returns the childNodes (incl. text-nodes or comments etc.) of the passed element. An empty array is returned if the passed element is null.\r\n * @param elm The element of which the childNodes shall be returned.\r\n */\r\nexport const contents = (elm: Element | null): ReadonlyArray => (elm ? from(elm.childNodes) : []);\r\n\r\n/**\r\n * Returns the parent element of the passed element, or null if the passed element is null.\r\n * @param elm The element of which the parent element shall be returned.\r\n */\r\nexport const parent = (elm: Node | null): Node | null => (elm ? elm.parentElement : null);\r\n","import { isArrayLike } from 'support/utils/types';\r\nimport { each, from } from 'support/utils/array';\r\nimport { parent } from 'support/dom/traversal';\r\n\r\ntype NodeCollection = ArrayLike | Node | undefined | null;\r\n\r\n/**\r\n * Inserts Nodes before the given preferredAnchor element.\r\n * @param parentElm The parent of the preferredAnchor element or the element which shall be the parent of the inserted Nodes.\r\n * @param preferredAnchor The element before which the Nodes shall be inserted or null if the elements shall be appended at the end.\r\n * @param insertedElms The Nodes which shall be inserted.\r\n */\r\nconst before = (parentElm: Node | null, preferredAnchor: Node | null, insertedElms: NodeCollection): void => {\r\n if (insertedElms) {\r\n let anchor: Node | null = preferredAnchor;\r\n let fragment: DocumentFragment | Node | undefined | null;\r\n\r\n // parent must be defined\r\n if (parentElm) {\r\n if (isArrayLike(insertedElms)) {\r\n fragment = document.createDocumentFragment();\r\n\r\n // append all insertedElms to the fragment and if one of these is the anchor, change the anchor\r\n each(insertedElms, (insertedElm) => {\r\n if (insertedElm === anchor) {\r\n anchor = insertedElm.previousSibling;\r\n }\r\n fragment!.appendChild(insertedElm);\r\n });\r\n } else {\r\n fragment = insertedElms;\r\n }\r\n\r\n // if the preferred anchor isn't null set it to a valid anchor\r\n if (preferredAnchor) {\r\n if (!anchor) {\r\n anchor = parentElm.firstChild;\r\n } else if (anchor !== preferredAnchor) {\r\n anchor = anchor.nextSibling;\r\n }\r\n }\r\n\r\n parentElm.insertBefore(fragment, anchor);\r\n }\r\n }\r\n};\r\n\r\n/**\r\n * Appends the given children at the end of the given Node.\r\n * @param node The Node to which the children shall be appended.\r\n * @param children The Nodes which shall be appended.\r\n */\r\nexport const appendChildren = (node: Node | null, children: NodeCollection): void => {\r\n before(node, null, children);\r\n};\r\n\r\n/**\r\n * Prepends the given children at the start of the given Node.\r\n * @param node The Node to which the children shall be prepended.\r\n * @param children The Nodes which shall be prepended.\r\n */\r\nexport const prependChildren = (node: Node | null, children: NodeCollection): void => {\r\n before(node, node && node.firstChild, children);\r\n};\r\n\r\n/**\r\n * Inserts the given Nodes before the given Node.\r\n * @param node The Node before which the given Nodes shall be inserted.\r\n * @param insertedNodes The Nodes which shall be inserted.\r\n */\r\nexport const insertBefore = (node: Node | null, insertedNodes: NodeCollection): void => {\r\n before(parent(node), node, insertedNodes);\r\n};\r\n\r\n/**\r\n * Inserts the given Nodes after the given Node.\r\n * @param node The Node after which the given Nodes shall be inserted.\r\n * @param insertedNodes The Nodes which shall be inserted.\r\n */\r\nexport const insertAfter = (node: Node | null, insertedNodes: NodeCollection): void => {\r\n before(parent(node), node && node.nextSibling, insertedNodes);\r\n};\r\n\r\n/**\r\n * Removes the given Nodes from their parent.\r\n * @param nodes The Nodes which shall be removed.\r\n */\r\nexport const removeElements = (nodes: NodeCollection): void => {\r\n if (isArrayLike(nodes)) {\r\n each(from(nodes), (e) => removeElements(e));\r\n } else if (nodes) {\r\n const parentElm = parent(nodes);\r\n if (parentElm) {\r\n parentElm.removeChild(nodes);\r\n }\r\n }\r\n};\r\n","import { each } from 'support/utils/array';\r\nimport { contents } from 'support/dom/traversal';\r\nimport { removeElements } from 'support/dom/manipulation';\r\n\r\n/**\r\n * Creates a div DOM node.\r\n */\r\nexport const createDiv = (): HTMLDivElement => document.createElement('div');\r\n\r\n/**\r\n * Creates DOM nodes modeled after the passed html string and returns the root dom nodes as a array.\r\n * @param html The html string after which the DOM nodes shall be created.\r\n */\r\nexport const createDOM = (html: string): ReadonlyArray => {\r\n const createdDiv = createDiv();\r\n createdDiv.innerHTML = html.trim();\r\n\r\n return each(contents(createdDiv), (elm) => removeElements(elm));\r\n};\r\n","export interface WH {\r\n w: T;\r\n h: T;\r\n}\r\n\r\nconst elementHasDimensions = (elm: HTMLElement): boolean => !!(elm.offsetWidth || elm.offsetHeight || elm.getClientRects().length);\r\nconst zeroObj: WH = {\r\n w: 0,\r\n h: 0,\r\n};\r\n\r\n/**\r\n * Returns the window inner- width and height.\r\n */\r\nexport const windowSize = (): WH => ({\r\n w: window.innerWidth,\r\n h: window.innerHeight,\r\n});\r\n\r\n/**\r\n * Returns the offset- width and height of the passed element. If the element is null the width and height values are 0.\r\n * @param elm The element of which the offset- width and height shall be returned.\r\n */\r\nexport const offsetSize = (elm: HTMLElement | null): WH =>\r\n elm\r\n ? {\r\n w: elm.offsetWidth,\r\n h: elm.offsetHeight,\r\n }\r\n : zeroObj;\r\n\r\n/**\r\n * Returns the client- width and height of the passed element. If the element is null the width and height values are 0.\r\n * @param elm The element of which the client- width and height shall be returned.\r\n */\r\nexport const clientSize = (elm: HTMLElement | null): WH =>\r\n elm\r\n ? {\r\n w: elm.clientWidth,\r\n h: elm.clientHeight,\r\n }\r\n : zeroObj;\r\n\r\n/**\r\n * Returns the BoundingClientRect of the passed element.\r\n * @param elm The element of which the BoundingClientRect shall be returned.\r\n */\r\nexport const getBoundingClientRect = (elm: HTMLElement): DOMRect => elm.getBoundingClientRect();\r\n\r\n/**\r\n * Determines whether the passed element has any dimensions.\r\n * @param elm The element.\r\n */\r\nexport const hasDimensions = (elm: HTMLElement | null): boolean => (elm ? elementHasDimensions(elm as HTMLElement) : false);\r\n","import { each, runEach } from 'support/utils/array';\r\n\r\nlet passiveEventsSupport: boolean;\r\nconst supportPassiveEvents = (): boolean => {\r\n if (passiveEventsSupport === undefined) {\r\n passiveEventsSupport = false;\r\n try {\r\n /* eslint-disable */\r\n // @ts-ignore\r\n window.addEventListener(\r\n 'test',\r\n null,\r\n Object.defineProperty({}, 'passive', {\r\n get: function () {\r\n passiveEventsSupport = true;\r\n },\r\n })\r\n );\r\n /* eslint-enable */\r\n } catch (e) {}\r\n }\r\n return passiveEventsSupport;\r\n};\r\n\r\nexport interface OnOptions {\r\n _capture?: boolean;\r\n _passive?: boolean;\r\n _once?: boolean;\r\n}\r\n\r\n/**\r\n * Removes the passed event listener for the passed events with the passed options.\r\n * @param target The element from which the listener shall be removed.\r\n * @param eventNames The eventsnames for which the listener shall be removed.\r\n * @param listener The listener which shall be removed.\r\n * @param capture The options of the removed listener.\r\n */\r\nexport const off = (target: EventTarget, eventNames: string, listener: EventListener, capture?: boolean): void => {\r\n each(eventNames.split(' '), (eventName) => {\r\n target.removeEventListener(eventName, listener, capture);\r\n });\r\n};\r\n\r\n/**\r\n * Adds the passed event listener for the passed eventnames with the passed options.\r\n * @param target The element to which the listener shall be added.\r\n * @param eventNames The eventsnames for which the listener shall be called.\r\n * @param listener The listener which is called on the eventnames.\r\n * @param options The options of the added listener.\r\n */\r\nexport const on = (target: EventTarget, eventNames: string, listener: EventListener, options?: OnOptions): (() => void) => {\r\n const doSupportPassiveEvents = supportPassiveEvents();\r\n const passive = (doSupportPassiveEvents && options && options._passive) || false;\r\n const capture = (options && options._capture) || false;\r\n const once = (options && options._once) || false;\r\n const offListeners: (() => void)[] = [];\r\n const nativeOptions: AddEventListenerOptions | boolean = doSupportPassiveEvents\r\n ? {\r\n passive,\r\n capture,\r\n }\r\n : capture;\r\n\r\n each(eventNames.split(' '), (eventName) => {\r\n const finalListener = once\r\n ? (evt: Event) => {\r\n target.removeEventListener(eventName, finalListener, capture);\r\n listener && listener(evt);\r\n }\r\n : listener;\r\n\r\n offListeners.push(off.bind(null, target, eventName, finalListener, capture));\r\n target.addEventListener(eventName, finalListener, nativeOptions);\r\n });\r\n\r\n return runEach.bind(0, offListeners);\r\n};\r\n\r\n/**\r\n * Shorthand for the stopPropagation event Method.\r\n * @param evt The event of which the stopPropagation method shall be called.\r\n */\r\nexport const stopPropagation = (evt: Event) => evt.stopPropagation();\r\n\r\n/**\r\n * Shorthand for the preventDefault event Method.\r\n * @param evt The event of which the preventDefault method shall be called.\r\n */\r\nexport const preventDefault = (evt: Event) => evt.preventDefault();\r\n","import { isArray, isFunction, isPlainObject, isNull } from 'support/utils/types';\r\nimport { each } from 'support/utils/array';\r\n\r\n/**\r\n * Determines whether the passed object has a property with the passed name.\r\n * @param obj The object.\r\n * @param prop The name of the property.\r\n */\r\nexport const hasOwnProperty = (obj: any, prop: string | number | symbol): boolean => Object.prototype.hasOwnProperty.call(obj, prop);\r\n\r\n/**\r\n * Returns the names of the enumerable string properties and methods of an object.\r\n * @param obj The object of which the properties shall be returned.\r\n */\r\nexport const keys = (obj: any): Array => (obj ? Object.keys(obj) : []);\r\n\r\n// https://github.com/jquery/jquery/blob/master/src/core.js#L116\r\nexport function assignDeep(target: T, object1: U): T & U;\r\nexport function assignDeep(target: T, object1: U, object2: V): T & U & V;\r\nexport function assignDeep(target: T, object1: U, object2: V, object3: W): T & U & V & W;\r\nexport function assignDeep(target: T, object1: U, object2: V, object3: W, object4: X): T & U & V & W & X;\r\nexport function assignDeep(target: T, object1: U, object2: V, object3: W, object4: X, object5: Y): T & U & V & W & X & Y;\r\nexport function assignDeep(\r\n target: T,\r\n object1?: U,\r\n object2?: V,\r\n object3?: W,\r\n object4?: X,\r\n object5?: Y,\r\n object6?: Z\r\n): T & U & V & W & X & Y & Z {\r\n const sources: Array = [object1, object2, object3, object4, object5, object6];\r\n\r\n // Handle case when target is a string or something (possible in deep copy)\r\n if ((typeof target !== 'object' || isNull(target)) && !isFunction(target)) {\r\n target = {} as T;\r\n }\r\n\r\n each(sources, (source) => {\r\n // Extend the base object\r\n each(keys(source), (key) => {\r\n const copy: any = source[key];\r\n\r\n // Prevent Object.prototype pollution\r\n // Prevent never-ending loop\r\n if (target === copy) {\r\n return true;\r\n }\r\n\r\n const copyIsArray = isArray(copy);\r\n\r\n // Recurse if we're merging plain objects or arrays\r\n if (copy && (isPlainObject(copy) || copyIsArray)) {\r\n const src = target[key];\r\n let clone: any = src;\r\n\r\n // Ensure proper type for the source value\r\n if (copyIsArray && !isArray(src)) {\r\n clone = [];\r\n } else if (!copyIsArray && !isPlainObject(src)) {\r\n clone = {};\r\n }\r\n\r\n // Never move original objects, clone them\r\n target[key] = assignDeep(clone, copy) as any;\r\n } else {\r\n target[key] = copy;\r\n }\r\n });\r\n });\r\n\r\n // Return the modified object\r\n return target as any;\r\n}\r\n","import { each, keys } from 'support/utils';\r\nimport { isString, isNumber, isArray } from 'support/utils/types';\r\nimport { PlainObject } from 'typings';\r\n\r\ntype CssStyles = { [key: string]: string | number };\r\nconst cssNumber = {\r\n animationiterationcount: 1,\r\n columncount: 1,\r\n fillopacity: 1,\r\n flexgrow: 1,\r\n flexshrink: 1,\r\n fontweight: 1,\r\n lineheight: 1,\r\n opacity: 1,\r\n order: 1,\r\n orphans: 1,\r\n widows: 1,\r\n zindex: 1,\r\n zoom: 1,\r\n};\r\n\r\nconst adaptCSSVal = (prop: string, val: string | number): string | number => (!cssNumber[prop.toLowerCase()] && isNumber(val) ? `${val}px` : val);\r\nconst getCSSVal = (elm: HTMLElement, computedStyle: CSSStyleDeclaration, prop: string): string =>\r\n /* istanbul ignore next */\r\n computedStyle != null ? computedStyle.getPropertyValue(prop) : elm.style[prop];\r\nconst setCSSVal = (elm: HTMLElement | null, prop: string, val: string | number): void => {\r\n try {\r\n if (elm && elm.style[prop] !== undefined) {\r\n elm.style[prop] = adaptCSSVal(prop, val);\r\n }\r\n } catch (e) {}\r\n};\r\n\r\n/**\r\n * Gets or sets the passed styles to the passed element.\r\n * @param elm The element to which the styles shall be applied to / be read from.\r\n * @param styles The styles which shall be set or read.\r\n */\r\nexport function style(elm: HTMLElement | null, styles: CssStyles): void;\r\nexport function style(elm: HTMLElement | null, styles: string): string;\r\nexport function style(elm: HTMLElement | null, styles: Array | string): { [key: string]: string };\r\nexport function style(elm: HTMLElement | null, styles: CssStyles | Array | string): { [key: string]: string } | string | void {\r\n const getSingleStyle = isString(styles);\r\n const getStyles = isArray(styles) || getSingleStyle;\r\n\r\n if (getStyles) {\r\n let getStylesResult: string | PlainObject = getSingleStyle ? '' : {};\r\n if (elm) {\r\n const computedStyle: CSSStyleDeclaration = window.getComputedStyle(elm, null);\r\n getStylesResult = getSingleStyle\r\n ? getCSSVal(elm, computedStyle, styles as string)\r\n : (styles as Array).reduce((result, key) => {\r\n result[key] = getCSSVal(elm, computedStyle, key as string);\r\n return result;\r\n }, getStylesResult);\r\n }\r\n return getStylesResult;\r\n }\r\n each(keys(styles), (key) => setCSSVal(elm, key, styles[key]));\r\n}\r\n\r\n/**\r\n * Hides the passed element (display: none).\r\n * @param elm The element which shall be hidden.\r\n */\r\nexport const hide = (elm: HTMLElement | null): void => {\r\n style(elm, { display: 'none' });\r\n};\r\n\r\n/**\r\n * Shows the passed element (display: block).\r\n * @param elm The element which shall be shown.\r\n */\r\nexport const show = (elm: HTMLElement | null): void => {\r\n style(elm, { display: 'block' });\r\n};\r\n","import { getBoundingClientRect } from 'support/dom/dimensions';\r\n\r\nexport interface XY {\r\n x: T;\r\n y: T;\r\n}\r\n\r\nconst zeroObj: XY = {\r\n x: 0,\r\n y: 0,\r\n};\r\n\r\n/**\r\n * Returns the offset- left and top coordinates of the passed element relative to the document. If the element is null the top and left values are 0.\r\n * @param elm The element of which the offset- top and left coordinates shall be returned.\r\n */\r\nexport const absoluteCoordinates = (elm: HTMLElement | null): XY => {\r\n const rect = elm ? getBoundingClientRect(elm) : 0;\r\n return rect\r\n ? {\r\n x: rect.left + window.pageYOffset,\r\n y: rect.top + window.pageXOffset,\r\n }\r\n : zeroObj;\r\n};\r\n\r\n/**\r\n * Returns the offset- left and top coordinates of the passed element. If the element is null the top and left values are 0.\r\n * @param elm The element of which the offset- top and left coordinates shall be returned.\r\n */\r\nexport const offsetCoordinates = (elm: HTMLElement | null): XY =>\r\n elm\r\n ? {\r\n x: elm.offsetLeft,\r\n y: elm.offsetTop,\r\n }\r\n : zeroObj;\r\n","import { each, hasOwnProperty } from 'support/utils';\r\nimport { createDiv } from 'support/dom';\r\n\r\nconst firstLetterToUpper = (str: string): string => str.charAt(0).toUpperCase() + str.slice(1);\r\nconst getDummyStyle = (): CSSStyleDeclaration => createDiv().style;\r\n\r\n// https://developer.mozilla.org/en-US/docs/Glossary/Vendor_Prefix\r\n\r\nexport const cssPrefixes: ReadonlyArray = ['-webkit-', '-moz-', '-o-', '-ms-'];\r\nexport const jsPrefixes: ReadonlyArray = ['WebKit', 'Moz', 'O', 'MS', 'webkit', 'moz', 'o', 'ms'];\r\n\r\nexport const jsCache: { [key: string]: any } = {};\r\nexport const cssCache: { [key: string]: string } = {};\r\n\r\n/**\r\n * Gets the name of the given CSS property with vendor prefix if it isn't supported without, or undefined if unsupported.\r\n * @param name The name of the CSS property which shall be get.\r\n */\r\nexport const cssProperty = (name: string): string | undefined => {\r\n let result: string | undefined = cssCache[name];\r\n\r\n if (hasOwnProperty(cssCache, name)) {\r\n return result;\r\n }\r\n\r\n const uppercasedName: string = firstLetterToUpper(name);\r\n const elmStyle: CSSStyleDeclaration = getDummyStyle();\r\n\r\n each(cssPrefixes, (prefix: string) => {\r\n const prefixWithoutDashes: string = prefix.replace(/-/g, '');\r\n const resultPossibilities: Array = [\r\n name, // transition\r\n prefix + name, // -webkit-transition\r\n prefixWithoutDashes + uppercasedName, // webkitTransition\r\n firstLetterToUpper(prefixWithoutDashes) + uppercasedName, // WebkitTransition\r\n ];\r\n result = resultPossibilities.find((resultPossibility: string) => elmStyle[resultPossibility] !== undefined);\r\n return !result;\r\n });\r\n\r\n cssCache[name] = result;\r\n return result;\r\n};\r\n\r\n/**\r\n * Get the name of the given CSS property value(s), with vendor prefix if it isn't supported wuthout, or undefined if no value is supported.\r\n * @param property The CSS property to which the CSS property value(s) belong.\r\n * @param values The value(s) separated by spaces which shall be get.\r\n * @param suffix A suffix which is added to each value in case the value is a function or something else more advanced.\r\n */\r\nexport const cssPropertyValue = (property: string, values: string, suffix?: string): string | undefined => {\r\n const name = `${property} ${values}`;\r\n let result: string | undefined = cssCache[name];\r\n\r\n if (hasOwnProperty(cssCache, name)) {\r\n return result;\r\n }\r\n\r\n const dummyStyle: CSSStyleDeclaration = getDummyStyle();\r\n const possbleValues: Array = values.split(' ');\r\n const preparedSuffix: string = suffix || '';\r\n const cssPrefixesWithFirstEmpty = [''].concat(cssPrefixes);\r\n\r\n each(possbleValues, (possibleValue: string) => {\r\n each(cssPrefixesWithFirstEmpty, (prefix: string) => {\r\n const prop = prefix + possibleValue;\r\n dummyStyle.cssText = `${property}:${prop}${preparedSuffix}`;\r\n if (dummyStyle.length) {\r\n result = prop;\r\n return false;\r\n }\r\n });\r\n return !result;\r\n });\r\n\r\n cssCache[name] = result;\r\n return result;\r\n};\r\n\r\n/**\r\n * Get the requested JS function, object or constructor with vendor prefix if it isn't supported without or undefined if unsupported.\r\n * @param name The name of the JS function, object or constructor.\r\n */\r\nexport const jsAPI = (name: string): T | undefined => {\r\n let result: any = jsCache[name] || window[name];\r\n\r\n if (hasOwnProperty(jsCache, name)) {\r\n return result;\r\n }\r\n\r\n each(jsPrefixes, (prefix: string) => {\r\n result = result || window[prefix + firstLetterToUpper(name)];\r\n return !result;\r\n });\r\n\r\n jsCache[name] = result;\r\n return result;\r\n};\r\n","import { jsAPI } from 'support/compatibility/vendors';\r\n\r\nexport const resizeObserver: any | undefined = jsAPI('ResizeObserver');\r\n","function _extends() {\n module.exports = _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}\n\nmodule.exports = _extends;","import { each, indexOf, hasOwnProperty, keys } from 'support/utils';\r\nimport { type, isArray, isUndefined, isEmptyObject, isPlainObject, isString } from 'support/utils/types';\r\nimport { OptionsTemplate, OptionsTemplateTypes, OptionsTemplateType, Func, OptionsValidatedResult } from 'support/options';\r\nimport { PlainObject } from 'typings';\r\n\r\nconst { stringify } = JSON;\r\n\r\n/**\r\n * A prefix and suffix tuple which serves as recognition pattern for template types.\r\n */\r\nconst templateTypePrefixSuffix: readonly [string, string] = ['__TPL_', '_TYPE__'];\r\n/**\r\n * A object which serves as a mapping for \"normal\" types and template types.\r\n * Key = normal type string\r\n * value = template type string\r\n */\r\nconst optionsTemplateTypes: OptionsTemplateTypesDictionary = ['boolean', 'number', 'string', 'array', 'object', 'function', 'null'].reduce(\r\n (result, item) => {\r\n result[item] = templateTypePrefixSuffix[0] + item + templateTypePrefixSuffix[1];\r\n return result;\r\n },\r\n {} as OptionsTemplateTypesDictionary\r\n);\r\n\r\n/**\r\n * Validates the given options object according to the given template object and returns a object which looks like:\r\n * {\r\n * foreign : a object which consists of properties which aren't defined inside the template. (foreign properties)\r\n * validated : a object which consists only of valid properties. (property name is inside the template and value has a correct type)\r\n * }\r\n * @param options The options object which shall be validated.\r\n * @param template The template according to which the options object shall be validated.\r\n * @param optionsDiff When provided the returned validated object will only have properties which are different to this objects properties.\r\n * Example (assume all properties are valid to the template):\r\n * Options object : { a: 'a', b: 'b', c: 'c' }\r\n * optionsDiff object : { a: 'a', b: 'b', c: undefined }\r\n * Returned validated object : { c: 'c' }\r\n * Because the value of the properties a and b didn't change, they aren't included in the returned object.\r\n * Without the optionsDiff object the returned validated object would be: { a: 'a', b: 'b', c: 'c' }\r\n * @param doWriteErrors True if errors shall be logged into the console, false otherwise.\r\n * @param propPath The propertyPath which lead to this object. (used for error logging)\r\n */\r\nconst validateRecursive = (\r\n options: T,\r\n template: OptionsTemplate>,\r\n optionsDiff: T,\r\n doWriteErrors?: boolean,\r\n propPath?: string\r\n): OptionsValidatedResult => {\r\n const validatedOptions: T = {} as T;\r\n const optionsCopy: T = { ...options };\r\n const props = keys(template).filter((prop) => hasOwnProperty(options, prop));\r\n\r\n each(props, (prop: Extract) => {\r\n const optionsDiffValue: any = isUndefined(optionsDiff[prop]) ? {} : optionsDiff[prop];\r\n const optionsValue: any = options[prop];\r\n const templateValue: PlainObject | string | OptionsTemplateTypes | Array = template[prop];\r\n const templateIsComplex = isPlainObject(templateValue);\r\n const propPrefix = propPath ? `${propPath}.` : '';\r\n\r\n // if the template has a object as value, it means that the options are complex (verschachtelt)\r\n if (templateIsComplex && isPlainObject(optionsValue)) {\r\n const validatedResult = validateRecursive(optionsValue, templateValue as PlainObject, optionsDiffValue, doWriteErrors, propPrefix + prop);\r\n validatedOptions[prop] = validatedResult.validated;\r\n optionsCopy[prop] = validatedResult.foreign as any;\r\n\r\n each([optionsCopy, validatedOptions], (value) => {\r\n if (isEmptyObject(value[prop])) {\r\n delete value[prop];\r\n }\r\n });\r\n } else if (!templateIsComplex) {\r\n let isValid = false;\r\n const errorEnumStrings: Array = [];\r\n const errorPossibleTypes: Array = [];\r\n const optionsValueType = type(optionsValue);\r\n const templateValueArr: Array = !isArray(templateValue)\r\n ? [templateValue as string | OptionsTemplateTypes]\r\n : (templateValue as Array);\r\n\r\n each(templateValueArr, (currTemplateType) => {\r\n // if currType value isn't inside possibleTemplateTypes we assume its a enum string value\r\n const isEnumString = indexOf(Object.values(optionsTemplateTypes), currTemplateType) < 0;\r\n if (isEnumString && isString(optionsValue)) {\r\n // split it into a array which contains all possible values for example: [\"yes\", \"no\", \"maybe\"]\r\n const enumStringSplit = currTemplateType.split(' ');\r\n isValid = !!enumStringSplit.find((possibility) => possibility === optionsValue);\r\n\r\n // build error message\r\n errorEnumStrings.push(...enumStringSplit);\r\n } else {\r\n isValid = optionsTemplateTypes[optionsValueType] === currTemplateType;\r\n }\r\n\r\n // build error message\r\n errorPossibleTypes.push(isEnumString ? optionsTemplateTypes.string : currTemplateType);\r\n\r\n // continue if invalid, break if valid\r\n return !isValid;\r\n });\r\n\r\n if (isValid) {\r\n const doStringifyComparison = isArray(optionsValue) || isPlainObject(optionsValue);\r\n if (doStringifyComparison ? stringify(optionsValue) !== stringify(optionsDiffValue) : optionsValue !== optionsDiffValue) {\r\n validatedOptions[prop] = optionsValue;\r\n }\r\n } else if (doWriteErrors) {\r\n console.warn(\r\n `${\r\n `The option \"${propPrefix}${prop}\" wasn't set, because it doesn't accept the type [ ${optionsValueType.toUpperCase()} ] with the value of \"${optionsValue}\".\\r\\n` +\r\n `Accepted types are: [ ${errorPossibleTypes.join(', ').toUpperCase()} ].\\r\\n`\r\n }${errorEnumStrings.length > 0 ? `\\r\\nValid strings are: [ ${errorEnumStrings.join(', ')} ].` : ''}`\r\n );\r\n }\r\n\r\n delete optionsCopy[prop];\r\n }\r\n });\r\n\r\n return {\r\n foreign: optionsCopy,\r\n validated: validatedOptions,\r\n };\r\n};\r\n\r\n/**\r\n * Validates the given options object according to the given template object and returns a object which looks like:\r\n * {\r\n * foreign : a object which consists of properties which aren't defined inside the template. (foreign properties)\r\n * validated : a object which consists only of valid properties. (property name is inside the template and value has a correct type)\r\n * }\r\n * @param options The options object which shall be validated.\r\n * @param template The template according to which the options object shall be validated.\r\n * @param optionsDiff When provided the returned validated object will only have properties which are different to this objects properties.\r\n * Example (assume all properties are valid to the template):\r\n * Options object : { a: 'a', b: 'b', c: 'c' }\r\n * optionsDiff object : { a: 'a', b: 'b', c: undefined }\r\n * Returned validated object : { c: 'c' }\r\n * Because the value of the properties a and b didn't change, they aren't included in the returned object.\r\n * Without the optionsDiff object the returned validated object would be: { a: 'a', b: 'b', c: 'c' }\r\n * @param doWriteErrors True if errors shall be logged into the console, false otherwise.\r\n */\r\nconst validate = (\r\n options: T,\r\n template: OptionsTemplate>,\r\n optionsDiff?: T,\r\n doWriteErrors?: boolean\r\n): OptionsValidatedResult => {\r\n /*\r\n if (!isEmptyObject(foreign) && doWriteErrors)\r\n console.warn(`The following options are discarded due to invalidity:\\r\\n ${window.JSON.stringify(foreign, null, 2)}`);\r\n\r\n //add values, which aren't specified in the template, to the finished validated object to prevent them from being discarded\r\n if (keepForeignProps) {\r\n Object.assign(result.validated, foreign);\r\n }\r\n */\r\n return validateRecursive(options, template, optionsDiff || ({} as T), doWriteErrors || false);\r\n};\r\n\r\nexport { validate, optionsTemplateTypes };\r\n\r\ntype OptionsTemplateTypesDictionary = {\r\n readonly boolean: OptionsTemplateType;\r\n readonly number: OptionsTemplateType;\r\n readonly string: OptionsTemplateType;\r\n readonly array: OptionsTemplateType>;\r\n readonly object: OptionsTemplateType; // eslint-disable-line @typescript-eslint/ban-types\r\n readonly function: OptionsTemplateType;\r\n readonly null: OptionsTemplateType;\r\n};\r\n","import {\r\n createDOM,\r\n addClass,\r\n style,\r\n appendChildren,\r\n clientSize,\r\n absoluteCoordinates,\r\n offsetSize,\r\n scrollLeft,\r\n XY,\r\n removeAttr,\r\n removeElements,\r\n windowSize,\r\n runEach,\r\n} from 'support';\r\n\r\nexport type OnEnvironmentChanged = (env: Environment) => void;\r\nexport interface Environment {\r\n _autoUpdateLoop: boolean;\r\n _nativeScrollbarSize: XY;\r\n _nativeScrollbarIsOverlaid: XY;\r\n _nativeScrollbarStyling: boolean;\r\n _rtlScrollBehavior: { n: boolean; i: boolean };\r\n _addListener(listener: OnEnvironmentChanged): void;\r\n _removeListener(listener: OnEnvironmentChanged): void;\r\n}\r\n\r\nlet environmentInstance: Environment;\r\nconst { abs, round } = Math;\r\nconst environmentElmId = 'os-environment';\r\n\r\nconst getNativeScrollbarSize = (body: HTMLElement, measureElm: HTMLElement): XY => {\r\n appendChildren(body, measureElm);\r\n const cSize = clientSize(measureElm);\r\n const oSize = offsetSize(measureElm);\r\n\r\n return {\r\n x: oSize.h - cSize.h,\r\n y: oSize.w - cSize.w,\r\n };\r\n};\r\n\r\nconst getNativeScrollbarStyling = (testElm: HTMLElement): boolean => {\r\n let result = false;\r\n addClass(testElm, 'os-viewport-native-scrollbars-invisible');\r\n try {\r\n result =\r\n style(testElm, 'scrollbar-width') === 'none' || window.getComputedStyle(testElm, '::-webkit-scrollbar').getPropertyValue('display') === 'none';\r\n } catch (ex) {}\r\n\r\n return result;\r\n};\r\n\r\nconst getRtlScrollBehavior = (parentElm: HTMLElement, childElm: HTMLElement): { i: boolean; n: boolean } => {\r\n const strHidden = 'hidden';\r\n style(parentElm, { overflowX: strHidden, overflowY: strHidden, direction: 'rtl' });\r\n scrollLeft(parentElm, 0);\r\n\r\n const parentOffset = absoluteCoordinates(parentElm);\r\n const childOffset = absoluteCoordinates(childElm);\r\n scrollLeft(parentElm, -999); // https://github.com/KingSora/OverlayScrollbars/issues/187\r\n const childOffsetAfterScroll = absoluteCoordinates(childElm);\r\n return {\r\n /**\r\n * origin direction = determines if the zero scroll position is on the left or right side\r\n * 'i' means 'invert' (i === true means that the axis must be inverted to be correct)\r\n * true = on the left side\r\n * false = on the right side\r\n */\r\n i: parentOffset.x === childOffset.x,\r\n /**\r\n * negative = determines if the maximum scroll is positive or negative\r\n * 'n' means 'negate' (n === true means that the axis must be negated to be correct)\r\n * true = negative\r\n * false = positive\r\n */\r\n n: childOffset.x !== childOffsetAfterScroll.x,\r\n };\r\n};\r\n\r\nconst getWindowDPR = (): number => {\r\n // eslint-disable-next-line\r\n // @ts-ignore\r\n const dDPI = window.screen.deviceXDPI || 0;\r\n // eslint-disable-next-line\r\n // @ts-ignore\r\n const sDPI = window.screen.logicalXDPI || 1;\r\n return window.devicePixelRatio || dDPI / sDPI;\r\n};\r\n\r\nconst diffBiggerThanOne = (valOne: number, valTwo: number): boolean => {\r\n const absValOne = abs(valOne);\r\n const absValTwo = abs(valTwo);\r\n return !(absValOne === absValTwo || absValOne + 1 === absValTwo || absValOne - 1 === absValTwo);\r\n};\r\n\r\nconst createEnvironment = (): Environment => {\r\n const { body } = document;\r\n const envDOM = createDOM(``);\r\n const envElm = envDOM[0] as HTMLElement;\r\n const envChildElm = envElm.firstChild as HTMLElement;\r\n\r\n const onChangedListener: Set = new Set();\r\n const nativeScrollBarSize = getNativeScrollbarSize(body, envElm);\r\n const nativeScrollbarIsOverlaid = {\r\n x: nativeScrollBarSize.x === 0,\r\n y: nativeScrollBarSize.y === 0,\r\n };\r\n\r\n const env: Environment = {\r\n _autoUpdateLoop: false,\r\n _nativeScrollbarSize: nativeScrollBarSize,\r\n _nativeScrollbarIsOverlaid: nativeScrollbarIsOverlaid,\r\n _nativeScrollbarStyling: getNativeScrollbarStyling(envElm),\r\n _rtlScrollBehavior: getRtlScrollBehavior(envElm, envChildElm),\r\n _addListener(listener: OnEnvironmentChanged): void {\r\n onChangedListener.add(listener);\r\n },\r\n _removeListener(listener: OnEnvironmentChanged): void {\r\n onChangedListener.delete(listener);\r\n },\r\n };\r\n\r\n removeAttr(envElm, 'style');\r\n removeElements(envElm);\r\n\r\n if (!nativeScrollbarIsOverlaid.x || !nativeScrollbarIsOverlaid.y) {\r\n let size = windowSize();\r\n let dpr = getWindowDPR();\r\n let scrollbarSize = nativeScrollBarSize;\r\n\r\n window.addEventListener('resize', () => {\r\n if (onChangedListener.size) {\r\n const sizeNew = windowSize();\r\n const deltaSize = {\r\n w: sizeNew.w - size.w,\r\n h: sizeNew.h - size.h,\r\n };\r\n\r\n if (deltaSize.w === 0 && deltaSize.h === 0) return;\r\n\r\n const deltaAbsSize = {\r\n w: abs(deltaSize.w),\r\n h: abs(deltaSize.h),\r\n };\r\n const deltaAbsRatio = {\r\n w: abs(round(sizeNew.w / (size.w / 100.0))),\r\n h: abs(round(sizeNew.h / (size.h / 100.0))),\r\n };\r\n const dprNew = getWindowDPR();\r\n const deltaIsBigger = deltaAbsSize.w > 2 && deltaAbsSize.h > 2;\r\n const difference = !diffBiggerThanOne(deltaAbsRatio.w, deltaAbsRatio.h);\r\n const dprChanged = dprNew !== dpr && dpr > 0;\r\n const isZoom = deltaIsBigger && difference && dprChanged;\r\n\r\n if (isZoom) {\r\n const newScrollbarSize = (environmentInstance._nativeScrollbarSize = getNativeScrollbarSize(body, envElm));\r\n removeElements(envElm);\r\n\r\n if (scrollbarSize.x !== newScrollbarSize.x || scrollbarSize.y !== newScrollbarSize.y) {\r\n runEach(onChangedListener);\r\n }\r\n\r\n scrollbarSize = newScrollbarSize;\r\n }\r\n\r\n size = sizeNew;\r\n dpr = dprNew;\r\n }\r\n });\r\n }\r\n\r\n return env;\r\n};\r\n\r\nexport const getEnvironment = (): Environment => {\r\n if (!environmentInstance) {\r\n environmentInstance = createEnvironment();\r\n }\r\n return environmentInstance;\r\n};\r\n","import {\r\n createDOM,\r\n style,\r\n appendChildren,\r\n offsetSize,\r\n scrollLeft,\r\n scrollTop,\r\n jsAPI,\r\n runEach,\r\n prependChildren,\r\n removeElements,\r\n on,\r\n preventDefault,\r\n stopPropagation,\r\n} from 'support';\r\nimport { getEnvironment } from 'environment';\r\n\r\nconst animationStartEventName = 'animationstart';\r\nconst scrollEventName = 'scroll';\r\nconst scrollAmount = 3333333;\r\nconst ResizeObserverConstructor = jsAPI('ResizeObserver');\r\nconst classNameSizeObserver = 'os-size-observer';\r\nconst classNameSizeObserverListener = `${classNameSizeObserver}-listener`;\r\nconst classNameSizeObserverListenerItem = `${classNameSizeObserverListener}-item`;\r\nconst classNameSizeObserverListenerItemFinal = `${classNameSizeObserverListenerItem}-final`;\r\nconst cAF = cancelAnimationFrame;\r\nconst rAF = requestAnimationFrame;\r\nconst getDirection = (elm: HTMLElement) => style(elm, 'direction');\r\n\r\n// TODO:\r\n// 1. MAYBE add comparison function to offsetSize etc.\r\n\r\nexport const createSizeObserver = (target: HTMLElement, onSizeChangedCallback: (direction?: boolean) => any, direction?: boolean) => {\r\n const rtlScrollBehavior = getEnvironment()._rtlScrollBehavior;\r\n const baseElements = createDOM(``);\r\n const sizeObserver = baseElements[0] as HTMLElement;\r\n const listenerElement = sizeObserver.firstChild as HTMLElement;\r\n const onSizeChangedCallbackProxy = (dir?: boolean) => {\r\n if (direction) {\r\n const rtl = getDirection(sizeObserver) === 'rtl';\r\n scrollLeft(sizeObserver, rtl ? (rtlScrollBehavior.n ? -scrollAmount : rtlScrollBehavior.i ? 0 : scrollAmount) : scrollAmount);\r\n scrollTop(sizeObserver, scrollAmount);\r\n }\r\n onSizeChangedCallback(dir === true);\r\n };\r\n const offListeners: (() => void)[] = [];\r\n let appearCallback: (...args: any) => any = onSizeChangedCallbackProxy;\r\n\r\n if (ResizeObserverConstructor) {\r\n const resizeObserverInstance = new ResizeObserverConstructor(onSizeChangedCallbackProxy);\r\n resizeObserverInstance.observe(listenerElement);\r\n } else {\r\n const observerElementChildren = createDOM(\r\n ``\r\n );\r\n appendChildren(listenerElement, observerElementChildren);\r\n const observerElementChildrenRoot = observerElementChildren[0] as HTMLElement;\r\n const shrinkElement = observerElementChildrenRoot.lastChild as HTMLElement;\r\n const expandElement = observerElementChildrenRoot.firstChild as HTMLElement;\r\n const expandElementChild = expandElement?.firstChild as HTMLElement;\r\n\r\n let cacheSize = offsetSize(listenerElement);\r\n let currSize = cacheSize;\r\n let isDirty = false;\r\n let rAFId: number;\r\n\r\n const reset = () => {\r\n scrollLeft(expandElement, scrollAmount);\r\n scrollTop(expandElement, scrollAmount);\r\n scrollLeft(shrinkElement, scrollAmount);\r\n scrollTop(shrinkElement, scrollAmount);\r\n };\r\n const onResized = function () {\r\n rAFId = 0;\r\n if (!isDirty) return;\r\n\r\n cacheSize = currSize;\r\n onSizeChangedCallbackProxy();\r\n };\r\n const onScroll = (scrollEvent?: Event) => {\r\n currSize = offsetSize(listenerElement);\r\n isDirty = !scrollEvent || currSize.w !== cacheSize.w || currSize.h !== cacheSize.h;\r\n\r\n if (scrollEvent && isDirty && !rAFId) {\r\n cAF(rAFId);\r\n rAFId = rAF(onResized);\r\n } else if (!scrollEvent) onResized();\r\n\r\n reset();\r\n if (scrollEvent) {\r\n preventDefault(scrollEvent);\r\n stopPropagation(scrollEvent);\r\n }\r\n return false;\r\n };\r\n\r\n offListeners.push(on(expandElement, scrollEventName, onScroll));\r\n offListeners.push(on(shrinkElement, scrollEventName, onScroll));\r\n\r\n // lets assume that the divs will never be that large and a constant value is enough\r\n style(expandElementChild, {\r\n width: scrollAmount,\r\n height: scrollAmount,\r\n });\r\n reset();\r\n appearCallback = onScroll;\r\n }\r\n\r\n if (direction) {\r\n let dirCache: string | undefined;\r\n offListeners.push(\r\n on(sizeObserver, scrollEventName, (event: Event) => {\r\n const dir = getDirection(sizeObserver);\r\n const changed = dir !== dirCache;\r\n if (changed) {\r\n if (dir === 'rtl') {\r\n style(listenerElement, { left: 'auto', right: 0 });\r\n } else {\r\n style(listenerElement, { left: 0, right: 'auto' });\r\n }\r\n dirCache = dir;\r\n onSizeChangedCallbackProxy(true);\r\n }\r\n\r\n preventDefault(event);\r\n stopPropagation(event);\r\n return false;\r\n })\r\n );\r\n }\r\n\r\n offListeners.push(on(sizeObserver, animationStartEventName, appearCallback));\r\n prependChildren(target, sizeObserver);\r\n\r\n return () => {\r\n runEach(offListeners);\r\n removeElements(sizeObserver);\r\n };\r\n};\r\n","import { createDOM } from 'support/dom';\r\nimport { getEnvironment } from 'environment';\r\nimport { createSizeObserver } from 'overlayscrollbars/observers/SizeObserver';\r\n\r\nconst abc = {\r\n a: 1,\r\n b: 1,\r\n c: 1,\r\n};\r\n\r\nexport default () => {\r\n return [\r\n getEnvironment(),\r\n createSizeObserver(document.body, () => {}),\r\n createDOM(\r\n '\\\r\n \\\r\n
\\\r\n
\\\r\n
\\\r\n
\\\r\n fdfhdfgh\\\r\n
\\\r\n
\\\r\n
\\\r\n
\\\r\n
\\\r\n
\\\r\n
'\r\n ),\r\n ];\r\n};\r\n"],"names":["isNumber","obj","isString","isFunction","isUndefined","undefined","isArray","Array","isArrayLike","length","getSetProp","topLeft","fallback","elm","value","removeAttr","attrName","removeAttribute","scrollLeft","scrollTop","rnothtmlwhite","classListAction","className","action","clazz","i","result","classes","match","classList","addClass","add","each","source","callback","Object","keys","key","from","arr","push","runEach","Set","forEach","fn","contents","childNodes","parent","parentElement","before","parentElm","preferredAnchor","insertedElms","anchor","fragment","document","createDocumentFragment","insertedElm","previousSibling","appendChild","firstChild","nextSibling","insertBefore","appendChildren","node","children","prependChildren","removeElements","nodes","e","removeChild","createDiv","createElement","createDOM","html","createdDiv","innerHTML","trim","zeroObj","w","h","windowSize","window","innerWidth","innerHeight","offsetSize","offsetWidth","offsetHeight","clientSize","clientWidth","clientHeight","getBoundingClientRect","passiveEventsSupport","supportPassiveEvents","addEventListener","defineProperty","get","off","target","eventNames","listener","capture","split","eventName","removeEventListener","on","options","doSupportPassiveEvents","passive","_passive","_capture","once","_once","offListeners","nativeOptions","finalListener","evt","bind","stopPropagation","preventDefault","hasOwnProperty","prop","prototype","call","cssNumber","animationiterationcount","columncount","fillopacity","flexgrow","flexshrink","fontweight","lineheight","opacity","order","orphans","widows","zindex","zoom","adaptCSSVal","val","toLowerCase","getCSSVal","computedStyle","getPropertyValue","style","setCSSVal","styles","getSingleStyle","getStyles","getStylesResult","getComputedStyle","reduce","x","y","absoluteCoordinates","rect","left","pageYOffset","top","pageXOffset","firstLetterToUpper","str","charAt","toUpperCase","slice","jsPrefixes","jsCache","jsAPI","name","prefix","resizeObserver","_extends","module","assign","arguments","apply","templateTypePrefixSuffix","optionsTemplateTypes","item","environmentInstance","abs","round","Math","environmentElmId","getNativeScrollbarSize","body","measureElm","cSize","oSize","getNativeScrollbarStyling","testElm","ex","getRtlScrollBehavior","childElm","strHidden","overflowX","overflowY","direction","parentOffset","childOffset","childOffsetAfterScroll","n","getWindowDPR","dDPI","screen","deviceXDPI","sDPI","logicalXDPI","devicePixelRatio","diffBiggerThanOne","valOne","valTwo","absValOne","absValTwo","createEnvironment","envDOM","envElm","envChildElm","onChangedListener","nativeScrollBarSize","nativeScrollbarIsOverlaid","env","_autoUpdateLoop","_nativeScrollbarSize","_nativeScrollbarIsOverlaid","_nativeScrollbarStyling","_rtlScrollBehavior","_addListener","_removeListener","delete","size","dpr","scrollbarSize","sizeNew","deltaSize","deltaAbsSize","deltaAbsRatio","dprNew","deltaIsBigger","difference","dprChanged","isZoom","newScrollbarSize","getEnvironment","animationStartEventName","scrollEventName","scrollAmount","ResizeObserverConstructor","classNameSizeObserver","classNameSizeObserverListener","classNameSizeObserverListenerItem","classNameSizeObserverListenerItemFinal","cAF","cancelAnimationFrame","rAF","requestAnimationFrame","getDirection","createSizeObserver","onSizeChangedCallback","rtlScrollBehavior","baseElements","sizeObserver","listenerElement","onSizeChangedCallbackProxy","dir","rtl","appearCallback","resizeObserverInstance","observe","observerElementChildren","observerElementChildrenRoot","shrinkElement","lastChild","expandElement","expandElementChild","cacheSize","currSize","isDirty","rAFId","reset","onResized","onScroll","scrollEvent","width","height","dirCache","event","changed","right"],"mappings":"SAWgBA,SAASC;AACvB,SAAO,OAAOA,GAAP,KAAe,QAAtB;AACD;SAEeC,SAASD;AACvB,SAAO,OAAOA,GAAP,KAAe,QAAtB;AACD;SAMeE,WAAWF;AACzB,SAAO,OAAOA,GAAP,KAAe,UAAtB;AACD;SAEeG,YAAYH;AAC1B,SAAOA,GAAG,KAAKI,SAAf;AACD;SAMeC,QAAQL;AACtB,SAAOM,KAAK,CAACD,OAAN,CAAcL,GAAd,CAAP;AACD;SAUeO,YAAyCP;AACvD,QAAMQ,MAAM,GAAG,CAAC,CAACR,GAAF,IAASA,GAAG,CAACQ,MAA5B;AACA,SAAOH,OAAO,CAACL,GAAD,CAAP,KAAiB,CAACE,UAAU,CAACF,GAAD,CAAX,IAAoBD,QAAQ,CAACS,MAAD,CAA5B,IAAwCA,MAAM,GAAG,CAAC,CAAlD,IAAuDA,MAAM,GAAG,CAAT,IAAc,EAA7F;AACD;;AC9CD,SAASC,UAAT,CACEC,OADF,EAEEC,QAFF,EAGEC,GAHF,EAIEC,KAJF;AAME,MAAIV,WAAW,CAACU,KAAD,CAAf,EAAwB;AACtB,WAAOD,GAAG,GAAGA,GAAG,CAACF,OAAD,CAAN,GAAkBC,QAA5B;AACD;;AACDC,EAAAA,GAAG,KAAKA,GAAG,CAACF,OAAD,CAAH,GAAeG,KAApB,CAAH;AACD;AAuBM,MAAMC,UAAU,GAAG,CAACF,GAAD,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G,cAAAA,IAAI,EAAE,CAAR;AAAWoI,cAAAA,KAAK,EAAE;AAAlB,aAAlB,CAAL;AACD;;AACDH,UAAAA,QAAQ,GAAGrB,GAAX;AACAD,UAAAA,0BAA0B,CAAC,IAAD,CAA1B;AACD;;AAEDhJ,QAAAA,cAAc,CAACuK,KAAD,CAAd;AACAxK,QAAAA,eAAe,CAACwK,KAAD,CAAf;AACA,eAAO,KAAP;AACD,OAhBC;IADJ;AAmBD;;AAED7K,EAAAA,YAAY,CAACzE,IAAb,CAAkBiE,EAAE,CAAC4J,YAAD,EAAejB,uBAAf,EAAwCsB,cAAxC,CAApB;AACAxM,EAAAA,eAAe,CAACgC,MAAD,EAASmK,YAAT,CAAf;AAEA,SAAO;AACL5N,IAAAA,OAAO,CAACwE,YAAD,CAAP;AACA9C,IAAAA,cAAc,CAACkM,YAAD,CAAd;AACD,GAHD;AAID,CA1GM;;ACtBP;AACE,SAAO;IACLlB,cAAc,EADT;IAELc,kBAAkB,CAAC1M,QAAQ,CAACkI,IAAV,EAAgB,QAAhB,CAFb;IAGLhH,SAAS;MACP;;;;;;;;;;;;;;;;;;;;;;IADO;EAHJ,CAAP;AA4BD;;;"}
\ No newline at end of file
diff --git a/packages/overlayscrollbars/dist/overlayscrollbars.esm.min.js b/packages/overlayscrollbars/dist/overlayscrollbars.esm.min.js
index 2a121e2..a7d354c 100644
--- a/packages/overlayscrollbars/dist/overlayscrollbars.esm.min.js
+++ b/packages/overlayscrollbars/dist/overlayscrollbars.esm.min.js
@@ -1 +1 @@
-function n(n){return"number"==typeof n}function r(n){return"string"==typeof n}function t(n){return Array.isArray(n)}function o(r){const o=!!r&&r.length;return t(r)||!function(n){return"function"==typeof n}(r)&&n(o)&&o>-1&&o%1==0}function e(n,r){return function(n,r,t,o){if(void 0===o)return t?t[n]:r;t&&(t[n]=o)}("scrollLeft",0,n,r)}const i=/[^\x20\t\r\n\f]+/g,s=(n,t)=>{((n,t,o)=>{let e,s=0,c=!1;if(n&&r(t)){const r=t.match(i)||[];for(c=r.length>0;e=r[s++];)c=o(n.classList,e)&&c}})(n,t,(n,r)=>n.add(r))};function c(n,r){if(o(n))for(let t=0;tr(n[t],t,n));return n}const l=n=>{if(Array.from)return Array.from(n);const r=[];return c(n,n=>{r.push(n)}),r},a=(n,r)=>{((n,r,t)=>{if(t){let e,i=r;n&&(o(t)?(e=document.createDocumentFragment(),c(t,n=>{n===i&&(i=n.previousSibling),e.appendChild(n)})):e=t,r&&(i?i!==r&&(i=i.nextSibling):i=n.firstChild),n.insertBefore(e,i))}})(n,null,r)},d=n=>{if(o(n))c(l(n),n=>d(n));else if(n){const t=(r=n)?r.parentElement:null;t&&t.removeChild(n)}var r},u=n=>{const r=document.createElement("div");return r.innerHTML=n.trim(),c((t=r)?l(t.childNodes):[],n=>d(n));var t},v={w:0,h:0},f=()=>({w:window.innerWidth,h:window.innerHeight}),w={animationiterationcount:1,columncount:1,fillopacity:1,flexgrow:1,flexshrink:1,fontweight:1,lineheight:1,opacity:1,order:1,orphans:1,widows:1,zindex:1,zoom:1},h=(n,r,t)=>null!=r?r.getPropertyValue(t):n.style[t],b=(r,t,o)=>{try{r&&void 0!==r.style[t]&&(r.style[t]=((r,t)=>!w[r.toLowerCase()]&&n(t)?t+"px":t)(t,o))}catch(e){}};function p(n,o){const e=r(o);if(t(o)||e){let r=e?"":{};if(n){const t=window.getComputedStyle(n,null);r=e?h(n,t,o):o.reduce((r,o)=>(r[o]=h(n,t,o),r),r)}return r}var i;c((i=o)?Object.keys(i):[],r=>b(n,r,o[r]))}const y={x:0,y:0},m=n=>{const r=n?(n=>n.getBoundingClientRect())(n):0;return r?{x:r.left+window.pageYOffset,y:r.top+window.pageXOffset}:y};var g=function(n,r){var t=r.get(n);if(!t)throw new TypeError("attempted to get private field on non-instance");return t.get?t.get.call(n):t.value};var x=function(n,r,t){var o=r.get(n);if(!o)throw new TypeError("attempted to set private field on non-instance");if(o.set)o.set.call(n,t);else{if(!o.writable)throw new TypeError("attempted to set read only private field");o.value=t}return t};const z=["WebKit","Moz","O","MS","webkit","moz","o","ms"],O={},j=n=>{let r=O[n]||window[n];return t=O,o=n,Object.prototype.hasOwnProperty.call(t,o)||(c(z,t=>{var o;return r=r||window[t+(o=n,o.charAt(0).toUpperCase()+o.slice(1))],!r}),O[n]=r),r;var t,o};j("ResizeObserver");!function(n,r,t){n(t={path:r,exports:{},require:function(n,r){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==r&&t.path)}},t.exports),t.exports}((function(n){function r(){return n.exports=r=Object.assign||function(n){for(var r=1;r(n[r]=k[0]+r+k[1],n),{}),Math),T=(n,r)=>{a(n,r);const t=(o=r)?{w:o.clientWidth,h:o.clientHeight}:v;var o;const e=(n=>n?{w:n.offsetWidth,h:n.offsetHeight}:v)(r);return{x:e.h-t.h,y:e.w-t.w}},L=()=>{const n=window.screen.deviceXDPI||0,r=window.screen.logicalXDPI||1;return window.devicePixelRatio||n/r};var M=new WeakMap;class A{constructor(){M.set(this,{writable:!0,value:void 0}),x(this,M,new Set);const n=this,{body:r}=document,t=u('')[0],o=t.firstChild,i=T(r,t),c={x:0===i.x,y:0===i.y};var l,a;if(n.t=!1,n.o=i,n.s=c,n.l=(n=>{let r=!1;s(n,"os-viewport-native-scrollbars-invisible");try{r="none"===p(n,"scrollbar-width")||"none"===window.getComputedStyle(n,"::-webkit-scrollbar").getPropertyValue("display")}catch(t){}return r})(t),n.u=((n,r)=>{p(n,{overflowX:"hidden",overflowY:"hidden",direction:"rtl"}),e(n,0);const t=m(n),o=m(r);e(n,-999);const i=m(r);return{i:t.x===o.x,n:o.x!==i.x}})(t,o),n.v=(()=>{let n=!1;try{window.addEventListener("test",null,Object.defineProperty({},"passive",{get:function(){n=!0}}))}catch(r){}return n})(),n.p=!!j("ResizeObserver"),a="style",null==(l=t)||l.removeAttribute(a),d(t),!c.x||!c.y){let o=f(),e=L();const i=g(this,M);window.addEventListener("resize",()=>{if(i.size){const s=f(),c={w:s.w-o.w,h:s.h-o.h};if(0===c.w&&0===c.h)return;const l={w:_(c.w),h:_(c.h)},a={w:_(E(s.w/(o.w/100))),h:_(E(s.h/(o.h/100)))},u=L(),v=l.w>2&&l.h>2,w=!((n,r)=>{const t=_(n),o=_(r);return!(t===o||t+1===o||t-1===o)})(a.w,a.h),h=u!==e&&e>0,b=v&&w&&h,p=n.o;let y;b&&(y=n.o=T(r,t),d(t),p.x===y.x&&p.y===y.y||i.forEach(r=>r&&r(n))),o=s,e=u}})}}addListener(n){g(this,M).add(n)}removeListener(n){g(this,M).delete(n)}}export default()=>[new A,u(' ')];
\ No newline at end of file
+function r(r){return"number"==typeof r}function t(r){return"string"==typeof r}function n(r){return Array.isArray(r)}function e(t){const e=!!t&&t.length;return n(t)||!function(r){return"function"==typeof r}(t)&&r(e)&&e>-1&&e%1==0}function o(r,t,n,e){if(void 0===e)return n?n[r]:t;n&&(n[r]=e)}function i(r,t){return o("scrollLeft",0,r,t)}function s(r,t){return o("scrollTop",0,r,t)}const l=/[^\x20\t\r\n\f]+/g,c=(r,n)=>{((r,n,e)=>{let o,i=0,s=!1;if(r&&t(n)){const t=n.match(l)||[];for(s=t.length>0;o=t[i++];)s=e(r.classList,o)&&s}})(r,n,(r,t)=>r.add(t))};function a(r,t){if(e(r))for(let n=0;nt(r[n],n,r));return r}const d=r=>{if(Array.from)return Array.from(r);const t=[];return a(r,r=>{t.push(r)}),t},v=r=>{r instanceof Set?r.forEach(r=>r&&r()):a(r,r=>r&&r())},u=(r,t,n)=>{if(n){let o,i=t;r&&(e(n)?(o=document.createDocumentFragment(),a(n,r=>{r===i&&(i=r.previousSibling),o.appendChild(r)})):o=n,t&&(i?i!==t&&(i=i.nextSibling):i=r.firstChild),r.insertBefore(o,i))}},f=(r,t)=>{u(r,null,t)},w=r=>{if(e(r))a(d(r),r=>w(r));else if(r){const n=(t=r)?t.parentElement:null;n&&n.removeChild(r)}var t},b=r=>{const t=document.createElement("div");return t.innerHTML=r.trim(),a((n=t)?d(n.childNodes):[],r=>w(r));var n},h={w:0,h:0},m=()=>({w:window.innerWidth,h:window.innerHeight}),p=r=>r?{w:r.offsetWidth,h:r.offsetHeight}:h;let y;const z=(r,t,n,e)=>{a(t.split(" "),t=>{r.removeEventListener(t,n,e)})},g=(r,t,n,e)=>{const o=(()=>{if(void 0===y){y=!1;try{window.addEventListener("test",null,Object.defineProperty({},"passive",{get:function(){y=!0}}))}catch(r){}}return y})(),i=o&&e&&e.t||!1,s=e&&e.o||!1,l=e&&e.s||!1,c=[],d=o?{passive:i,capture:s}:s;return a(t.split(" "),t=>{const e=l?o=>{r.removeEventListener(t,e,s),n&&n(o)}:n;c.push(z.bind(null,r,t,e,s)),r.addEventListener(t,e,d)}),v.bind(0,c)},_=r=>r.stopPropagation(),x=r=>r.preventDefault(),O={animationiterationcount:1,columncount:1,fillopacity:1,flexgrow:1,flexshrink:1,fontweight:1,lineheight:1,opacity:1,order:1,orphans:1,widows:1,zindex:1,zoom:1},S=(r,t,n)=>null!=t?t.getPropertyValue(n):r.style[n],j=(t,n,e)=>{try{t&&void 0!==t.style[n]&&(t.style[n]=((t,n)=>!O[t.toLowerCase()]&&r(n)?n+"px":n)(n,e))}catch(o){}};function k(r,e){const o=t(e);if(n(e)||o){let t=o?"":{};if(r){const n=window.getComputedStyle(r,null);t=o?S(r,n,e):e.reduce((t,e)=>(t[e]=S(r,n,e),t),t)}return t}var i;a((i=e)?Object.keys(i):[],t=>j(r,t,e[t]))}const A={x:0,y:0},L=r=>{const t=r?(r=>r.getBoundingClientRect())(r):0;return t?{x:t.left+window.pageYOffset,y:t.top+window.pageXOffset}:A},q=["WebKit","Moz","O","MS","webkit","moz","o","ms"],M={},T=r=>{let t=M[r]||window[r];return n=M,e=r,Object.prototype.hasOwnProperty.call(n,e)||(a(q,n=>{var e;return t=t||window[n+(e=r,e.charAt(0).toUpperCase()+e.slice(1))],!t}),M[r]=t),t;var n,e};T("ResizeObserver");!function(r,t,n){r(n={path:t,exports:{},require:function(r,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&n.path)}},n.exports),n.exports}((function(r){function t(){return r.exports=t=Object.assign||function(r){for(var t=1;t(r[t]=E[0]+t+E[1],r),{});let F;const{abs:P,round:R}=Math,Y=(r,t)=>{f(r,t);const n=(e=t)?{w:e.clientWidth,h:e.clientHeight}:h;var e;const o=p(t);return{x:o.h-n.h,y:o.w-n.w}},B=r=>{let t=!1;c(r,"os-viewport-native-scrollbars-invisible");try{t="none"===k(r,"scrollbar-width")||"none"===window.getComputedStyle(r,"::-webkit-scrollbar").getPropertyValue("display")}catch(n){}return t},D=(r,t)=>{k(r,{overflowX:"hidden",overflowY:"hidden",direction:"rtl"}),i(r,0);const n=L(r),e=L(t);i(r,-999);const o=L(t);return{i:n.x===e.x,n:e.x!==o.x}},I=()=>{const r=window.screen.deviceXDPI||0,t=window.screen.logicalXDPI||1;return window.devicePixelRatio||r/t},K=()=>{const{body:r}=document,t=b('')[0],n=t.firstChild,e=new Set,o=Y(r,t),i={x:0===o.x,y:0===o.y},s={l:!1,v:o,u:i,m:B(t),p:D(t,n),g(r){e.add(r)},_(r){e.delete(r)}};var l,c;if(c="style",null==(l=t)||l.removeAttribute(c),w(t),!i.x||!i.y){let n=m(),i=I(),s=o;window.addEventListener("resize",()=>{if(e.size){const o=m(),l={w:o.w-n.w,h:o.h-n.h};if(0===l.w&&0===l.h)return;const c={w:P(l.w),h:P(l.h)},a={w:P(R(o.w/(n.w/100))),h:P(R(o.h/(n.h/100)))},d=I(),u=c.w>2&&c.h>2,f=!((r,t)=>{const n=P(r),e=P(t);return!(n===e||n+1===e||n-1===e)})(a.w,a.h),b=d!==i&&i>0;if(u&&f&&b){const n=F.v=Y(r,t);w(t),s.x===n.x&&s.y===n.y||v(e),s=n}n=o,i=d}})}return s},U=()=>(F||(F=K()),F),W=T("ResizeObserver"),X=cancelAnimationFrame,C=requestAnimationFrame,G=r=>k(r,"direction"),H=(r,t,n)=>{const e=U().p,o=b('')[0],l=o.firstChild,c=r=>{if(n){const r="rtl"===G(o);i(o,r?e.n?-3333333:e.i?0:3333333:3333333),s(o,3333333)}t(!0===r)},a=[];let d=c;if(W){new W(c).observe(l)}else{const r=b('');f(l,r);const t=r[0],n=t.lastChild,e=t.firstChild,o=null==e?void 0:e.firstChild;let v,u=p(l),w=u,h=!1;const m=()=>{i(e,3333333),s(e,3333333),i(n,3333333),s(n,3333333)},y=function(){v=0,h&&(u=w,c())},z=r=>(w=p(l),h=!r||w.w!==u.w||w.h!==u.h,r&&h&&!v?(X(v),v=C(y)):r||y(),m(),r&&(x(r),_(r)),!1);a.push(g(e,"scroll",z)),a.push(g(n,"scroll",z)),k(o,{width:3333333,height:3333333}),m(),d=z}if(n){let r;a.push(g(o,"scroll",t=>{const n=G(o);return n!==r&&(k(l,"rtl"===n?{left:"auto",right:0}:{left:0,right:"auto"}),r=n,c(!0)),x(t),_(t),!1}))}var h,m;return a.push(g(o,"animationstart",d)),m=o,u(h=r,h&&h.firstChild,m),()=>{v(a),w(o)}};export default()=>[U(),H(document.body,()=>{}),b(' ')];
\ No newline at end of file
diff --git a/packages/overlayscrollbars/dist/overlayscrollbars.js b/packages/overlayscrollbars/dist/overlayscrollbars.js
index 9720e6c..a2d4205 100644
--- a/packages/overlayscrollbars/dist/overlayscrollbars.js
+++ b/packages/overlayscrollbars/dist/overlayscrollbars.js
@@ -40,6 +40,9 @@
function scrollLeft(elm, value) {
return getSetProp('scrollLeft', 0, elm, value);
}
+ function scrollTop(elm, value) {
+ return getSetProp('scrollTop', 0, elm, value);
+ }
var rnothtmlwhite = /[^\x20\t\r\n\f]+/g;
@@ -91,6 +94,17 @@
});
return result;
};
+ var runEach = function runEach(arr) {
+ if (arr instanceof Set) {
+ arr.forEach(function (fn) {
+ return fn && fn();
+ });
+ } else {
+ each(arr, function (fn) {
+ return fn && fn();
+ });
+ }
+ };
var contents = function contents(elm) {
return elm ? from(elm.childNodes) : [];
@@ -134,6 +148,9 @@
var appendChildren = function appendChildren(node, children) {
before(node, null, children);
};
+ var prependChildren = function prependChildren(node, children) {
+ before(node, node && node.firstChild, children);
+ };
var removeElements = function removeElements(nodes) {
if (isArrayLike(nodes)) {
each(from(nodes), function (e) {
@@ -189,6 +206,64 @@
return elm.getBoundingClientRect();
};
+ var passiveEventsSupport;
+
+ var supportPassiveEvents = function supportPassiveEvents() {
+ if (passiveEventsSupport === undefined) {
+ passiveEventsSupport = false;
+
+ try {
+ window.addEventListener(
+ 'test',
+ null,
+ Object.defineProperty({}, 'passive', {
+ get: function get() {
+ passiveEventsSupport = true;
+ },
+ })
+ );
+ } catch (e) {}
+ }
+
+ return passiveEventsSupport;
+ };
+
+ var off = function off(target, eventNames, listener, capture) {
+ each(eventNames.split(' '), function (eventName) {
+ target.removeEventListener(eventName, listener, capture);
+ });
+ };
+ var on = function on(target, eventNames, listener, options) {
+ var doSupportPassiveEvents = supportPassiveEvents();
+ var passive = (doSupportPassiveEvents && options && options._passive) || false;
+ var capture = (options && options._capture) || false;
+ var once = (options && options._once) || false;
+ var offListeners = [];
+ var nativeOptions = doSupportPassiveEvents
+ ? {
+ passive: passive,
+ capture: capture,
+ }
+ : capture;
+ each(eventNames.split(' '), function (eventName) {
+ var finalListener = once
+ ? function (evt) {
+ target.removeEventListener(eventName, finalListener, capture);
+ listener && listener(evt);
+ }
+ : listener;
+ offListeners.push(off.bind(null, target, eventName, finalListener, capture));
+ target.addEventListener(eventName, finalListener, nativeOptions);
+ });
+ return runEach.bind(0, offListeners);
+ };
+ var stopPropagation = function stopPropagation(evt) {
+ return evt.stopPropagation();
+ };
+ var preventDefault = function preventDefault(evt) {
+ return evt.preventDefault();
+ };
+
var hasOwnProperty = function hasOwnProperty(obj, prop) {
return Object.prototype.hasOwnProperty.call(obj, prop);
};
@@ -267,44 +342,6 @@
: zeroObj$1;
};
- function _classPrivateFieldGet(receiver, privateMap) {
- var descriptor = privateMap.get(receiver);
-
- if (!descriptor) {
- throw new TypeError('attempted to get private field on non-instance');
- }
-
- if (descriptor.get) {
- return descriptor.get.call(receiver);
- }
-
- return descriptor.value;
- }
-
- var classPrivateFieldGet = _classPrivateFieldGet;
-
- function _classPrivateFieldSet(receiver, privateMap, value) {
- var descriptor = privateMap.get(receiver);
-
- if (!descriptor) {
- throw new TypeError('attempted to set private field on non-instance');
- }
-
- if (descriptor.set) {
- descriptor.set.call(receiver, value);
- } else {
- if (!descriptor.writable) {
- throw new TypeError('attempted to set read only private field');
- }
-
- descriptor.value = value;
- }
-
- return value;
- }
-
- var classPrivateFieldSet = _classPrivateFieldSet;
-
var firstLetterToUpper = function firstLetterToUpper(str) {
return str.charAt(0).toUpperCase() + str.slice(1);
};
@@ -375,11 +412,12 @@
return result;
}, {});
+ var environmentInstance;
var abs = Math.abs,
round = Math.round;
- var envornmentElmId = 'os-envornment';
+ var environmentElmId = 'os-environment';
- var nativeScrollbarSize = function nativeScrollbarSize(body, measureElm) {
+ var getNativeScrollbarSize = function getNativeScrollbarSize(body, measureElm) {
appendChildren(body, measureElm);
var cSize = clientSize(measureElm);
var oSize = offsetSize(measureElm);
@@ -389,7 +427,7 @@
};
};
- var nativeScrollbarStyling = function nativeScrollbarStyling(testElm) {
+ var getNativeScrollbarStyling = function getNativeScrollbarStyling(testElm) {
var result = false;
addClass(testElm, 'os-viewport-native-scrollbars-invisible');
@@ -402,7 +440,7 @@
return result;
};
- var rtlScrollBehavior = function rtlScrollBehavior(parentElm, childElm) {
+ var getRtlScrollBehavior = function getRtlScrollBehavior(parentElm, childElm) {
var strHidden = 'hidden';
style(parentElm, {
overflowX: strHidden,
@@ -420,25 +458,7 @@
};
};
- var passiveEvents = function passiveEvents() {
- var supportsPassive = false;
-
- try {
- window.addEventListener(
- 'test',
- null,
- Object.defineProperty({}, 'passive', {
- get: function get() {
- supportsPassive = true;
- },
- })
- );
- } catch (e) {}
-
- return supportsPassive;
- };
-
- var windowDPR = function windowDPR() {
+ var getWindowDPR = function getWindowDPR() {
var dDPI = window.screen.deviceXDPI || 0;
var sDPI = window.screen.logicalXDPI || 1;
return window.devicePixelRatio || dDPI / sDPI;
@@ -450,103 +470,236 @@
return !(absValOne === absValTwo || absValOne + 1 === absValTwo || absValOne - 1 === absValTwo);
};
- var _onChangedListener = new WeakMap();
+ var createEnvironment = function createEnvironment() {
+ var _document = document,
+ body = _document.body;
+ var envDOM = createDOM('');
+ var envElm = envDOM[0];
+ var envChildElm = envElm.firstChild;
+ var onChangedListener = new Set();
+ var nativeScrollBarSize = getNativeScrollbarSize(body, envElm);
+ var nativeScrollbarIsOverlaid = {
+ x: nativeScrollBarSize.x === 0,
+ y: nativeScrollBarSize.y === 0,
+ };
+ var env = {
+ _autoUpdateLoop: false,
+ _nativeScrollbarSize: nativeScrollBarSize,
+ _nativeScrollbarIsOverlaid: nativeScrollbarIsOverlaid,
+ _nativeScrollbarStyling: getNativeScrollbarStyling(envElm),
+ _rtlScrollBehavior: getRtlScrollBehavior(envElm, envChildElm),
+ _addListener: function _addListener(listener) {
+ onChangedListener.add(listener);
+ },
+ _removeListener: function _removeListener(listener) {
+ onChangedListener.delete(listener);
+ },
+ };
+ removeAttr(envElm, 'style');
+ removeElements(envElm);
- var Environment = /*#__PURE__*/ (function () {
- function Environment() {
- _onChangedListener.set(this, {
- writable: true,
- value: void 0,
- });
+ if (!nativeScrollbarIsOverlaid.x || !nativeScrollbarIsOverlaid.y) {
+ var size = windowSize();
+ var dpr = getWindowDPR();
+ var scrollbarSize = nativeScrollBarSize;
+ window.addEventListener('resize', function () {
+ if (onChangedListener.size) {
+ var sizeNew = windowSize();
+ var deltaSize = {
+ w: sizeNew.w - size.w,
+ h: sizeNew.h - size.h,
+ };
+ if (deltaSize.w === 0 && deltaSize.h === 0) return;
+ var deltaAbsSize = {
+ w: abs(deltaSize.w),
+ h: abs(deltaSize.h),
+ };
+ var deltaAbsRatio = {
+ w: abs(round(sizeNew.w / (size.w / 100.0))),
+ h: abs(round(sizeNew.h / (size.h / 100.0))),
+ };
+ var dprNew = getWindowDPR();
+ var deltaIsBigger = deltaAbsSize.w > 2 && deltaAbsSize.h > 2;
+ var difference = !diffBiggerThanOne(deltaAbsRatio.w, deltaAbsRatio.h);
+ var dprChanged = dprNew !== dpr && dpr > 0;
+ var isZoom = deltaIsBigger && difference && dprChanged;
- classPrivateFieldSet(this, _onChangedListener, new Set());
+ if (isZoom) {
+ var newScrollbarSize = (environmentInstance._nativeScrollbarSize = getNativeScrollbarSize(body, envElm));
+ removeElements(envElm);
- var _self = this;
-
- var _document = document,
- body = _document.body;
- var envDOM = createDOM('');
- var envElm = envDOM[0];
- var envChildElm = envElm.firstChild;
- var nScrollBarSize = nativeScrollbarSize(body, envElm);
- var nativeScrollbarIsOverlaid = {
- x: nScrollBarSize.x === 0,
- y: nScrollBarSize.y === 0,
- };
- _self._autoUpdateLoop = false;
- _self._nativeScrollbarSize = nScrollBarSize;
- _self._nativeScrollbarIsOverlaid = nativeScrollbarIsOverlaid;
- _self._nativeScrollbarStyling = nativeScrollbarStyling(envElm);
- _self._rtlScrollBehavior = rtlScrollBehavior(envElm, envChildElm);
- _self._supportPassiveEvents = passiveEvents();
- _self._supportResizeObserver = !!jsAPI('ResizeObserver');
- removeAttr(envElm, 'style');
- removeElements(envElm);
-
- if (!nativeScrollbarIsOverlaid.x || !nativeScrollbarIsOverlaid.y) {
- var size = windowSize();
- var dpr = windowDPR();
-
- var onChangedListener = classPrivateFieldGet(this, _onChangedListener);
-
- window.addEventListener('resize', function () {
- if (onChangedListener.size) {
- var sizeNew = windowSize();
- var deltaSize = {
- w: sizeNew.w - size.w,
- h: sizeNew.h - size.h,
- };
- if (deltaSize.w === 0 && deltaSize.h === 0) return;
- var deltaAbsSize = {
- w: abs(deltaSize.w),
- h: abs(deltaSize.h),
- };
- var deltaAbsRatio = {
- w: abs(round(sizeNew.w / (size.w / 100.0))),
- h: abs(round(sizeNew.h / (size.h / 100.0))),
- };
- var dprNew = windowDPR();
- var deltaIsBigger = deltaAbsSize.w > 2 && deltaAbsSize.h > 2;
- var difference = !diffBiggerThanOne(deltaAbsRatio.w, deltaAbsRatio.h);
- var dprChanged = dprNew !== dpr && dpr > 0;
- var isZoom = deltaIsBigger && difference && dprChanged;
- var oldScrollbarSize = _self._nativeScrollbarSize;
- var newScrollbarSize;
-
- if (isZoom) {
- newScrollbarSize = _self._nativeScrollbarSize = nativeScrollbarSize(body, envElm);
- removeElements(envElm);
-
- if (oldScrollbarSize.x !== newScrollbarSize.x || oldScrollbarSize.y !== newScrollbarSize.y) {
- onChangedListener.forEach(function (listener) {
- return listener && listener(_self);
- });
- }
+ if (scrollbarSize.x !== newScrollbarSize.x || scrollbarSize.y !== newScrollbarSize.y) {
+ runEach(onChangedListener);
}
- size = sizeNew;
- dpr = dprNew;
+ scrollbarSize = newScrollbarSize;
}
- });
- }
+
+ size = sizeNew;
+ dpr = dprNew;
+ }
+ });
}
- var _proto = Environment.prototype;
+ return env;
+ };
- _proto.addListener = function addListener(listener) {
- classPrivateFieldGet(this, _onChangedListener).add(listener);
+ var getEnvironment = function getEnvironment() {
+ if (!environmentInstance) {
+ environmentInstance = createEnvironment();
+ }
+
+ return environmentInstance;
+ };
+
+ var animationStartEventName = 'animationstart';
+ var scrollEventName = 'scroll';
+ var scrollAmount = 3333333;
+ var ResizeObserverConstructor = jsAPI('ResizeObserver');
+ var classNameSizeObserver = 'os-size-observer';
+ var classNameSizeObserverListener = classNameSizeObserver + '-listener';
+ var classNameSizeObserverListenerItem = classNameSizeObserverListener + '-item';
+ var classNameSizeObserverListenerItemFinal = classNameSizeObserverListenerItem + '-final';
+ var cAF = cancelAnimationFrame;
+ var rAF = requestAnimationFrame;
+
+ var getDirection = function getDirection(elm) {
+ return style(elm, 'direction');
+ };
+
+ var createSizeObserver = function createSizeObserver(target, onSizeChangedCallback, direction) {
+ var rtlScrollBehavior = getEnvironment()._rtlScrollBehavior;
+
+ var baseElements = createDOM('');
+ var sizeObserver = baseElements[0];
+ var listenerElement = sizeObserver.firstChild;
+
+ var onSizeChangedCallbackProxy = function onSizeChangedCallbackProxy(dir) {
+ if (direction) {
+ var rtl = getDirection(sizeObserver) === 'rtl';
+ scrollLeft(sizeObserver, rtl ? (rtlScrollBehavior.n ? -scrollAmount : rtlScrollBehavior.i ? 0 : scrollAmount) : scrollAmount);
+ scrollTop(sizeObserver, scrollAmount);
+ }
+
+ onSizeChangedCallback(dir === true);
};
- _proto.removeListener = function removeListener(listener) {
- classPrivateFieldGet(this, _onChangedListener).delete(listener);
- };
+ var offListeners = [];
+ var appearCallback = onSizeChangedCallbackProxy;
- return Environment;
- })();
+ if (ResizeObserverConstructor) {
+ var resizeObserverInstance = new ResizeObserverConstructor(onSizeChangedCallbackProxy);
+ resizeObserverInstance.observe(listenerElement);
+ } else {
+ var observerElementChildren = createDOM(
+ ''
+ );
+ appendChildren(listenerElement, observerElementChildren);
+ var observerElementChildrenRoot = observerElementChildren[0];
+ var shrinkElement = observerElementChildrenRoot.lastChild;
+ var expandElement = observerElementChildrenRoot.firstChild;
+ var expandElementChild = expandElement == null ? void 0 : expandElement.firstChild;
+ var cacheSize = offsetSize(listenerElement);
+ var currSize = cacheSize;
+ var isDirty = false;
+ var rAFId;
+
+ var reset = function reset() {
+ scrollLeft(expandElement, scrollAmount);
+ scrollTop(expandElement, scrollAmount);
+ scrollLeft(shrinkElement, scrollAmount);
+ scrollTop(shrinkElement, scrollAmount);
+ };
+
+ var onResized = function onResized() {
+ rAFId = 0;
+ if (!isDirty) return;
+ cacheSize = currSize;
+ onSizeChangedCallbackProxy();
+ };
+
+ var onScroll = function onScroll(scrollEvent) {
+ currSize = offsetSize(listenerElement);
+ isDirty = !scrollEvent || currSize.w !== cacheSize.w || currSize.h !== cacheSize.h;
+
+ if (scrollEvent && isDirty && !rAFId) {
+ cAF(rAFId);
+ rAFId = rAF(onResized);
+ } else if (!scrollEvent) onResized();
+
+ reset();
+
+ if (scrollEvent) {
+ preventDefault(scrollEvent);
+ stopPropagation(scrollEvent);
+ }
+
+ return false;
+ };
+
+ offListeners.push(on(expandElement, scrollEventName, onScroll));
+ offListeners.push(on(shrinkElement, scrollEventName, onScroll));
+ style(expandElementChild, {
+ width: scrollAmount,
+ height: scrollAmount,
+ });
+ reset();
+ appearCallback = onScroll;
+ }
+
+ if (direction) {
+ var dirCache;
+ offListeners.push(
+ on(sizeObserver, scrollEventName, function (event) {
+ var dir = getDirection(sizeObserver);
+ var changed = dir !== dirCache;
+
+ if (changed) {
+ if (dir === 'rtl') {
+ style(listenerElement, {
+ left: 'auto',
+ right: 0,
+ });
+ } else {
+ style(listenerElement, {
+ left: 0,
+ right: 'auto',
+ });
+ }
+
+ dirCache = dir;
+ onSizeChangedCallbackProxy(true);
+ }
+
+ preventDefault(event);
+ stopPropagation(event);
+ return false;
+ })
+ );
+ }
+
+ offListeners.push(on(sizeObserver, animationStartEventName, appearCallback));
+ prependChildren(target, sizeObserver);
+ return function () {
+ runEach(offListeners);
+ removeElements(sizeObserver);
+ };
+ };
var index = function () {
return [
- new Environment(),
+ getEnvironment(),
+ createSizeObserver(document.body, function () {}),
createDOM(
'\
\
diff --git a/packages/overlayscrollbars/dist/overlayscrollbars.js.map b/packages/overlayscrollbars/dist/overlayscrollbars.js.map
index 8da76a2..51f50f1 100644
--- a/packages/overlayscrollbars/dist/overlayscrollbars.js.map
+++ b/packages/overlayscrollbars/dist/overlayscrollbars.js.map
@@ -1 +1 @@
-{"version":3,"file":"overlayscrollbars.js","sources":["../src/support/utils/types.ts","../src/support/dom/attribute.ts","../src/support/dom/class.ts","../src/support/utils/array.ts","../src/support/dom/traversal.ts","../src/support/dom/manipulation.ts","../src/support/dom/create.ts","../src/support/dom/dimensions.ts","../src/support/utils/object.ts","../src/support/dom/style.ts","../src/support/dom/offset.ts","../../../node_modules/@babel/runtime/helpers/classPrivateFieldGet.js","../../../node_modules/@babel/runtime/helpers/classPrivateFieldSet.js","../src/support/compatibility/vendors.ts","../src/support/compatibility/apis.ts","../../../node_modules/@babel/runtime/helpers/extends.js","../src/support/options/validation.ts","../src/environment/environment.ts","../src/index.ts"],"sourcesContent":["import { PlainObject } from 'typings';\r\n\r\nexport const type: (obj: any) => string = (obj) => {\r\n if (obj === undefined) return `${obj}`;\r\n if (obj === null) return `${obj}`;\r\n return Object.prototype.toString\r\n .call(obj)\r\n .replace(/^\\[object (.+)\\]$/, '$1')\r\n .toLowerCase();\r\n};\r\n\r\nexport function isNumber(obj: any): obj is number {\r\n return typeof obj === 'number';\r\n}\r\n\r\nexport function isString(obj: any): obj is string {\r\n return typeof obj === 'string';\r\n}\r\n\r\nexport function isBoolean(obj: any): obj is boolean {\r\n return typeof obj === 'boolean';\r\n}\r\n\r\nexport function isFunction(obj: any): obj is (...args: Array
) => unknown {\r\n return typeof obj === 'function';\r\n}\r\n\r\nexport function isUndefined(obj: any): obj is undefined {\r\n return obj === undefined;\r\n}\r\n\r\nexport function isNull(obj: any): obj is null {\r\n return obj === null;\r\n}\r\n\r\nexport function isArray(obj: any): obj is Array {\r\n return Array.isArray(obj);\r\n}\r\n\r\nexport function isObject(obj: any): boolean {\r\n return typeof obj === 'object' && !isArray(obj) && !isNull(obj);\r\n}\r\n\r\n/**\r\n * Returns true if the given object is array like, false otherwise.\r\n * @param obj The Object\r\n */\r\nexport function isArrayLike(obj: any): obj is ArrayLike {\r\n const length = !!obj && obj.length;\r\n return isArray(obj) || (!isFunction(obj) && isNumber(length) && length > -1 && length % 1 == 0); // eslint-disable-line eqeqeq\r\n}\r\n\r\n/**\r\n * Returns true if the given object is a \"plain\" (e.g. { key: value }) object, false otherwise.\r\n * @param obj The Object.\r\n */\r\nexport function isPlainObject(obj: any): obj is PlainObject {\r\n if (!obj || !isObject(obj) || type(obj) !== 'object') return false;\r\n\r\n let key;\r\n const proto = 'prototype';\r\n const { hasOwnProperty } = Object[proto];\r\n const hasOwnConstructor = hasOwnProperty.call(obj, 'constructor');\r\n const hasIsPrototypeOf = obj.constructor && obj.constructor[proto] && hasOwnProperty.call(obj.constructor[proto], 'isPrototypeOf');\r\n\r\n if (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) {\r\n return false;\r\n }\r\n\r\n /* eslint-disable no-restricted-syntax */\r\n for (key in obj) {\r\n /**/\r\n }\r\n /* eslint-enable */\r\n\r\n return isUndefined(key) || hasOwnProperty.call(obj, key);\r\n}\r\n\r\n/**\r\n * Checks whether the given object is a HTMLElement.\r\n * @param obj The object which shall be checked.\r\n */\r\nexport function isHTMLElement(obj: any): obj is HTMLElement {\r\n const instaceOfRightHandSide = window.HTMLElement;\r\n const doInstanceOf = isObject(instaceOfRightHandSide) || isFunction(instaceOfRightHandSide);\r\n return !!(doInstanceOf ? obj instanceof instaceOfRightHandSide : obj && isObject(obj) && obj.nodeType === 1 && isString(obj.nodeName));\r\n}\r\n\r\n/**\r\n * Returns true if the given object is empty, false otherwise.\r\n * @param obj The Object.\r\n */\r\nexport function isEmptyObject(obj: any): boolean {\r\n /* eslint-disable no-restricted-syntax, guard-for-in */\r\n for (const name in obj) return false;\r\n return true;\r\n /* eslint-enable */\r\n}\r\n","import { isUndefined } from 'support/utils/types';\r\n\r\ntype GetSetPropName = 'scrollLeft' | 'scrollTop' | 'value';\r\n\r\nfunction getSetProp(\r\n topLeft: GetSetPropName,\r\n fallback: number | string,\r\n elm: HTMLElement | HTMLInputElement | null,\r\n value?: number | string\r\n): number | string | void {\r\n if (isUndefined(value)) {\r\n return elm ? elm[topLeft] : fallback;\r\n }\r\n elm && (elm[topLeft] = value);\r\n}\r\n\r\n/**\r\n * Gets or sets a attribute with the given attribute of the given element depending whether the value attribute is given.\r\n * Returns null if the element has no attribute with the given name.\r\n * @param elm The element of which the attribute shall be get or set.\r\n * @param attrName The attribute name which shall be get or set.\r\n * @param value The value of the attribute which shall be set.\r\n */\r\nexport function attr(elm: HTMLElement | null, attrName: string): string | null;\r\nexport function attr(elm: HTMLElement | null, attrName: string, value: string): void;\r\nexport function attr(elm: HTMLElement | null, attrName: string, value?: string): string | null | void {\r\n if (isUndefined(value)) {\r\n return elm ? elm.getAttribute(attrName) : null;\r\n }\r\n elm && elm.setAttribute(attrName, value);\r\n}\r\n\r\n/**\r\n * Removes the given attribute from the given element.\r\n * @param elm The element of which the attribute shall be removed.\r\n * @param attrName The attribute name.\r\n */\r\nexport const removeAttr = (elm: Element | null, attrName: string): void => {\r\n elm?.removeAttribute(attrName);\r\n};\r\n\r\n/**\r\n * Gets or sets the scrollLeft value of the given element depending whether the value attribute is given.\r\n * @param elm The element of which the scrollLeft value shall be get or set.\r\n * @param value The scrollLeft value which shall be set.\r\n */\r\nexport function scrollLeft(elm: HTMLElement | null): number;\r\nexport function scrollLeft(elm: HTMLElement | null, value: number): void;\r\nexport function scrollLeft(elm: HTMLElement | null, value?: number): number | void {\r\n return getSetProp('scrollLeft', 0, elm, value) as number;\r\n}\r\n\r\n/**\r\n * Gets or sets the scrollTop value of the given element depending whether the value attribute is given.\r\n * @param elm The element of which the scrollTop value shall be get or set.\r\n * @param value The scrollTop value which shall be set.\r\n */\r\nexport function scrollTop(elm: HTMLElement | null): number;\r\nexport function scrollTop(elm: HTMLElement | null, value: number): void;\r\nexport function scrollTop(elm: HTMLElement | null, value?: number): number | void {\r\n return getSetProp('scrollTop', 0, elm, value) as number;\r\n}\r\n\r\n/**\r\n * Gets or sets the value of the given input element depending whether the value attribute is given.\r\n * @param elm The input element of which the value shall be get or set.\r\n * @param value The value which shall be set.\r\n */\r\nexport function val(elm: HTMLInputElement | null): string;\r\nexport function val(elm: HTMLInputElement | null, value: string): void;\r\nexport function val(elm: HTMLInputElement | null, value?: string): string | void {\r\n return getSetProp('value', '', elm, value) as string;\r\n}\r\n","import { isString } from 'support/utils/types';\r\n\r\nconst rnothtmlwhite = /[^\\x20\\t\\r\\n\\f]+/g;\r\nconst classListAction = (elm: Element | null, className: string, action: (elmClassList: DOMTokenList, clazz: string) => boolean | void): boolean => {\r\n let clazz: string;\r\n let i = 0;\r\n let result = false;\r\n\r\n if (elm && isString(className)) {\r\n const classes: Array = className.match(rnothtmlwhite) || [];\r\n result = classes.length > 0;\r\n while ((clazz = classes[i++])) {\r\n result = (action(elm.classList, clazz) as boolean) && result;\r\n }\r\n }\r\n return result;\r\n};\r\n\r\n/**\r\n * Check whether the given element has the given class name(s).\r\n * @param elm The element.\r\n * @param className The class name(s).\r\n */\r\nexport const hasClass = (elm: Element | null, className: string): boolean =>\r\n classListAction(elm, className, (classList, clazz) => classList.contains(clazz));\r\n\r\n/**\r\n * Adds the given class name(s) to the given element.\r\n * @param elm The element.\r\n * @param className The class name(s) which shall be added. (separated by spaces)\r\n */\r\nexport const addClass = (elm: Element | null, className: string): void => {\r\n classListAction(elm, className, (classList, clazz) => classList.add(clazz));\r\n};\r\n\r\n/**\r\n * Removes the given class name(s) from the given element.\r\n * @param elm The element.\r\n * @param className The class name(s) which shall be removed. (separated by spaces)\r\n */\r\nexport const removeClass = (elm: Element | null, className: string): void => {\r\n classListAction(elm, className, (classList, clazz) => classList.remove(clazz));\r\n};\r\n","import { isArrayLike } from 'support/utils/types';\r\nimport { PlainObject } from 'typings';\r\n\r\n/**\r\n * Iterates through a array or object\r\n * @param arrayLikeOrObject The array or object through which shall be iterated.\r\n * @param callback The function which is responsible for the iteration.\r\n * If the function returns true its treated like a \"continue\" statement.\r\n * If the function returns false its treated like a \"break\" statement.\r\n */\r\nexport function each(\r\n array: Array | ReadonlyArray,\r\n callback: (value: T, indexOrKey: number, source: Array) => boolean | void\r\n): Array | ReadonlyArray;\r\nexport function each(\r\n array: Array | ReadonlyArray | null,\r\n callback: (value: T, indexOrKey: number, source: Array) => boolean | void\r\n): Array | ReadonlyArray | null;\r\nexport function each(\r\n arrayLikeObject: ArrayLike,\r\n callback: (value: T, indexOrKey: number, source: ArrayLike) => boolean | void\r\n): ArrayLike;\r\nexport function each(\r\n arrayLikeObject: ArrayLike | null,\r\n callback: (value: T, indexOrKey: number, source: ArrayLike) => boolean | void\r\n): ArrayLike | null;\r\nexport function each(obj: PlainObject, callback: (value: any, indexOrKey: string, source: PlainObject) => boolean | void): PlainObject;\r\nexport function each(obj: PlainObject | null, callback: (value: any, indexOrKey: string, source: PlainObject) => boolean | void): PlainObject | null;\r\nexport function each(\r\n source: ArrayLike | PlainObject | null,\r\n callback: (value: T | any, indexOrKey: any, source: any) => boolean | void\r\n): Array | ReadonlyArray | ArrayLike | PlainObject | null {\r\n if (isArrayLike(source)) {\r\n for (let i = 0; i < source.length; i++) {\r\n if (callback(source[i], i, source) === false) {\r\n break;\r\n }\r\n }\r\n } else if (source) {\r\n each(Object.keys(source), (key) => callback(source[key], key, source));\r\n }\r\n return source;\r\n}\r\n\r\n/**\r\n * Returns the index of the given inside the given array or -1 if the given item isn't part of the given array.\r\n * @param arr The array.\r\n * @param item The item.\r\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0.\r\n */\r\nexport const indexOf = (arr: Array, item: T, fromIndex?: number): number => arr.indexOf(item, fromIndex);\r\n\r\n/**\r\n * Creates a shallow-copied Array instance from an array-like or iterable object.\r\n * @param arr The object from which the array instance shall be created.\r\n */\r\nexport const from = (arr: ArrayLike) => {\r\n if (Array.from) {\r\n return Array.from(arr);\r\n }\r\n const result: Array = [];\r\n each(arr, (elm) => {\r\n result.push(elm);\r\n });\r\n return result;\r\n};\r\n","import { each, from } from 'support/utils/array';\r\n\r\n/**\r\n * Find all elements with the passed selector, outgoing (and including) the passed element or the document if no element was provided.\r\n * @param selector The selector which has to be searched by.\r\n * @param elm The element from which the search shall be outgoing.\r\n */\r\nexport const find = (selector: string, elm?: Element | null): ReadonlyArray => {\r\n const arr: Array = [];\r\n\r\n each((elm || document).querySelectorAll(selector), (e: Element) => {\r\n arr.push(e);\r\n });\r\n\r\n return arr;\r\n};\r\n\r\n/**\r\n * Find the first element with the passed selector, outgoing (and including) the passed element or the document if no element was provided.\r\n * @param selector The selector which has to be searched by.\r\n * @param elm The element from which the search shall be outgoing.\r\n */\r\nexport const findFirst = (selector: string, elm?: Element | null): Element | null => (elm || document).querySelector(selector);\r\n\r\n/**\r\n * Determines whether the passed element is matching with the passed selector.\r\n * @param elm The element which has to be compared with the passed selector.\r\n * @param selector The selector which has to be compared with the passed element. Additional selectors: ':visible' and ':hidden'.\r\n */\r\nexport const is = (elm: Element | null, selector: string): boolean => (elm ? elm.matches(selector) : false);\r\n\r\n/**\r\n * Returns the children (no text-nodes or comments) of the passed element which are matching the passed selector. An empty array is returned if the passed element is null.\r\n * @param elm The element of which the children shall be returned.\r\n * @param selector The selector which must match with the children elements.\r\n */\r\nexport const children = (elm: Element | null, selector?: string): ReadonlyArray => {\r\n const childs: Array = [];\r\n\r\n each(elm && elm.children, (child: Element) => {\r\n if (selector) {\r\n if (child.matches(selector)) {\r\n childs.push(child);\r\n }\r\n } else {\r\n childs.push(child);\r\n }\r\n });\r\n\r\n return childs;\r\n};\r\n\r\n/**\r\n * Returns the childNodes (incl. text-nodes or comments etc.) of the passed element. An empty array is returned if the passed element is null.\r\n * @param elm The element of which the childNodes shall be returned.\r\n */\r\nexport const contents = (elm: Element | null): ReadonlyArray => (elm ? from(elm.childNodes) : []);\r\n\r\n/**\r\n * Returns the parent element of the passed element, or null if the passed element is null.\r\n * @param elm The element of which the parent element shall be returned.\r\n */\r\nexport const parent = (elm: Node | null): Node | null => (elm ? elm.parentElement : null);\r\n","import { isArrayLike } from 'support/utils/types';\r\nimport { each, from } from 'support/utils/array';\r\nimport { parent } from 'support/dom/traversal';\r\n\r\ntype NodeCollection = ArrayLike | Node | undefined | null;\r\n\r\n/**\r\n * Inserts Nodes before the given preferredAnchor element.\r\n * @param parentElm The parent of the preferredAnchor element or the element which shall be the parent of the inserted Nodes.\r\n * @param preferredAnchor The element before which the Nodes shall be inserted or null if the elements shall be appended at the end.\r\n * @param insertedElms The Nodes which shall be inserted.\r\n */\r\nconst before = (parentElm: Node | null, preferredAnchor: Node | null, insertedElms: NodeCollection): void => {\r\n if (insertedElms) {\r\n let anchor: Node | null = preferredAnchor;\r\n let fragment: DocumentFragment | Node | undefined | null;\r\n\r\n // parent must be defined\r\n if (parentElm) {\r\n if (isArrayLike(insertedElms)) {\r\n fragment = document.createDocumentFragment();\r\n\r\n // append all insertedElms to the fragment and if one of these is the anchor, change the anchor\r\n each(insertedElms, (insertedElm) => {\r\n if (insertedElm === anchor) {\r\n anchor = insertedElm.previousSibling;\r\n }\r\n fragment!.appendChild(insertedElm);\r\n });\r\n } else {\r\n fragment = insertedElms;\r\n }\r\n\r\n // if the preferred anchor isn't null set it to a valid anchor\r\n if (preferredAnchor) {\r\n if (!anchor) {\r\n anchor = parentElm.firstChild;\r\n } else if (anchor !== preferredAnchor) {\r\n anchor = anchor.nextSibling;\r\n }\r\n }\r\n\r\n parentElm.insertBefore(fragment, anchor);\r\n }\r\n }\r\n};\r\n\r\n/**\r\n * Appends the given children at the end of the given Node.\r\n * @param node The Node to which the children shall be appended.\r\n * @param children The Nodes which shall be appended.\r\n */\r\nexport const appendChildren = (node: Node | null, children: NodeCollection): void => {\r\n before(node, null, children);\r\n};\r\n\r\n/**\r\n * Prepends the given children at the start of the given Node.\r\n * @param node The Node to which the children shall be prepended.\r\n * @param children The Nodes which shall be prepended.\r\n */\r\nexport const prependChildren = (node: Node | null, children: NodeCollection): void => {\r\n before(node, node && node.firstChild, children);\r\n};\r\n\r\n/**\r\n * Inserts the given Nodes before the given Node.\r\n * @param node The Node before which the given Nodes shall be inserted.\r\n * @param insertedNodes The Nodes which shall be inserted.\r\n */\r\nexport const insertBefore = (node: Node | null, insertedNodes: NodeCollection): void => {\r\n before(parent(node), node, insertedNodes);\r\n};\r\n\r\n/**\r\n * Inserts the given Nodes after the given Node.\r\n * @param node The Node after which the given Nodes shall be inserted.\r\n * @param insertedNodes The Nodes which shall be inserted.\r\n */\r\nexport const insertAfter = (node: Node | null, insertedNodes: NodeCollection): void => {\r\n before(parent(node), node && node.nextSibling, insertedNodes);\r\n};\r\n\r\n/**\r\n * Removes the given Nodes from their parent.\r\n * @param nodes The Nodes which shall be removed.\r\n */\r\nexport const removeElements = (nodes: NodeCollection): void => {\r\n if (isArrayLike(nodes)) {\r\n each(from(nodes), (e) => removeElements(e));\r\n } else if (nodes) {\r\n const parentElm = parent(nodes);\r\n if (parentElm) {\r\n parentElm.removeChild(nodes);\r\n }\r\n }\r\n};\r\n","import { each } from 'support/utils/array';\r\nimport { contents } from 'support/dom/traversal';\r\nimport { removeElements } from 'support/dom/manipulation';\r\n\r\n/**\r\n * Creates a div DOM node.\r\n */\r\nexport const createDiv = (): HTMLDivElement => document.createElement('div');\r\n\r\n/**\r\n * Creates DOM nodes modeled after the passed html string and returns the root dom nodes as a array.\r\n * @param html The html string after which the DOM nodes shall be created.\r\n */\r\nexport const createDOM = (html: string): ReadonlyArray => {\r\n const createdDiv = createDiv();\r\n createdDiv.innerHTML = html.trim();\r\n\r\n return each(contents(createdDiv), (elm) => removeElements(elm));\r\n};\r\n","import { WH } from 'support/dom';\r\n\r\nconst elementHasDimensions = (elm: HTMLElement): boolean => !!(elm.offsetWidth || elm.offsetHeight || elm.getClientRects().length);\r\nconst zeroObj: WH = {\r\n w: 0,\r\n h: 0,\r\n};\r\n\r\n/**\r\n * Returns the window inner- width and height.\r\n */\r\nexport const windowSize = (): WH => ({\r\n w: window.innerWidth,\r\n h: window.innerHeight,\r\n});\r\n\r\n/**\r\n * Returns the offset- width and height of the passed element. If the element is null the width and height values are 0.\r\n * @param elm The element of which the offset- width and height shall be returned.\r\n */\r\nexport const offsetSize = (elm: HTMLElement | null): WH =>\r\n elm\r\n ? {\r\n w: elm.offsetWidth,\r\n h: elm.offsetHeight,\r\n }\r\n : zeroObj;\r\n\r\n/**\r\n * Returns the client- width and height of the passed element. If the element is null the width and height values are 0.\r\n * @param elm The element of which the client- width and height shall be returned.\r\n */\r\nexport const clientSize = (elm: HTMLElement | null): WH =>\r\n elm\r\n ? {\r\n w: elm.clientWidth,\r\n h: elm.clientHeight,\r\n }\r\n : zeroObj;\r\n\r\n/**\r\n * Returns the BoundingClientRect of the passed element.\r\n * @param elm The element of which the BoundingClientRect shall be returned.\r\n */\r\nexport const getBoundingClientRect = (elm: HTMLElement): DOMRect => elm.getBoundingClientRect();\r\n\r\n/**\r\n * Determines whether the passed element has any dimensions.\r\n * @param elm The element.\r\n */\r\nexport const hasDimensions = (elm: HTMLElement | null): boolean => (elm ? elementHasDimensions(elm as HTMLElement) : false);\r\n","import { isArray, isFunction, isPlainObject, isNull } from 'support/utils/types';\r\nimport { each } from 'support/utils/array';\r\n\r\n/**\r\n * Determines whether the passed object has a property with the passed name.\r\n * @param obj The object.\r\n * @param prop The name of the property.\r\n */\r\nexport const hasOwnProperty = (obj: any, prop: string | number | symbol): boolean => Object.prototype.hasOwnProperty.call(obj, prop);\r\n\r\n/**\r\n * Returns the names of the enumerable string properties and methods of an object.\r\n * @param obj The object of which the properties shall be returned.\r\n */\r\nexport const keys = (obj: any): Array => (obj ? Object.keys(obj) : []);\r\n\r\n// https://github.com/jquery/jquery/blob/master/src/core.js#L116\r\nexport function assignDeep(target: T, object1: U): T & U;\r\nexport function assignDeep(target: T, object1: U, object2: V): T & U & V;\r\nexport function assignDeep(target: T, object1: U, object2: V, object3: W): T & U & V & W;\r\nexport function assignDeep(target: T, object1: U, object2: V, object3: W, object4: X): T & U & V & W & X;\r\nexport function assignDeep(target: T, object1: U, object2: V, object3: W, object4: X, object5: Y): T & U & V & W & X & Y;\r\nexport function assignDeep(\r\n target: T,\r\n object1?: U,\r\n object2?: V,\r\n object3?: W,\r\n object4?: X,\r\n object5?: Y,\r\n object6?: Z\r\n): T & U & V & W & X & Y & Z {\r\n const sources: Array = [object1, object2, object3, object4, object5, object6];\r\n\r\n // Handle case when target is a string or something (possible in deep copy)\r\n if ((typeof target !== 'object' || isNull(target)) && !isFunction(target)) {\r\n target = {} as T;\r\n }\r\n\r\n each(sources, (source) => {\r\n // Extend the base object\r\n each(keys(source), (key) => {\r\n const copy: any = source[key];\r\n\r\n // Prevent Object.prototype pollution\r\n // Prevent never-ending loop\r\n if (target === copy) {\r\n return true;\r\n }\r\n\r\n const copyIsArray = isArray(copy);\r\n\r\n // Recurse if we're merging plain objects or arrays\r\n if (copy && (isPlainObject(copy) || copyIsArray)) {\r\n const src = target[key];\r\n let clone: any = src;\r\n\r\n // Ensure proper type for the source value\r\n if (copyIsArray && !isArray(src)) {\r\n clone = [];\r\n } else if (!copyIsArray && !isPlainObject(src)) {\r\n clone = {};\r\n }\r\n\r\n // Never move original objects, clone them\r\n target[key] = assignDeep(clone, copy) as any;\r\n } else {\r\n target[key] = copy;\r\n }\r\n });\r\n });\r\n\r\n // Return the modified object\r\n return target as any;\r\n}\r\n","import { each, keys } from 'support/utils';\r\nimport { isString, isNumber, isArray } from 'support/utils/types';\r\nimport { PlainObject } from 'typings';\r\n\r\ntype CssStyles = { [key: string]: string | number };\r\nconst cssNumber = {\r\n animationiterationcount: 1,\r\n columncount: 1,\r\n fillopacity: 1,\r\n flexgrow: 1,\r\n flexshrink: 1,\r\n fontweight: 1,\r\n lineheight: 1,\r\n opacity: 1,\r\n order: 1,\r\n orphans: 1,\r\n widows: 1,\r\n zindex: 1,\r\n zoom: 1,\r\n};\r\n\r\nconst adaptCSSVal = (prop: string, val: string | number): string | number => (!cssNumber[prop.toLowerCase()] && isNumber(val) ? `${val}px` : val);\r\nconst getCSSVal = (elm: HTMLElement, computedStyle: CSSStyleDeclaration, prop: string): string =>\r\n /* istanbul ignore next */\r\n computedStyle != null ? computedStyle.getPropertyValue(prop) : elm.style[prop];\r\nconst setCSSVal = (elm: HTMLElement | null, prop: string, val: string | number): void => {\r\n try {\r\n if (elm && elm.style[prop] !== undefined) {\r\n elm.style[prop] = adaptCSSVal(prop, val);\r\n }\r\n } catch (e) {}\r\n};\r\n\r\n/**\r\n * Gets or sets the passed styles to the passed element.\r\n * @param elm The element to which the styles shall be applied to / be read from.\r\n * @param styles The styles which shall be set or read.\r\n */\r\nexport function style(elm: HTMLElement | null, styles: CssStyles): void;\r\nexport function style(elm: HTMLElement | null, styles: string): string;\r\nexport function style(elm: HTMLElement | null, styles: Array | string): { [key: string]: string };\r\nexport function style(elm: HTMLElement | null, styles: CssStyles | Array | string): { [key: string]: string } | string | void {\r\n const getSingleStyle = isString(styles);\r\n const getStyles = isArray(styles) || getSingleStyle;\r\n\r\n if (getStyles) {\r\n let getStylesResult: string | PlainObject = getSingleStyle ? '' : {};\r\n if (elm) {\r\n const computedStyle: CSSStyleDeclaration = window.getComputedStyle(elm, null);\r\n getStylesResult = getSingleStyle\r\n ? getCSSVal(elm, computedStyle, styles as string)\r\n : (styles as Array).reduce((result, key) => {\r\n result[key] = getCSSVal(elm, computedStyle, key as string);\r\n return result;\r\n }, getStylesResult);\r\n }\r\n return getStylesResult;\r\n }\r\n each(keys(styles), (key) => setCSSVal(elm, key, styles[key]));\r\n}\r\n\r\n/**\r\n * Hides the passed element (display: none).\r\n * @param elm The element which shall be hidden.\r\n */\r\nexport const hide = (elm: HTMLElement | null): void => {\r\n style(elm, { display: 'none' });\r\n};\r\n\r\n/**\r\n * Shows the passed element (display: block).\r\n * @param elm The element which shall be shown.\r\n */\r\nexport const show = (elm: HTMLElement | null): void => {\r\n style(elm, { display: 'block' });\r\n};\r\n","import { getBoundingClientRect } from 'support/dom/dimensions';\r\nimport { XY } from 'support/dom';\r\n\r\nconst zeroObj: XY = {\r\n x: 0,\r\n y: 0,\r\n};\r\n\r\n/**\r\n * Returns the offset- left and top coordinates of the passed element relative to the document. If the element is null the top and left values are 0.\r\n * @param elm The element of which the offset- top and left coordinates shall be returned.\r\n */\r\nexport const absoluteCoordinates = (elm: HTMLElement | null): XY => {\r\n const rect = elm ? getBoundingClientRect(elm) : 0;\r\n return rect\r\n ? {\r\n x: rect.left + window.pageYOffset,\r\n y: rect.top + window.pageXOffset,\r\n }\r\n : zeroObj;\r\n};\r\n\r\n/**\r\n * Returns the offset- left and top coordinates of the passed element. If the element is null the top and left values are 0.\r\n * @param elm The element of which the offset- top and left coordinates shall be returned.\r\n */\r\nexport const offsetCoordinates = (elm: HTMLElement | null): XY =>\r\n elm\r\n ? {\r\n x: elm.offsetLeft,\r\n y: elm.offsetTop,\r\n }\r\n : zeroObj;\r\n","function _classPrivateFieldGet(receiver, privateMap) {\n var descriptor = privateMap.get(receiver);\n\n if (!descriptor) {\n throw new TypeError(\"attempted to get private field on non-instance\");\n }\n\n if (descriptor.get) {\n return descriptor.get.call(receiver);\n }\n\n return descriptor.value;\n}\n\nmodule.exports = _classPrivateFieldGet;","function _classPrivateFieldSet(receiver, privateMap, value) {\n var descriptor = privateMap.get(receiver);\n\n if (!descriptor) {\n throw new TypeError(\"attempted to set private field on non-instance\");\n }\n\n if (descriptor.set) {\n descriptor.set.call(receiver, value);\n } else {\n if (!descriptor.writable) {\n throw new TypeError(\"attempted to set read only private field\");\n }\n\n descriptor.value = value;\n }\n\n return value;\n}\n\nmodule.exports = _classPrivateFieldSet;","import { each, hasOwnProperty } from 'support/utils';\r\nimport { createDiv } from 'support/dom';\r\n\r\nconst firstLetterToUpper = (str: string): string => str.charAt(0).toUpperCase() + str.slice(1);\r\nconst getDummyStyle = (): CSSStyleDeclaration => createDiv().style;\r\n\r\n// https://developer.mozilla.org/en-US/docs/Glossary/Vendor_Prefix\r\n\r\nexport const cssPrefixes: ReadonlyArray = ['-webkit-', '-moz-', '-o-', '-ms-'];\r\nexport const jsPrefixes: ReadonlyArray = ['WebKit', 'Moz', 'O', 'MS', 'webkit', 'moz', 'o', 'ms'];\r\n\r\nexport const jsCache: { [key: string]: any } = {};\r\nexport const cssCache: { [key: string]: string } = {};\r\n\r\n/**\r\n * Gets the name of the given CSS property with vendor prefix if it isn't supported without, or undefined if unsupported.\r\n * @param name The name of the CSS property which shall be get.\r\n */\r\nexport const cssProperty = (name: string): string | undefined => {\r\n let result: string | undefined = cssCache[name];\r\n\r\n if (hasOwnProperty(cssCache, name)) {\r\n return result;\r\n }\r\n\r\n const uppercasedName: string = firstLetterToUpper(name);\r\n const elmStyle: CSSStyleDeclaration = getDummyStyle();\r\n\r\n each(cssPrefixes, (prefix: string) => {\r\n const prefixWithoutDashes: string = prefix.replace(/-/g, '');\r\n const resultPossibilities: Array = [\r\n name, // transition\r\n prefix + name, // -webkit-transition\r\n prefixWithoutDashes + uppercasedName, // webkitTransition\r\n firstLetterToUpper(prefixWithoutDashes) + uppercasedName, // WebkitTransition\r\n ];\r\n result = resultPossibilities.find((resultPossibility: string) => elmStyle[resultPossibility] !== undefined);\r\n return !result;\r\n });\r\n\r\n cssCache[name] = result;\r\n return result;\r\n};\r\n\r\n/**\r\n * Get the name of the given CSS property value(s), with vendor prefix if it isn't supported wuthout, or undefined if no value is supported.\r\n * @param property The CSS property to which the CSS property value(s) belong.\r\n * @param values The value(s) separated by spaces which shall be get.\r\n * @param suffix A suffix which is added to each value in case the value is a function or something else more advanced.\r\n */\r\nexport const cssPropertyValue = (property: string, values: string, suffix?: string): string | undefined => {\r\n const name = `${property} ${values}`;\r\n let result: string | undefined = cssCache[name];\r\n\r\n if (hasOwnProperty(cssCache, name)) {\r\n return result;\r\n }\r\n\r\n const dummyStyle: CSSStyleDeclaration = getDummyStyle();\r\n const possbleValues: Array = values.split(' ');\r\n const preparedSuffix: string = suffix || '';\r\n const cssPrefixesWithFirstEmpty = [''].concat(cssPrefixes);\r\n\r\n each(possbleValues, (possibleValue: string) => {\r\n each(cssPrefixesWithFirstEmpty, (prefix: string) => {\r\n const prop = prefix + possibleValue;\r\n dummyStyle.cssText = `${property}:${prop}${preparedSuffix}`;\r\n if (dummyStyle.length) {\r\n result = prop;\r\n return false;\r\n }\r\n });\r\n return !result;\r\n });\r\n\r\n cssCache[name] = result;\r\n return result;\r\n};\r\n\r\n/**\r\n * Get the requested JS function, object or constructor with vendor prefix if it isn't supported without or undefined if unsupported.\r\n * @param name The name of the JS function, object or constructor.\r\n */\r\nexport const jsAPI = (name: string): T | undefined => {\r\n let result: any = jsCache[name] || window[name];\r\n\r\n if (hasOwnProperty(jsCache, name)) {\r\n return result;\r\n }\r\n\r\n each(jsPrefixes, (prefix: string) => {\r\n result = result || window[prefix + firstLetterToUpper(name)];\r\n return !result;\r\n });\r\n\r\n jsCache[name] = result;\r\n return result;\r\n};\r\n","import { jsAPI } from 'support/compatibility/vendors';\r\n\r\nexport const resizeObserver: any | undefined = jsAPI('ResizeObserver');\r\n","function _extends() {\n module.exports = _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}\n\nmodule.exports = _extends;","import { each, indexOf, hasOwnProperty, keys } from 'support/utils';\r\nimport { type, isArray, isUndefined, isEmptyObject, isPlainObject, isString } from 'support/utils/types';\r\nimport { OptionsTemplate, OptionsTemplateTypes, OptionsTemplateType, Func, OptionsValidatedResult } from 'support/options';\r\nimport { PlainObject } from 'typings';\r\n\r\nconst { stringify } = JSON;\r\n\r\n/**\r\n * A prefix and suffix tuple which serves as recognition pattern for template types.\r\n */\r\nconst templateTypePrefixSuffix: readonly [string, string] = ['__TPL_', '_TYPE__'];\r\n/**\r\n * A object which serves as a mapping for \"normal\" types and template types.\r\n * Key = normal type string\r\n * value = template type string\r\n */\r\nconst optionsTemplateTypes: OptionsTemplateTypesDictionary = ['boolean', 'number', 'string', 'array', 'object', 'function', 'null'].reduce(\r\n (result, item) => {\r\n result[item] = templateTypePrefixSuffix[0] + item + templateTypePrefixSuffix[1];\r\n return result;\r\n },\r\n {} as OptionsTemplateTypesDictionary\r\n);\r\n\r\n/**\r\n * Validates the given options object according to the given template object and returns a object which looks like:\r\n * {\r\n * foreign : a object which consists of properties which aren't defined inside the template. (foreign properties)\r\n * validated : a object which consists only of valid properties. (property name is inside the template and value has a correct type)\r\n * }\r\n * @param options The options object which shall be validated.\r\n * @param template The template according to which the options object shall be validated.\r\n * @param optionsDiff When provided the returned validated object will only have properties which are different to this objects properties.\r\n * Example (assume all properties are valid to the template):\r\n * Options object : { a: 'a', b: 'b', c: 'c' }\r\n * optionsDiff object : { a: 'a', b: 'b', c: undefined }\r\n * Returned validated object : { c: 'c' }\r\n * Because the value of the properties a and b didn't change, they aren't included in the returned object.\r\n * Without the optionsDiff object the returned validated object would be: { a: 'a', b: 'b', c: 'c' }\r\n * @param doWriteErrors True if errors shall be logged into the console, false otherwise.\r\n * @param propPath The propertyPath which lead to this object. (used for error logging)\r\n */\r\nconst validateRecursive = (\r\n options: T,\r\n template: OptionsTemplate>,\r\n optionsDiff: T,\r\n doWriteErrors?: boolean,\r\n propPath?: string\r\n): OptionsValidatedResult => {\r\n const validatedOptions: T = {} as T;\r\n const optionsCopy: T = { ...options };\r\n const props = keys(template).filter((prop) => hasOwnProperty(options, prop));\r\n\r\n each(props, (prop: Extract) => {\r\n const optionsDiffValue: any = isUndefined(optionsDiff[prop]) ? {} : optionsDiff[prop];\r\n const optionsValue: any = options[prop];\r\n const templateValue: PlainObject | string | OptionsTemplateTypes | Array = template[prop];\r\n const templateIsComplex = isPlainObject(templateValue);\r\n const propPrefix = propPath ? `${propPath}.` : '';\r\n\r\n // if the template has a object as value, it means that the options are complex (verschachtelt)\r\n if (templateIsComplex && isPlainObject(optionsValue)) {\r\n const validatedResult = validateRecursive(optionsValue, templateValue as PlainObject, optionsDiffValue, doWriteErrors, propPrefix + prop);\r\n validatedOptions[prop] = validatedResult.validated;\r\n optionsCopy[prop] = validatedResult.foreign as any;\r\n\r\n each([optionsCopy, validatedOptions], (value) => {\r\n if (isEmptyObject(value[prop])) {\r\n delete value[prop];\r\n }\r\n });\r\n } else if (!templateIsComplex) {\r\n let isValid = false;\r\n const errorEnumStrings: Array = [];\r\n const errorPossibleTypes: Array = [];\r\n const optionsValueType = type(optionsValue);\r\n const templateValueArr: Array = !isArray(templateValue)\r\n ? [templateValue as string | OptionsTemplateTypes]\r\n : (templateValue as Array);\r\n\r\n each(templateValueArr, (currTemplateType) => {\r\n // if currType value isn't inside possibleTemplateTypes we assume its a enum string value\r\n const isEnumString = indexOf(Object.values(optionsTemplateTypes), currTemplateType) < 0;\r\n if (isEnumString && isString(optionsValue)) {\r\n // split it into a array which contains all possible values for example: [\"yes\", \"no\", \"maybe\"]\r\n const enumStringSplit = currTemplateType.split(' ');\r\n isValid = !!enumStringSplit.find((possibility) => possibility === optionsValue);\r\n\r\n // build error message\r\n errorEnumStrings.push(...enumStringSplit);\r\n } else {\r\n isValid = optionsTemplateTypes[optionsValueType] === currTemplateType;\r\n }\r\n\r\n // build error message\r\n errorPossibleTypes.push(isEnumString ? optionsTemplateTypes.string : currTemplateType);\r\n\r\n // continue if invalid, break if valid\r\n return !isValid;\r\n });\r\n\r\n if (isValid) {\r\n const doStringifyComparison = isArray(optionsValue) || isPlainObject(optionsValue);\r\n if (doStringifyComparison ? stringify(optionsValue) !== stringify(optionsDiffValue) : optionsValue !== optionsDiffValue) {\r\n validatedOptions[prop] = optionsValue;\r\n }\r\n } else if (doWriteErrors) {\r\n console.warn(\r\n `${\r\n `The option \"${propPrefix}${prop}\" wasn't set, because it doesn't accept the type [ ${optionsValueType.toUpperCase()} ] with the value of \"${optionsValue}\".\\r\\n` +\r\n `Accepted types are: [ ${errorPossibleTypes.join(', ').toUpperCase()} ].\\r\\n`\r\n }${errorEnumStrings.length > 0 ? `\\r\\nValid strings are: [ ${errorEnumStrings.join(', ')} ].` : ''}`\r\n );\r\n }\r\n\r\n delete optionsCopy[prop];\r\n }\r\n });\r\n\r\n return {\r\n foreign: optionsCopy,\r\n validated: validatedOptions,\r\n };\r\n};\r\n\r\n/**\r\n * Validates the given options object according to the given template object and returns a object which looks like:\r\n * {\r\n * foreign : a object which consists of properties which aren't defined inside the template. (foreign properties)\r\n * validated : a object which consists only of valid properties. (property name is inside the template and value has a correct type)\r\n * }\r\n * @param options The options object which shall be validated.\r\n * @param template The template according to which the options object shall be validated.\r\n * @param optionsDiff When provided the returned validated object will only have properties which are different to this objects properties.\r\n * Example (assume all properties are valid to the template):\r\n * Options object : { a: 'a', b: 'b', c: 'c' }\r\n * optionsDiff object : { a: 'a', b: 'b', c: undefined }\r\n * Returned validated object : { c: 'c' }\r\n * Because the value of the properties a and b didn't change, they aren't included in the returned object.\r\n * Without the optionsDiff object the returned validated object would be: { a: 'a', b: 'b', c: 'c' }\r\n * @param doWriteErrors True if errors shall be logged into the console, false otherwise.\r\n */\r\nconst validate = (\r\n options: T,\r\n template: OptionsTemplate>,\r\n optionsDiff?: T,\r\n doWriteErrors?: boolean\r\n): OptionsValidatedResult => {\r\n /*\r\n if (!isEmptyObject(foreign) && doWriteErrors)\r\n console.warn(`The following options are discarded due to invalidity:\\r\\n ${window.JSON.stringify(foreign, null, 2)}`);\r\n\r\n //add values, which aren't specified in the template, to the finished validated object to prevent them from being discarded\r\n if (keepForeignProps) {\r\n Object.assign(result.validated, foreign);\r\n }\r\n */\r\n return validateRecursive(options, template, optionsDiff || ({} as T), doWriteErrors || false);\r\n};\r\n\r\nexport { validate, optionsTemplateTypes };\r\n\r\ntype OptionsTemplateTypesDictionary = {\r\n readonly boolean: OptionsTemplateType;\r\n readonly number: OptionsTemplateType;\r\n readonly string: OptionsTemplateType;\r\n readonly array: OptionsTemplateType>;\r\n readonly object: OptionsTemplateType; // eslint-disable-line @typescript-eslint/ban-types\r\n readonly function: OptionsTemplateType;\r\n readonly null: OptionsTemplateType