@aiszlab/relax 1.2.14 → 1.2.16
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/dom/scroll-to.js
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { __classPrivateFieldSet, __classPrivateFieldGet } from '../node_modules/tslib/tslib.es6.js';
|
|
2
2
|
|
|
3
|
-
var _Scroller_scrolled, _Scroller_scroller;
|
|
3
|
+
var _a, _Scroller_scrolled, _Scroller_scroller;
|
|
4
4
|
class Scroller {
|
|
5
5
|
constructor() {
|
|
6
|
-
var
|
|
6
|
+
var _b;
|
|
7
|
+
var _c;
|
|
7
8
|
_Scroller_scrolled.set(this, new Map()
|
|
8
9
|
// singleton mode
|
|
9
10
|
);
|
|
10
|
-
|
|
11
|
-
_Scroller_scroller.set(this, null);
|
|
12
|
-
return (__classPrivateFieldSet(this, _Scroller_scroller, (_a = __classPrivateFieldGet(this, _Scroller_scroller, "f")) !== null && _a !== void 0 ? _a : this, "f"));
|
|
11
|
+
return (__classPrivateFieldSet(_c = _a, _a, (_b = __classPrivateFieldGet(_c, _a, "f", _Scroller_scroller)) !== null && _b !== void 0 ? _b : this, "f", _Scroller_scroller));
|
|
13
12
|
}
|
|
14
13
|
get scrolled() {
|
|
15
14
|
return __classPrivateFieldGet(this, _Scroller_scrolled, "f");
|
|
@@ -18,7 +17,9 @@ class Scroller {
|
|
|
18
17
|
return direction === 'vertical' ? 'scrollTop' : 'scrollLeft';
|
|
19
18
|
}
|
|
20
19
|
}
|
|
21
|
-
|
|
20
|
+
_a = Scroller, _Scroller_scrolled = new WeakMap();
|
|
21
|
+
// singleton mode
|
|
22
|
+
_Scroller_scroller = { value: null };
|
|
22
23
|
/**
|
|
23
24
|
* @description
|
|
24
25
|
* scroll to for wrapper element
|
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
2
|
import { isStateGetter } from '../is/is-state-getter.js';
|
|
3
3
|
import { isUndefined } from '../is/is-undefined.js';
|
|
4
|
-
import 'rxjs';
|
|
5
|
-
import './use-scroll-locker.js';
|
|
6
|
-
import '../dom/scroll-to.js';
|
|
7
|
-
import './use-toggleable.js';
|
|
8
4
|
import { useUpdateEffect } from './use-update-effect.js';
|
|
9
|
-
import 'react-is';
|
|
10
5
|
|
|
11
6
|
/**
|
|
12
7
|
* @author murukal
|
|
@@ -1,21 +1,19 @@
|
|
|
1
1
|
import { useRef, useEffect } from 'react';
|
|
2
|
-
import 'rxjs';
|
|
3
|
-
import { callAsEffect } from '../utils/thenable-effect-callback.js';
|
|
4
2
|
import { useMounted } from './use-mounted.js';
|
|
5
|
-
import '
|
|
6
|
-
import '../dom/scroll-to.js';
|
|
7
|
-
import './use-toggleable.js';
|
|
8
|
-
import 'react-is';
|
|
3
|
+
import { callAsEffect } from '../utils/thenable-effect-callback.js';
|
|
9
4
|
|
|
10
5
|
const useUpdateEffect = (callable, deps) => {
|
|
11
6
|
const isMounted = useRef(false);
|
|
12
7
|
useEffect(() => {
|
|
13
8
|
if (!isMounted.current)
|
|
14
|
-
return
|
|
9
|
+
return;
|
|
15
10
|
return callAsEffect(callable);
|
|
16
11
|
}, deps);
|
|
17
12
|
useMounted(() => {
|
|
18
13
|
isMounted.current = true;
|
|
14
|
+
return () => {
|
|
15
|
+
isMounted.current = false;
|
|
16
|
+
};
|
|
19
17
|
});
|
|
20
18
|
};
|
|
21
19
|
|