@bysages/solid 0.2.0 → 0.2.1
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/index.mjs +11 -5
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -4716,24 +4716,30 @@ function DataTable(props) {
|
|
|
4716
4716
|
const rows = createMemo(() => table.getRowModel().rows);
|
|
4717
4717
|
/** The declared row height is the density-scale baseline; the live
|
|
4718
4718
|
* scale comes off the document so the virtual window matches what CSS
|
|
4719
|
-
* actually renders.
|
|
4719
|
+
* actually renders. It is read once and re-read only when the density
|
|
4720
|
+
* or scene attribute moves — estimateSize runs on every scroll frame. */
|
|
4720
4721
|
const baseRowHeight = () => props.rowHeight ?? 40;
|
|
4721
|
-
|
|
4722
|
+
let densityScale = 1;
|
|
4723
|
+
const readDensityScale = () => {
|
|
4722
4724
|
const value = Number(getComputedStyle(document.documentElement).getPropertyValue("--bs-density-scale"));
|
|
4723
|
-
|
|
4725
|
+
densityScale = Number.isFinite(value) && value > 0 ? value : 1;
|
|
4724
4726
|
};
|
|
4725
4727
|
const virtualizer = createVirtualizer({
|
|
4726
4728
|
get count() {
|
|
4727
4729
|
return rows().length;
|
|
4728
4730
|
},
|
|
4729
4731
|
getScrollElement: () => viewport(),
|
|
4730
|
-
estimateSize: () => baseRowHeight() * densityScale
|
|
4732
|
+
estimateSize: () => baseRowHeight() * densityScale,
|
|
4731
4733
|
getItemKey: (index) => rows()[index]?.id ?? index,
|
|
4732
4734
|
overscan: 8
|
|
4733
4735
|
});
|
|
4734
4736
|
onMount(() => {
|
|
4735
4737
|
if (typeof MutationObserver === "undefined") return;
|
|
4736
|
-
|
|
4738
|
+
readDensityScale();
|
|
4739
|
+
const densityObserver = new MutationObserver(() => {
|
|
4740
|
+
readDensityScale();
|
|
4741
|
+
virtualizer.measure();
|
|
4742
|
+
});
|
|
4737
4743
|
densityObserver.observe(document.documentElement, {
|
|
4738
4744
|
attributes: true,
|
|
4739
4745
|
attributeFilter: ["data-density", "data-scene"]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bysages/solid",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "By Sages Elements components for Solid — styled by the paper-and-ink design tokens",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"accessible",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"@tanstack/solid-virtual": "3.13.40",
|
|
48
48
|
"@zag-js/cascade-select": "1.44.0",
|
|
49
49
|
"@zag-js/solid": "1.44.0",
|
|
50
|
-
"@bysages/core": "0.2.
|
|
50
|
+
"@bysages/core": "0.2.1"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"ai": "7.0.107",
|