create-guren-app 1.21.3 → 1.22.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-guren-app",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.22.0",
|
|
4
4
|
"description": "Scaffold a Guren app: a Bun-first fullstack TypeScript framework with Laravel-style conventions, Inertia.js + React, Drizzle ORM, and an agent harness for Claude Code and other coding agents.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"guren",
|
|
@@ -21,14 +21,14 @@
|
|
|
21
21
|
"test": "bun test"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@guren/cli": "^2.
|
|
24
|
+
"@guren/cli": "^2.37.0",
|
|
25
25
|
"@guren/core": "^1.27.0",
|
|
26
|
-
"@guren/orm": "^2.16.
|
|
26
|
+
"@guren/orm": "^2.16.2",
|
|
27
27
|
"drizzle-orm": "1.0.0-rc.4",
|
|
28
28
|
"zod": "^4.5.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@guren/testing": "^1.15.
|
|
31
|
+
"@guren/testing": "^1.15.1",
|
|
32
32
|
"bun-types": "^1.3.1",
|
|
33
33
|
"drizzle-kit": "1.0.0-rc.4",
|
|
34
34
|
"oxlint": "~1.81.0",
|
|
@@ -22,10 +22,10 @@
|
|
|
22
22
|
"db:seed": "bunx guren db:seed"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@guren/cli": "^2.
|
|
25
|
+
"@guren/cli": "^2.37.0",
|
|
26
26
|
"@guren/core": "^1.27.0",
|
|
27
27
|
"@guren/inertia-client": "^1.4.0",
|
|
28
|
-
"@guren/orm": "^2.16.
|
|
28
|
+
"@guren/orm": "^2.16.2",
|
|
29
29
|
"@inertiajs/react": "^3.11.0",
|
|
30
30
|
"drizzle-orm": "1.0.0-rc.4",
|
|
31
31
|
"react": "^19.0.0",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"zod": "^4.5.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@guren/testing": "^1.15.
|
|
36
|
+
"@guren/testing": "^1.15.1",
|
|
37
37
|
"@tailwindcss/vite": "^4.2.2",
|
|
38
38
|
"@types/react": "^19.0.0",
|
|
39
39
|
"@types/react-dom": "^19.0.0",
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
// guren-ui: Pagination v1. `guren upgrade` replaces this file only while it is unedited.
|
|
2
|
+
import { Link } from '@inertiajs/react'
|
|
3
|
+
import type { HTMLAttributes } from 'react'
|
|
4
|
+
|
|
5
|
+
/** The `links` a paginator sends (`pagination.links` of `PaginatedPageProps`), read by shape. */
|
|
6
|
+
export interface PaginationLinksLike {
|
|
7
|
+
prev: string | null
|
|
8
|
+
next: string | null
|
|
9
|
+
pages: readonly { page: number; url: string | null; active: boolean }[]
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
type PaginationItem = number | 'gap'
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* The first and last page, `siblings` pages either side of the current one, and a gap between runs.
|
|
16
|
+
* Not exported: a component file that exports a function besides its components loses Vite's Fast Refresh.
|
|
17
|
+
*/
|
|
18
|
+
function paginationItems(current: number, last: number, siblings = 1): PaginationItem[] {
|
|
19
|
+
const shown = new Set([1, last])
|
|
20
|
+
for (let page = current - siblings; page <= current + siblings; page++) {
|
|
21
|
+
if (page >= 1 && page <= last) shown.add(page)
|
|
22
|
+
}
|
|
23
|
+
const items: PaginationItem[] = []
|
|
24
|
+
let previous = 0
|
|
25
|
+
for (const page of [...shown].sort((a, b) => a - b)) {
|
|
26
|
+
// A gap of one page shows that page: "1 … 3" hides no more than "1 2 3" takes.
|
|
27
|
+
if (page - previous === 2) items.push(previous + 1)
|
|
28
|
+
else if (page - previous > 2) items.push('gap')
|
|
29
|
+
items.push(page)
|
|
30
|
+
previous = page
|
|
31
|
+
}
|
|
32
|
+
return items
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const LINK = 'rounded-g-ctl border border-g-line px-3 py-1 text-g-text-2 transition hover:border-g-line-strong hover:text-g-heading'
|
|
36
|
+
// A tint, not the accent fill: the page's one fill is its primary action.
|
|
37
|
+
const CURRENT = 'rounded-g-ctl border border-g-accent-text bg-g-accent-tint px-3 py-1 font-bold text-g-accent-text'
|
|
38
|
+
const DISABLED = 'rounded-g-ctl border border-g-line px-3 py-1 text-g-muted'
|
|
39
|
+
|
|
40
|
+
export interface PaginationProps extends Omit<HTMLAttributes<HTMLElement>, 'children'> {
|
|
41
|
+
links: PaginationLinksLike
|
|
42
|
+
/** Pages shown either side of the current one before a gap. */
|
|
43
|
+
siblings?: number
|
|
44
|
+
previousLabel?: string
|
|
45
|
+
nextLabel?: string
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** Previous, the page numbers and next as Inertia links; renders nothing for a single page. */
|
|
49
|
+
export function Pagination({
|
|
50
|
+
links,
|
|
51
|
+
siblings = 1,
|
|
52
|
+
previousLabel = 'Previous',
|
|
53
|
+
nextLabel = 'Next',
|
|
54
|
+
className,
|
|
55
|
+
'aria-label': label = 'Pagination',
|
|
56
|
+
...props
|
|
57
|
+
}: PaginationProps) {
|
|
58
|
+
if (links.pages.length <= 1) return null
|
|
59
|
+
const byNumber = new Map(links.pages.map((page) => [page.page, page]))
|
|
60
|
+
// A page past the last one marks none active: every number stays a link, the run starts at page 1.
|
|
61
|
+
const current = links.pages.find((page) => page.active)?.page
|
|
62
|
+
const last = links.pages.at(-1)?.page ?? 1
|
|
63
|
+
|
|
64
|
+
return (
|
|
65
|
+
<nav aria-label={label} className={['flex flex-wrap items-center gap-2 font-mono text-sm', className].filter(Boolean).join(' ')} {...props}>
|
|
66
|
+
{links.prev ? <Link href={links.prev} className={LINK}>{previousLabel}</Link> : <span aria-disabled="true" className={DISABLED}>{previousLabel}</span>}
|
|
67
|
+
{paginationItems(current ?? 1, last, siblings).map((item, index) => {
|
|
68
|
+
if (item === 'gap') return <span key={`gap-${index}`} aria-hidden="true" className="px-1 text-g-muted">…</span>
|
|
69
|
+
const url = byNumber.get(item)?.url
|
|
70
|
+
if (item === current) return <span key={item} aria-current="page" className={CURRENT}>{item}</span>
|
|
71
|
+
return url ? <Link key={item} href={url} className={LINK}>{item}</Link> : <span key={item} className={DISABLED}>{item}</span>
|
|
72
|
+
})}
|
|
73
|
+
{links.next ? <Link href={links.next} className={LINK}>{nextLabel}</Link> : <span aria-disabled="true" className={DISABLED}>{nextLabel}</span>}
|
|
74
|
+
</nav>
|
|
75
|
+
)
|
|
76
|
+
}
|