diff --git a/packages/overlayscrollbars-jquery/dist/overlayscrollbars-jquery.js b/packages/overlayscrollbars-jquery/dist/overlayscrollbars-jquery.js index 63609b4..5755a16 100644 --- a/packages/overlayscrollbars-jquery/dist/overlayscrollbars-jquery.js +++ b/packages/overlayscrollbars-jquery/dist/overlayscrollbars-jquery.js @@ -1,24 +1,48 @@ -var OverlayScrollbars = function (exports, not_png, j) { - 'use strict'; +(function (global, factory) { + if (typeof define === "function" && define.amd) { + define("OverlayScrollbars", ["exports", "dir/not.png", "jquery"], factory); + } else if (typeof exports !== "undefined") { + factory(exports, require("dir/not.png"), require("jquery")); + } else { + var mod = { + exports: {} + }; + factory(mod.exports, global.not, global.jQuery); + global.OverlayScrollbars = mod.exports; + } +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _not, _jquery) { + "use strict"; + + Object.defineProperty(_exports, "__esModule", { + value: true + }); + Object.defineProperty(_exports, "not", { + enumerable: true, + get: function get() { + return _not.default; + } + }); + _exports.file = _exports.c = _exports.b = _exports.abc = _exports.a = _exports.default = void 0; + _not = _interopRequireDefault(_not); + _jquery = _interopRequireDefault(_jquery); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - not_png = not_png && Object.prototype.hasOwnProperty.call(not_png, 'default') ? not_png['default'] : not_png; - j = j && Object.prototype.hasOwnProperty.call(j, 'default') ? j['default'] : j; var abc = 'abc'; + _exports.abc = abc; var a = 1 + 1; var file = { a: a }; + _exports.file = file; var a$1 = 'a'; + _exports.a = a$1; var b = 'b'; + _exports.b = b; var c = 'c'; - var index = j('div'); - exports.not = not_png; - exports.a = a$1; - exports.abc = abc; - exports.b = b; - exports.c = c; - exports.default = index; - exports.file = file; - return exports; -}({}, not_png, jQuery); + _exports.c = c; + var index = (0, _jquery.default)('div'); + var _default = index; + _exports.default = _default; +}); //# sourceMappingURL=overlayscrollbars-jquery.js.map diff --git a/packages/overlayscrollbars-jquery/dist/overlayscrollbars-jquery.js.map b/packages/overlayscrollbars-jquery/dist/overlayscrollbars-jquery.js.map index 9184e45..01b7ca1 100644 --- a/packages/overlayscrollbars-jquery/dist/overlayscrollbars-jquery.js.map +++ b/packages/overlayscrollbars-jquery/dist/overlayscrollbars-jquery.js.map @@ -1 +1 @@ -{"version":3,"file":"overlayscrollbars-jquery.js","sources":["../src/dir/abc.js","../src/file.js","../src/test.js","../src/index.js"],"sourcesContent":["export default 'abc';\n","const a = 1 + 1;\nexport default {\n a,\n};\n","export const a = 'a';\nexport const b = 'b';\nexport const c = 'c';\n","import abc from 'dir/abc';\nimport not from 'dir/not.png';\nimport file from 'file';\nimport j from 'jquery';\nimport { a, b, c } from 'test';\n\nexport default j('div');\nexport { a, b, c, file, abc, not };\n"],"names":["a","b","c","j"],"mappings":";;;;;YAAe;ACAf,MAAMA,CAAC,GAAG,IAAI,CAAd;aACe;AACbA,IAAAA,CAAC,EAADA;AADa;MCDFA,GAAC,GAAG;MACJC,CAAC,GAAG;MACJC,CAAC,GAAG;cCIFC,CAAC,CAAC,KAAD;;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"overlayscrollbars-jquery.js","sources":["../src/dir/abc.js","../src/file.js","../src/test.js","../src/index.js"],"sourcesContent":["export default 'abc';\n","const a = 1 + 1;\nexport default {\n a,\n};\n","export const a = 'a';\nexport const b = 'b';\nexport const c = 'c';\n","import abc from 'dir/abc';\nimport not from 'dir/not.png';\nimport file from 'file';\nimport j from 'jquery';\nimport { a, b, c } from 'test';\n\nexport default j('div');\nexport { a, b, c, file, abc, not };\n"],"names":["a","b","c"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,YAAe,KAAf;;ACAA,MAAMA,CAAC,GAAG,IAAI,CAAd;AACA,aAAe;AACbA,IAAAA,CAAC,EAADA;AADa,GAAf;;ACDY,MAACA,GAAC,GAAG,GAAL;;AACA,MAACC,CAAC,GAAG,GAAL;;AACA,MAACC,CAAC,GAAG,GAAL;;ACIZ,cAAe,qBAAE,KAAF,CAAf;"} \ No newline at end of file diff --git a/packages/overlayscrollbars-jquery/dist/overlayscrollbars-jquery.min.js b/packages/overlayscrollbars-jquery/dist/overlayscrollbars-jquery.min.js index c922b20..854f28a 100644 --- a/packages/overlayscrollbars-jquery/dist/overlayscrollbars-jquery.min.js +++ b/packages/overlayscrollbars-jquery/dist/overlayscrollbars-jquery.min.js @@ -1 +1 @@ -var OverlayScrollbars=function(t,a,e){"use strict";a=a&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a;var r={a:2},l=(e=e&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e)("div");return t.not=a,t.a="a",t.abc="abc",t.b="b",t.c="c",t.default=l,t.file=r,t}({},not_png,jQuery); \ No newline at end of file +!function(e,r){if("function"==typeof define&&define.amd)define("OverlayScrollbars",["exports","dir/not.png","jquery"],r);else if("undefined"!=typeof exports)r(exports,require("dir/not.png"),require("jquery"));else{var t={exports:{}};r(t.exports,e.not,e.jQuery),e.OverlayScrollbars=t.exports}}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:this,(function(e,r,t){function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"not",{enumerable:!0,get:function(){return r.default}}),e.file=e.c=e.b=e.abc=e.a=e.default=void 0,r=n(r),t=n(t);e.abc="abc";var f={a:2};e.file=f;e.a="a";e.b="b";e.c="c";var o=(0,t.default)("div");e.default=o})); \ No newline at end of file diff --git a/packages/overlayscrollbars/dist/overlayscrollbars.esm.js b/packages/overlayscrollbars/dist/overlayscrollbars.esm.js index 983f8de..435bc17 100644 --- a/packages/overlayscrollbars/dist/overlayscrollbars.esm.js +++ b/packages/overlayscrollbars/dist/overlayscrollbars.esm.js @@ -91,7 +91,5 @@ var index = () => { '), a, b, c]; }; -const a = 1; export default index; -export { a }; //# sourceMappingURL=overlayscrollbars.esm.js.map diff --git a/packages/overlayscrollbars/dist/overlayscrollbars.esm.js.map b/packages/overlayscrollbars/dist/overlayscrollbars.esm.js.map index 57ad163..cceb4c1 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/core/utils/types.ts","../src/core/utils/object.ts","../src/core/utils/array.ts","../src/core/dom/traversal.ts","../src/core/dom/manipulation.ts","../src/core/dom/create.ts","../src/index.ts"],"sourcesContent":["import { PlainObject } from 'core/typings';\n\nexport const type: (obj: any) => string = (obj) => {\n if (obj === undefined) return `${obj}`;\n if (obj === null) return `${obj}`;\n return Object.prototype.toString\n .call(obj)\n .replace(/^\\[object (.+)\\]$/, '$1')\n .toLowerCase();\n};\n\nexport function isNumber(obj: any): obj is number {\n return typeof obj === 'number';\n}\n\nexport function isString(obj: any): obj is string {\n return typeof obj === 'string';\n}\n\nexport function isBoolean(obj: any): obj is boolean {\n return typeof obj === 'boolean';\n}\n\nexport function isFunction(obj: any): obj is (...args: Array) => unknown {\n return typeof obj === 'function';\n}\n\nexport function isUndefined(obj: any): obj is undefined {\n return obj === undefined;\n}\n\nexport function isNull(obj: any): obj is null {\n return obj === null;\n}\n\nexport function isArray(obj: any): obj is Array {\n return Array.isArray(obj);\n}\n\nexport function isObject(obj: any): boolean {\n return typeof obj === 'object' && !isArray(obj) && !isNull(obj);\n}\n\n/**\n * Returns true if the given object is array like, false otherwise.\n * @param obj The Object\n */\nexport function isArrayLike(obj: any): obj is ArrayLike {\n const length = !!obj && obj.length;\n return isArray(obj) || (!isFunction(obj) && isNumber(length) && length > -1 && length % 1 == 0); // eslint-disable-line eqeqeq\n}\n\n/**\n * Returns true if the given object is a \"plain\" (e.g. { key: value }) object, false otherwise.\n * @param obj The Object.\n */\nexport function isPlainObject(obj: any): obj is PlainObject {\n if (!obj || !isObject(obj) || type(obj) !== 'object') return false;\n\n let key;\n const proto = 'prototype';\n const { hasOwnProperty } = Object[proto];\n const hasOwnConstructor = hasOwnProperty.call(obj, 'constructor');\n const hasIsPrototypeOf = obj.constructor && obj.constructor[proto] && hasOwnProperty.call(obj.constructor[proto], 'isPrototypeOf');\n\n if (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) {\n return false;\n }\n\n /* eslint-disable no-restricted-syntax */\n for (key in obj) {\n /**/\n }\n /* eslint-enable */\n\n return isUndefined(key) || hasOwnProperty.call(obj, key);\n}\n\n/**\n * Checks whether the given object is a HTMLElement.\n * @param obj The object which shall be checked.\n */\nexport function isHTMLElement(obj: any): obj is HTMLElement {\n const instaceOfRightHandSide = window.HTMLElement;\n const doInstanceOf = isObject(instaceOfRightHandSide) || isFunction(instaceOfRightHandSide);\n return !!(doInstanceOf ? obj instanceof instaceOfRightHandSide : obj && isObject(obj) && obj.nodeType === 1 && isString(obj.nodeName));\n}\n\n/**\n * Returns true if the given object is empty, false otherwise.\n * @param obj The Object.\n */\nexport function isEmptyObject(obj: any): boolean {\n /* eslint-disable no-restricted-syntax, guard-for-in */\n for (const name in obj) return false;\n return true;\n /* eslint-enable */\n}\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 = (obj: any, prop: string | number | symbol) =>\r\n 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: any) => (obj ? Object.keys(obj) : []);\r\n","import { keys } from 'core/utils/object';\nimport { isArrayLike } from 'core/utils/types';\nimport { PlainObject } from 'core/typings';\n\n/**\n * Iterates through a array or object\n * @param arrayLikeOrObject The array or object through which shall be iterated.\n * @param callback The function which is responsible for the iteration.\n * If the function returns true its treated like a \"continue\" statement.\n * If the function returns false its treated like a \"break\" statement.\n */\nexport function each(\n array: Array | ReadonlyArray,\n callback: (value: T, indexOrKey: number, source: Array) => boolean | void,\n): Array | ReadonlyArray;\nexport function each(\n array: Array | ReadonlyArray | null,\n callback: (value: T, indexOrKey: number, source: Array) => boolean | void,\n): Array | ReadonlyArray | null;\nexport function each(\n arrayLikeObject: ArrayLike,\n callback: (value: T, indexOrKey: number, source: ArrayLike) => boolean | void,\n): ArrayLike;\nexport function each(\n arrayLikeObject: ArrayLike | null,\n callback: (value: T, indexOrKey: number, source: ArrayLike) => boolean | void,\n): ArrayLike | null;\nexport function each(obj: PlainObject, callback: (value: any, indexOrKey: string, source: PlainObject) => boolean | void): PlainObject;\nexport function each(obj: PlainObject | null, callback: (value: any, indexOrKey: string, source: PlainObject) => boolean | void): PlainObject | null;\nexport function each(\n source: ArrayLike | PlainObject | null,\n callback: (value: T | any, indexOrKey: any, source: any) => boolean | void,\n): Array | ReadonlyArray | ArrayLike | PlainObject | null {\n if (isArrayLike(source)) {\n for (let i = 0; i < source.length; i++) {\n if (callback(source[i], i, source) === false) {\n break;\n }\n }\n } else if (source) {\n each(keys(source), (key) => callback(source[key], key, source));\n }\n return source;\n}\n\n/**\n * Returns the index of the given inside the given array or -1 if the given item isn't part of the given array.\n * @param arr The array.\n * @param item The item.\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0.\n */\nexport const indexOf: (arr: Array, item: T, fromIndex?: number) => number = (arr, item, fromIndex) => arr.indexOf(item, fromIndex);\n","import { each } from 'core/utils/array';\n\nconst elementIsVisible: (elm: HTMLElement) => boolean = (elm) => !!(elm.offsetWidth || elm.offsetHeight || elm.getClientRects().length);\n\nexport const find: (selector: string, elm?: Element | null) => ReadonlyArray = (selector, elm?) => {\n const arr: Array = [];\n\n each((elm || document).querySelectorAll(selector), (e: Element) => {\n arr.push(e);\n });\n\n return arr;\n};\n\nexport const findFirst: (selector: string, elm?: Element | null) => Element | null = (selector, elm?) => (elm || document).querySelector(selector);\n\nexport const is: (elm: Element | null, selector: string) => boolean = (elm, selector) => {\n if (elm) {\n if (selector === ':visible') {\n return elementIsVisible(elm as HTMLElement);\n }\n if (selector === ':hidden') {\n return !elementIsVisible(elm as HTMLElement);\n }\n if (elm.matches(selector)) {\n return true;\n }\n }\n return false;\n};\n\nexport const children: (elm: Element | null, selector?: string) => ReadonlyArray = (elm, selector?) => {\n const childs: Array = [];\n\n each(elm && elm.children, (child: Element) => {\n if (selector) {\n if (child.matches(selector)) {\n childs.push(child);\n }\n } else {\n childs.push(child);\n }\n });\n\n return childs;\n};\n\nexport const contents: (elm: Element | null) => ReadonlyArray = (elm) => (elm ? Array.from(elm.childNodes) : []);\n\nexport const parent: (elm: Node | null) => Node | null = (elm) => (elm ? elm.parentElement : null);\n","import { isArrayLike } from 'core/utils/types';\nimport { each } from 'core/utils/array';\nimport { parent } from 'core/dom/traversal';\n\ntype NodeCollection = ArrayLike | Node | undefined | null;\n\n/**\n * Inserts Nodes before the given preferredAnchor element.\n * @param parentElm The parent of the preferredAnchor element or the element which shall be the parent of the inserted Nodes.\n * @param preferredAnchor The element before which the Nodes shall be inserted or null if the elements shall be appended at the end.\n * @param insertedElms The Nodes which shall be inserted.\n */\nconst before: (parentElm: Node | null, preferredAnchor: Node | null, insertedElms: NodeCollection) => void = (\n parentElm,\n preferredAnchor,\n insertedElms,\n) => {\n if (insertedElms) {\n let anchor: Node | null = preferredAnchor;\n let fragment: DocumentFragment | Node | undefined | null;\n\n // parent must be defined\n if (parentElm) {\n if (isArrayLike(insertedElms)) {\n fragment = document.createDocumentFragment();\n\n // append all insertedElms to the fragment and if one of these is the anchor, change the anchor\n each(insertedElms, (insertedElm) => {\n if (insertedElm === anchor) {\n anchor = insertedElm.previousSibling;\n }\n fragment!.appendChild(insertedElm);\n });\n } else {\n fragment = insertedElms;\n }\n\n // if the preferred anchor isn't null set it to a valid anchor\n if (preferredAnchor) {\n if (!anchor) {\n anchor = parentElm.firstChild;\n } else if (anchor !== preferredAnchor) {\n anchor = anchor.nextSibling;\n }\n }\n\n parentElm.insertBefore(fragment, anchor);\n }\n }\n};\n\n/**\n * Appends the given children at the end of the given Node.\n * @param node The Node to which the children shall be appended.\n * @param children The Nodes which shall be appended.\n */\nexport const appendChildren: (node: Node | null, children: NodeCollection) => void = (node, children) => {\n before(node, null, children);\n};\n\n/**\n * Prepends the given children at the start of the given Node.\n * @param node The Node to which the children shall be prepended.\n * @param children The Nodes which shall be prepended.\n */\nexport const prependChildren: (node: Node | null, children: NodeCollection) => void = (node, children) => {\n before(node, node && node.firstChild, children);\n};\n\n/**\n * Inserts the given Nodes before the given Node.\n * @param node The Node before which the given Nodes shall be inserted.\n * @param insertedNodes The Nodes which shall be inserted.\n */\nexport const insertBefore: (node: Node | null, insertedNodes: NodeCollection) => void = (node, insertedNodes) => {\n before(parent(node), node, insertedNodes);\n};\n\n/**\n * Inserts the given Nodes after the given Node.\n * @param node The Node after which the given Nodes shall be inserted.\n * @param insertedNodes The Nodes which shall be inserted.\n */\nexport const insertAfter: (node: Node | null, insertedNodes: NodeCollection) => void = (node, insertedNodes) => {\n before(parent(node), node && node.nextSibling, insertedNodes);\n};\n\n/**\n * Removes the given Nodes from their parent.\n * @param nodes The Nodes which shall be removed.\n */\nexport const removeElements: (nodes: NodeCollection) => void = (nodes) => {\n if (isArrayLike(nodes)) {\n each(Array.from(nodes), (e) => removeElements(e));\n } else if (nodes) {\n const { parentNode } = nodes;\n if (parentNode) {\n parentNode.removeChild(nodes);\n }\n }\n};\n","import { each } from 'core/utils/array';\nimport { contents } from 'core/dom/traversal';\nimport { removeElements } from 'core/dom/manipulation';\n\nexport const createDiv: () => HTMLDivElement = () => document.createElement('div');\n\nexport const createDOM: (html: string) => ReadonlyArray = (html) => {\n const createdDiv = createDiv();\n createdDiv.innerHTML = html.trim();\n\n return each(contents(createdDiv), (elm) => removeElements(elm));\n};\n","import { createDOM } from 'core/dom';\n\n/*\nexport * from 'core/compatibility';\nexport * from 'core/utils';\nexport * from 'core/dom';\nexport * from 'core/options';\nexport * from 'instances';\n*/\n\nconst abc = {\n a: 1,\n b: 1,\n c: 1,\n};\n\nexport default () => {\n const { a, b, c } = abc;\n return [\n createDOM(\n '\\\n
\\\n
\\\n
\\\n
\\\n
\\\n fdfhdfgh\\\n
\\\n
\\\n
\\\n
\\\n
\\\n
\\\n
\\\n
\\\n
\\\n
\\\n
\\\n
\\\n
\\\n
\\\n
',\n ),\n a,\n b,\n c,\n ];\n};\n\nexport const a = 1;\n"],"names":["isNumber","obj","isFunction","isArray","Array","isArrayLike","length","keys","Object","each","source","callback","i","key","contents","elm","from","childNodes","removeElements","nodes","e","parentNode","removeChild","createDiv","document","createElement","createDOM","html","createdDiv","innerHTML","trim","abc","a","b","c"],"mappings":"SAWgBA,SAASC;AACvB,SAAO,OAAOA,GAAP,KAAe,QAAtB;AACD;;SAUeC,WAAWD;AACzB,SAAO,OAAOA,GAAP,KAAe,UAAtB;AACD;;SAUeE,QAAQF;AACtB,SAAOG,KAAK,CAACD,OAAN,CAAcF,GAAd,CAAP;AACD;;SAUeI,YAAyCJ;AACvD,QAAMK,MAAM,GAAG,CAAC,CAACL,GAAF,IAASA,GAAG,CAACK,MAA5B;AACA,SAAOH,OAAO,CAACF,GAAD,CAAP,IAAiB,CAACC,UAAU,CAACD,GAAD,CAAX,IAAoBD,QAAQ,CAACM,MAAD,CAA5B,IAAwCA,MAAM,GAAG,CAAC,CAAlD,IAAuDA,MAAM,GAAG,CAAT,IAAc,CAA7F;;;ACrCK,MAAMC,IAAI,GAAiCN,GAAD,IAAeA,GAAG,GAAGO,MAAM,CAACD,IAAP,CAAYN,GAAZ,CAAH,GAAsB,EAAlF;;SCiBSQ,KACdC,QACAC;AAEA,MAAIN,WAAW,CAACK,MAAD,CAAf,EAAyB;AACvB,SAAK,IAAIE,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGF,MAAM,CAACJ,MAA3B,EAAmCM,CAAC,EAApC,EAAwC;AACtC,UAAID,QAAQ,CAACD,MAAM,CAACE,CAAD,CAAP,EAAYA,CAAZ,EAAeF,MAAf,CAAR,KAAmC,KAAvC,EAA8C;AAC5C;AACD;AACF;AACF,GAND,MAMO,IAAIA,MAAJ,EAAY;AACjBD,IAAAA,IAAI,CAACF,IAAI,CAACG,MAAD,CAAL,EAAgBG,GAAD,IAASF,QAAQ,CAACD,MAAM,CAACG,GAAD,CAAP,EAAcA,GAAd,EAAmBH,MAAnB,CAAhC,CAAJ;AACD;;AACD,SAAOA,MAAP;;;ACKK,MAAMI,QAAQ,GAAuDC,GAAD,IAAUA,GAAG,GAAGX,KAAK,CAACY,IAAN,CAAsBD,GAAG,CAACE,UAA1B,CAAH,GAA2C,EAA5H;;AC4CA,MAAMC,cAAc,GAAqCC,KAAD;AAC7D,MAAId,WAAW,CAACc,KAAD,CAAf,EAAwB;AACtBV,IAAAA,IAAI,CAACL,KAAK,CAACY,IAAN,CAAWG,KAAX,CAAD,EAAqBC,CAAD,IAAOF,cAAc,CAACE,CAAD,CAAzC,CAAJ;AACD,GAFD,MAEO,IAAID,KAAJ,EAAW;AAChB,UAAM;AAAEE,MAAAA;AAAF,QAAiBF,KAAvB;;AACA,QAAIE,UAAJ,EAAgB;AACdA,MAAAA,UAAU,CAACC,WAAX,CAAuBH,KAAvB;AACD;AACF;AACF,CATM;;ACvFA,MAAMI,SAAS,GAAyB,MAAMC,QAAQ,CAACC,aAAT,CAAuB,KAAvB,CAA9C;;AAEA,MAAMC,SAAS,GAA2CC,IAAD;AAC9D,QAAMC,UAAU,GAAGL,SAAS,EAA5B;AACAK,EAAAA,UAAU,CAACC,SAAX,GAAuBF,IAAI,CAACG,IAAL,EAAvB;AAEA,SAAOrB,IAAI,CAACK,QAAQ,CAACc,UAAD,CAAT,EAAwBb,GAAD,IAASG,cAAc,CAACH,GAAD,CAA9C,CAAX;AACD,CALM;;ACIP,MAAMgB,GAAG,GAAG;AACVC,EAAAA,CAAC,EAAE,CADO;AAEVC,EAAAA,CAAC,EAAE,CAFO;AAGVC,EAAAA,CAAC,EAAE;AAHO,CAAZ;;AAMA,YAAe;AACb,QAAM;AAAEF,IAAAA,CAAF;AAAKC,IAAAA,CAAL;AAAQC,IAAAA;AAAR,MAAcH,GAApB;AACA,SAAO,CACLL,SAAS,CACP;;;;;;;;;;;;;;;;;;;;;WADO,CADJ,EAyBLM,CAzBK,EA0BLC,CA1BK,EA2BLC,CA3BK,CAAP;AA6BD,CA/BD;;MAiCaF,CAAC,GAAG;;"} \ No newline at end of file +{"version":3,"file":"overlayscrollbars.esm.js","sources":["../src/core/utils/types.ts","../src/core/utils/object.ts","../src/core/utils/array.ts","../src/core/dom/traversal.ts","../src/core/dom/manipulation.ts","../src/core/dom/create.ts","../src/index.ts"],"sourcesContent":["import { PlainObject } from 'core/typings';\n\nexport const type: (obj: any) => string = (obj) => {\n if (obj === undefined) return `${obj}`;\n if (obj === null) return `${obj}`;\n return Object.prototype.toString\n .call(obj)\n .replace(/^\\[object (.+)\\]$/, '$1')\n .toLowerCase();\n};\n\nexport function isNumber(obj: any): obj is number {\n return typeof obj === 'number';\n}\n\nexport function isString(obj: any): obj is string {\n return typeof obj === 'string';\n}\n\nexport function isBoolean(obj: any): obj is boolean {\n return typeof obj === 'boolean';\n}\n\nexport function isFunction(obj: any): obj is (...args: Array) => unknown {\n return typeof obj === 'function';\n}\n\nexport function isUndefined(obj: any): obj is undefined {\n return obj === undefined;\n}\n\nexport function isNull(obj: any): obj is null {\n return obj === null;\n}\n\nexport function isArray(obj: any): obj is Array {\n return Array.isArray(obj);\n}\n\nexport function isObject(obj: any): boolean {\n return typeof obj === 'object' && !isArray(obj) && !isNull(obj);\n}\n\n/**\n * Returns true if the given object is array like, false otherwise.\n * @param obj The Object\n */\nexport function isArrayLike(obj: any): obj is ArrayLike {\n const length = !!obj && obj.length;\n return isArray(obj) || (!isFunction(obj) && isNumber(length) && length > -1 && length % 1 == 0); // eslint-disable-line eqeqeq\n}\n\n/**\n * Returns true if the given object is a \"plain\" (e.g. { key: value }) object, false otherwise.\n * @param obj The Object.\n */\nexport function isPlainObject(obj: any): obj is PlainObject {\n if (!obj || !isObject(obj) || type(obj) !== 'object') return false;\n\n let key;\n const proto = 'prototype';\n const { hasOwnProperty } = Object[proto];\n const hasOwnConstructor = hasOwnProperty.call(obj, 'constructor');\n const hasIsPrototypeOf = obj.constructor && obj.constructor[proto] && hasOwnProperty.call(obj.constructor[proto], 'isPrototypeOf');\n\n if (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) {\n return false;\n }\n\n /* eslint-disable no-restricted-syntax */\n for (key in obj) {\n /**/\n }\n /* eslint-enable */\n\n return isUndefined(key) || hasOwnProperty.call(obj, key);\n}\n\n/**\n * Checks whether the given object is a HTMLElement.\n * @param obj The object which shall be checked.\n */\nexport function isHTMLElement(obj: any): obj is HTMLElement {\n const instaceOfRightHandSide = window.HTMLElement;\n const doInstanceOf = isObject(instaceOfRightHandSide) || isFunction(instaceOfRightHandSide);\n return !!(doInstanceOf ? obj instanceof instaceOfRightHandSide : obj && isObject(obj) && obj.nodeType === 1 && isString(obj.nodeName));\n}\n\n/**\n * Returns true if the given object is empty, false otherwise.\n * @param obj The Object.\n */\nexport function isEmptyObject(obj: any): boolean {\n /* eslint-disable no-restricted-syntax, guard-for-in */\n for (const name in obj) return false;\n return true;\n /* eslint-enable */\n}\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 = (obj: any, prop: string | number | symbol) =>\r\n 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: any) => (obj ? Object.keys(obj) : []);\r\n","import { keys } from 'core/utils/object';\nimport { isArrayLike } from 'core/utils/types';\nimport { PlainObject } from 'core/typings';\n\n/**\n * Iterates through a array or object\n * @param arrayLikeOrObject The array or object through which shall be iterated.\n * @param callback The function which is responsible for the iteration.\n * If the function returns true its treated like a \"continue\" statement.\n * If the function returns false its treated like a \"break\" statement.\n */\nexport function each(\n array: Array | ReadonlyArray,\n callback: (value: T, indexOrKey: number, source: Array) => boolean | void,\n): Array | ReadonlyArray;\nexport function each(\n array: Array | ReadonlyArray | null,\n callback: (value: T, indexOrKey: number, source: Array) => boolean | void,\n): Array | ReadonlyArray | null;\nexport function each(\n arrayLikeObject: ArrayLike,\n callback: (value: T, indexOrKey: number, source: ArrayLike) => boolean | void,\n): ArrayLike;\nexport function each(\n arrayLikeObject: ArrayLike | null,\n callback: (value: T, indexOrKey: number, source: ArrayLike) => boolean | void,\n): ArrayLike | null;\nexport function each(obj: PlainObject, callback: (value: any, indexOrKey: string, source: PlainObject) => boolean | void): PlainObject;\nexport function each(obj: PlainObject | null, callback: (value: any, indexOrKey: string, source: PlainObject) => boolean | void): PlainObject | null;\nexport function each(\n source: ArrayLike | PlainObject | null,\n callback: (value: T | any, indexOrKey: any, source: any) => boolean | void,\n): Array | ReadonlyArray | ArrayLike | PlainObject | null {\n if (isArrayLike(source)) {\n for (let i = 0; i < source.length; i++) {\n if (callback(source[i], i, source) === false) {\n break;\n }\n }\n } else if (source) {\n each(keys(source), (key) => callback(source[key], key, source));\n }\n return source;\n}\n\n/**\n * Returns the index of the given inside the given array or -1 if the given item isn't part of the given array.\n * @param arr The array.\n * @param item The item.\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0.\n */\nexport const indexOf: (arr: Array, item: T, fromIndex?: number) => number = (arr, item, fromIndex) => arr.indexOf(item, fromIndex);\n","import { each } from 'core/utils/array';\n\nconst elementIsVisible: (elm: HTMLElement) => boolean = (elm) => !!(elm.offsetWidth || elm.offsetHeight || elm.getClientRects().length);\n\nexport const find: (selector: string, elm?: Element | null) => ReadonlyArray = (selector, elm?) => {\n const arr: Array = [];\n\n each((elm || document).querySelectorAll(selector), (e: Element) => {\n arr.push(e);\n });\n\n return arr;\n};\n\nexport const findFirst: (selector: string, elm?: Element | null) => Element | null = (selector, elm?) => (elm || document).querySelector(selector);\n\nexport const is: (elm: Element | null, selector: string) => boolean = (elm, selector) => {\n if (elm) {\n if (selector === ':visible') {\n return elementIsVisible(elm as HTMLElement);\n }\n if (selector === ':hidden') {\n return !elementIsVisible(elm as HTMLElement);\n }\n if (elm.matches(selector)) {\n return true;\n }\n }\n return false;\n};\n\nexport const children: (elm: Element | null, selector?: string) => ReadonlyArray = (elm, selector?) => {\n const childs: Array = [];\n\n each(elm && elm.children, (child: Element) => {\n if (selector) {\n if (child.matches(selector)) {\n childs.push(child);\n }\n } else {\n childs.push(child);\n }\n });\n\n return childs;\n};\n\nexport const contents: (elm: Element | null) => ReadonlyArray = (elm) => (elm ? Array.from(elm.childNodes) : []);\n\nexport const parent: (elm: Node | null) => Node | null = (elm) => (elm ? elm.parentElement : null);\n","import { isArrayLike } from 'core/utils/types';\nimport { each } from 'core/utils/array';\nimport { parent } from 'core/dom/traversal';\n\ntype NodeCollection = ArrayLike | Node | undefined | null;\n\n/**\n * Inserts Nodes before the given preferredAnchor element.\n * @param parentElm The parent of the preferredAnchor element or the element which shall be the parent of the inserted Nodes.\n * @param preferredAnchor The element before which the Nodes shall be inserted or null if the elements shall be appended at the end.\n * @param insertedElms The Nodes which shall be inserted.\n */\nconst before: (parentElm: Node | null, preferredAnchor: Node | null, insertedElms: NodeCollection) => void = (\n parentElm,\n preferredAnchor,\n insertedElms,\n) => {\n if (insertedElms) {\n let anchor: Node | null = preferredAnchor;\n let fragment: DocumentFragment | Node | undefined | null;\n\n // parent must be defined\n if (parentElm) {\n if (isArrayLike(insertedElms)) {\n fragment = document.createDocumentFragment();\n\n // append all insertedElms to the fragment and if one of these is the anchor, change the anchor\n each(insertedElms, (insertedElm) => {\n if (insertedElm === anchor) {\n anchor = insertedElm.previousSibling;\n }\n fragment!.appendChild(insertedElm);\n });\n } else {\n fragment = insertedElms;\n }\n\n // if the preferred anchor isn't null set it to a valid anchor\n if (preferredAnchor) {\n if (!anchor) {\n anchor = parentElm.firstChild;\n } else if (anchor !== preferredAnchor) {\n anchor = anchor.nextSibling;\n }\n }\n\n parentElm.insertBefore(fragment, anchor);\n }\n }\n};\n\n/**\n * Appends the given children at the end of the given Node.\n * @param node The Node to which the children shall be appended.\n * @param children The Nodes which shall be appended.\n */\nexport const appendChildren: (node: Node | null, children: NodeCollection) => void = (node, children) => {\n before(node, null, children);\n};\n\n/**\n * Prepends the given children at the start of the given Node.\n * @param node The Node to which the children shall be prepended.\n * @param children The Nodes which shall be prepended.\n */\nexport const prependChildren: (node: Node | null, children: NodeCollection) => void = (node, children) => {\n before(node, node && node.firstChild, children);\n};\n\n/**\n * Inserts the given Nodes before the given Node.\n * @param node The Node before which the given Nodes shall be inserted.\n * @param insertedNodes The Nodes which shall be inserted.\n */\nexport const insertBefore: (node: Node | null, insertedNodes: NodeCollection) => void = (node, insertedNodes) => {\n before(parent(node), node, insertedNodes);\n};\n\n/**\n * Inserts the given Nodes after the given Node.\n * @param node The Node after which the given Nodes shall be inserted.\n * @param insertedNodes The Nodes which shall be inserted.\n */\nexport const insertAfter: (node: Node | null, insertedNodes: NodeCollection) => void = (node, insertedNodes) => {\n before(parent(node), node && node.nextSibling, insertedNodes);\n};\n\n/**\n * Removes the given Nodes from their parent.\n * @param nodes The Nodes which shall be removed.\n */\nexport const removeElements: (nodes: NodeCollection) => void = (nodes) => {\n if (isArrayLike(nodes)) {\n each(Array.from(nodes), (e) => removeElements(e));\n } else if (nodes) {\n const { parentNode } = nodes;\n if (parentNode) {\n parentNode.removeChild(nodes);\n }\n }\n};\n","import { each } from 'core/utils/array';\nimport { contents } from 'core/dom/traversal';\nimport { removeElements } from 'core/dom/manipulation';\n\nexport const createDiv: () => HTMLDivElement = () => document.createElement('div');\n\nexport const createDOM: (html: string) => ReadonlyArray = (html) => {\n const createdDiv = createDiv();\n createdDiv.innerHTML = html.trim();\n\n return each(contents(createdDiv), (elm) => removeElements(elm));\n};\n","import { createDOM } from 'core/dom';\n\n/*\nexport * from 'core/compatibility';\nexport * from 'core/utils';\nexport * from 'core/dom';\nexport * from 'core/options';\nexport * from 'instances';\n*/\n\nconst abc = {\n a: 1,\n b: 1,\n c: 1,\n};\n\nexport default () => {\n const { a, b, c } = abc;\n return [\n createDOM(\n '\\\n
\\\n
\\\n
\\\n
\\\n
\\\n fdfhdfgh\\\n
\\\n
\\\n
\\\n
\\\n
\\\n
\\\n
\\\n
\\\n
\\\n
\\\n
\\\n
\\\n
\\\n
\\\n
'\n ),\n a,\n b,\n c,\n ];\n};\n"],"names":["isNumber","obj","isFunction","isArray","Array","isArrayLike","length","keys","Object","each","source","callback","i","key","contents","elm","from","childNodes","removeElements","nodes","e","parentNode","removeChild","createDiv","document","createElement","createDOM","html","createdDiv","innerHTML","trim","abc","a","b","c"],"mappings":"SAWgBA,SAASC;AACvB,SAAO,OAAOA,GAAP,KAAe,QAAtB;AACD;;SAUeC,WAAWD;AACzB,SAAO,OAAOA,GAAP,KAAe,UAAtB;AACD;;SAUeE,QAAQF;AACtB,SAAOG,KAAK,CAACD,OAAN,CAAcF,GAAd,CAAP;AACD;;SAUeI,YAAyCJ;AACvD,QAAMK,MAAM,GAAG,CAAC,CAACL,GAAF,IAASA,GAAG,CAACK,MAA5B;AACA,SAAOH,OAAO,CAACF,GAAD,CAAP,IAAiB,CAACC,UAAU,CAACD,GAAD,CAAX,IAAoBD,QAAQ,CAACM,MAAD,CAA5B,IAAwCA,MAAM,GAAG,CAAC,CAAlD,IAAuDA,MAAM,GAAG,CAAT,IAAc,CAA7F;;;ACrCK,MAAMC,IAAI,GAAiCN,GAAD,IAAeA,GAAG,GAAGO,MAAM,CAACD,IAAP,CAAYN,GAAZ,CAAH,GAAsB,EAAlF;;SCiBSQ,KACdC,QACAC;AAEA,MAAIN,WAAW,CAACK,MAAD,CAAf,EAAyB;AACvB,SAAK,IAAIE,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGF,MAAM,CAACJ,MAA3B,EAAmCM,CAAC,EAApC,EAAwC;AACtC,UAAID,QAAQ,CAACD,MAAM,CAACE,CAAD,CAAP,EAAYA,CAAZ,EAAeF,MAAf,CAAR,KAAmC,KAAvC,EAA8C;AAC5C;AACD;AACF;AACF,GAND,MAMO,IAAIA,MAAJ,EAAY;AACjBD,IAAAA,IAAI,CAACF,IAAI,CAACG,MAAD,CAAL,EAAgBG,GAAD,IAASF,QAAQ,CAACD,MAAM,CAACG,GAAD,CAAP,EAAcA,GAAd,EAAmBH,MAAnB,CAAhC,CAAJ;AACD;;AACD,SAAOA,MAAP;;;ACKK,MAAMI,QAAQ,GAAuDC,GAAD,IAAUA,GAAG,GAAGX,KAAK,CAACY,IAAN,CAAsBD,GAAG,CAACE,UAA1B,CAAH,GAA2C,EAA5H;;AC4CA,MAAMC,cAAc,GAAqCC,KAAD;AAC7D,MAAId,WAAW,CAACc,KAAD,CAAf,EAAwB;AACtBV,IAAAA,IAAI,CAACL,KAAK,CAACY,IAAN,CAAWG,KAAX,CAAD,EAAqBC,CAAD,IAAOF,cAAc,CAACE,CAAD,CAAzC,CAAJ;AACD,GAFD,MAEO,IAAID,KAAJ,EAAW;AAChB,UAAM;AAAEE,MAAAA;AAAF,QAAiBF,KAAvB;;AACA,QAAIE,UAAJ,EAAgB;AACdA,MAAAA,UAAU,CAACC,WAAX,CAAuBH,KAAvB;AACD;AACF;AACF,CATM;;ACvFA,MAAMI,SAAS,GAAyB,MAAMC,QAAQ,CAACC,aAAT,CAAuB,KAAvB,CAA9C;;AAEA,MAAMC,SAAS,GAA2CC,IAAD;AAC9D,QAAMC,UAAU,GAAGL,SAAS,EAA5B;AACAK,EAAAA,UAAU,CAACC,SAAX,GAAuBF,IAAI,CAACG,IAAL,EAAvB;AAEA,SAAOrB,IAAI,CAACK,QAAQ,CAACc,UAAD,CAAT,EAAwBb,GAAD,IAASG,cAAc,CAACH,GAAD,CAA9C,CAAX;AACD,CALM;;ACIP,MAAMgB,GAAG,GAAG;AACVC,EAAAA,CAAC,EAAE,CADO;AAEVC,EAAAA,CAAC,EAAE,CAFO;AAGVC,EAAAA,CAAC,EAAE;AAHO,CAAZ;;AAMA,YAAe;AACb,QAAM;AAAEF,IAAAA,CAAF;AAAKC,IAAAA,CAAL;AAAQC,IAAAA;AAAR,MAAcH,GAApB;AACA,SAAO,CACLL,SAAS,CACP;;;;;;;;;;;;;;;;;;;;;WADO,CADJ,EAyBLM,CAzBK,EA0BLC,CA1BK,EA2BLC,CA3BK,CAAP;AA6BD,CA/BD;;"} \ 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 4587694..332b6dc 100644 --- a/packages/overlayscrollbars/dist/overlayscrollbars.esm.min.js +++ b/packages/overlayscrollbars/dist/overlayscrollbars.esm.min.js @@ -1 +1 @@ -function r(r){const s=!!r&&r.length;return function(r){return Array.isArray(r)}(r)||!function(r){return"function"==typeof r}(r)&&function(r){return"number"==typeof r}(s)&&s>-1&&s%1==0}function s(o,c){if(r(o))for(let r=0;rc(o[r],r,o));var i;return o}const o=c=>{if(r(c))s(Array.from(c),r=>o(r));else if(c){const{parentNode:r}=c;r&&r.removeChild(c)}},c=r=>{const c=document.createElement("div");return c.innerHTML=r.trim(),s((i=c)?Array.from(i.childNodes):[],r=>o(r));var i},i={a:1,b:1,c:1};const e=1;export default()=>{const{a:r,b:s,c:o}=i;return[c('
fdfhdfgh
'),r,s,o]};export{e as a}; \ No newline at end of file +function r(r){const s=!!r&&r.length;return function(r){return Array.isArray(r)}(r)||!function(r){return"function"==typeof r}(r)&&function(r){return"number"==typeof r}(s)&&s>-1&&s%1==0}function s(o,i){if(r(o))for(let r=0;ri(o[r],r,o));var c;return o}const o=i=>{if(r(i))s(Array.from(i),r=>o(r));else if(i){const{parentNode:r}=i;r&&r.removeChild(i)}},i=r=>{const i=document.createElement("div");return i.innerHTML=r.trim(),s((c=i)?Array.from(c.childNodes):[],r=>o(r));var c},c={a:1,b:1,c:1};export default()=>{const{a:r,b:s,c:o}=c;return[i('
fdfhdfgh
'),r,s,o]}; \ No newline at end of file diff --git a/packages/overlayscrollbars/dist/overlayscrollbars.js b/packages/overlayscrollbars/dist/overlayscrollbars.js index 05cb47d..3aba4ae 100644 --- a/packages/overlayscrollbars/dist/overlayscrollbars.js +++ b/packages/overlayscrollbars/dist/overlayscrollbars.js @@ -1,5 +1,22 @@ -var OverlayScrollbars = function (exports) { - 'use strict'; +(function (global, factory) { + if (typeof define === "function" && define.amd) { + define("OverlayScrollbars", ["exports"], factory); + } else if (typeof exports !== "undefined") { + factory(exports); + } else { + var mod = { + exports: {} + }; + factory(mod.exports); + global.OverlayScrollbars = mod.exports; + } +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { + "use strict"; + + Object.defineProperty(_exports, "__esModule", { + value: true + }); + _exports.default = void 0; function isNumber(obj) { return typeof obj === 'number'; @@ -102,9 +119,7 @@ var OverlayScrollbars = function (exports) { '), a, b, c]; }; - var a = 1; - exports.a = a; - exports.default = index; - return exports; -}({}); + var _default = index; + _exports.default = _default; +}); //# sourceMappingURL=overlayscrollbars.js.map diff --git a/packages/overlayscrollbars/dist/overlayscrollbars.js.map b/packages/overlayscrollbars/dist/overlayscrollbars.js.map index 3f610aa..d61b41a 100644 --- a/packages/overlayscrollbars/dist/overlayscrollbars.js.map +++ b/packages/overlayscrollbars/dist/overlayscrollbars.js.map @@ -1 +1 @@ -{"version":3,"file":"overlayscrollbars.js","sources":["../src/core/utils/types.ts","../src/core/utils/object.ts","../src/core/utils/array.ts","../src/core/dom/traversal.ts","../src/core/dom/manipulation.ts","../src/core/dom/create.ts","../src/index.ts"],"sourcesContent":["import { PlainObject } from 'core/typings';\n\nexport const type: (obj: any) => string = (obj) => {\n if (obj === undefined) return `${obj}`;\n if (obj === null) return `${obj}`;\n return Object.prototype.toString\n .call(obj)\n .replace(/^\\[object (.+)\\]$/, '$1')\n .toLowerCase();\n};\n\nexport function isNumber(obj: any): obj is number {\n return typeof obj === 'number';\n}\n\nexport function isString(obj: any): obj is string {\n return typeof obj === 'string';\n}\n\nexport function isBoolean(obj: any): obj is boolean {\n return typeof obj === 'boolean';\n}\n\nexport function isFunction(obj: any): obj is (...args: Array) => unknown {\n return typeof obj === 'function';\n}\n\nexport function isUndefined(obj: any): obj is undefined {\n return obj === undefined;\n}\n\nexport function isNull(obj: any): obj is null {\n return obj === null;\n}\n\nexport function isArray(obj: any): obj is Array {\n return Array.isArray(obj);\n}\n\nexport function isObject(obj: any): boolean {\n return typeof obj === 'object' && !isArray(obj) && !isNull(obj);\n}\n\n/**\n * Returns true if the given object is array like, false otherwise.\n * @param obj The Object\n */\nexport function isArrayLike(obj: any): obj is ArrayLike {\n const length = !!obj && obj.length;\n return isArray(obj) || (!isFunction(obj) && isNumber(length) && length > -1 && length % 1 == 0); // eslint-disable-line eqeqeq\n}\n\n/**\n * Returns true if the given object is a \"plain\" (e.g. { key: value }) object, false otherwise.\n * @param obj The Object.\n */\nexport function isPlainObject(obj: any): obj is PlainObject {\n if (!obj || !isObject(obj) || type(obj) !== 'object') return false;\n\n let key;\n const proto = 'prototype';\n const { hasOwnProperty } = Object[proto];\n const hasOwnConstructor = hasOwnProperty.call(obj, 'constructor');\n const hasIsPrototypeOf = obj.constructor && obj.constructor[proto] && hasOwnProperty.call(obj.constructor[proto], 'isPrototypeOf');\n\n if (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) {\n return false;\n }\n\n /* eslint-disable no-restricted-syntax */\n for (key in obj) {\n /**/\n }\n /* eslint-enable */\n\n return isUndefined(key) || hasOwnProperty.call(obj, key);\n}\n\n/**\n * Checks whether the given object is a HTMLElement.\n * @param obj The object which shall be checked.\n */\nexport function isHTMLElement(obj: any): obj is HTMLElement {\n const instaceOfRightHandSide = window.HTMLElement;\n const doInstanceOf = isObject(instaceOfRightHandSide) || isFunction(instaceOfRightHandSide);\n return !!(doInstanceOf ? obj instanceof instaceOfRightHandSide : obj && isObject(obj) && obj.nodeType === 1 && isString(obj.nodeName));\n}\n\n/**\n * Returns true if the given object is empty, false otherwise.\n * @param obj The Object.\n */\nexport function isEmptyObject(obj: any): boolean {\n /* eslint-disable no-restricted-syntax, guard-for-in */\n for (const name in obj) return false;\n return true;\n /* eslint-enable */\n}\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 = (obj: any, prop: string | number | symbol) =>\r\n 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: any) => (obj ? Object.keys(obj) : []);\r\n","import { keys } from 'core/utils/object';\nimport { isArrayLike } from 'core/utils/types';\nimport { PlainObject } from 'core/typings';\n\n/**\n * Iterates through a array or object\n * @param arrayLikeOrObject The array or object through which shall be iterated.\n * @param callback The function which is responsible for the iteration.\n * If the function returns true its treated like a \"continue\" statement.\n * If the function returns false its treated like a \"break\" statement.\n */\nexport function each(\n array: Array | ReadonlyArray,\n callback: (value: T, indexOrKey: number, source: Array) => boolean | void,\n): Array | ReadonlyArray;\nexport function each(\n array: Array | ReadonlyArray | null,\n callback: (value: T, indexOrKey: number, source: Array) => boolean | void,\n): Array | ReadonlyArray | null;\nexport function each(\n arrayLikeObject: ArrayLike,\n callback: (value: T, indexOrKey: number, source: ArrayLike) => boolean | void,\n): ArrayLike;\nexport function each(\n arrayLikeObject: ArrayLike | null,\n callback: (value: T, indexOrKey: number, source: ArrayLike) => boolean | void,\n): ArrayLike | null;\nexport function each(obj: PlainObject, callback: (value: any, indexOrKey: string, source: PlainObject) => boolean | void): PlainObject;\nexport function each(obj: PlainObject | null, callback: (value: any, indexOrKey: string, source: PlainObject) => boolean | void): PlainObject | null;\nexport function each(\n source: ArrayLike | PlainObject | null,\n callback: (value: T | any, indexOrKey: any, source: any) => boolean | void,\n): Array | ReadonlyArray | ArrayLike | PlainObject | null {\n if (isArrayLike(source)) {\n for (let i = 0; i < source.length; i++) {\n if (callback(source[i], i, source) === false) {\n break;\n }\n }\n } else if (source) {\n each(keys(source), (key) => callback(source[key], key, source));\n }\n return source;\n}\n\n/**\n * Returns the index of the given inside the given array or -1 if the given item isn't part of the given array.\n * @param arr The array.\n * @param item The item.\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0.\n */\nexport const indexOf: (arr: Array, item: T, fromIndex?: number) => number = (arr, item, fromIndex) => arr.indexOf(item, fromIndex);\n","import { each } from 'core/utils/array';\n\nconst elementIsVisible: (elm: HTMLElement) => boolean = (elm) => !!(elm.offsetWidth || elm.offsetHeight || elm.getClientRects().length);\n\nexport const find: (selector: string, elm?: Element | null) => ReadonlyArray = (selector, elm?) => {\n const arr: Array = [];\n\n each((elm || document).querySelectorAll(selector), (e: Element) => {\n arr.push(e);\n });\n\n return arr;\n};\n\nexport const findFirst: (selector: string, elm?: Element | null) => Element | null = (selector, elm?) => (elm || document).querySelector(selector);\n\nexport const is: (elm: Element | null, selector: string) => boolean = (elm, selector) => {\n if (elm) {\n if (selector === ':visible') {\n return elementIsVisible(elm as HTMLElement);\n }\n if (selector === ':hidden') {\n return !elementIsVisible(elm as HTMLElement);\n }\n if (elm.matches(selector)) {\n return true;\n }\n }\n return false;\n};\n\nexport const children: (elm: Element | null, selector?: string) => ReadonlyArray = (elm, selector?) => {\n const childs: Array = [];\n\n each(elm && elm.children, (child: Element) => {\n if (selector) {\n if (child.matches(selector)) {\n childs.push(child);\n }\n } else {\n childs.push(child);\n }\n });\n\n return childs;\n};\n\nexport const contents: (elm: Element | null) => ReadonlyArray = (elm) => (elm ? Array.from(elm.childNodes) : []);\n\nexport const parent: (elm: Node | null) => Node | null = (elm) => (elm ? elm.parentElement : null);\n","import { isArrayLike } from 'core/utils/types';\nimport { each } from 'core/utils/array';\nimport { parent } from 'core/dom/traversal';\n\ntype NodeCollection = ArrayLike | Node | undefined | null;\n\n/**\n * Inserts Nodes before the given preferredAnchor element.\n * @param parentElm The parent of the preferredAnchor element or the element which shall be the parent of the inserted Nodes.\n * @param preferredAnchor The element before which the Nodes shall be inserted or null if the elements shall be appended at the end.\n * @param insertedElms The Nodes which shall be inserted.\n */\nconst before: (parentElm: Node | null, preferredAnchor: Node | null, insertedElms: NodeCollection) => void = (\n parentElm,\n preferredAnchor,\n insertedElms,\n) => {\n if (insertedElms) {\n let anchor: Node | null = preferredAnchor;\n let fragment: DocumentFragment | Node | undefined | null;\n\n // parent must be defined\n if (parentElm) {\n if (isArrayLike(insertedElms)) {\n fragment = document.createDocumentFragment();\n\n // append all insertedElms to the fragment and if one of these is the anchor, change the anchor\n each(insertedElms, (insertedElm) => {\n if (insertedElm === anchor) {\n anchor = insertedElm.previousSibling;\n }\n fragment!.appendChild(insertedElm);\n });\n } else {\n fragment = insertedElms;\n }\n\n // if the preferred anchor isn't null set it to a valid anchor\n if (preferredAnchor) {\n if (!anchor) {\n anchor = parentElm.firstChild;\n } else if (anchor !== preferredAnchor) {\n anchor = anchor.nextSibling;\n }\n }\n\n parentElm.insertBefore(fragment, anchor);\n }\n }\n};\n\n/**\n * Appends the given children at the end of the given Node.\n * @param node The Node to which the children shall be appended.\n * @param children The Nodes which shall be appended.\n */\nexport const appendChildren: (node: Node | null, children: NodeCollection) => void = (node, children) => {\n before(node, null, children);\n};\n\n/**\n * Prepends the given children at the start of the given Node.\n * @param node The Node to which the children shall be prepended.\n * @param children The Nodes which shall be prepended.\n */\nexport const prependChildren: (node: Node | null, children: NodeCollection) => void = (node, children) => {\n before(node, node && node.firstChild, children);\n};\n\n/**\n * Inserts the given Nodes before the given Node.\n * @param node The Node before which the given Nodes shall be inserted.\n * @param insertedNodes The Nodes which shall be inserted.\n */\nexport const insertBefore: (node: Node | null, insertedNodes: NodeCollection) => void = (node, insertedNodes) => {\n before(parent(node), node, insertedNodes);\n};\n\n/**\n * Inserts the given Nodes after the given Node.\n * @param node The Node after which the given Nodes shall be inserted.\n * @param insertedNodes The Nodes which shall be inserted.\n */\nexport const insertAfter: (node: Node | null, insertedNodes: NodeCollection) => void = (node, insertedNodes) => {\n before(parent(node), node && node.nextSibling, insertedNodes);\n};\n\n/**\n * Removes the given Nodes from their parent.\n * @param nodes The Nodes which shall be removed.\n */\nexport const removeElements: (nodes: NodeCollection) => void = (nodes) => {\n if (isArrayLike(nodes)) {\n each(Array.from(nodes), (e) => removeElements(e));\n } else if (nodes) {\n const { parentNode } = nodes;\n if (parentNode) {\n parentNode.removeChild(nodes);\n }\n }\n};\n","import { each } from 'core/utils/array';\nimport { contents } from 'core/dom/traversal';\nimport { removeElements } from 'core/dom/manipulation';\n\nexport const createDiv: () => HTMLDivElement = () => document.createElement('div');\n\nexport const createDOM: (html: string) => ReadonlyArray = (html) => {\n const createdDiv = createDiv();\n createdDiv.innerHTML = html.trim();\n\n return each(contents(createdDiv), (elm) => removeElements(elm));\n};\n","import { createDOM } from 'core/dom';\n\n/*\nexport * from 'core/compatibility';\nexport * from 'core/utils';\nexport * from 'core/dom';\nexport * from 'core/options';\nexport * from 'instances';\n*/\n\nconst abc = {\n a: 1,\n b: 1,\n c: 1,\n};\n\nexport default () => {\n const { a, b, c } = abc;\n return [\n createDOM(\n '\\\n
\\\n
\\\n
\\\n
\\\n
\\\n fdfhdfgh\\\n
\\\n
\\\n
\\\n
\\\n
\\\n
\\\n
\\\n
\\\n
\\\n
\\\n
\\\n
\\\n
\\\n
\\\n
',\n ),\n a,\n b,\n c,\n ];\n};\n\nexport const a = 1;\n"],"names":["isNumber","obj","isFunction","isArray","Array","isArrayLike","length","keys","Object","each","source","callback","i","key","contents","elm","from","childNodes","removeElements","nodes","e","parentNode","removeChild","createDiv","document","createElement","createDOM","html","createdDiv","innerHTML","trim","abc","a","b","c"],"mappings":";;;WAWgBA,SAASC;AACvB,WAAO,OAAOA,GAAP,KAAe,QAAtB;AACD;;WAUeC,WAAWD;AACzB,WAAO,OAAOA,GAAP,KAAe,UAAtB;AACD;;WAUeE,QAAQF;AACtB,WAAOG,KAAK,CAACD,OAAN,CAAcF,GAAd,CAAP;AACD;;WAUeI,YAAyCJ;AACvD,QAAMK,MAAM,GAAG,CAAC,CAACL,GAAF,IAASA,GAAG,CAACK,MAA5B;AACA,WAAOH,OAAO,CAACF,GAAD,CAAP,IAAiB,CAACC,UAAU,CAACD,GAAD,CAAX,IAAoBD,QAAQ,CAACM,MAAD,CAA5B,IAAwCA,MAAM,GAAG,CAAC,CAAlD,IAAuDA,MAAM,GAAG,CAAT,IAAc,CAA7F;;;ACrCK,MAAMC,IAAI,GAAgC,SAApCA,IAAoC,CAACN,GAAD;AAAA,WAAeA,GAAG,GAAGO,MAAM,CAACD,IAAP,CAAYN,GAAZ,CAAH,GAAsB,EAAxC;AAAA,GAA1C;;WCiBSQ,KACdC,QACAC;AAEA,QAAIN,WAAW,CAACK,MAAD,CAAf,EAAyB;AACvB,WAAK,IAAIE,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGF,MAAM,CAACJ,MAA3B,EAAmCM,CAAC,EAApC,EAAwC;AACtC,YAAID,QAAQ,CAACD,MAAM,CAACE,CAAD,CAAP,EAAYA,CAAZ,EAAeF,MAAf,CAAR,KAAmC,KAAvC,EAA8C;AAC5C;AACD;AACF;AACF,KAND,MAMO,IAAIA,MAAJ,EAAY;AACjBD,MAAAA,IAAI,CAACF,IAAI,CAACG,MAAD,CAAL,EAAe,UAACG,GAAD;AAAA,eAASF,QAAQ,CAACD,MAAM,CAACG,GAAD,CAAP,EAAcA,GAAd,EAAmBH,MAAnB,CAAjB;AAAA,OAAf,CAAJ;AACD;;AACD,WAAOA,MAAP;;;ACKK,MAAMI,QAAQ,GAAsD,SAA9DA,QAA8D,CAACC,GAAD;AAAA,WAAUA,GAAG,GAAGX,KAAK,CAACY,IAAN,CAAsBD,GAAG,CAACE,UAA1B,CAAH,GAA2C,EAAxD;AAAA,GAApE;;AC4CA,MAAMC,cAAc,GAAoC,SAAlDA,cAAkD,CAACC,KAAD;AAC7D,QAAId,WAAW,CAACc,KAAD,CAAf,EAAwB;AACtBV,MAAAA,IAAI,CAACL,KAAK,CAACY,IAAN,CAAWG,KAAX,CAAD,EAAoB,UAACC,CAAD;AAAA,eAAOF,cAAc,CAACE,CAAD,CAArB;AAAA,OAApB,CAAJ;AACD,KAFD,MAEO,IAAID,KAAJ,EAAW;AAAA,UACRE,UADQ,GACOF,KADP,CACRE,UADQ;;AAEhB,UAAIA,UAAJ,EAAgB;AACdA,QAAAA,UAAU,CAACC,WAAX,CAAuBH,KAAvB;AACD;AACF;AACF,GATM;;ACvFA,MAAMI,SAAS,GAAyB,SAAlCA,SAAkC;AAAA,WAAMC,QAAQ,CAACC,aAAT,CAAuB,KAAvB,CAAN;AAAA,GAAxC;;AAEA,MAAMC,SAAS,GAA0C,SAAnDA,SAAmD,CAACC,IAAD;AAC9D,QAAMC,UAAU,GAAGL,SAAS,EAA5B;AACAK,IAAAA,UAAU,CAACC,SAAX,GAAuBF,IAAI,CAACG,IAAL,EAAvB;AAEA,WAAOrB,IAAI,CAACK,QAAQ,CAACc,UAAD,CAAT,EAAuB,UAACb,GAAD;AAAA,aAASG,cAAc,CAACH,GAAD,CAAvB;AAAA,KAAvB,CAAX;AACD,GALM;;ACIP,MAAMgB,GAAG,GAAG;AACVC,IAAAA,CAAC,EAAE,CADO;AAEVC,IAAAA,CAAC,EAAE,CAFO;AAGVC,IAAAA,CAAC,EAAE;AAHO,GAAZ;;cAMe,cAAA;QACLF,IAAYD,IAAZC;QAAGC,IAASF,IAATE;QAAGC,IAAMH,IAANG;AACd,WAAO,CACLR,SAAS,CACP;;;;;;;;;;;;;;;;;;;;;WADO,CADJ,EAyBLM,CAzBK,EA0BLC,CA1BK,EA2BLC,CA3BK,CAAP;AA6BD;;MAEYF,CAAC,GAAG;;;;"} \ No newline at end of file +{"version":3,"file":"overlayscrollbars.js","sources":["../src/core/utils/types.ts","../src/core/utils/object.ts","../src/core/utils/array.ts","../src/core/dom/traversal.ts","../src/core/dom/manipulation.ts","../src/core/dom/create.ts","../src/index.ts"],"sourcesContent":["import { PlainObject } from 'core/typings';\n\nexport const type: (obj: any) => string = (obj) => {\n if (obj === undefined) return `${obj}`;\n if (obj === null) return `${obj}`;\n return Object.prototype.toString\n .call(obj)\n .replace(/^\\[object (.+)\\]$/, '$1')\n .toLowerCase();\n};\n\nexport function isNumber(obj: any): obj is number {\n return typeof obj === 'number';\n}\n\nexport function isString(obj: any): obj is string {\n return typeof obj === 'string';\n}\n\nexport function isBoolean(obj: any): obj is boolean {\n return typeof obj === 'boolean';\n}\n\nexport function isFunction(obj: any): obj is (...args: Array) => unknown {\n return typeof obj === 'function';\n}\n\nexport function isUndefined(obj: any): obj is undefined {\n return obj === undefined;\n}\n\nexport function isNull(obj: any): obj is null {\n return obj === null;\n}\n\nexport function isArray(obj: any): obj is Array {\n return Array.isArray(obj);\n}\n\nexport function isObject(obj: any): boolean {\n return typeof obj === 'object' && !isArray(obj) && !isNull(obj);\n}\n\n/**\n * Returns true if the given object is array like, false otherwise.\n * @param obj The Object\n */\nexport function isArrayLike(obj: any): obj is ArrayLike {\n const length = !!obj && obj.length;\n return isArray(obj) || (!isFunction(obj) && isNumber(length) && length > -1 && length % 1 == 0); // eslint-disable-line eqeqeq\n}\n\n/**\n * Returns true if the given object is a \"plain\" (e.g. { key: value }) object, false otherwise.\n * @param obj The Object.\n */\nexport function isPlainObject(obj: any): obj is PlainObject {\n if (!obj || !isObject(obj) || type(obj) !== 'object') return false;\n\n let key;\n const proto = 'prototype';\n const { hasOwnProperty } = Object[proto];\n const hasOwnConstructor = hasOwnProperty.call(obj, 'constructor');\n const hasIsPrototypeOf = obj.constructor && obj.constructor[proto] && hasOwnProperty.call(obj.constructor[proto], 'isPrototypeOf');\n\n if (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) {\n return false;\n }\n\n /* eslint-disable no-restricted-syntax */\n for (key in obj) {\n /**/\n }\n /* eslint-enable */\n\n return isUndefined(key) || hasOwnProperty.call(obj, key);\n}\n\n/**\n * Checks whether the given object is a HTMLElement.\n * @param obj The object which shall be checked.\n */\nexport function isHTMLElement(obj: any): obj is HTMLElement {\n const instaceOfRightHandSide = window.HTMLElement;\n const doInstanceOf = isObject(instaceOfRightHandSide) || isFunction(instaceOfRightHandSide);\n return !!(doInstanceOf ? obj instanceof instaceOfRightHandSide : obj && isObject(obj) && obj.nodeType === 1 && isString(obj.nodeName));\n}\n\n/**\n * Returns true if the given object is empty, false otherwise.\n * @param obj The Object.\n */\nexport function isEmptyObject(obj: any): boolean {\n /* eslint-disable no-restricted-syntax, guard-for-in */\n for (const name in obj) return false;\n return true;\n /* eslint-enable */\n}\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 = (obj: any, prop: string | number | symbol) =>\r\n 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: any) => (obj ? Object.keys(obj) : []);\r\n","import { keys } from 'core/utils/object';\nimport { isArrayLike } from 'core/utils/types';\nimport { PlainObject } from 'core/typings';\n\n/**\n * Iterates through a array or object\n * @param arrayLikeOrObject The array or object through which shall be iterated.\n * @param callback The function which is responsible for the iteration.\n * If the function returns true its treated like a \"continue\" statement.\n * If the function returns false its treated like a \"break\" statement.\n */\nexport function each(\n array: Array | ReadonlyArray,\n callback: (value: T, indexOrKey: number, source: Array) => boolean | void,\n): Array | ReadonlyArray;\nexport function each(\n array: Array | ReadonlyArray | null,\n callback: (value: T, indexOrKey: number, source: Array) => boolean | void,\n): Array | ReadonlyArray | null;\nexport function each(\n arrayLikeObject: ArrayLike,\n callback: (value: T, indexOrKey: number, source: ArrayLike) => boolean | void,\n): ArrayLike;\nexport function each(\n arrayLikeObject: ArrayLike | null,\n callback: (value: T, indexOrKey: number, source: ArrayLike) => boolean | void,\n): ArrayLike | null;\nexport function each(obj: PlainObject, callback: (value: any, indexOrKey: string, source: PlainObject) => boolean | void): PlainObject;\nexport function each(obj: PlainObject | null, callback: (value: any, indexOrKey: string, source: PlainObject) => boolean | void): PlainObject | null;\nexport function each(\n source: ArrayLike | PlainObject | null,\n callback: (value: T | any, indexOrKey: any, source: any) => boolean | void,\n): Array | ReadonlyArray | ArrayLike | PlainObject | null {\n if (isArrayLike(source)) {\n for (let i = 0; i < source.length; i++) {\n if (callback(source[i], i, source) === false) {\n break;\n }\n }\n } else if (source) {\n each(keys(source), (key) => callback(source[key], key, source));\n }\n return source;\n}\n\n/**\n * Returns the index of the given inside the given array or -1 if the given item isn't part of the given array.\n * @param arr The array.\n * @param item The item.\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0.\n */\nexport const indexOf: (arr: Array, item: T, fromIndex?: number) => number = (arr, item, fromIndex) => arr.indexOf(item, fromIndex);\n","import { each } from 'core/utils/array';\n\nconst elementIsVisible: (elm: HTMLElement) => boolean = (elm) => !!(elm.offsetWidth || elm.offsetHeight || elm.getClientRects().length);\n\nexport const find: (selector: string, elm?: Element | null) => ReadonlyArray = (selector, elm?) => {\n const arr: Array = [];\n\n each((elm || document).querySelectorAll(selector), (e: Element) => {\n arr.push(e);\n });\n\n return arr;\n};\n\nexport const findFirst: (selector: string, elm?: Element | null) => Element | null = (selector, elm?) => (elm || document).querySelector(selector);\n\nexport const is: (elm: Element | null, selector: string) => boolean = (elm, selector) => {\n if (elm) {\n if (selector === ':visible') {\n return elementIsVisible(elm as HTMLElement);\n }\n if (selector === ':hidden') {\n return !elementIsVisible(elm as HTMLElement);\n }\n if (elm.matches(selector)) {\n return true;\n }\n }\n return false;\n};\n\nexport const children: (elm: Element | null, selector?: string) => ReadonlyArray = (elm, selector?) => {\n const childs: Array = [];\n\n each(elm && elm.children, (child: Element) => {\n if (selector) {\n if (child.matches(selector)) {\n childs.push(child);\n }\n } else {\n childs.push(child);\n }\n });\n\n return childs;\n};\n\nexport const contents: (elm: Element | null) => ReadonlyArray = (elm) => (elm ? Array.from(elm.childNodes) : []);\n\nexport const parent: (elm: Node | null) => Node | null = (elm) => (elm ? elm.parentElement : null);\n","import { isArrayLike } from 'core/utils/types';\nimport { each } from 'core/utils/array';\nimport { parent } from 'core/dom/traversal';\n\ntype NodeCollection = ArrayLike | Node | undefined | null;\n\n/**\n * Inserts Nodes before the given preferredAnchor element.\n * @param parentElm The parent of the preferredAnchor element or the element which shall be the parent of the inserted Nodes.\n * @param preferredAnchor The element before which the Nodes shall be inserted or null if the elements shall be appended at the end.\n * @param insertedElms The Nodes which shall be inserted.\n */\nconst before: (parentElm: Node | null, preferredAnchor: Node | null, insertedElms: NodeCollection) => void = (\n parentElm,\n preferredAnchor,\n insertedElms,\n) => {\n if (insertedElms) {\n let anchor: Node | null = preferredAnchor;\n let fragment: DocumentFragment | Node | undefined | null;\n\n // parent must be defined\n if (parentElm) {\n if (isArrayLike(insertedElms)) {\n fragment = document.createDocumentFragment();\n\n // append all insertedElms to the fragment and if one of these is the anchor, change the anchor\n each(insertedElms, (insertedElm) => {\n if (insertedElm === anchor) {\n anchor = insertedElm.previousSibling;\n }\n fragment!.appendChild(insertedElm);\n });\n } else {\n fragment = insertedElms;\n }\n\n // if the preferred anchor isn't null set it to a valid anchor\n if (preferredAnchor) {\n if (!anchor) {\n anchor = parentElm.firstChild;\n } else if (anchor !== preferredAnchor) {\n anchor = anchor.nextSibling;\n }\n }\n\n parentElm.insertBefore(fragment, anchor);\n }\n }\n};\n\n/**\n * Appends the given children at the end of the given Node.\n * @param node The Node to which the children shall be appended.\n * @param children The Nodes which shall be appended.\n */\nexport const appendChildren: (node: Node | null, children: NodeCollection) => void = (node, children) => {\n before(node, null, children);\n};\n\n/**\n * Prepends the given children at the start of the given Node.\n * @param node The Node to which the children shall be prepended.\n * @param children The Nodes which shall be prepended.\n */\nexport const prependChildren: (node: Node | null, children: NodeCollection) => void = (node, children) => {\n before(node, node && node.firstChild, children);\n};\n\n/**\n * Inserts the given Nodes before the given Node.\n * @param node The Node before which the given Nodes shall be inserted.\n * @param insertedNodes The Nodes which shall be inserted.\n */\nexport const insertBefore: (node: Node | null, insertedNodes: NodeCollection) => void = (node, insertedNodes) => {\n before(parent(node), node, insertedNodes);\n};\n\n/**\n * Inserts the given Nodes after the given Node.\n * @param node The Node after which the given Nodes shall be inserted.\n * @param insertedNodes The Nodes which shall be inserted.\n */\nexport const insertAfter: (node: Node | null, insertedNodes: NodeCollection) => void = (node, insertedNodes) => {\n before(parent(node), node && node.nextSibling, insertedNodes);\n};\n\n/**\n * Removes the given Nodes from their parent.\n * @param nodes The Nodes which shall be removed.\n */\nexport const removeElements: (nodes: NodeCollection) => void = (nodes) => {\n if (isArrayLike(nodes)) {\n each(Array.from(nodes), (e) => removeElements(e));\n } else if (nodes) {\n const { parentNode } = nodes;\n if (parentNode) {\n parentNode.removeChild(nodes);\n }\n }\n};\n","import { each } from 'core/utils/array';\nimport { contents } from 'core/dom/traversal';\nimport { removeElements } from 'core/dom/manipulation';\n\nexport const createDiv: () => HTMLDivElement = () => document.createElement('div');\n\nexport const createDOM: (html: string) => ReadonlyArray = (html) => {\n const createdDiv = createDiv();\n createdDiv.innerHTML = html.trim();\n\n return each(contents(createdDiv), (elm) => removeElements(elm));\n};\n","import { createDOM } from 'core/dom';\n\n/*\nexport * from 'core/compatibility';\nexport * from 'core/utils';\nexport * from 'core/dom';\nexport * from 'core/options';\nexport * from 'instances';\n*/\n\nconst abc = {\n a: 1,\n b: 1,\n c: 1,\n};\n\nexport default () => {\n const { a, b, c } = abc;\n return [\n createDOM(\n '\\\n
\\\n
\\\n
\\\n
\\\n
\\\n fdfhdfgh\\\n
\\\n
\\\n
\\\n
\\\n
\\\n
\\\n
\\\n
\\\n
\\\n
\\\n
\\\n
\\\n
\\\n
\\\n
'\n ),\n a,\n b,\n c,\n ];\n};\n"],"names":["isNumber","obj","isFunction","isArray","Array","isArrayLike","length","keys","Object","each","source","callback","i","key","contents","elm","from","childNodes","removeElements","nodes","e","parentNode","removeChild","createDiv","document","createElement","createDOM","html","createdDiv","innerHTML","trim","abc","a","b","c"],"mappings":"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"} \ No newline at end of file diff --git a/packages/overlayscrollbars/dist/overlayscrollbars.min.js b/packages/overlayscrollbars/dist/overlayscrollbars.min.js index d1a235d..7363e02 100644 --- a/packages/overlayscrollbars/dist/overlayscrollbars.min.js +++ b/packages/overlayscrollbars/dist/overlayscrollbars.min.js @@ -1 +1 @@ -var OverlayScrollbars=function(r){"use strict";function s(r){var s=!!r&&r.length;return function(r){return Array.isArray(r)}(r)||!function(r){return"function"==typeof r}(r)&&function(r){return"number"==typeof r}(s)&&s>-1&&s%1==0}function o(r,i){if(s(r))for(var n=0;n
fdfhdfgh
'),r,s,o]},r}({}); \ No newline at end of file +!function(r,e){if("function"==typeof define&&define.amd)define("OverlayScrollbars",["exports"],e);else if("undefined"!=typeof exports)e(exports);else{var o={exports:{}};e(o.exports),r.OverlayScrollbars=o.exports}}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:this,(function(r){function e(r){var e=!!r&&r.length;return function(r){return Array.isArray(r)}(r)||!function(r){return"function"==typeof r}(r)&&function(r){return"number"==typeof r}(e)&&e>-1&&e%1==0}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;function o(r,s){if(e(r))for(var i=0;i
fdfhdfgh
'),r,e,o]};r.default=t})); \ No newline at end of file diff --git a/packages/overlayscrollbars/src/core/compatibility/events.ts b/packages/overlayscrollbars/src/core/compatibility/events.ts index e5dbc20..2a5250b 100644 --- a/packages/overlayscrollbars/src/core/compatibility/events.ts +++ b/packages/overlayscrollbars/src/core/compatibility/events.ts @@ -1,4 +1,4 @@ -export const mouseButton: (event: MouseEvent) => number = (event) => { +export const mouseButton = (event: MouseEvent): number => { const { button } = event; if (!event.which && button !== undefined) { return button & 1 ? 1 : button & 2 ? 3 : button & 4 ? 2 : 0; // eslint-disable-line no-bitwise diff --git a/packages/overlayscrollbars/src/core/compatibility/vendors.ts b/packages/overlayscrollbars/src/core/compatibility/vendors.ts index 33cfde4..aa6d729 100644 --- a/packages/overlayscrollbars/src/core/compatibility/vendors.ts +++ b/packages/overlayscrollbars/src/core/compatibility/vendors.ts @@ -1,8 +1,8 @@ import { each, hasOwnProperty } from 'core/utils'; import { createDiv } from 'core/dom'; -const firstLetterToUpper: (str: string) => string = (str) => str.charAt(0).toUpperCase() + str.slice(1); -const getDummyStyle: () => CSSStyleDeclaration = () => createDiv().style; +const firstLetterToUpper = (str: string): string => str.charAt(0).toUpperCase() + str.slice(1); +const getDummyStyle = (): CSSStyleDeclaration => createDiv().style; // https://developer.mozilla.org/en-US/docs/Glossary/Vendor_Prefix @@ -16,7 +16,7 @@ export const cssCache: { [key: string]: string } = {}; * Gets the name of the given CSS property with vendor prefix if it isn't supported without, or undefined if unsupported. * @param name The name of the CSS property which shall be get. */ -export const cssProperty: (name: string) => string | undefined = (name) => { +export const cssProperty = (name: string): string | undefined => { let result: string | undefined = cssCache[name]; if (hasOwnProperty(cssCache, name)) { @@ -48,7 +48,7 @@ export const cssProperty: (name: string) => string | undefined = (name) => { * @param values The value(s) separated by spaces which shall be get. * @param suffix A suffix which is added to each value in case the value is a function or something else more advanced. */ -export const cssPropertyValue: (property: string, values: string, suffix?: string) => string | undefined = (property, values, suffix) => { +export const cssPropertyValue = (property: string, values: string, suffix?: string): string | undefined => { const name = `${property} ${values}`; let result: string | undefined = cssCache[name]; @@ -81,7 +81,7 @@ export const cssPropertyValue: (property: string, values: string, suffix?: strin * Get the requested JS function, object or constructor with vendor prefix if it isn't supported without or undefined if unsupported. * @param name The name of the JS function, object or constructor. */ -export const jsAPI: (name: string) => any = (name) => { +export const jsAPI = (name: string): any => { let result: any = jsCache[name] || window[name]; if (hasOwnProperty(jsCache, name)) { diff --git a/packages/overlayscrollbars/src/core/dom/attribute.ts b/packages/overlayscrollbars/src/core/dom/attribute.ts index 47f3f72..036a409 100644 --- a/packages/overlayscrollbars/src/core/dom/attribute.ts +++ b/packages/overlayscrollbars/src/core/dom/attribute.ts @@ -5,7 +5,7 @@ * @param attrName The attribute name which shall be get or set. * @param value The value of the attribute which shall be set. */ -export const attr: (elm: Element, attrName: string, value?: string) => string | null | void = (elm, attrName, value) => { +export const attr = (elm: Element, attrName: string, value?: string): string | null | void => { if (value === undefined) { return elm.getAttribute(attrName); } @@ -17,7 +17,7 @@ export const attr: (elm: Element, attrName: string, value?: string) => string | * @param elm The element of which the attribute shall be removed. * @param attrName The attribute name. */ -export const removeAttr: (elm: Element, attrName: string) => void = (elm, attrName) => { +export const removeAttr = (elm: Element, attrName: string): void => { elm.removeAttribute(attrName); }; @@ -26,7 +26,7 @@ export const removeAttr: (elm: Element, attrName: string) => void = (elm, attrNa * @param elm The element of which the scrollLeft value shall be get or set. * @param value The scrollLeft value which shall be set. */ -export const scrollLeft: (elm: HTMLElement, value?: number) => number | void = (elm, value) => { +export const scrollLeft = (elm: HTMLElement, value?: number): number | void => { if (value === undefined) { return elm.scrollLeft; } @@ -38,7 +38,7 @@ export const scrollLeft: (elm: HTMLElement, value?: number) => number | void = ( * @param elm The element of which the scrollTop value shall be get or set. * @param value The scrollTop value which shall be set. */ -export const scrollTop: (elm: HTMLElement, value?: number) => number | void = (elm, value) => { +export const scrollTop = (elm: HTMLElement, value?: number): number | void => { if (value === undefined) { return elm.scrollTop; } @@ -50,7 +50,7 @@ export const scrollTop: (elm: HTMLElement, value?: number) => number | void = (e * @param elm The input element of which the value shall be get or set. * @param value The value which shall be set. */ -export const val: (elm: HTMLInputElement, value?: string) => string | void = (elm, value) => { +export const val = (elm: HTMLInputElement, value?: string): string | void => { if (value === undefined) { return elm.value; } diff --git a/packages/overlayscrollbars/src/core/dom/class.ts b/packages/overlayscrollbars/src/core/dom/class.ts index d41524e..c00cd62 100644 --- a/packages/overlayscrollbars/src/core/dom/class.ts +++ b/packages/overlayscrollbars/src/core/dom/class.ts @@ -7,14 +7,14 @@ const rnothtmlwhite = /[^\x20\t\r\n\f]+/g; * @param elm The element. * @param className The class name. */ -export const hasClass: (elm: Element, className: string) => boolean = (elm, className) => elm.classList.contains(className); +export const hasClass = (elm: Element, className: string): boolean => elm.classList.contains(className); /** * Adds the given class name(s) to the given element. * @param elm The element. * @param className The class name(s) which shall be added. (separated by spaces) */ -export const addClass: (elm: Element, className: string) => void = (elm, className) => { +export const addClass = (elm: Element, className: string): void => { let clazz: string; let i = 0; @@ -31,7 +31,7 @@ export const addClass: (elm: Element, className: string) => void = (elm, classNa * @param elm The element. * @param className The class name(s) which shall be removed. (separated by spaces) */ -export const removeClass: (elm: Element, className: string) => void = (elm, className) => { +export const removeClass = (elm: Element, className: string): void => { let clazz: string; let i = 0; @@ -49,7 +49,7 @@ export const removeClass: (elm: Element, className: string) => void = (elm, clas * @param elm The element. * @param className The class name(s) which shall be added or removed. (separated by spaces) */ -export const conditionalClass: (elm: Element, className: string, condition: boolean) => void = (elm, className, condition) => { +export const conditionalClass = (elm: Element, className: string, condition: boolean): void => { if (condition) { addClass(elm, className); } else { diff --git a/packages/overlayscrollbars/src/core/dom/create.ts b/packages/overlayscrollbars/src/core/dom/create.ts index abb82ab..e15e617 100644 --- a/packages/overlayscrollbars/src/core/dom/create.ts +++ b/packages/overlayscrollbars/src/core/dom/create.ts @@ -2,9 +2,9 @@ import { each } from 'core/utils/array'; import { contents } from 'core/dom/traversal'; import { removeElements } from 'core/dom/manipulation'; -export const createDiv: () => HTMLDivElement = () => document.createElement('div'); +export const createDiv = (): HTMLDivElement => document.createElement('div'); -export const createDOM: (html: string) => ReadonlyArray = (html) => { +export const createDOM = (html: string): ReadonlyArray => { const createdDiv = createDiv(); createdDiv.innerHTML = html.trim(); diff --git a/packages/overlayscrollbars/src/core/dom/manipulation.ts b/packages/overlayscrollbars/src/core/dom/manipulation.ts index 37ab452..c396860 100644 --- a/packages/overlayscrollbars/src/core/dom/manipulation.ts +++ b/packages/overlayscrollbars/src/core/dom/manipulation.ts @@ -10,11 +10,7 @@ type NodeCollection = ArrayLike | Node | undefined | null; * @param preferredAnchor The element before which the Nodes shall be inserted or null if the elements shall be appended at the end. * @param insertedElms The Nodes which shall be inserted. */ -const before: (parentElm: Node | null, preferredAnchor: Node | null, insertedElms: NodeCollection) => void = ( - parentElm, - preferredAnchor, - insertedElms, -) => { +const before = (parentElm: Node | null, preferredAnchor: Node | null, insertedElms: NodeCollection): void => { if (insertedElms) { let anchor: Node | null = preferredAnchor; let fragment: DocumentFragment | Node | undefined | null; @@ -54,7 +50,7 @@ const before: (parentElm: Node | null, preferredAnchor: Node | null, insertedElm * @param node The Node to which the children shall be appended. * @param children The Nodes which shall be appended. */ -export const appendChildren: (node: Node | null, children: NodeCollection) => void = (node, children) => { +export const appendChildren = (node: Node | null, children: NodeCollection): void => { before(node, null, children); }; @@ -63,7 +59,7 @@ export const appendChildren: (node: Node | null, children: NodeCollection) => vo * @param node The Node to which the children shall be prepended. * @param children The Nodes which shall be prepended. */ -export const prependChildren: (node: Node | null, children: NodeCollection) => void = (node, children) => { +export const prependChildren = (node: Node | null, children: NodeCollection): void => { before(node, node && node.firstChild, children); }; @@ -72,7 +68,7 @@ export const prependChildren: (node: Node | null, children: NodeCollection) => v * @param node The Node before which the given Nodes shall be inserted. * @param insertedNodes The Nodes which shall be inserted. */ -export const insertBefore: (node: Node | null, insertedNodes: NodeCollection) => void = (node, insertedNodes) => { +export const insertBefore = (node: Node | null, insertedNodes: NodeCollection): void => { before(parent(node), node, insertedNodes); }; @@ -81,7 +77,7 @@ export const insertBefore: (node: Node | null, insertedNodes: NodeCollection) => * @param node The Node after which the given Nodes shall be inserted. * @param insertedNodes The Nodes which shall be inserted. */ -export const insertAfter: (node: Node | null, insertedNodes: NodeCollection) => void = (node, insertedNodes) => { +export const insertAfter = (node: Node | null, insertedNodes: NodeCollection): void => { before(parent(node), node && node.nextSibling, insertedNodes); }; @@ -89,7 +85,7 @@ export const insertAfter: (node: Node | null, insertedNodes: NodeCollection) => * Removes the given Nodes from their parent. * @param nodes The Nodes which shall be removed. */ -export const removeElements: (nodes: NodeCollection) => void = (nodes) => { +export const removeElements = (nodes: NodeCollection): void => { if (isArrayLike(nodes)) { each(Array.from(nodes), (e) => removeElements(e)); } else if (nodes) { diff --git a/packages/overlayscrollbars/src/core/dom/style.ts b/packages/overlayscrollbars/src/core/dom/style.ts index 1de467b..1588bbb 100644 --- a/packages/overlayscrollbars/src/core/dom/style.ts +++ b/packages/overlayscrollbars/src/core/dom/style.ts @@ -19,10 +19,10 @@ const cssNumber = { zoom: true, }; -const parseCSSVal: (prop: string, val: string | number) => string | number = (prop, val) => +const parseCSSVal = (prop: string, val: string | number): string | number => !cssNumber[prop.toLowerCase()] && isNumber(val) ? `${val}px` : val; -const setCSSVal: (elm: HTMLElement, prop: string, val: string | number) => void = (elm, prop, val) => { +const setCSSVal = (elm: HTMLElement, prop: string, val: string | number): void => { try { if (elm.style[prop] !== undefined) { elm.style[prop] = parseCSSVal(prop, val); @@ -48,10 +48,10 @@ export function style(elm: HTMLElement, styles: string | cssStyleObj, val?: stri } } -export const hide: (elm: HTMLElement) => void = (elm) => { +export const hide = (elm: HTMLElement): void => { elm.style.display = 'none'; }; -export const show: (elm: HTMLElement) => void = (elm) => { +export const show = (elm: HTMLElement): void => { elm.style.display = 'block'; }; diff --git a/packages/overlayscrollbars/src/core/dom/traversal.ts b/packages/overlayscrollbars/src/core/dom/traversal.ts index 81c10a9..7c82178 100644 --- a/packages/overlayscrollbars/src/core/dom/traversal.ts +++ b/packages/overlayscrollbars/src/core/dom/traversal.ts @@ -1,8 +1,8 @@ import { each } from 'core/utils/array'; -const elementIsVisible: (elm: HTMLElement) => boolean = (elm) => !!(elm.offsetWidth || elm.offsetHeight || elm.getClientRects().length); +const elementIsVisible = (elm: HTMLElement): boolean => !!(elm.offsetWidth || elm.offsetHeight || elm.getClientRects().length); -export const find: (selector: string, elm?: Element | null) => ReadonlyArray = (selector, elm?) => { +export const find = (selector: string, elm?: Element | null): ReadonlyArray => { const arr: Array = []; each((elm || document).querySelectorAll(selector), (e: Element) => { @@ -12,9 +12,9 @@ export const find: (selector: string, elm?: Element | null) => ReadonlyArray Element | null = (selector, elm?) => (elm || document).querySelector(selector); +export const findFirst = (selector: string, elm?: Element | null): Element | null => (elm || document).querySelector(selector); -export const is: (elm: Element | null, selector: string) => boolean = (elm, selector) => { +export const is = (elm: Element | null, selector: string): boolean => { if (elm) { if (selector === ':visible') { return elementIsVisible(elm as HTMLElement); @@ -29,7 +29,7 @@ export const is: (elm: Element | null, selector: string) => boolean = (elm, sele return false; }; -export const children: (elm: Element | null, selector?: string) => ReadonlyArray = (elm, selector?) => { +export const children = (elm: Element | null, selector?: string): ReadonlyArray => { const childs: Array = []; each(elm && elm.children, (child: Element) => { @@ -45,6 +45,6 @@ export const children: (elm: Element | null, selector?: string) => ReadonlyArray return childs; }; -export const contents: (elm: Element | null) => ReadonlyArray = (elm) => (elm ? Array.from(elm.childNodes) : []); +export const contents = (elm: Element | null): ReadonlyArray => (elm ? Array.from(elm.childNodes) : []); -export const parent: (elm: Node | null) => Node | null = (elm) => (elm ? elm.parentElement : null); +export const parent = (elm: Node | null): Node | null => (elm ? elm.parentElement : null); diff --git a/packages/overlayscrollbars/src/core/options/validation.ts b/packages/overlayscrollbars/src/core/options/validation.ts index 06fe8b7..24f6ed3 100644 --- a/packages/overlayscrollbars/src/core/options/validation.ts +++ b/packages/overlayscrollbars/src/core/options/validation.ts @@ -47,13 +47,13 @@ const optionsTemplateTypes: OptionsTemplateTypesDictionary = ['boolean', 'number * @param doWriteErrors True if errors shall be logged into the console, false otherwise. * @param propPath The propertyPath which lead to this object. (used for error logging) */ -const validateRecursive = function ( +const validateRecursive = ( options: T, template: OptionsTemplate>, optionsDiff: OptionsValidated, doWriteErrors?: boolean, propPath?: string, -): OptionsValidatedResult { +): OptionsValidatedResult => { const validatedOptions: OptionsValidated = {}; const optionsCopy: T = { ...options }; const props = keys(template).filter((prop) => hasOwnProperty(options, prop)); @@ -147,12 +147,12 @@ const validateRecursive = function ( * Without the optionsDiff object the returned validated object would be: { a: 'a', b: 'b', c: 'c' } * @param doWriteErrors True if errors shall be logged into the console, false otherwise. */ -const validate = function ( +const validate = ( options: T, template: OptionsTemplate>, optionsDiff?: OptionsValidated, doWriteErrors?: boolean, -): OptionsValidatedResult { +): OptionsValidatedResult => { /* if (!isEmptyObject(foreign) && doWriteErrors) console.warn(`The following options are discarded due to invalidity:\r\n ${window.JSON.stringify(foreign, null, 2)}`); diff --git a/packages/overlayscrollbars/src/core/utils/array.ts b/packages/overlayscrollbars/src/core/utils/array.ts index 3fb0fbf..c7a4e7a 100644 --- a/packages/overlayscrollbars/src/core/utils/array.ts +++ b/packages/overlayscrollbars/src/core/utils/array.ts @@ -49,4 +49,4 @@ export function each( * @param item The item. * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0. */ -export const indexOf: (arr: Array, item: T, fromIndex?: number) => number = (arr, item, fromIndex) => arr.indexOf(item, fromIndex); +export const indexOf = (arr: Array, item: T, fromIndex?: number): number => arr.indexOf(item, fromIndex); diff --git a/packages/overlayscrollbars/src/core/utils/object.ts b/packages/overlayscrollbars/src/core/utils/object.ts index fc9b170..c52ea1a 100644 --- a/packages/overlayscrollbars/src/core/utils/object.ts +++ b/packages/overlayscrollbars/src/core/utils/object.ts @@ -3,11 +3,11 @@ * @param obj The object. * @param prop The name of the property. */ -export const hasOwnProperty: (obj: any, prop: string | number | symbol) => boolean = (obj: any, prop: string | number | symbol) => +export const hasOwnProperty = (obj: any, prop: string | number | symbol): boolean => Object.prototype.hasOwnProperty.call(obj, prop); /** * Returns the names of the enumerable string properties and methods of an object. * @param obj The object of which the properties shall be returned. */ -export const keys: (obj: any) => Array = (obj: any) => (obj ? Object.keys(obj) : []); +export const keys = (obj: any): Array => (obj ? Object.keys(obj) : []); diff --git a/packages/overlayscrollbars/src/index.ts b/packages/overlayscrollbars/src/index.ts index 6962bad..bd35943 100644 --- a/packages/overlayscrollbars/src/index.ts +++ b/packages/overlayscrollbars/src/index.ts @@ -39,12 +39,10 @@ export default () => { \ \
\ - ', + ' ), a, b, c, ]; }; - -export const a = 1; diff --git a/packages/overlayscrollbars/src/instances.ts b/packages/overlayscrollbars/src/instances.ts index 0fc059e..e09d12f 100644 --- a/packages/overlayscrollbars/src/instances.ts +++ b/packages/overlayscrollbars/src/instances.ts @@ -6,7 +6,7 @@ const targetInstanceMap: WeakMap = new WeakMap(); * @param target The element which is the target of the OverlayScrollbars instance. * @param osInstance The OverlayScrollbars instance. */ -export const addInstance: (target: Element, osInstance: any) => void = (target, osInstance) => { +export const addInstance = (target: Element, osInstance: any): void => { targetInstanceMap.set(target, osInstance); targets.add(target); }; @@ -15,7 +15,7 @@ export const addInstance: (target: Element, osInstance: any) => void = (target, * Removes a OverlayScrollbars instance from the given element. * @param target The element from which its OverlayScrollbars instance shall be removed. */ -export const removeInstance: (target: Element) => void = (target) => { +export const removeInstance = (target: Element): void => { targetInstanceMap.delete(target); targets.delete(target); }; @@ -24,13 +24,13 @@ export const removeInstance: (target: Element) => void = (target) => { * Gets the OverlayScrollbars from the given element or undefined if it doesn't have one. * @param target The element of which its OverlayScrollbars instance shall be get. */ -export const getInstance: (target: Element) => any = (target) => targetInstanceMap.get(target); +export const getInstance = (target: Element): any => targetInstanceMap.get(target); /** * Gets a Map which represents all active OverayScrollbars instances. * The Key is the ekement and the value is the instance. */ -export const allInstances: () => ReadonlyMap = () => { +export const allInstances = (): ReadonlyMap => { const validTargetInstanceMap: Map = new Map(); targets.forEach((target: Element) => { diff --git a/packages/overlayscrollbars/types/index.d.ts b/packages/overlayscrollbars/types/index.d.ts index 4ba5634..568c40d 100644 --- a/packages/overlayscrollbars/types/index.d.ts +++ b/packages/overlayscrollbars/types/index.d.ts @@ -1,3 +1,2 @@ declare const _default: () => (number | readonly Node[])[]; export default _default; -export declare const a = 1; diff --git a/rollup.config.js b/rollup.config.js index bc61315..d6392d1 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -70,13 +70,26 @@ export default async (config) => { const mainOutputArray = [ { - format: 'iife', + format: 'esm', name, globals, exports, file: path.resolve(distPath, `${project}.js`), sourcemap: legacySourceMap, - plugins: [rollupBabelOutputPlugin(legacyOutputBabelConfig)], + plugins: [ + rollupBabelOutputPlugin({ + ...legacyOutputBabelConfig, + plugins: [ + [ + '@babel/plugin-transform-modules-umd', + { + moduleId: name, + globals, + }, + ], + ], + }), + ], }, { format: 'esm',