runeforge 0.0.3 → 0.0.5
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.
|
@@ -49,3 +49,54 @@
|
|
|
49
49
|
{/each}
|
|
50
50
|
</ul>
|
|
51
51
|
</div>
|
|
52
|
+
|
|
53
|
+
<style>
|
|
54
|
+
/*
|
|
55
|
+
* DaisyUI breadcrumbs use @layer rules that Tailwind v4 doesn't propagate
|
|
56
|
+
* from node_modules. These unlayered rules override that gap.
|
|
57
|
+
*/
|
|
58
|
+
:global(.breadcrumbs > ul),
|
|
59
|
+
:global(.breadcrumbs > ol),
|
|
60
|
+
:global(.breadcrumbs > menu) {
|
|
61
|
+
display: flex;
|
|
62
|
+
align-items: center;
|
|
63
|
+
white-space: nowrap;
|
|
64
|
+
overflow-x: auto;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
:global(.breadcrumbs > ul > li),
|
|
68
|
+
:global(.breadcrumbs > ol > li),
|
|
69
|
+
:global(.breadcrumbs > menu > li) {
|
|
70
|
+
display: flex;
|
|
71
|
+
align-items: center;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
:global(.breadcrumbs > ul > li + li::before),
|
|
75
|
+
:global(.breadcrumbs > ol > li + li::before),
|
|
76
|
+
:global(.breadcrumbs > menu > li + li::before) {
|
|
77
|
+
content: '';
|
|
78
|
+
display: block;
|
|
79
|
+
opacity: 0.4;
|
|
80
|
+
border-top: 1px solid;
|
|
81
|
+
border-right: 1px solid;
|
|
82
|
+
width: 0.375rem;
|
|
83
|
+
height: 0.375rem;
|
|
84
|
+
margin-inline: 0.5rem 0.75rem;
|
|
85
|
+
rotate: 45deg;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/*
|
|
89
|
+
* Tailwind preflight sets svg { display: block }, which stacks icons above
|
|
90
|
+
* labels when the <a>/<span> inline-flex class isn't generated from node_modules.
|
|
91
|
+
*/
|
|
92
|
+
:global(.breadcrumbs > ul > li > a),
|
|
93
|
+
:global(.breadcrumbs > ul > li > span),
|
|
94
|
+
:global(.breadcrumbs > ol > li > a),
|
|
95
|
+
:global(.breadcrumbs > ol > li > span),
|
|
96
|
+
:global(.breadcrumbs > menu > li > a),
|
|
97
|
+
:global(.breadcrumbs > menu > li > span) {
|
|
98
|
+
display: inline-flex;
|
|
99
|
+
align-items: center;
|
|
100
|
+
gap: 0.5rem;
|
|
101
|
+
}
|
|
102
|
+
</style>
|
|
@@ -24,6 +24,41 @@
|
|
|
24
24
|
function next() {
|
|
25
25
|
if (page < totalPages) page++;
|
|
26
26
|
}
|
|
27
|
+
|
|
28
|
+
function buildPages(current: number, total: number): number[] {
|
|
29
|
+
if (total <= 7) return Array.from({ length: total }, (_, i) => i + 1);
|
|
30
|
+
|
|
31
|
+
const visible = new Set<number>();
|
|
32
|
+
visible.add(1);
|
|
33
|
+
visible.add(total);
|
|
34
|
+
for (let i = Math.max(1, current - 2); i <= Math.min(total, current + 2); i++) {
|
|
35
|
+
visible.add(i);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const sorted = Array.from(visible).sort((a, b) => a - b);
|
|
39
|
+
const result: number[] = [];
|
|
40
|
+
for (let i = 0; i < sorted.length; i++) {
|
|
41
|
+
if (i > 0 && sorted[i] - sorted[i - 1] > 1) result.push(0);
|
|
42
|
+
result.push(sorted[i]);
|
|
43
|
+
}
|
|
44
|
+
return result;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const pages = $derived(buildPages(page, totalPages));
|
|
48
|
+
|
|
49
|
+
function handlePageInput(e: KeyboardEvent) {
|
|
50
|
+
if (e.key !== 'Enter') return;
|
|
51
|
+
const val = parseInt((e.currentTarget as HTMLInputElement).value);
|
|
52
|
+
if (!isNaN(val) && val >= 1 && val <= totalPages) {
|
|
53
|
+
page = val;
|
|
54
|
+
} else {
|
|
55
|
+
(e.currentTarget as HTMLInputElement).value = String(page);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function resetInput(e: FocusEvent) {
|
|
60
|
+
(e.currentTarget as HTMLInputElement).value = String(page);
|
|
61
|
+
}
|
|
27
62
|
</script>
|
|
28
63
|
|
|
29
64
|
{#if totalPages > 1}
|
|
@@ -33,30 +68,28 @@
|
|
|
33
68
|
</span>
|
|
34
69
|
|
|
35
70
|
<div class="join">
|
|
36
|
-
<Button
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
71
|
+
<Button class="join-item btn-sm" disabled={page === 1} onclick={prev}>«</Button>
|
|
72
|
+
|
|
73
|
+
{#each pages as p, i (i)}
|
|
74
|
+
{#if p === 0}
|
|
75
|
+
<Button class="join-item btn-sm" disabled>…</Button>
|
|
76
|
+
{:else if p === page}
|
|
77
|
+
<input
|
|
78
|
+
type="number"
|
|
79
|
+
class="join-item btn btn-sm w-12 text-center appearance-none"
|
|
80
|
+
style="background-color: var(--color-base-100);"
|
|
81
|
+
min="1"
|
|
82
|
+
max={totalPages}
|
|
83
|
+
value={page}
|
|
84
|
+
onkeydown={handlePageInput}
|
|
85
|
+
onblur={resetInput}
|
|
86
|
+
/>
|
|
87
|
+
{:else}
|
|
88
|
+
<Button class="join-item btn-sm" onclick={() => (page = p)}>{p}</Button>
|
|
89
|
+
{/if}
|
|
51
90
|
{/each}
|
|
52
91
|
|
|
53
|
-
<Button
|
|
54
|
-
class="join-item btn-sm"
|
|
55
|
-
disabled={page === totalPages}
|
|
56
|
-
onclick={next}
|
|
57
|
-
>
|
|
58
|
-
»
|
|
59
|
-
</Button>
|
|
92
|
+
<Button class="join-item btn-sm" disabled={page === totalPages} onclick={next}>»</Button>
|
|
60
93
|
</div>
|
|
61
94
|
</div>
|
|
62
95
|
{/if}
|