@lyeve-labs/ui-kit 0.20.0 → 0.21.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.
|
@@ -22,6 +22,18 @@
|
|
|
22
22
|
* back.
|
|
23
23
|
*/
|
|
24
24
|
hasNext?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* How many rows the page on screen actually holds.
|
|
27
|
+
*
|
|
28
|
+
* Only an uncounted list needs it, and only for the sentence: without a
|
|
29
|
+
* total the component knows where the page starts but not where it ends,
|
|
30
|
+
* because the last page is short and nothing here says how short. Given it,
|
|
31
|
+
* the summary states a range instead of naming the page.
|
|
32
|
+
*
|
|
33
|
+
* It is the row count of what was rendered, not a page size. A caller that
|
|
34
|
+
* asked for 50 and received 12 passes 12.
|
|
35
|
+
*/
|
|
36
|
+
count?: number;
|
|
25
37
|
/**
|
|
26
38
|
* What the list holds, in the plural: 'files', 'jobs', 'webhooks'.
|
|
27
39
|
*
|
|
@@ -61,6 +73,7 @@
|
|
|
61
73
|
total = undefined,
|
|
62
74
|
perPage = 20,
|
|
63
75
|
hasNext = false,
|
|
76
|
+
count = undefined,
|
|
64
77
|
noun = '',
|
|
65
78
|
class: cls = '',
|
|
66
79
|
onchange,
|
|
@@ -79,6 +92,15 @@
|
|
|
79
92
|
let from = $derived(Math.min((safePage - 1) * perPage + 1, safeTotal));
|
|
80
93
|
let to = $derived(Math.min(safePage * perPage, safeTotal));
|
|
81
94
|
|
|
95
|
+
/**
|
|
96
|
+
* The rows on screen, when the caller states them. Zero and a negative are
|
|
97
|
+
* both "nothing to describe": a page of no rows has no range, and the summary
|
|
98
|
+
* falls back to naming the page rather than printing an inverted one.
|
|
99
|
+
*/
|
|
100
|
+
let safeCount = $derived(
|
|
101
|
+
typeof count === 'number' && isFinite(count) && count > 0 ? Math.floor(count) : undefined,
|
|
102
|
+
);
|
|
103
|
+
|
|
82
104
|
let canPrev = $derived(safePage > 1);
|
|
83
105
|
let canNext = $derived(counted ? safePage < totalPages : hasNext);
|
|
84
106
|
let hasControls = $derived(counted ? totalPages > 1 : canPrev || canNext);
|
|
@@ -140,6 +162,11 @@
|
|
|
140
162
|
*/
|
|
141
163
|
let summary = $derived.by(() => {
|
|
142
164
|
if (!counted) {
|
|
165
|
+
if (safeCount !== undefined) {
|
|
166
|
+
const start = (safePage - 1) * perPage + 1;
|
|
167
|
+
const span = `${formatCount(start)} to ${formatCount(start + safeCount - 1)}`;
|
|
168
|
+
return label ? `${label} ${span}` : span;
|
|
169
|
+
}
|
|
143
170
|
return label ? `${label}, page ${formatCount(safePage)}` : `Page ${formatCount(safePage)}`;
|
|
144
171
|
}
|
|
145
172
|
if (safeTotal === 0) return label ? `No ${label}` : 'No results';
|
|
@@ -18,6 +18,18 @@ interface Base {
|
|
|
18
18
|
* back.
|
|
19
19
|
*/
|
|
20
20
|
hasNext?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* How many rows the page on screen actually holds.
|
|
23
|
+
*
|
|
24
|
+
* Only an uncounted list needs it, and only for the sentence: without a
|
|
25
|
+
* total the component knows where the page starts but not where it ends,
|
|
26
|
+
* because the last page is short and nothing here says how short. Given it,
|
|
27
|
+
* the summary states a range instead of naming the page.
|
|
28
|
+
*
|
|
29
|
+
* It is the row count of what was rendered, not a page size. A caller that
|
|
30
|
+
* asked for 50 and received 12 passes 12.
|
|
31
|
+
*/
|
|
32
|
+
count?: number;
|
|
21
33
|
/**
|
|
22
34
|
* What the list holds, in the plural: 'files', 'jobs', 'webhooks'.
|
|
23
35
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -89,4 +89,4 @@ export type { ConfirmOptions } from './components/dialog/dialog-manager.svelte.j
|
|
|
89
89
|
export type { DialogOptions, DialogEntry, DialogSize } from './components/dialog/types.js';
|
|
90
90
|
export { cn, type ClassValue } from './utils/cn.js';
|
|
91
91
|
export { getTheme, getThemePreference, nextThemePreference, resolveTheme, setTheme, setThemePreference, systemTheme, themeBootScript, toggleTheme, watchSystemTheme, THEME_PREFERENCES, type Theme, type ThemePreference, } from './utils/theme.js';
|
|
92
|
-
export declare const VERSION = "0.
|
|
92
|
+
export declare const VERSION = "0.21.0";
|
package/dist/index.js
CHANGED
|
@@ -96,4 +96,4 @@ export { getTheme, getThemePreference, nextThemePreference, resolveTheme, setThe
|
|
|
96
96
|
// ── Version ────────────────────────────────────────────────────────────────
|
|
97
97
|
// Generated from package.json by `pnpm version:sync`. Bump package.json, never
|
|
98
98
|
// this line; the build and the test suite fail when the two disagree.
|
|
99
|
-
export const VERSION = '0.
|
|
99
|
+
export const VERSION = '0.21.0';
|
package/package.json
CHANGED