@vobs/ui 0.2.0 → 0.3.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/dist/app-shell-dom.d.ts +6 -0
- package/dist/app-shell-dom.js +373 -33
- package/dist/app-shell.d.ts +55 -19
- package/dist/app-shell.js +63 -18
- package/dist/base.css +1 -2
- package/dist/complex-inputs.js +7 -3
- package/dist/components.css +235 -47
- package/dist/data-display.d.ts +31 -0
- package/dist/data-display.js +72 -29
- package/dist/dialog.d.ts +26 -0
- package/dist/dialog.js +94 -0
- package/dist/forms.js +10 -6
- package/dist/index.d.ts +5 -1
- package/dist/index.js +7 -1
- package/dist/overlay.d.ts +4 -0
- package/dist/overlay.js +10 -5
- package/dist/page-state.d.ts +23 -0
- package/dist/page-state.js +96 -0
- package/dist/theme-data.d.ts +31 -0
- package/dist/theme-data.js +43 -0
- package/dist/theme.d.ts +19 -1
- package/dist/theme.js +72 -33
- package/dist/tokens.css +121 -0
- package/dist/tree.js +11 -5
- package/dist/virtual-list.js +28 -11
- package/package.json +17 -9
package/dist/virtual-list.js
CHANGED
|
@@ -90,6 +90,7 @@ export function createVirtualListResizeMeasurementContract(options) {
|
|
|
90
90
|
}))
|
|
91
91
|
.filter((entry) => entry.height !== undefined && Number.isFinite(entry.height) && entry.height > 0)
|
|
92
92
|
.map((entry) => entry.key);
|
|
93
|
+
const measuredKeySet = new Set(measuredKeys);
|
|
93
94
|
const measuringKeys = uniqueKeys(options.measuringIds ?? []);
|
|
94
95
|
const plans = createDynamicVirtualListPlans(options.getMeasuredItemHeight === undefined
|
|
95
96
|
? options
|
|
@@ -99,7 +100,7 @@ export function createVirtualListResizeMeasurementContract(options) {
|
|
|
99
100
|
});
|
|
100
101
|
const estimatedKeys = options.items
|
|
101
102
|
.map((_, index) => keyFor(options, index))
|
|
102
|
-
.filter((key) => !
|
|
103
|
+
.filter((key) => !measuredKeySet.has(key));
|
|
103
104
|
return {
|
|
104
105
|
plans,
|
|
105
106
|
measuredKeys,
|
|
@@ -174,8 +175,7 @@ export function calculateDynamicVirtualListState(options) {
|
|
|
174
175
|
if (count === 0) {
|
|
175
176
|
return createDynamicState(options, 0, 0, 0, -1, 0, []);
|
|
176
177
|
}
|
|
177
|
-
const metrics = dynamicItemMetrics(options, estimatedItemHeight);
|
|
178
|
-
const totalSize = metrics.at(-1)?.end ?? 0;
|
|
178
|
+
const { metrics, measuredCount, totalSize } = dynamicItemMetrics(options, estimatedItemHeight);
|
|
179
179
|
const viewportHeight = Math.max(0, options.viewportHeight);
|
|
180
180
|
const scrollOffset = clamp(options.scrollOffset ?? 0, 0, Math.max(totalSize - viewportHeight, 0));
|
|
181
181
|
const visibleStart = firstDynamicIndexAfter(metrics, scrollOffset);
|
|
@@ -186,7 +186,7 @@ export function calculateDynamicVirtualListState(options) {
|
|
|
186
186
|
const end = ssrCount === undefined
|
|
187
187
|
? Math.min(count - 1, visibleEnd + (options.overscan ?? 2))
|
|
188
188
|
: fallbackEnd;
|
|
189
|
-
return createDynamicState(options, totalSize, scrollOffset, visibleStart, visibleEnd,
|
|
189
|
+
return createDynamicState(options, totalSize, scrollOffset, visibleStart, visibleEnd, measuredCount, dynamicRangeItems(options, metrics, start, end));
|
|
190
190
|
}
|
|
191
191
|
export function createFixedVirtualListController(options) {
|
|
192
192
|
let current = normalizeControllerOptions(options);
|
|
@@ -398,14 +398,17 @@ function dynamicItemFromMetric(options, index, metric) {
|
|
|
398
398
|
function dynamicItemMetrics(options, estimatedItemHeight) {
|
|
399
399
|
const metrics = [];
|
|
400
400
|
let start = 0;
|
|
401
|
+
let measuredCount = 0;
|
|
401
402
|
for (let index = 0; index < options.items.length; index++) {
|
|
402
403
|
const measuredHeight = options.getItemHeight?.(options.items[index], index);
|
|
403
404
|
const measured = measuredHeight !== undefined && Number.isFinite(measuredHeight) && measuredHeight > 0;
|
|
404
405
|
const size = measured ? measuredHeight : estimatedItemHeight;
|
|
405
406
|
metrics.push({ start, size, measured, end: start + size });
|
|
406
407
|
start += size;
|
|
408
|
+
if (measured)
|
|
409
|
+
measuredCount += 1;
|
|
407
410
|
}
|
|
408
|
-
return metrics;
|
|
411
|
+
return { metrics, measuredCount, totalSize: start };
|
|
409
412
|
}
|
|
410
413
|
function createLayoutState(options, rowCount, columnCount, totalWidth, totalHeight, scrollLeft, scrollTop, visibleStartIndex, visibleEndIndex, visibleRowStart, visibleRowEnd, items, visibleColumnStart = 0, visibleColumnEnd = -1) {
|
|
411
414
|
return {
|
|
@@ -468,14 +471,28 @@ function layoutItemFromRange(options, index, rowIndex, columnIndex, width, heigh
|
|
|
468
471
|
};
|
|
469
472
|
}
|
|
470
473
|
function firstDynamicIndexAfter(metrics, offset) {
|
|
471
|
-
|
|
472
|
-
|
|
474
|
+
let low = 0;
|
|
475
|
+
let high = metrics.length;
|
|
476
|
+
while (low < high) {
|
|
477
|
+
const mid = low + Math.floor((high - low) / 2);
|
|
478
|
+
if (metrics[mid].end > offset)
|
|
479
|
+
high = mid;
|
|
480
|
+
else
|
|
481
|
+
low = mid + 1;
|
|
482
|
+
}
|
|
483
|
+
return low === metrics.length ? Math.max(0, metrics.length - 1) : low;
|
|
473
484
|
}
|
|
474
485
|
function lastDynamicIndexBefore(metrics, offset) {
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
486
|
+
let low = 0;
|
|
487
|
+
let high = metrics.length;
|
|
488
|
+
while (low < high) {
|
|
489
|
+
const mid = low + Math.floor((high - low) / 2);
|
|
490
|
+
if (metrics[mid].start >= offset)
|
|
491
|
+
high = mid;
|
|
492
|
+
else
|
|
493
|
+
low = mid + 1;
|
|
494
|
+
}
|
|
495
|
+
return low === metrics.length ? metrics.length - 1 : Math.max(0, low);
|
|
479
496
|
}
|
|
480
497
|
function normalizeControllerOptions(options) {
|
|
481
498
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vobs/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Optional design tokens, layouts and UI components for vobs.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
@@ -41,6 +41,14 @@
|
|
|
41
41
|
"types": "./dist/data-display.d.ts",
|
|
42
42
|
"import": "./dist/data-display.js"
|
|
43
43
|
},
|
|
44
|
+
"./page-state": {
|
|
45
|
+
"types": "./dist/page-state.d.ts",
|
|
46
|
+
"import": "./dist/page-state.js"
|
|
47
|
+
},
|
|
48
|
+
"./dialog": {
|
|
49
|
+
"types": "./dist/dialog.d.ts",
|
|
50
|
+
"import": "./dist/dialog.js"
|
|
51
|
+
},
|
|
44
52
|
"./icons": {
|
|
45
53
|
"types": "./dist/icons.d.ts",
|
|
46
54
|
"import": "./dist/icons.js"
|
|
@@ -96,18 +104,18 @@
|
|
|
96
104
|
"main": "./dist/index.js",
|
|
97
105
|
"dependencies": {
|
|
98
106
|
"@tanstack/virtual-core": "^3.17.7",
|
|
99
|
-
"@vobs/
|
|
100
|
-
"@vobs/
|
|
101
|
-
"@vobs/
|
|
102
|
-
"@vobs/
|
|
103
|
-
"@vobs/
|
|
104
|
-
"@vobs/
|
|
105
|
-
"@vobs/
|
|
107
|
+
"@vobs/icons": "0.3.0",
|
|
108
|
+
"@vobs/i18n": "0.3.0",
|
|
109
|
+
"@vobs/forms": "0.3.0",
|
|
110
|
+
"@vobs/runtime-dom": "0.3.0",
|
|
111
|
+
"@vobs/router": "0.3.0",
|
|
112
|
+
"@vobs/reactivity": "0.3.0",
|
|
113
|
+
"@vobs/server-renderer": "0.3.0"
|
|
106
114
|
},
|
|
107
115
|
"sideEffects": [
|
|
108
116
|
"./dist/*.css"
|
|
109
117
|
],
|
|
110
118
|
"engines": {
|
|
111
|
-
"node": ">=
|
|
119
|
+
"node": ">=22.12.0"
|
|
112
120
|
}
|
|
113
121
|
}
|