@oxog/scrollex 1.1.0 → 1.2.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/CHANGELOG.md +36 -1
- package/README.md +22 -5
- package/dist/{chunk-CIB3EBBJ.js → chunk-2AWRSNQN.js} +12 -11
- package/dist/chunk-2AWRSNQN.js.map +1 -0
- package/dist/{chunk-ND5PV5MU.cjs → chunk-CTKEJZGD.cjs} +12 -11
- package/dist/chunk-CTKEJZGD.cjs.map +1 -0
- package/dist/index.cjs +120 -31
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -4
- package/dist/index.d.ts +3 -4
- package/dist/index.js +100 -11
- package/dist/index.js.map +1 -1
- package/dist/plugins/index.cjs +18 -16
- package/dist/plugins/index.cjs.map +1 -1
- package/dist/plugins/index.d.cts +3 -4
- package/dist/plugins/index.d.ts +3 -4
- package/dist/plugins/index.js +10 -8
- package/dist/plugins/index.js.map +1 -1
- package/dist/{scroll-controller-D5AV1E2p.d.cts → scroll-controller-U4Zov88U.d.cts} +25 -5
- package/dist/{scroll-controller-D5AV1E2p.d.ts → scroll-controller-U4Zov88U.d.ts} +25 -5
- package/package.json +23 -10
- package/dist/chunk-CIB3EBBJ.js.map +0 -1
- package/dist/chunk-ND5PV5MU.cjs.map +0 -1
package/dist/plugins/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkCTKEJZGD_cjs = require('../chunk-CTKEJZGD.cjs');
|
|
4
4
|
var react = require('react');
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
6
|
|
|
@@ -15,16 +15,16 @@ function masonryRenderer(options) {
|
|
|
15
15
|
} = options;
|
|
16
16
|
let kernel = null;
|
|
17
17
|
let virtualItems = [];
|
|
18
|
-
let columnCount = typeof columns === "number" ?
|
|
18
|
+
let columnCount = typeof columns === "number" ? chunkCTKEJZGD_cjs.normalizeColumnCount(columns) : 1;
|
|
19
19
|
let columnWidth = 0;
|
|
20
20
|
let columnHeights = [];
|
|
21
21
|
let totalHeight = 0;
|
|
22
22
|
const layoutCache = /* @__PURE__ */ new Map();
|
|
23
23
|
function calculateColumns(containerWidth) {
|
|
24
24
|
if (typeof columns === "number") {
|
|
25
|
-
columnCount =
|
|
25
|
+
columnCount = chunkCTKEJZGD_cjs.normalizeColumnCount(columns);
|
|
26
26
|
} else {
|
|
27
|
-
columnCount =
|
|
27
|
+
columnCount = chunkCTKEJZGD_cjs.autoColumnCount(containerWidth, minColumnWidth, gap);
|
|
28
28
|
}
|
|
29
29
|
columnWidth = (containerWidth - (columnCount - 1) * gap) / columnCount;
|
|
30
30
|
}
|
|
@@ -570,8 +570,9 @@ function scrollRestoration(options) {
|
|
|
570
570
|
};
|
|
571
571
|
if (includeIndex) {
|
|
572
572
|
const keyboardNav2 = kernel.getPlugin("keyboard-nav");
|
|
573
|
-
|
|
574
|
-
|
|
573
|
+
const navApi = keyboardNav2?.api;
|
|
574
|
+
if (navApi?.getFocusedIndex) {
|
|
575
|
+
const focusedIndex = navApi.getFocusedIndex();
|
|
575
576
|
if (focusedIndex !== null) {
|
|
576
577
|
state.focusedIndex = focusedIndex;
|
|
577
578
|
}
|
|
@@ -607,8 +608,9 @@ function scrollRestoration(options) {
|
|
|
607
608
|
kernel.scrollTo(kernel.getOptions().direction === "horizontal" ? state.scrollLeft : state.scrollTop);
|
|
608
609
|
if (includeIndex && state.focusedIndex !== void 0) {
|
|
609
610
|
const keyboardNav2 = kernel.getPlugin("keyboard-nav");
|
|
610
|
-
|
|
611
|
-
|
|
611
|
+
const navApi = keyboardNav2?.api;
|
|
612
|
+
if (navApi?.setFocusedIndex) {
|
|
613
|
+
navApi.setFocusedIndex(state.focusedIndex);
|
|
612
614
|
}
|
|
613
615
|
}
|
|
614
616
|
return true;
|
|
@@ -623,7 +625,7 @@ function scrollRestoration(options) {
|
|
|
623
625
|
const horizontal = kernel.getOptions().direction === "horizontal";
|
|
624
626
|
const viewport = kernel.getViewport();
|
|
625
627
|
const target = horizontal ? state.scrollLeft : state.scrollTop;
|
|
626
|
-
const maxScroll = kernel.getTotalSize() - (horizontal ? viewport.width : viewport.height);
|
|
628
|
+
const maxScroll = kernel.getTotalSize() + (kernel.getOptions().scrollMargin ?? 0) - (horizontal ? viewport.width : viewport.height);
|
|
627
629
|
if (target > maxScroll + 1) {
|
|
628
630
|
awaitingContent = true;
|
|
629
631
|
return;
|
|
@@ -667,7 +669,7 @@ function scrollRestoration(options) {
|
|
|
667
669
|
install(k) {
|
|
668
670
|
kernel = k;
|
|
669
671
|
if (saveOnScroll) {
|
|
670
|
-
debouncedSave =
|
|
672
|
+
debouncedSave = chunkCTKEJZGD_cjs.debounce(save, debounceMs);
|
|
671
673
|
}
|
|
672
674
|
if (restoreOnMount && restoredKernels.get(k) !== key) {
|
|
673
675
|
restoreFrame = requestAnimationFrame(() => {
|
|
@@ -1130,7 +1132,7 @@ function debugPanel(options = {}) {
|
|
|
1130
1132
|
const horizontal = kernel.getOptions().direction === "horizontal";
|
|
1131
1133
|
const viewport = kernel.getViewport();
|
|
1132
1134
|
const scrollOffset = horizontal ? scrollPos.scrollLeft : scrollPos.scrollTop;
|
|
1133
|
-
const maxScroll = kernel.getTotalSize() - (horizontal ? viewport.width : viewport.height);
|
|
1135
|
+
const maxScroll = kernel.getTotalSize() + (kernel.getOptions().scrollMargin ?? 0) - (horizontal ? viewport.width : viewport.height);
|
|
1134
1136
|
state.stats = {
|
|
1135
1137
|
...state.stats,
|
|
1136
1138
|
memoryUsage,
|
|
@@ -1654,23 +1656,23 @@ function EventsPanel({ eventLog, onClear }) {
|
|
|
1654
1656
|
|
|
1655
1657
|
Object.defineProperty(exports, "autoMeasurerPlugin", {
|
|
1656
1658
|
enumerable: true,
|
|
1657
|
-
get: function () { return
|
|
1659
|
+
get: function () { return chunkCTKEJZGD_cjs.autoMeasurerPlugin; }
|
|
1658
1660
|
});
|
|
1659
1661
|
Object.defineProperty(exports, "gridRendererPlugin", {
|
|
1660
1662
|
enumerable: true,
|
|
1661
|
-
get: function () { return
|
|
1663
|
+
get: function () { return chunkCTKEJZGD_cjs.gridRendererPlugin; }
|
|
1662
1664
|
});
|
|
1663
1665
|
Object.defineProperty(exports, "infiniteLoaderPlugin", {
|
|
1664
1666
|
enumerable: true,
|
|
1665
|
-
get: function () { return
|
|
1667
|
+
get: function () { return chunkCTKEJZGD_cjs.infiniteLoaderPlugin; }
|
|
1666
1668
|
});
|
|
1667
1669
|
Object.defineProperty(exports, "listRendererPlugin", {
|
|
1668
1670
|
enumerable: true,
|
|
1669
|
-
get: function () { return
|
|
1671
|
+
get: function () { return chunkCTKEJZGD_cjs.listRendererPlugin; }
|
|
1670
1672
|
});
|
|
1671
1673
|
Object.defineProperty(exports, "scrollControllerPlugin", {
|
|
1672
1674
|
enumerable: true,
|
|
1673
|
-
get: function () { return
|
|
1675
|
+
get: function () { return chunkCTKEJZGD_cjs.scrollControllerPlugin; }
|
|
1674
1676
|
});
|
|
1675
1677
|
exports.DebugPanelOverlay = DebugPanelOverlay;
|
|
1676
1678
|
exports.bidirectional = bidirectional;
|