@karta.io/simplebar 0.33.8 → 0.34.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,11 @@
1
1
  'use strict';
2
2
 
3
- const lodashEs = require('lodash-es');
3
+ const throttle = require('lodash/throttle');
4
+ const debounce = require('lodash/debounce');
5
+ const memoize = require('lodash/memoize');
4
6
  const resizeObserver = require('@juggle/resize-observer');
5
- const canUseDOM = require('can-use-dom');
7
+
8
+ const canUseDOM = typeof window !== "undefined" && typeof window.document !== "undefined";
6
9
 
7
10
  function getElementWindow(element) {
8
11
  if (!element || !element.ownerDocument || !element.ownerDocument.defaultView) {
@@ -237,16 +240,16 @@ const _SimpleBar = class {
237
240
  if (_SimpleBar.instances.has(this.el)) {
238
241
  return;
239
242
  }
240
- this.recalculate = lodashEs.throttle(this.recalculate.bind(this), 64);
241
- this.onMouseMove = lodashEs.throttle(this.onMouseMove.bind(this), 64);
242
- this.hideScrollbars = lodashEs.debounce(
243
+ this.recalculate = throttle(this.recalculate.bind(this), 64);
244
+ this.onMouseMove = throttle(this.onMouseMove.bind(this), 64);
245
+ this.hideScrollbars = debounce(
243
246
  this.hideScrollbars.bind(this),
244
247
  this.options.timeout
245
248
  );
246
- this.onWindowResize = lodashEs.debounce(this.onWindowResize.bind(this), 64, {
249
+ this.onWindowResize = debounce(this.onWindowResize.bind(this), 64, {
247
250
  leading: true
248
251
  });
249
- _SimpleBar.getRtlHelpers = lodashEs.memoize(_SimpleBar.getRtlHelpers);
252
+ _SimpleBar.getRtlHelpers = memoize(_SimpleBar.getRtlHelpers);
250
253
  this.init();
251
254
  }
252
255
  static getRtlHelpers() {
@@ -1,6 +1,9 @@
1
- import { throttle, debounce, memoize } from 'lodash-es';
1
+ import throttle from 'lodash/throttle';
2
+ import debounce from 'lodash/debounce';
3
+ import memoize from 'lodash/memoize';
2
4
  import { ResizeObserver } from '@juggle/resize-observer';
3
- import canUseDOM from 'can-use-dom';
5
+
6
+ const canUseDOM = typeof window !== "undefined" && typeof window.document !== "undefined";
4
7
 
5
8
  function getElementWindow(element) {
6
9
  if (!element || !element.ownerDocument || !element.ownerDocument.defaultView) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@karta.io/simplebar",
3
- "version": "0.33.8",
3
+ "version": "0.34.0-alpha.2",
4
4
  "description": "Клон core части библиотеки simplebar",
5
5
  "files": [
6
6
  "dist",
@@ -21,8 +21,7 @@
21
21
  "license": "MIT",
22
22
  "dependencies": {
23
23
  "@juggle/resize-observer": "3.3.1",
24
- "can-use-dom": "0.1.0",
25
- "lodash-es": "4.17.21"
24
+ "lodash": "4.17.21"
26
25
  },
27
26
  "devDependencies": {
28
27
  "unbuild": "1.0.1"
@@ -0,0 +1,3 @@
1
+ const canUseDOM = typeof window !== 'undefined' && typeof window.document !== 'undefined';
2
+
3
+ export default canUseDOM;
package/src/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import canUseDOM from 'can-use-dom';
1
+ import canUseDOM from './canUseDOM';
2
2
 
3
3
  import SimpleBar from './simplebar';
4
4
  import { getOptions } from './helpers';
@@ -1,4 +1,4 @@
1
- import canUseDOM from 'can-use-dom';
1
+ import canUseDOM from './canUseDOM';
2
2
  import { getElementDocument } from "./helpers";
3
3
 
4
4
  let cachedScrollbarWidth = null;
package/src/simplebar.js CHANGED
@@ -1,6 +1,8 @@
1
- import { throttle, debounce, memoize } from 'lodash-es';
1
+ import throttle from 'lodash/throttle';
2
+ import debounce from 'lodash/debounce';
3
+ import memoize from 'lodash/memoize';
2
4
  import { ResizeObserver } from '@juggle/resize-observer';
3
- import canUseDOM from 'can-use-dom';
5
+ import canUseDOM from './canUseDOM';
4
6
  import scrollbarWidth from './scrollbar-width';
5
7
  import { getElementWindow, getElementDocument } from './helpers';
6
8