@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.
- package/dist/simplebar.cjs +10 -7
- package/dist/simplebar.mjs +5 -2
- package/package.json +2 -3
- package/src/canUseDOM.js +3 -0
- package/src/index.js +1 -1
- package/src/scrollbar-width.js +1 -1
- package/src/simplebar.js +4 -2
package/dist/simplebar.cjs
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const
|
|
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
|
-
|
|
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 =
|
|
241
|
-
this.onMouseMove =
|
|
242
|
-
this.hideScrollbars =
|
|
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 =
|
|
249
|
+
this.onWindowResize = debounce(this.onWindowResize.bind(this), 64, {
|
|
247
250
|
leading: true
|
|
248
251
|
});
|
|
249
|
-
_SimpleBar.getRtlHelpers =
|
|
252
|
+
_SimpleBar.getRtlHelpers = memoize(_SimpleBar.getRtlHelpers);
|
|
250
253
|
this.init();
|
|
251
254
|
}
|
|
252
255
|
static getRtlHelpers() {
|
package/dist/simplebar.mjs
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import
|
|
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
|
-
|
|
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.
|
|
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
|
-
"
|
|
25
|
-
"lodash-es": "4.17.21"
|
|
24
|
+
"lodash": "4.17.21"
|
|
26
25
|
},
|
|
27
26
|
"devDependencies": {
|
|
28
27
|
"unbuild": "1.0.1"
|
package/src/canUseDOM.js
ADDED
package/src/index.js
CHANGED
package/src/scrollbar-width.js
CHANGED
package/src/simplebar.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import
|
|
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 '
|
|
5
|
+
import canUseDOM from './canUseDOM';
|
|
4
6
|
import scrollbarWidth from './scrollbar-width';
|
|
5
7
|
import { getElementWindow, getElementDocument } from './helpers';
|
|
6
8
|
|