next-data-kit 9.9.2 → 10.0.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/MIGRATION.md +43 -0
- package/README.md +107 -782
- package/dist/index.d.ts +79 -111
- package/dist/index.js +98 -205
- package/dist/index.js.map +1 -1
- package/dist/server.d.ts +121 -89
- package/dist/server.js +96 -285
- package/dist/server.js.map +1 -1
- package/package.json +50 -104
- package/registry/r/data-kit.json +58 -0
- package/registry/r/registry.json +23 -0
- package/dist/action-DCmAhOQa.d.cts +0 -196
- package/dist/action-DCmAhOQa.d.ts +0 -196
- package/dist/chunk-5TIEIY7M.cjs +0 -393
- package/dist/chunk-5TIEIY7M.cjs.map +0 -1
- package/dist/chunk-MTJATM72.cjs +0 -2423
- package/dist/chunk-MTJATM72.cjs.map +0 -1
- package/dist/chunk-O377UO7C.js +0 -2379
- package/dist/chunk-O377UO7C.js.map +0 -1
- package/dist/chunk-VFSNUXOW.js +0 -382
- package/dist/chunk-VFSNUXOW.js.map +0 -1
- package/dist/client/components/data-kit-infinity.d.ts +0 -23
- package/dist/client/components/data-kit-infinity.d.ts.map +0 -1
- package/dist/client/components/data-kit-table.d.ts +0 -34
- package/dist/client/components/data-kit-table.d.ts.map +0 -1
- package/dist/client/components/data-kit.d.ts +0 -25
- package/dist/client/components/data-kit.d.ts.map +0 -1
- package/dist/client/components/index.d.ts +0 -4
- package/dist/client/components/index.d.ts.map +0 -1
- package/dist/client/components/ui/button.d.ts +0 -14
- package/dist/client/components/ui/button.d.ts.map +0 -1
- package/dist/client/components/ui/checkbox.d.ts +0 -5
- package/dist/client/components/ui/checkbox.d.ts.map +0 -1
- package/dist/client/components/ui/dropdown-menu.d.ts +0 -28
- package/dist/client/components/ui/dropdown-menu.d.ts.map +0 -1
- package/dist/client/components/ui/index.d.ts +0 -8
- package/dist/client/components/ui/index.d.ts.map +0 -1
- package/dist/client/components/ui/pagination.d.ts +0 -14
- package/dist/client/components/ui/pagination.d.ts.map +0 -1
- package/dist/client/components/ui/popover.d.ts +0 -10
- package/dist/client/components/ui/popover.d.ts.map +0 -1
- package/dist/client/components/ui/select.d.ts +0 -18
- package/dist/client/components/ui/select.d.ts.map +0 -1
- package/dist/client/components/ui/table.d.ts +0 -11
- package/dist/client/components/ui/table.d.ts.map +0 -1
- package/dist/client/context/index.d.ts +0 -22
- package/dist/client/context/index.d.ts.map +0 -1
- package/dist/client/hooks/index.d.ts +0 -7
- package/dist/client/hooks/index.d.ts.map +0 -1
- package/dist/client/hooks/useDataKit.d.ts +0 -9
- package/dist/client/hooks/useDataKit.d.ts.map +0 -1
- package/dist/client/hooks/usePagination.d.ts +0 -18
- package/dist/client/hooks/usePagination.d.ts.map +0 -1
- package/dist/client/hooks/useSelection.d.ts +0 -13
- package/dist/client/hooks/useSelection.d.ts.map +0 -1
- package/dist/client/index.d.ts +0 -11
- package/dist/client/index.d.ts.map +0 -1
- package/dist/client/utils/cn.d.ts +0 -10
- package/dist/client/utils/cn.d.ts.map +0 -1
- package/dist/client/utils/index.d.ts +0 -60
- package/dist/client/utils/index.d.ts.map +0 -1
- package/dist/client.cjs +0 -85
- package/dist/client.cjs.map +0 -1
- package/dist/client.d.cts +0 -62
- package/dist/client.d.ts +0 -7
- package/dist/client.d.ts.map +0 -1
- package/dist/client.js +0 -4
- package/dist/client.js.map +0 -1
- package/dist/index-DUVfK8q6.d.ts +0 -284
- package/dist/index-qXbjvUTB.d.cts +0 -284
- package/dist/index.cjs +0 -300
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -117
- package/dist/internal/hooks.cjs +0 -12
- package/dist/internal/hooks.cjs.map +0 -1
- package/dist/internal/hooks.d.cts +0 -1
- package/dist/internal/hooks.d.ts +0 -1
- package/dist/internal/hooks.js +0 -3
- package/dist/internal/hooks.js.map +0 -1
- package/dist/server/utils.d.ts +0 -52
- package/dist/server/utils.d.ts.map +0 -1
- package/dist/server.cjs +0 -315
- package/dist/server.cjs.map +0 -1
- package/dist/server.d.cts +0 -99
- package/dist/styles.css +0 -2
- package/dist/types/client/component.d.ts +0 -129
- package/dist/types/client/component.d.ts.map +0 -1
- package/dist/types/client/hook.d.ts +0 -116
- package/dist/types/client/hook.d.ts.map +0 -1
- package/dist/types/client/selectable.d.ts +0 -43
- package/dist/types/client/selectable.d.ts.map +0 -1
- package/dist/types/index.cjs +0 -4
- package/dist/types/index.cjs.map +0 -1
- package/dist/types/index.d.cts +0 -291
- package/dist/types/index.d.ts +0 -12
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js +0 -3
- package/dist/types/index.js.map +0 -1
- package/dist/types/next-data-kit.d.ts +0 -95
- package/dist/types/next-data-kit.d.ts.map +0 -1
- package/dist/types/server/action.d.ts +0 -44
- package/dist/types/server/action.d.ts.map +0 -1
- package/dist/types/server/database/mongo.d.ts +0 -56
- package/dist/types/server/database/mongo.d.ts.map +0 -1
- package/dist/useDataKit-XFp3_mUc.d.cts +0 -276
- package/dist/useDataKit-XFp3_mUc.d.ts +0 -276
package/MIGRATION.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Migrating from 9.x to 10.0
|
|
2
|
+
|
|
3
|
+
10.0 is a rewrite. Tables are declared once on the server with only the filters and sorts you allow; the UI moves into your project as a shadcn registry item; the package ships no CSS and no Radix.
|
|
4
|
+
|
|
5
|
+
## What changes
|
|
6
|
+
|
|
7
|
+
| 9.x | 10.0 |
|
|
8
|
+
|---|---|
|
|
9
|
+
| `dataKitServerAction({ model, input, item, filterCustom, … })` | `dataKitDefine({ adapter, filter, sort, page, item })` + `kit.parse` / `kit.query` |
|
|
10
|
+
| `model: UserModel` | `adapter: adapterMongoose({ model: UserModel })` (`.lean()` by default, `hydrate: true` for documents) |
|
|
11
|
+
| `adapter: adapterMemory(items)` | `adapter: adapterMemory({ items })` |
|
|
12
|
+
| `filterCustom: { role: (value) => … }` | `filter: { role: { schema: z.enum([...]), query: (props) => … } }` |
|
|
13
|
+
| `createSearchFilter(['name'])` | `filterSearch({ field: ['name'] })` |
|
|
14
|
+
| client `filters[].configuration` / `filterConfig` | removed: the client can no longer choose a database field |
|
|
15
|
+
| `queryAllowed`, `filterAllowed`, `sortAllowed` | removed: only declared keys exist |
|
|
16
|
+
| `input.query` (exact matches from the client) | `scope: (props) => …` from server-side `context` |
|
|
17
|
+
| `sorts`, column `sortable: { path }`, legacy `sort` | `sort: { field, default }`, `DataKitTable` column `sort` |
|
|
18
|
+
| sort value `1` / `-1` | `direction: 'asc' \| 'desc'` |
|
|
19
|
+
| `limit: { default }`, `maxLimit` | `page: { size: { default, max } }` |
|
|
20
|
+
| result `{ type: 'ITEMS', items, documentTotal }` | `{ items, total, page: { number, size }, sort, filter }` |
|
|
21
|
+
| `DataKitTable` (props for everything) | `DataKitRoot` + `DataKitTable` / `DataKitFilter` / `DataKitPagination` / `DataKitSelection` |
|
|
22
|
+
| `DataKit` (custom layout) | `DataKitRoot` with `children={(kit) => …}` or `useDataKitRoot()` |
|
|
23
|
+
| `DataKitInfinity` | `DataKitRoot append source={{ fetch }}` + `DataKitInfinite` |
|
|
24
|
+
| `selectable: { enabled, actions }` | `DataKitTable selectable` + `DataKitSelection` |
|
|
25
|
+
| `controller` ref (`itemPush`, `itemUpdate`, `itemDelete`, `refetchData`) | `kit.item.push / update / remove`, `kit.refresh()` |
|
|
26
|
+
| `memory: 'search-params'` | default (URL + navigation), or `source={{ fetch, url: true }}` |
|
|
27
|
+
| `memory: 'memory'` | `source={{ fetch }}` |
|
|
28
|
+
| `refetchInterval` | `refetch={{ intervalMs }}` |
|
|
29
|
+
| per-row `state` | plain React state in your copied `DataKitTable` |
|
|
30
|
+
| `useSelection`, `usePagination` | `kit.selection`, `kit.page.count` |
|
|
31
|
+
| `DataKitProvider`, `createDataKitContext` | removed |
|
|
32
|
+
| bundled styles (`ndk:` classes) | removed: your shadcn components and theme |
|
|
33
|
+
| peers: Radix, `cva`, `lucide-react`, zod 3 | peers: `react` 19, `react-dom` 19, `zod` 4, optional `mongoose` |
|
|
34
|
+
| CommonJS build | ESM only |
|
|
35
|
+
|
|
36
|
+
## Steps
|
|
37
|
+
|
|
38
|
+
1. `npm install next-data-kit@10` and remove `@radix-ui/*`, `class-variance-authority` and `react-intersection-observer` if only next-data-kit used them.
|
|
39
|
+
2. Add `"@ndk": "https://unpkg.com/next-data-kit@10/registry/r/{name}.json"` to `registries` in `components.json`, then `npx shadcn add @ndk/data-kit`.
|
|
40
|
+
3. Replace each `dataKitServerAction` with a `dataKitDefine` next to the page that uses it, and give every filter a zod `schema`.
|
|
41
|
+
4. In the page, `kit.parse({ searchParams })` then `kit.query({ input, context })`, and pass the result to the view as `initial`.
|
|
42
|
+
5. Replace `DataKitTable` / `DataKit` / `DataKitInfinity` with `DataKitRoot` and the parts.
|
|
43
|
+
6. Keep a server action only for `source.fetch` (infinite scroll), and check auth in it.
|