@smartimpact-it/scroll-utils 1.1.0
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/LICENSE +674 -0
- package/README.md +158 -0
- package/dist/cjs/Bootstrap4AccordionScrollIntoView.js +74 -0
- package/dist/cjs/BootstrapAccordionScrollIntoView.js +68 -0
- package/dist/cjs/FixHashScrollPosition.js +38 -0
- package/dist/cjs/FoundationAccordionScrollIntoView.js +52 -0
- package/dist/cjs/ScrollDirection.js +120 -0
- package/dist/cjs/ScrollOffset.js +346 -0
- package/dist/cjs/ScrollPages.js +97 -0
- package/dist/cjs/index.js +93 -0
- package/dist/cjs/scrollWithMarginTop.js +34 -0
- package/dist/cjs/utils/onReady.js +46 -0
- package/dist/cjs/utils/utils.js +77 -0
- package/dist/esm/Bootstrap4AccordionScrollIntoView.js +57 -0
- package/dist/esm/BootstrapAccordionScrollIntoView.js +51 -0
- package/dist/esm/FixHashScrollPosition.js +24 -0
- package/dist/esm/FoundationAccordionScrollIntoView.js +35 -0
- package/dist/esm/ScrollDirection.js +98 -0
- package/dist/esm/ScrollOffset.js +283 -0
- package/dist/esm/ScrollPages.js +80 -0
- package/dist/esm/index.js +9 -0
- package/dist/esm/scrollWithMarginTop.js +25 -0
- package/dist/esm/utils/onReady.js +33 -0
- package/dist/esm/utils/utils.js +62 -0
- package/dist/types/Bootstrap4AccordionScrollIntoView.d.ts +11 -0
- package/dist/types/BootstrapAccordionScrollIntoView.d.ts +11 -0
- package/dist/types/FixHashScrollPosition.d.ts +7 -0
- package/dist/types/FoundationAccordionScrollIntoView.d.ts +11 -0
- package/dist/types/ScrollDirection.d.ts +29 -0
- package/dist/types/ScrollOffset.d.ts +49 -0
- package/dist/types/ScrollPages.d.ts +21 -0
- package/dist/types/index.d.ts +9 -0
- package/dist/types/scrollWithMarginTop.d.ts +5 -0
- package/dist/types/utils/onReady.d.ts +20 -0
- package/dist/types/utils/utils.d.ts +4 -0
- package/dist/umd/index.js +2 -0
- package/dist/umd/index.js.LICENSE.txt +8 -0
- package/package.json +101 -0
- package/src/Bootstrap4AccordionScrollIntoView.ts +51 -0
- package/src/BootstrapAccordionScrollIntoView.ts +45 -0
- package/src/FixHashScrollPosition.ts +31 -0
- package/src/FoundationAccordionScrollIntoView.ts +31 -0
- package/src/ScrollDirection.ts +122 -0
- package/src/ScrollOffset.ts +316 -0
- package/src/ScrollPages.ts +81 -0
- package/src/index.js +9 -0
- package/src/scrollWithMarginTop.ts +33 -0
- package/src/utils/onReady.ts +38 -0
- package/src/utils/utils.ts +78 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.isFunction = exports.debounce = exports.throttle = exports.deepEquals = void 0;
|
|
8
|
+
// deep compare objects
|
|
9
|
+
var deepEquals = function deepEquals(x, y) {
|
|
10
|
+
if (x === y) return true;
|
|
11
|
+
// if both x and y are null or undefined and exactly the same
|
|
12
|
+
if (!(x instanceof Object) || !(y instanceof Object)) return false;
|
|
13
|
+
// if they are not strictly equal, they both need to be Objects
|
|
14
|
+
if (x.constructor !== y.constructor) return false;
|
|
15
|
+
// they must have the exact same prototype chain, the closest we can do is
|
|
16
|
+
// test there constructor.
|
|
17
|
+
for (var p in x) {
|
|
18
|
+
if (!x.hasOwnProperty(p)) continue;
|
|
19
|
+
// other properties were tested using x.constructor === y.constructor
|
|
20
|
+
if (!y.hasOwnProperty(p)) return false;
|
|
21
|
+
// allows to compare x[ p ] and y[ p ] when set to undefined
|
|
22
|
+
if (x[p] === y[p]) continue;
|
|
23
|
+
// if they have the same strict value or identity then they are equal
|
|
24
|
+
if (_typeof(x[p]) !== 'object') return false;
|
|
25
|
+
// Numbers, Strings, Functions, Booleans must be strictly equal
|
|
26
|
+
if (!(0, exports.deepEquals)(x[p], y[p])) return false;
|
|
27
|
+
// Objects and Arrays must be tested recursively
|
|
28
|
+
}
|
|
29
|
+
for (var _p in y) {
|
|
30
|
+
if (y.hasOwnProperty(_p) && !x.hasOwnProperty(_p)) return false;
|
|
31
|
+
// allows x[ p ] to be set to undefined
|
|
32
|
+
}
|
|
33
|
+
return true;
|
|
34
|
+
};
|
|
35
|
+
exports.deepEquals = deepEquals;
|
|
36
|
+
var throttle = function throttle(func) {
|
|
37
|
+
var limit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 100;
|
|
38
|
+
var inThrottle;
|
|
39
|
+
return function () {
|
|
40
|
+
var args = arguments,
|
|
41
|
+
context = this;
|
|
42
|
+
if (!inThrottle) {
|
|
43
|
+
func.apply(context, args);
|
|
44
|
+
inThrottle = true;
|
|
45
|
+
setTimeout(function () {
|
|
46
|
+
return inThrottle = false;
|
|
47
|
+
}, limit);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
exports.throttle = throttle;
|
|
52
|
+
// Returns a function, that, as long as it continues to be invoked, will not
|
|
53
|
+
// be triggered. The function will be called after it stops being called for
|
|
54
|
+
// N milliseconds. If `immediate` is passed, trigger the function on the
|
|
55
|
+
// leading edge, instead of the trailing.
|
|
56
|
+
var debounce = function debounce(func, wait) {
|
|
57
|
+
var immediate = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
58
|
+
var timeout;
|
|
59
|
+
return function () {
|
|
60
|
+
var context = this,
|
|
61
|
+
args = arguments;
|
|
62
|
+
var later = function later() {
|
|
63
|
+
timeout = null;
|
|
64
|
+
if (!immediate) func.apply(context, args);
|
|
65
|
+
};
|
|
66
|
+
var callNow = immediate && !timeout;
|
|
67
|
+
clearTimeout(timeout);
|
|
68
|
+
timeout = setTimeout(later, wait);
|
|
69
|
+
if (callNow) func.apply(context, args);
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
exports.debounce = debounce;
|
|
73
|
+
var isFunction = function isFunction(value) {
|
|
74
|
+
// from https://stackoverflow.com/a/55785839
|
|
75
|
+
return Boolean(value) && (Object.prototype.toString.call(value) === '[object Function]' || 'function' === typeof value || value instanceof Function);
|
|
76
|
+
};
|
|
77
|
+
exports.isFunction = isFunction;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
function _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }
|
|
2
|
+
function _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }
|
|
3
|
+
function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
|
|
4
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
+
function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
|
|
8
|
+
function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
|
|
9
|
+
import { scrollWithMarginTop } from './scrollWithMarginTop';
|
|
10
|
+
import { onComplete } from './utils/onReady';
|
|
11
|
+
/**
|
|
12
|
+
* Scroll to the opened accordion tab
|
|
13
|
+
*/
|
|
14
|
+
var _Bootstrap4AccordionScrollIntoView_brand = /*#__PURE__*/new WeakSet();
|
|
15
|
+
var _handle = /*#__PURE__*/new WeakMap();
|
|
16
|
+
export class Bootstrap4AccordionScrollIntoView {
|
|
17
|
+
constructor({
|
|
18
|
+
extraOffset = 0
|
|
19
|
+
} = {}) {
|
|
20
|
+
_classPrivateMethodInitSpec(this, _Bootstrap4AccordionScrollIntoView_brand);
|
|
21
|
+
_defineProperty(this, "extraOffset", void 0);
|
|
22
|
+
_classPrivateFieldInitSpec(this, _handle, e => {
|
|
23
|
+
var _target$closest;
|
|
24
|
+
let header = null;
|
|
25
|
+
const target = e.target;
|
|
26
|
+
// Skip scrolling if the clicked element or any of its parents has the class 'skip-scroll-into-view'.
|
|
27
|
+
if ((_target$closest = target.closest) !== null && _target$closest !== void 0 && _target$closest.call(target, '.skip-scroll-into-view, [data-skip-scroll-into-view]')) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
const tabId = target.id;
|
|
31
|
+
const headerId = target.getAttribute('aria-labelledby');
|
|
32
|
+
if (headerId) {
|
|
33
|
+
header = document.querySelector(`#${headerId}`);
|
|
34
|
+
}
|
|
35
|
+
if (!header && tabId) {
|
|
36
|
+
header = document.querySelector(`[data-target="#${tabId}"]`);
|
|
37
|
+
}
|
|
38
|
+
if (header) {
|
|
39
|
+
scrollWithMarginTop(header, this.extraOffset, true);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
this.extraOffset = extraOffset;
|
|
43
|
+
onComplete(() => setTimeout(() => _assertClassBrand(_Bootstrap4AccordionScrollIntoView_brand, this, _addEventListeners).call(this), 1000));
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
function _addEventListeners() {
|
|
47
|
+
if ('$' in window) {
|
|
48
|
+
window.$(document).on('shown.collapse', e => {
|
|
49
|
+
_classPrivateFieldGet(_handle, this).call(this, e);
|
|
50
|
+
});
|
|
51
|
+
} else {
|
|
52
|
+
document.addEventListener('shown.collapse', e => {
|
|
53
|
+
_classPrivateFieldGet(_handle, this).call(this, e);
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
export default Bootstrap4AccordionScrollIntoView;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
function _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }
|
|
2
|
+
function _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }
|
|
3
|
+
function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
|
|
4
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
+
function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
|
|
8
|
+
function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
|
|
9
|
+
import { scrollWithMarginTop } from './scrollWithMarginTop';
|
|
10
|
+
import { onComplete } from './utils/onReady';
|
|
11
|
+
/**
|
|
12
|
+
* Scroll to the opened accordion tab
|
|
13
|
+
*/
|
|
14
|
+
var _BootstrapAccordionScrollIntoView_brand = /*#__PURE__*/new WeakSet();
|
|
15
|
+
var _handle = /*#__PURE__*/new WeakMap();
|
|
16
|
+
export class BootstrapAccordionScrollIntoView {
|
|
17
|
+
constructor({
|
|
18
|
+
extraOffset = 0
|
|
19
|
+
} = {}) {
|
|
20
|
+
_classPrivateMethodInitSpec(this, _BootstrapAccordionScrollIntoView_brand);
|
|
21
|
+
_defineProperty(this, "extraOffset", void 0);
|
|
22
|
+
_classPrivateFieldInitSpec(this, _handle, e => {
|
|
23
|
+
var _target$closest;
|
|
24
|
+
let header = null;
|
|
25
|
+
const target = e.target;
|
|
26
|
+
// Skip scrolling if the clicked element or any of its parents has the class 'skip-scroll-into-view'.
|
|
27
|
+
if ((_target$closest = target.closest) !== null && _target$closest !== void 0 && _target$closest.call(target, '.skip-scroll-into-view, [data-skip-scroll-into-view]')) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
const tabId = target.id;
|
|
31
|
+
const headerId = target.getAttribute('aria-labelledby');
|
|
32
|
+
if (headerId) {
|
|
33
|
+
header = document.querySelector(`#${headerId}`);
|
|
34
|
+
}
|
|
35
|
+
if (!header && tabId) {
|
|
36
|
+
header = document.querySelector(`[data-bs-target="#${tabId}"]`);
|
|
37
|
+
}
|
|
38
|
+
if (header) {
|
|
39
|
+
scrollWithMarginTop(header, this.extraOffset, true);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
this.extraOffset = extraOffset;
|
|
43
|
+
onComplete(() => setTimeout(() => _assertClassBrand(_BootstrapAccordionScrollIntoView_brand, this, _addEventListeners).call(this), 1000));
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
function _addEventListeners() {
|
|
47
|
+
document.addEventListener('shown.bs.collapse', e => {
|
|
48
|
+
_classPrivateFieldGet(_handle, this).call(this, e);
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
export default BootstrapAccordionScrollIntoView;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { scrollWithMarginTop } from './scrollWithMarginTop';
|
|
2
|
+
/**
|
|
3
|
+
* Fix the scroll offset when loading a page with a #hash (anchor)
|
|
4
|
+
*/
|
|
5
|
+
export class FixHashScrollPosition {
|
|
6
|
+
constructor() {
|
|
7
|
+
// fix for scroll-margin-top
|
|
8
|
+
window.addEventListener('hashchange', () => {
|
|
9
|
+
const hash = window.location.hash;
|
|
10
|
+
if (!hash || hash === '#') {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
try {
|
|
14
|
+
const element = document.querySelector(hash);
|
|
15
|
+
if (element) {
|
|
16
|
+
setTimeout(() => scrollWithMarginTop(element));
|
|
17
|
+
}
|
|
18
|
+
} catch (e) {
|
|
19
|
+
console.warn(e);
|
|
20
|
+
}
|
|
21
|
+
}, false);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
export default FixHashScrollPosition;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
function _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }
|
|
2
|
+
function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
|
|
3
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
4
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
5
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
6
|
+
function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
|
|
7
|
+
import { scrollWithMarginTop } from './scrollWithMarginTop';
|
|
8
|
+
import { onComplete } from './utils/onReady';
|
|
9
|
+
/**
|
|
10
|
+
* Scroll to the opened accordion tab
|
|
11
|
+
*/
|
|
12
|
+
var _FoundationAccordionScrollIntoView_brand = /*#__PURE__*/new WeakSet();
|
|
13
|
+
export class FoundationAccordionScrollIntoView {
|
|
14
|
+
constructor({
|
|
15
|
+
extraOffset = 0
|
|
16
|
+
} = {}) {
|
|
17
|
+
_classPrivateMethodInitSpec(this, _FoundationAccordionScrollIntoView_brand);
|
|
18
|
+
_defineProperty(this, "extraOffset", void 0);
|
|
19
|
+
this.extraOffset = extraOffset;
|
|
20
|
+
onComplete(() => setTimeout(() => _assertClassBrand(_FoundationAccordionScrollIntoView_brand, this, _addEventListeners).call(this), 1000));
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
function _addEventListeners() {
|
|
24
|
+
if (!('$' in window)) return;
|
|
25
|
+
window.$(document).on('down.zf.accordion', (e, $content) => {
|
|
26
|
+
var _target$closest;
|
|
27
|
+
const target = $content.get(0).parentNode;
|
|
28
|
+
// Skip scrolling if the clicked element or any of its parents has the class 'skip-scroll-into-view'.
|
|
29
|
+
if ((_target$closest = target.closest) !== null && _target$closest !== void 0 && _target$closest.call(target, '.skip-scroll-into-view, [data-skip-scroll-into-view]')) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
scrollWithMarginTop(target, this.extraOffset, true);
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
export default FoundationAccordionScrollIntoView;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
function _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }
|
|
2
|
+
function _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }
|
|
3
|
+
function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
|
|
4
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
+
function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
|
|
8
|
+
function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
|
|
9
|
+
function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
|
|
10
|
+
import isFunction from 'lodash/isFunction';
|
|
11
|
+
import throttle from 'lodash/throttle';
|
|
12
|
+
var _lastScrollTop = /*#__PURE__*/new WeakMap();
|
|
13
|
+
var _throttle = /*#__PURE__*/new WeakMap();
|
|
14
|
+
var _throttleOptions = /*#__PURE__*/new WeakMap();
|
|
15
|
+
var _ScrollDirection_brand = /*#__PURE__*/new WeakSet();
|
|
16
|
+
export class ScrollDirection {
|
|
17
|
+
/**
|
|
18
|
+
* start an instance
|
|
19
|
+
* @param {{onlyFor: a callback to determine where to modify classes; threshold: amount in px to take into account }} param0
|
|
20
|
+
*/
|
|
21
|
+
constructor({
|
|
22
|
+
onlyFor = null,
|
|
23
|
+
threshold = 0,
|
|
24
|
+
thresholdCallback = null,
|
|
25
|
+
throttle: _throttle2 = 16,
|
|
26
|
+
throttleOptions = {
|
|
27
|
+
trailing: false
|
|
28
|
+
}
|
|
29
|
+
} = {}) {
|
|
30
|
+
/**
|
|
31
|
+
* setup the scroll event listener
|
|
32
|
+
*/
|
|
33
|
+
_classPrivateMethodInitSpec(this, _ScrollDirection_brand);
|
|
34
|
+
_defineProperty(this, "onlyForCallback", null);
|
|
35
|
+
_classPrivateFieldInitSpec(this, _lastScrollTop, 0);
|
|
36
|
+
_defineProperty(this, "threshold", 0);
|
|
37
|
+
_defineProperty(this, "thresholdCallback", null);
|
|
38
|
+
_classPrivateFieldInitSpec(this, _throttle, void 0);
|
|
39
|
+
_classPrivateFieldInitSpec(this, _throttleOptions, void 0);
|
|
40
|
+
this.onlyForCallback = onlyFor;
|
|
41
|
+
this.threshold = threshold;
|
|
42
|
+
this.thresholdCallback = thresholdCallback;
|
|
43
|
+
_classPrivateFieldSet(_throttle, this, _throttle2);
|
|
44
|
+
_classPrivateFieldSet(_throttleOptions, this, throttleOptions);
|
|
45
|
+
_classPrivateFieldSet(_lastScrollTop, this, window.pageYOffset || document.documentElement.scrollTop);
|
|
46
|
+
_assertClassBrand(_ScrollDirection_brand, this, _setupListeners).call(this);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
function _setupListeners() {
|
|
50
|
+
const update = () => {
|
|
51
|
+
const isValid = !this.onlyForCallback || this.onlyForCallback();
|
|
52
|
+
if (!isValid) return;
|
|
53
|
+
_assertClassBrand(_ScrollDirection_brand, this, _determineDirection).call(this);
|
|
54
|
+
};
|
|
55
|
+
if (_classPrivateFieldGet(_throttle, this)) {
|
|
56
|
+
const throttledUpdate = throttle(update, _classPrivateFieldGet(_throttle, this), _classPrivateFieldGet(_throttleOptions, this) || {});
|
|
57
|
+
window.addEventListener('scroll', throttledUpdate, {
|
|
58
|
+
passive: true
|
|
59
|
+
});
|
|
60
|
+
} else {
|
|
61
|
+
window.addEventListener('scroll', update, {
|
|
62
|
+
passive: true
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* dispatch an event on the window
|
|
68
|
+
*/
|
|
69
|
+
function _dispatchEvent(name) {
|
|
70
|
+
requestAnimationFrame(() => {
|
|
71
|
+
window.dispatchEvent(new CustomEvent(name));
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* determine the scroll direction
|
|
76
|
+
*/
|
|
77
|
+
function _determineDirection() {
|
|
78
|
+
const body = document.body,
|
|
79
|
+
classList = body.classList;
|
|
80
|
+
const scrollTop = window.pageYOffset || document.documentElement.scrollTop;
|
|
81
|
+
const localThreshold = this.thresholdCallback && isFunction(this.thresholdCallback) ? this.thresholdCallback({
|
|
82
|
+
scrollTop,
|
|
83
|
+
threshold: this.threshold,
|
|
84
|
+
lastScrollTop: _classPrivateFieldGet(_lastScrollTop, this)
|
|
85
|
+
}) : this.threshold;
|
|
86
|
+
if (Math.abs(scrollTop - _classPrivateFieldGet(_lastScrollTop, this)) < localThreshold) return;
|
|
87
|
+
if (scrollTop > _classPrivateFieldGet(_lastScrollTop, this) + localThreshold && !classList.contains('scrolling-down')) {
|
|
88
|
+
classList.add('scrolling-down');
|
|
89
|
+
classList.remove('scrolling-up');
|
|
90
|
+
_assertClassBrand(_ScrollDirection_brand, this, _dispatchEvent).call(this, 'scrollDirectionChange');
|
|
91
|
+
} else if (scrollTop < _classPrivateFieldGet(_lastScrollTop, this) - localThreshold && !classList.contains('scrolling-up')) {
|
|
92
|
+
classList.add('scrolling-up');
|
|
93
|
+
classList.remove('scrolling-down');
|
|
94
|
+
_assertClassBrand(_ScrollDirection_brand, this, _dispatchEvent).call(this, 'scrollDirectionChange');
|
|
95
|
+
}
|
|
96
|
+
_classPrivateFieldSet(_lastScrollTop, this, Math.max(scrollTop, 0));
|
|
97
|
+
}
|
|
98
|
+
export default ScrollDirection;
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
2
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
3
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
4
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
5
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
6
|
+
function _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }
|
|
7
|
+
function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
|
|
8
|
+
function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
|
|
9
|
+
function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
|
|
10
|
+
function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
|
|
11
|
+
import debounce from 'lodash/debounce';
|
|
12
|
+
import isFunction from 'lodash/isFunction';
|
|
13
|
+
var _name = /*#__PURE__*/new WeakMap();
|
|
14
|
+
var _selectors = /*#__PURE__*/new WeakMap();
|
|
15
|
+
var _elements = /*#__PURE__*/new WeakMap();
|
|
16
|
+
var _fixedHeight = /*#__PURE__*/new WeakMap();
|
|
17
|
+
var _condition = /*#__PURE__*/new WeakMap();
|
|
18
|
+
var _resizeCondition = /*#__PURE__*/new WeakMap();
|
|
19
|
+
var _resizeConditionValue = /*#__PURE__*/new WeakMap();
|
|
20
|
+
var _totalHeight = /*#__PURE__*/new WeakMap();
|
|
21
|
+
var _isValid = /*#__PURE__*/new WeakMap();
|
|
22
|
+
var _heightCache = /*#__PURE__*/new WeakMap();
|
|
23
|
+
var _getElementHeight = /*#__PURE__*/new WeakMap();
|
|
24
|
+
export class ScrollOffsetPart {
|
|
25
|
+
constructor({
|
|
26
|
+
name = '',
|
|
27
|
+
selectors = [],
|
|
28
|
+
elements = [],
|
|
29
|
+
fixedHeight = false,
|
|
30
|
+
condition = false,
|
|
31
|
+
resizeCondition = false
|
|
32
|
+
}) {
|
|
33
|
+
_classPrivateFieldInitSpec(this, _name, void 0);
|
|
34
|
+
_classPrivateFieldInitSpec(this, _selectors, void 0);
|
|
35
|
+
_classPrivateFieldInitSpec(this, _elements, void 0);
|
|
36
|
+
_classPrivateFieldInitSpec(this, _fixedHeight, void 0);
|
|
37
|
+
_classPrivateFieldInitSpec(this, _condition, void 0);
|
|
38
|
+
_classPrivateFieldInitSpec(this, _resizeCondition, void 0);
|
|
39
|
+
_classPrivateFieldInitSpec(this, _resizeConditionValue, void 0);
|
|
40
|
+
_classPrivateFieldInitSpec(this, _totalHeight, 0);
|
|
41
|
+
_classPrivateFieldInitSpec(this, _isValid, false);
|
|
42
|
+
_classPrivateFieldInitSpec(this, _heightCache, new WeakMap());
|
|
43
|
+
_defineProperty(this, "setElementHeight", (element, height) => {
|
|
44
|
+
if (!element || !Number.isFinite(height) || height < 0) return;
|
|
45
|
+
_classPrivateFieldGet(_heightCache, this).set(element, Math.round(height));
|
|
46
|
+
});
|
|
47
|
+
_classPrivateFieldInitSpec(this, _getElementHeight, element => {
|
|
48
|
+
if (!element) return 0;
|
|
49
|
+
const cachedHeight = _classPrivateFieldGet(_heightCache, this).get(element);
|
|
50
|
+
if (cachedHeight !== undefined) return cachedHeight;
|
|
51
|
+
const measuredHeight = element.clientHeight || 0;
|
|
52
|
+
_classPrivateFieldGet(_heightCache, this).set(element, measuredHeight);
|
|
53
|
+
return measuredHeight;
|
|
54
|
+
});
|
|
55
|
+
_defineProperty(this, "calculate", () => {
|
|
56
|
+
var _classPrivateFieldGet2;
|
|
57
|
+
_classPrivateFieldSet(_isValid, this, !!((_classPrivateFieldGet2 = _classPrivateFieldGet(_elements, this)) !== null && _classPrivateFieldGet2 !== void 0 && _classPrivateFieldGet2.length));
|
|
58
|
+
if (_classPrivateFieldGet(_isValid, this) && _classPrivateFieldGet(_condition, this) && isFunction(_classPrivateFieldGet(_condition, this))) {
|
|
59
|
+
_classPrivateFieldSet(_isValid, this, _classPrivateFieldGet(_isValid, this) && _classPrivateFieldGet(_condition, this).call(this));
|
|
60
|
+
}
|
|
61
|
+
if (_classPrivateFieldGet(_isValid, this) && _classPrivateFieldGet(_resizeCondition, this) && isFunction(_classPrivateFieldGet(_resizeCondition, this))) {
|
|
62
|
+
if (!('resizeConditionValue' in this)) {
|
|
63
|
+
_classPrivateFieldSet(_resizeConditionValue, this, _classPrivateFieldGet(_resizeCondition, this).call(this));
|
|
64
|
+
}
|
|
65
|
+
_classPrivateFieldSet(_isValid, this, _classPrivateFieldGet(_isValid, this) && _classPrivateFieldGet(_resizeConditionValue, this));
|
|
66
|
+
}
|
|
67
|
+
if (!_classPrivateFieldGet(_isValid, this)) {
|
|
68
|
+
_classPrivateFieldSet(_totalHeight, this, 0);
|
|
69
|
+
} else if (_classPrivateFieldGet(_fixedHeight, this)) {
|
|
70
|
+
_classPrivateFieldSet(_totalHeight, this, _classPrivateFieldGet(_fixedHeight, this));
|
|
71
|
+
} else {
|
|
72
|
+
let totalHeight = 0;
|
|
73
|
+
_classPrivateFieldGet(_elements, this).forEach(element => {
|
|
74
|
+
totalHeight += _classPrivateFieldGet(_getElementHeight, this).call(this, element);
|
|
75
|
+
});
|
|
76
|
+
_classPrivateFieldSet(_totalHeight, this, totalHeight);
|
|
77
|
+
}
|
|
78
|
+
return this;
|
|
79
|
+
});
|
|
80
|
+
_defineProperty(this, "calculateResizeConditions", () => {
|
|
81
|
+
if (_classPrivateFieldGet(_resizeCondition, this) && isFunction(_classPrivateFieldGet(_resizeCondition, this))) {
|
|
82
|
+
const oldValue = _classPrivateFieldGet(_resizeConditionValue, this) || false;
|
|
83
|
+
_classPrivateFieldSet(_resizeConditionValue, this, _classPrivateFieldGet(_resizeCondition, this).call(this));
|
|
84
|
+
return oldValue != _classPrivateFieldGet(_resizeConditionValue, this);
|
|
85
|
+
}
|
|
86
|
+
return false;
|
|
87
|
+
});
|
|
88
|
+
_classPrivateFieldSet(_name, this, name);
|
|
89
|
+
_classPrivateFieldSet(_selectors, this, (selectors || []).filter(Boolean));
|
|
90
|
+
_classPrivateFieldSet(_elements, this, (elements || []).filter(Boolean));
|
|
91
|
+
_classPrivateFieldSet(_fixedHeight, this, fixedHeight);
|
|
92
|
+
_classPrivateFieldSet(_condition, this, condition);
|
|
93
|
+
_classPrivateFieldSet(_resizeCondition, this, resizeCondition);
|
|
94
|
+
_classPrivateFieldGet(_selectors, this).forEach(selector => {
|
|
95
|
+
const newElements = [...document.querySelectorAll(selector)];
|
|
96
|
+
if (newElements.length) {
|
|
97
|
+
_classPrivateFieldSet(_elements, this, [..._classPrivateFieldGet(_elements, this), ...newElements]);
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
this.calculate();
|
|
101
|
+
}
|
|
102
|
+
get name() {
|
|
103
|
+
return _classPrivateFieldGet(_name, this);
|
|
104
|
+
}
|
|
105
|
+
get totalHeight() {
|
|
106
|
+
return _classPrivateFieldGet(_totalHeight, this);
|
|
107
|
+
}
|
|
108
|
+
get isValid() {
|
|
109
|
+
return _classPrivateFieldGet(_isValid, this);
|
|
110
|
+
}
|
|
111
|
+
get elements() {
|
|
112
|
+
return _classPrivateFieldGet(_elements, this);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
/**!
|
|
116
|
+
* ScrollOffset - a class to handle add css variables to the body element,
|
|
117
|
+
* with the value of the "header" parts that are visible
|
|
118
|
+
* so that we can adjust scroll positions etc. based on it
|
|
119
|
+
*
|
|
120
|
+
* Author: Bogdan Barbu
|
|
121
|
+
* Team: Codingheads (codingheads.com)
|
|
122
|
+
*/
|
|
123
|
+
var _offsetParts = /*#__PURE__*/new WeakMap();
|
|
124
|
+
var _variables = /*#__PURE__*/new WeakMap();
|
|
125
|
+
var _extraEvents = /*#__PURE__*/new WeakMap();
|
|
126
|
+
var _registerForHoudini = /*#__PURE__*/new WeakMap();
|
|
127
|
+
var _useResizeObserver = /*#__PURE__*/new WeakMap();
|
|
128
|
+
var _measureScheduled = /*#__PURE__*/new WeakMap();
|
|
129
|
+
var _registerCssVariables = /*#__PURE__*/new WeakMap();
|
|
130
|
+
var _calculateOffset = /*#__PURE__*/new WeakMap();
|
|
131
|
+
var _calculateResizeConditions = /*#__PURE__*/new WeakMap();
|
|
132
|
+
var _debouncedCalculateOffset = /*#__PURE__*/new WeakMap();
|
|
133
|
+
var _debouncedCalculateResizeConditions = /*#__PURE__*/new WeakMap();
|
|
134
|
+
var _scheduleCalculateOffset = /*#__PURE__*/new WeakMap();
|
|
135
|
+
var _setupListeners = /*#__PURE__*/new WeakMap();
|
|
136
|
+
export class ScrollOffset {
|
|
137
|
+
/**
|
|
138
|
+
* setup the conditions
|
|
139
|
+
*/
|
|
140
|
+
constructor({
|
|
141
|
+
offsetParts = [],
|
|
142
|
+
variables = [],
|
|
143
|
+
registerForHoudini = true,
|
|
144
|
+
useResizeObserver = true,
|
|
145
|
+
extraEvents = []
|
|
146
|
+
} = {}) {
|
|
147
|
+
_classPrivateFieldInitSpec(this, _offsetParts, void 0);
|
|
148
|
+
_classPrivateFieldInitSpec(this, _variables, void 0);
|
|
149
|
+
_classPrivateFieldInitSpec(this, _extraEvents, void 0);
|
|
150
|
+
_classPrivateFieldInitSpec(this, _registerForHoudini, void 0);
|
|
151
|
+
_classPrivateFieldInitSpec(this, _useResizeObserver, void 0);
|
|
152
|
+
_classPrivateFieldInitSpec(this, _measureScheduled, false);
|
|
153
|
+
/**
|
|
154
|
+
* register the css variables as length in the Houdini CSS API
|
|
155
|
+
*/
|
|
156
|
+
_classPrivateFieldInitSpec(this, _registerCssVariables, () => {
|
|
157
|
+
_classPrivateFieldGet(_variables, this).forEach(({
|
|
158
|
+
name
|
|
159
|
+
}) => {
|
|
160
|
+
window.CSS.registerProperty({
|
|
161
|
+
name: `--${name}`,
|
|
162
|
+
syntax: '<length>',
|
|
163
|
+
inherits: true,
|
|
164
|
+
initialValue: '0px'
|
|
165
|
+
});
|
|
166
|
+
});
|
|
167
|
+
});
|
|
168
|
+
/**
|
|
169
|
+
* calculate the offsets and set the css variables
|
|
170
|
+
*/
|
|
171
|
+
_classPrivateFieldInitSpec(this, _calculateOffset, () => {
|
|
172
|
+
// calculate the conditions
|
|
173
|
+
_classPrivateFieldGet(_offsetParts, this).forEach(part => part.calculate());
|
|
174
|
+
// determine the css variables
|
|
175
|
+
const cssVariables = _classPrivateFieldGet(_variables, this).map(variable => {
|
|
176
|
+
const value = variable.offsetParts.reduce((acc, part) => {
|
|
177
|
+
if (typeof part == 'string') {
|
|
178
|
+
part = _classPrivateFieldGet(_offsetParts, this).find(partInfo => partInfo.name.localeCompare(part) == 0);
|
|
179
|
+
}
|
|
180
|
+
if (part && part.isValid) {
|
|
181
|
+
acc += part.totalHeight;
|
|
182
|
+
}
|
|
183
|
+
return acc;
|
|
184
|
+
}, 0);
|
|
185
|
+
return _objectSpread(_objectSpread({}, variable), {}, {
|
|
186
|
+
value
|
|
187
|
+
});
|
|
188
|
+
});
|
|
189
|
+
// output the variables
|
|
190
|
+
cssVariables.forEach(({
|
|
191
|
+
name,
|
|
192
|
+
value
|
|
193
|
+
}) => {
|
|
194
|
+
document.documentElement.style.setProperty(`--${name}`, `${value}px`);
|
|
195
|
+
});
|
|
196
|
+
document.body.dispatchEvent(new CustomEvent('ScrollOffsetChange', {
|
|
197
|
+
bubbles: true
|
|
198
|
+
}));
|
|
199
|
+
});
|
|
200
|
+
/**
|
|
201
|
+
* recalculate values for conditions that only depend on resize
|
|
202
|
+
*/
|
|
203
|
+
_classPrivateFieldInitSpec(this, _calculateResizeConditions, () => {
|
|
204
|
+
_classPrivateFieldGet(_offsetParts, this).forEach(part => part.calculateResizeConditions());
|
|
205
|
+
});
|
|
206
|
+
_classPrivateFieldInitSpec(this, _debouncedCalculateOffset, debounce(_classPrivateFieldGet(_calculateOffset, this), 32));
|
|
207
|
+
_classPrivateFieldInitSpec(this, _debouncedCalculateResizeConditions, debounce(_classPrivateFieldGet(_calculateResizeConditions, this), 32));
|
|
208
|
+
_classPrivateFieldInitSpec(this, _scheduleCalculateOffset, () => {
|
|
209
|
+
if (_classPrivateFieldGet(_measureScheduled, this)) return;
|
|
210
|
+
_classPrivateFieldSet(_measureScheduled, this, true);
|
|
211
|
+
requestAnimationFrame(() => {
|
|
212
|
+
_classPrivateFieldSet(_measureScheduled, this, false);
|
|
213
|
+
_classPrivateFieldGet(_debouncedCalculateOffset, this).call(this);
|
|
214
|
+
});
|
|
215
|
+
});
|
|
216
|
+
/**
|
|
217
|
+
* setup event listeners
|
|
218
|
+
*/
|
|
219
|
+
_classPrivateFieldInitSpec(this, _setupListeners, () => {
|
|
220
|
+
['resize', 'orientationchange'].forEach(type => {
|
|
221
|
+
window.addEventListener(type, _classPrivateFieldGet(_debouncedCalculateResizeConditions, this));
|
|
222
|
+
});
|
|
223
|
+
['resize', 'orientationchange', 'scrollDirectionChange', 'stickyIsPinned', 'stickyIsUnpinned', ..._classPrivateFieldGet(_extraEvents, this)].forEach(type => window.addEventListener(type, _classPrivateFieldGet(_scheduleCalculateOffset, this)));
|
|
224
|
+
// setup resizeObservers for the elements
|
|
225
|
+
if (_classPrivateFieldGet(_useResizeObserver, this)) {
|
|
226
|
+
const resizeObserver = new ResizeObserver(entries => {
|
|
227
|
+
entries.forEach(entry => {
|
|
228
|
+
var _entry$contentRect;
|
|
229
|
+
const target = entry.target;
|
|
230
|
+
const height = Math.round(((_entry$contentRect = entry.contentRect) === null || _entry$contentRect === void 0 ? void 0 : _entry$contentRect.height) || (target === null || target === void 0 ? void 0 : target.clientHeight) || 0);
|
|
231
|
+
if (!target || !height) return;
|
|
232
|
+
_classPrivateFieldGet(_offsetParts, this).forEach(part => {
|
|
233
|
+
if (part.elements.includes(target)) {
|
|
234
|
+
part.setElementHeight(target, height);
|
|
235
|
+
}
|
|
236
|
+
});
|
|
237
|
+
});
|
|
238
|
+
_classPrivateFieldGet(_scheduleCalculateOffset, this).call(this);
|
|
239
|
+
});
|
|
240
|
+
_classPrivateFieldGet(_offsetParts, this).forEach(part => part.elements.forEach(element => resizeObserver.observe(element)));
|
|
241
|
+
}
|
|
242
|
+
});
|
|
243
|
+
// parse the variables
|
|
244
|
+
if (Array.isArray(variables)) {
|
|
245
|
+
_classPrivateFieldSet(_variables, this, variables);
|
|
246
|
+
} else {
|
|
247
|
+
_classPrivateFieldSet(_variables, this, Object.entries(variables).map(([key, value]) => {
|
|
248
|
+
return {
|
|
249
|
+
name: key,
|
|
250
|
+
offsetParts: value
|
|
251
|
+
};
|
|
252
|
+
}));
|
|
253
|
+
}
|
|
254
|
+
// take the offset parts from the variables
|
|
255
|
+
const variableOffsetParts = _classPrivateFieldGet(_variables, this).map(({
|
|
256
|
+
offsetParts
|
|
257
|
+
}) => {
|
|
258
|
+
return offsetParts.filter(part => part instanceof ScrollOffsetPart);
|
|
259
|
+
}).flat(1);
|
|
260
|
+
// merge with the settings and keep only distinct elements
|
|
261
|
+
offsetParts = [...new Set([...offsetParts, ...variableOffsetParts])];
|
|
262
|
+
// parse the offset parts
|
|
263
|
+
_classPrivateFieldSet(_offsetParts, this, offsetParts.map(part => {
|
|
264
|
+
let partObject = null;
|
|
265
|
+
if (!(part instanceof ScrollOffsetPart)) {
|
|
266
|
+
partObject = new ScrollOffsetPart(part);
|
|
267
|
+
} else {
|
|
268
|
+
partObject = part;
|
|
269
|
+
}
|
|
270
|
+
partObject.calculate();
|
|
271
|
+
return partObject;
|
|
272
|
+
}));
|
|
273
|
+
_classPrivateFieldSet(_extraEvents, this, extraEvents || []);
|
|
274
|
+
_classPrivateFieldSet(_registerForHoudini, this, registerForHoudini && 'CSS' in window && 'registerProperty' in window.CSS);
|
|
275
|
+
_classPrivateFieldSet(_useResizeObserver, this, 'ResizeObserver' in window && useResizeObserver);
|
|
276
|
+
if (_classPrivateFieldGet(_registerForHoudini, this)) {
|
|
277
|
+
_classPrivateFieldGet(_registerCssVariables, this).call(this);
|
|
278
|
+
}
|
|
279
|
+
_classPrivateFieldGet(_setupListeners, this).call(this);
|
|
280
|
+
_classPrivateFieldGet(_calculateOffset, this).call(this);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
export default ScrollOffset;
|