@vexcms/next 0.1.0-alpha.2

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/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,96 @@
1
+ # @vexcms/admin-next
2
+
3
+ The admin panel for [VEX CMS](https://github.com/ianyimi/vex), built for Next.js. Provides a complete content management interface with collection CRUD, media management, versioning, live preview, access control, and user impersonation.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pnpm add @vexcms/admin-next
9
+ ```
10
+
11
+ ## Quick Setup
12
+
13
+ ```tsx
14
+ // app/admin/[[...path]]/page.tsx
15
+ import { AdminLayout, AdminPage } from "@vexcms/admin-next"
16
+ import config from "@/vex.config"
17
+
18
+ export default function Admin({ params }) {
19
+ return (
20
+ <AdminLayout config={config} user={user}>
21
+ <AdminPage config={config} path={params.path} />
22
+ </AdminLayout>
23
+ )
24
+ }
25
+ ```
26
+
27
+ ## Features
28
+
29
+ ### Collection Management
30
+
31
+ - **List view** — Paginated data table with search, sorting, bulk delete, and configurable columns
32
+ - **Edit view** — Auto-generated forms from collection schema with field validation via TanStack React Form
33
+ - **Create/delete** — Dialogs for document creation and deletion with permission checks
34
+ - **Bidirectional pagination** — Instant access to first and last pages
35
+
36
+ ### Media Management
37
+
38
+ - **Grid/list views** — Browse media files with thumbnails
39
+ - **Upload** — Drag-and-drop upload with file type detection
40
+ - **Media picker** — Inline picker for upload and relationship fields with search and pagination
41
+ - **Image dimensions** — Auto-detected on upload
42
+
43
+ ### Versioning & Drafts
44
+
45
+ - **Draft/publish workflow** — Status badges, publish/unpublish actions
46
+ - **Version history** — Dropdown to view, restore, or delete previous versions
47
+ - **Autosave** — Configurable auto-save interval for draft documents
48
+
49
+ ### Live Preview
50
+
51
+ - **Side-by-side panel** — Preview content changes in an iframe alongside the editor
52
+ - **Responsive breakpoints** — Test at different screen sizes
53
+ - **Snapshot system** — Transient preview data without saving to database
54
+
55
+ ### Access Control
56
+
57
+ - **Permission provider** — React context for role-based access control
58
+ - **Field-level permissions** — Read-only fields based on user roles
59
+ - **Collection-level permissions** — Control create, read, update, delete per collection
60
+ - **UI enforcement** — Buttons and actions hidden/disabled based on permissions
61
+
62
+ ### User Impersonation
63
+
64
+ - **Impersonation banner** — Shows when an admin is viewing as another user
65
+ - **User switching** — Select from impersonatable users list
66
+
67
+ ### Admin Layout
68
+
69
+ - **Sidebar navigation** — Collections grouped by `admin.group`, with auth and media sections
70
+ - **Theme support** — Light/dark mode
71
+ - **User menu** — Profile, sign out, impersonation controls
72
+
73
+ ## Exports
74
+
75
+ | Export | Description |
76
+ |--------|-------------|
77
+ | `AdminPage` | Main routing component — renders the correct view based on URL path |
78
+ | `AdminLayout` | Server-side layout wrapper with sidebar and theme |
79
+ | `PermissionProvider` | React context provider for RBAC |
80
+ | `usePermission` | Hook to check a single action permission |
81
+ | `usePermissions` | Hook to check all CRUD permissions for a resource |
82
+ | `usePermissionContext` | Hook to access the full permission context |
83
+ | `ImpersonationBanner` | Banner component for admin impersonation |
84
+ | `useMediaPickerState` | Hook for media picker state management |
85
+
86
+ ## Peer Dependencies
87
+
88
+ - `next` — Next.js 14+
89
+ - `react` / `react-dom` — React 18+
90
+ - `convex` — Convex backend
91
+ - `@convex-dev/react-query` — Convex React Query integration
92
+ - `@tanstack/react-query` — Data fetching
93
+ - `@tanstack/react-form` — Form state management
94
+ - `@tanstack/react-table` — Table component
95
+ - `nuqs` — URL query string state
96
+ - `zod` — Schema validation
@@ -0,0 +1,53 @@
1
+ import type { ReactNode } from "react";
2
+ import type { VexConfig } from "@vexcms/core";
3
+ import type { AdminUser } from "@vexcms/react";
4
+ /**
5
+ * Next.js admin layout shell for VexCMS.
6
+ *
7
+ * A **server component** that sits on the server→client boundary for the admin
8
+ * panel. It sanitizes the resolved `vex.config` with `sanitizeConfigForClient`
9
+ * — stripping storage adapter class instances, functions, and React components
10
+ * — *before* the config is handed to the client leaf `NextAdminLayoutClient`.
11
+ *
12
+ * This placement is the whole point: React serializes props when a server
13
+ * component renders a client component, so the sanitize **must** happen on the
14
+ * server side of that edge. Sanitizing inside the client component would run
15
+ * too late — the raw config would already have failed to serialize.
16
+ *
17
+ * The client leaf handles everything that needs the browser (`usePathname`,
18
+ * `NuqsAdapter`, `NextLink`/`NextImage`); this wrapper does no client work.
19
+ *
20
+ * Render it from your admin `layout.tsx`. Because this is a server component,
21
+ * your `layout.tsx` may itself be an `async` server component (e.g. to run auth
22
+ * checks) and pass the **raw** `vex.config` straight through — no sanitize
23
+ * needed on the application side.
24
+ *
25
+ * @param props - Layout props
26
+ * @param props.config - The resolved VexCMS config from `vex.config.ts` (raw)
27
+ * @param props.children - The page content from `[[...slug]]/page.tsx`
28
+ * @param props.user - Current user for the admin shell
29
+ *
30
+ * @example
31
+ * ```tsx
32
+ * // app/admin/layout.tsx
33
+ * import { NextAdminLayout } from "@vexcms/next/client";
34
+ * import config from "~/vex.config";
35
+ * import { getCurrentUser } from "~/auth/serverUtils";
36
+ *
37
+ * export default async function AdminLayout({ children }: { children: ReactNode }) {
38
+ * const user = await getCurrentUser();
39
+ * return (
40
+ * <NextAdminLayout config={config} user={user ?? undefined}>
41
+ * {children}
42
+ * </NextAdminLayout>
43
+ * );
44
+ * }
45
+ * ```
46
+ */
47
+ export declare function NextAdminLayout(props: {
48
+ config: VexConfig;
49
+ children: ReactNode;
50
+ user?: AdminUser;
51
+ organization?: Record<string, unknown>;
52
+ }): Promise<import("react").JSX.Element>;
53
+ //# sourceMappingURL=NextAdminLayout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NextAdminLayout.d.ts","sourceRoot":"","sources":["../src/NextAdminLayout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAI/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,wBAAsB,eAAe,CAAC,KAAK,EAAE;IAC3C,MAAM,EAAE,SAAS,CAAC;IAClB,QAAQ,EAAE,SAAS,CAAC;IACpB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACxC,wCAmBA"}
@@ -0,0 +1,24 @@
1
+ // src/NextAdminLayout.tsx
2
+ import { sanitizeConfigForClient } from "@vexcms/core";
3
+ import { NextAdminLayoutClient } from "./NextAdminLayoutClient";
4
+ import { cookies } from "next/headers";
5
+ import { jsx } from "react/jsx-runtime";
6
+ async function NextAdminLayout(props) {
7
+ const clientConfig = sanitizeConfigForClient(props.config);
8
+ const cookieStore = await cookies();
9
+ const sidebarOpen = String(cookieStore.get("sidebar_state")?.value) === "true";
10
+ return /* @__PURE__ */ jsx(
11
+ NextAdminLayoutClient,
12
+ {
13
+ config: clientConfig,
14
+ user: props.user,
15
+ organization: props.organization,
16
+ sidebarOpen,
17
+ children: props.children
18
+ }
19
+ );
20
+ }
21
+ export {
22
+ NextAdminLayout
23
+ };
24
+ //# sourceMappingURL=NextAdminLayout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/NextAdminLayout.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport type { VexConfig } from \"@vexcms/core\";\nimport { sanitizeConfigForClient } from \"@vexcms/core\";\nimport type { AdminUser } from \"@vexcms/react\";\nimport { NextAdminLayoutClient } from \"./NextAdminLayoutClient\";\nimport { cookies } from \"next/headers\";\n\n/**\n * Next.js admin layout shell for VexCMS.\n *\n * A **server component** that sits on the server→client boundary for the admin\n * panel. It sanitizes the resolved `vex.config` with `sanitizeConfigForClient`\n * — stripping storage adapter class instances, functions, and React components\n * — *before* the config is handed to the client leaf `NextAdminLayoutClient`.\n *\n * This placement is the whole point: React serializes props when a server\n * component renders a client component, so the sanitize **must** happen on the\n * server side of that edge. Sanitizing inside the client component would run\n * too late — the raw config would already have failed to serialize.\n *\n * The client leaf handles everything that needs the browser (`usePathname`,\n * `NuqsAdapter`, `NextLink`/`NextImage`); this wrapper does no client work.\n *\n * Render it from your admin `layout.tsx`. Because this is a server component,\n * your `layout.tsx` may itself be an `async` server component (e.g. to run auth\n * checks) and pass the **raw** `vex.config` straight through — no sanitize\n * needed on the application side.\n *\n * @param props - Layout props\n * @param props.config - The resolved VexCMS config from `vex.config.ts` (raw)\n * @param props.children - The page content from `[[...slug]]/page.tsx`\n * @param props.user - Current user for the admin shell\n *\n * @example\n * ```tsx\n * // app/admin/layout.tsx\n * import { NextAdminLayout } from \"@vexcms/next/client\";\n * import config from \"~/vex.config\";\n * import { getCurrentUser } from \"~/auth/serverUtils\";\n *\n * export default async function AdminLayout({ children }: { children: ReactNode }) {\n * const user = await getCurrentUser();\n * return (\n * <NextAdminLayout config={config} user={user ?? undefined}>\n * {children}\n * </NextAdminLayout>\n * );\n * }\n * ```\n */\nexport async function NextAdminLayout(props: {\n config: VexConfig;\n children: ReactNode;\n user?: AdminUser;\n organization?: Record<string, unknown>;\n}) {\n // Sanitize on the SERVER side of the server→client boundary, before the\n // config is serialized as a prop into the client leaf. This removes the\n // storage adapter class instances that would otherwise crash RSC\n // serialization (\"Classes or null prototypes are not supported\").\n const clientConfig = sanitizeConfigForClient(props.config);\n const cookieStore = await cookies();\n const sidebarOpen = String(cookieStore.get(\"sidebar_state\")?.value) === \"true\";\n\n return (\n <NextAdminLayoutClient\n config={clientConfig}\n user={props.user}\n organization={props.organization}\n sidebarOpen={sidebarOpen}\n >\n {props.children}\n </NextAdminLayoutClient>\n );\n}\n"],"mappings":";AAEA,SAAS,+BAA+B;AAExC,SAAS,6BAA6B;AACtC,SAAS,eAAe;AA4DpB;AAfJ,eAAsB,gBAAgB,OAKnC;AAKD,QAAM,eAAe,wBAAwB,MAAM,MAAM;AACzD,QAAM,cAAc,MAAM,QAAQ;AAClC,QAAM,cAAc,OAAO,YAAY,IAAI,eAAe,GAAG,KAAK,MAAM;AAExE,SACE;AAAA,IAAC;AAAA;AAAA,MACC,QAAQ;AAAA,MACR,MAAM,MAAM;AAAA,MACZ,cAAc,MAAM;AAAA,MACpB;AAAA,MAEC,gBAAM;AAAA;AAAA,EACT;AAEJ;","names":[]}
@@ -0,0 +1,35 @@
1
+ import type { ReactNode } from "react";
2
+ import type { ClientVexConfig } from "@vexcms/core";
3
+ import { type AdminUser } from "@vexcms/react";
4
+ /**
5
+ * Client leaf for the Next.js admin layout.
6
+ *
7
+ * Owns all client-only wiring that cannot run on the server:
8
+ * - `usePathname()` to derive the active collection slug / document id for
9
+ * sidebar highlighting (Next.js layouts do not receive route params).
10
+ * - `NuqsAdapter` (`nuqs/adapters/next/app`) so URL state works inside the
11
+ * admin routes.
12
+ * - `NextLink` / `NextImage` passed as framework components so every
13
+ * `VexLink`/`VexImage` uses Next.js routing and image optimisation.
14
+ *
15
+ * **Receives an already-sanitized `ClientVexConfig`.** The server wrapper
16
+ * ({@link NextAdminLayout}) calls `sanitizeConfigForClient` before this
17
+ * component is reached, so no non-serializable values (storage adapter class
18
+ * instances, functions, React components) cross the server→client boundary.
19
+ *
20
+ * This component is internal to `@vexcms/next` — applications render
21
+ * {@link NextAdminLayout} instead.
22
+ *
23
+ * @param props - Layout props
24
+ * @param props.config - Sanitized config, safe to serialize across the boundary
25
+ * @param props.children - The page content from `[[...slug]]/page.tsx`
26
+ * @param props.user - Current user for the admin shell
27
+ */
28
+ export declare function NextAdminLayoutClient(props: {
29
+ config: ClientVexConfig;
30
+ children: ReactNode;
31
+ user?: AdminUser;
32
+ organization?: Record<string, unknown>;
33
+ sidebarOpen?: boolean;
34
+ }): import("react").JSX.Element;
35
+ //# sourceMappingURL=NextAdminLayoutClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NextAdminLayoutClient.d.ts","sourceRoot":"","sources":["../src/NextAdminLayoutClient.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAKpD,OAAO,EAAe,KAAK,SAAS,EAAE,MAAM,eAAe,CAAC;AAE5D;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE;IAC3C,MAAM,EAAE,eAAe,CAAC;IACxB,QAAQ,EAAE,SAAS,CAAC;IACpB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACvC,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,+BAwBA"}
@@ -0,0 +1,34 @@
1
+ "use client";
2
+ "use client";
3
+
4
+ // src/NextAdminLayoutClient.tsx
5
+ import { usePathname } from "next/navigation";
6
+ import NextLink from "next/link";
7
+ import NextImage from "next/image";
8
+ import { NuqsAdapter } from "nuqs/adapters/next/app";
9
+ import { AdminLayout } from "@vexcms/react";
10
+ import { jsx } from "react/jsx-runtime";
11
+ function NextAdminLayoutClient(props) {
12
+ const pathname = usePathname();
13
+ const segments = pathname.split("/").filter(Boolean);
14
+ const activeSlug = segments[1];
15
+ const activeDocID = segments[2];
16
+ return /* @__PURE__ */ jsx(NuqsAdapter, { children: /* @__PURE__ */ jsx(
17
+ AdminLayout,
18
+ {
19
+ config: props.config,
20
+ activeSlug,
21
+ components: { Link: NextLink, Image: NextImage },
22
+ pathname,
23
+ activeDocID,
24
+ user: props.user,
25
+ organization: props.organization,
26
+ sidebarOpen: props.sidebarOpen,
27
+ children: props.children
28
+ }
29
+ ) });
30
+ }
31
+ export {
32
+ NextAdminLayoutClient
33
+ };
34
+ //# sourceMappingURL=NextAdminLayoutClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/NextAdminLayoutClient.tsx"],"sourcesContent":["\"use client\";\n// \"use client\" is injected by the tsup build banner for this entry (see\n// tsup.config.ts) so the emitted module carries the client boundary.\nimport type { ReactNode } from \"react\";\nimport type { ClientVexConfig } from \"@vexcms/core\";\nimport { usePathname } from \"next/navigation\";\nimport NextLink from \"next/link\";\nimport NextImage from \"next/image\";\nimport { NuqsAdapter } from \"nuqs/adapters/next/app\";\nimport { AdminLayout, type AdminUser } from \"@vexcms/react\";\n\n/**\n * Client leaf for the Next.js admin layout.\n *\n * Owns all client-only wiring that cannot run on the server:\n * - `usePathname()` to derive the active collection slug / document id for\n * sidebar highlighting (Next.js layouts do not receive route params).\n * - `NuqsAdapter` (`nuqs/adapters/next/app`) so URL state works inside the\n * admin routes.\n * - `NextLink` / `NextImage` passed as framework components so every\n * `VexLink`/`VexImage` uses Next.js routing and image optimisation.\n *\n * **Receives an already-sanitized `ClientVexConfig`.** The server wrapper\n * ({@link NextAdminLayout}) calls `sanitizeConfigForClient` before this\n * component is reached, so no non-serializable values (storage adapter class\n * instances, functions, React components) cross the server→client boundary.\n *\n * This component is internal to `@vexcms/next` — applications render\n * {@link NextAdminLayout} instead.\n *\n * @param props - Layout props\n * @param props.config - Sanitized config, safe to serialize across the boundary\n * @param props.children - The page content from `[[...slug]]/page.tsx`\n * @param props.user - Current user for the admin shell\n */\nexport function NextAdminLayoutClient(props: {\n config: ClientVexConfig;\n children: ReactNode;\n user?: AdminUser;\n organization?: Record<string, unknown>;\n sidebarOpen?: boolean;\n}) {\n const pathname = usePathname();\n // pathname: \"/admin\", \"/admin/posts\", \"/admin/posts/123\"\n // Split on \"/\" and take the segment after \"admin\"\n const segments = pathname.split(\"/\").filter(Boolean);\n const activeSlug = segments[1]; // undefined on /admin, \"posts\" on /admin/posts\n const activeDocID = segments[2];\n\n return (\n <NuqsAdapter>\n <AdminLayout\n config={props.config}\n activeSlug={activeSlug}\n components={{ Link: NextLink, Image: NextImage }}\n pathname={pathname}\n activeDocID={activeDocID}\n user={props.user}\n organization={props.organization}\n sidebarOpen={props.sidebarOpen}\n >\n {props.children}\n </AdminLayout>\n </NuqsAdapter>\n );\n}\n"],"mappings":";;;;AAKA,SAAS,mBAAmB;AAC5B,OAAO,cAAc;AACrB,OAAO,eAAe;AACtB,SAAS,mBAAmB;AAC5B,SAAS,mBAAmC;AA0CtC;AAhBC,SAAS,sBAAsB,OAMnC;AACD,QAAM,WAAW,YAAY;AAG7B,QAAM,WAAW,SAAS,MAAM,GAAG,EAAE,OAAO,OAAO;AACnD,QAAM,aAAa,SAAS,CAAC;AAC7B,QAAM,cAAc,SAAS,CAAC;AAE9B,SACE,oBAAC,eACC;AAAA,IAAC;AAAA;AAAA,MACC,QAAQ,MAAM;AAAA,MACd;AAAA,MACA,YAAY,EAAE,MAAM,UAAU,OAAO,UAAU;AAAA,MAC/C;AAAA,MACA;AAAA,MACA,MAAM,MAAM;AAAA,MACZ,cAAc,MAAM;AAAA,MACpB,aAAa,MAAM;AAAA,MAElB,gBAAM;AAAA;AAAA,EACT,GACF;AAEJ;","names":[]}
@@ -0,0 +1,45 @@
1
+ import type { VexConfig } from "@vexcms/core";
2
+ /**
3
+ * VexCMS admin page server component for Next.js.
4
+ *
5
+ * An `async` server component that routes by the `[[...slug]]` catch-all
6
+ * params, prefetches Convex data via `fetchQuery`, and renders the correct
7
+ * view component. Does **not** include a layout wrapper — `VexAdminLayout`
8
+ * in `app/admin/layout.tsx` owns the persistent shell.
9
+ *
10
+ * **Route mapping:**
11
+ * | `path` array | View |
12
+ * |---|---|
13
+ * | `[]` or undefined | `DashboardView` |
14
+ * | `[collectionSlug]` | `CollectionListView` with preloaded docs |
15
+ * | `[collectionSlug, "new"]` | `CollectionEditView` (empty form) |
16
+ * | `[collectionSlug, documentId]` | `CollectionEditView` with preloaded doc |
17
+ *
18
+ * @param props - Component props
19
+ * @param props.config - The resolved VexCMS configuration from `vex.config.ts`
20
+ * @param props.params - Next.js 15 async params `{ path?: string[] }`
21
+ * @returns The appropriate admin view for the current URL path.
22
+ *
23
+ * @example
24
+ * ```tsx
25
+ * // app/admin/[[...slug]]/page.tsx
26
+ * import { VexAdminPage } from "@vexcms/next";
27
+ * import config from "../../../../vex.config";
28
+ *
29
+ * export default function AdminPage({
30
+ * params,
31
+ * }: {
32
+ * params: Promise<{ path?: string[] }>;
33
+ * }) {
34
+ * return <VexAdminPage config={config} params={params} />;
35
+ * }
36
+ * ```
37
+ */
38
+ export declare function NextAdminPage(props: {
39
+ config: VexConfig;
40
+ params: Promise<{
41
+ path?: string[];
42
+ }>;
43
+ token?: string;
44
+ }): Promise<import("react").JSX.Element>;
45
+ //# sourceMappingURL=NextAdminPage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NextAdminPage.d.ts","sourceRoot":"","sources":["../src/NextAdminPage.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAoC,SAAS,EAAoB,MAAM,cAAc,CAAC;AAYlG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,wBAAsB,aAAa,CAAC,KAAK,EAAE;IACzC,MAAM,EAAE,SAAS,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC;QAAE,IAAI,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC,CAAC;IACrC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,wCAoIA"}
@@ -0,0 +1,142 @@
1
+ // src/NextAdminPage.tsx
2
+ import { fetchQuery } from "convex/nextjs";
3
+ import { vexConvexApi } from "@vexcms/core";
4
+ import {
5
+ DashboardView,
6
+ CollectionListView,
7
+ CollectionEditView,
8
+ MediaCollectionEditView,
9
+ MediaCollectionListView,
10
+ GlobalsListView,
11
+ GlobalEditView
12
+ } from "@vexcms/react";
13
+ import { sanitizeConfigForClient } from "@vexcms/core";
14
+ import { jsx, jsxs } from "react/jsx-runtime";
15
+ async function NextAdminPage(props) {
16
+ const { path = [] } = await props.params;
17
+ const [collectionSlug, documentId] = path;
18
+ const clientConfig = sanitizeConfigForClient(props.config);
19
+ if (!collectionSlug) {
20
+ return /* @__PURE__ */ jsx(DashboardView, { config: clientConfig });
21
+ }
22
+ if (collectionSlug === "globals") {
23
+ if (!documentId) {
24
+ return /* @__PURE__ */ jsx(GlobalsListView, { config: clientConfig });
25
+ }
26
+ const globalConfig = clientConfig.globals.find((g) => g.slug === documentId);
27
+ if (!globalConfig) {
28
+ return /* @__PURE__ */ jsxs("div", { children: [
29
+ /* @__PURE__ */ jsxs("p", { className: "text-muted-foreground p-6", children: [
30
+ 'Global "',
31
+ documentId,
32
+ '" not found.'
33
+ ] }),
34
+ /* @__PURE__ */ jsx("p", { children: "TODO: add not found view" })
35
+ ] });
36
+ }
37
+ const global = await fetchQuery(
38
+ vexConvexApi.globals.get,
39
+ { slug: globalConfig.slug },
40
+ props.token ? { token: props.token } : void 0
41
+ );
42
+ return /* @__PURE__ */ jsx(GlobalEditView, { global: globalConfig, initialData: global });
43
+ }
44
+ const collection = clientConfig.collections.find((c) => c.slug === collectionSlug);
45
+ const mediaCollection = clientConfig.mediaCollections.find((mc) => mc.slug === collectionSlug);
46
+ if (!collection && !mediaCollection) {
47
+ return /* @__PURE__ */ jsxs("div", { children: [
48
+ /* @__PURE__ */ jsxs("p", { className: "text-muted-foreground p-6", children: [
49
+ 'Collection "',
50
+ collectionSlug,
51
+ '" not found.'
52
+ ] }),
53
+ /* @__PURE__ */ jsx("p", { children: "TODO: add not found view" })
54
+ ] });
55
+ }
56
+ if (mediaCollection && documentId) {
57
+ const initialData2 = await fetchQuery(
58
+ vexConvexApi.get,
59
+ {
60
+ id: documentId,
61
+ collection: mediaCollection.slug
62
+ },
63
+ props.token ? { token: props.token } : void 0
64
+ );
65
+ return /* @__PURE__ */ jsx(
66
+ MediaCollectionEditView,
67
+ {
68
+ collection: mediaCollection,
69
+ documentId,
70
+ initialData: initialData2
71
+ }
72
+ );
73
+ }
74
+ if (mediaCollection) {
75
+ const numItems2 = Math.max(
76
+ mediaCollection.admin.table.serverPageSize,
77
+ mediaCollection.admin.table.defaultPageSize
78
+ );
79
+ const initialData2 = await fetchQuery(
80
+ vexConvexApi.find,
81
+ {
82
+ collection: collectionSlug,
83
+ paginationOpts: {
84
+ numItems: numItems2,
85
+ totalDocs: true,
86
+ cursor: null
87
+ }
88
+ },
89
+ props.token ? { token: props.token } : void 0
90
+ );
91
+ return /* @__PURE__ */ jsx(
92
+ MediaCollectionListView,
93
+ {
94
+ collection: mediaCollection,
95
+ initialData: initialData2
96
+ }
97
+ );
98
+ }
99
+ if (collection && documentId) {
100
+ const initialData2 = await fetchQuery(
101
+ vexConvexApi.get,
102
+ {
103
+ id: documentId,
104
+ collection: collection.slug
105
+ },
106
+ props.token ? { token: props.token } : void 0
107
+ );
108
+ return /* @__PURE__ */ jsx(
109
+ CollectionEditView,
110
+ {
111
+ collection,
112
+ documentId,
113
+ initialData: initialData2
114
+ }
115
+ );
116
+ }
117
+ if (!collection) {
118
+ throw new Error("invalid collection slug");
119
+ }
120
+ const numItems = Math.max(
121
+ collection.admin.table.serverPageSize,
122
+ collection.admin.table.defaultPageSize
123
+ );
124
+ const initialData = await fetchQuery(
125
+ vexConvexApi.findPaginated,
126
+ {
127
+ collection: collectionSlug,
128
+ depth: 1,
129
+ paginationOpts: {
130
+ cursor: null,
131
+ numItems,
132
+ totalDocs: true
133
+ }
134
+ },
135
+ props.token ? { token: props.token } : void 0
136
+ );
137
+ return /* @__PURE__ */ jsx(CollectionListView, { collection, initialData });
138
+ }
139
+ export {
140
+ NextAdminPage
141
+ };
142
+ //# sourceMappingURL=NextAdminPage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/NextAdminPage.tsx"],"sourcesContent":["import { fetchQuery } from \"convex/nextjs\";\nimport { vexConvexApi } from \"@vexcms/core\";\nimport type { CollectionSlug, PaginationResult, VexConfig, VexMediaDocument } from \"@vexcms/core\";\nimport {\n DashboardView,\n CollectionListView,\n CollectionEditView,\n MediaCollectionEditView,\n MediaCollectionListView,\n GlobalsListView,\n GlobalEditView,\n} from \"@vexcms/react\";\nimport { sanitizeConfigForClient } from \"@vexcms/core\";\n\n/**\n * VexCMS admin page server component for Next.js.\n *\n * An `async` server component that routes by the `[[...slug]]` catch-all\n * params, prefetches Convex data via `fetchQuery`, and renders the correct\n * view component. Does **not** include a layout wrapper — `VexAdminLayout`\n * in `app/admin/layout.tsx` owns the persistent shell.\n *\n * **Route mapping:**\n * | `path` array | View |\n * |---|---|\n * | `[]` or undefined | `DashboardView` |\n * | `[collectionSlug]` | `CollectionListView` with preloaded docs |\n * | `[collectionSlug, \"new\"]` | `CollectionEditView` (empty form) |\n * | `[collectionSlug, documentId]` | `CollectionEditView` with preloaded doc |\n *\n * @param props - Component props\n * @param props.config - The resolved VexCMS configuration from `vex.config.ts`\n * @param props.params - Next.js 15 async params `{ path?: string[] }`\n * @returns The appropriate admin view for the current URL path.\n *\n * @example\n * ```tsx\n * // app/admin/[[...slug]]/page.tsx\n * import { VexAdminPage } from \"@vexcms/next\";\n * import config from \"../../../../vex.config\";\n *\n * export default function AdminPage({\n * params,\n * }: {\n * params: Promise<{ path?: string[] }>;\n * }) {\n * return <VexAdminPage config={config} params={params} />;\n * }\n * ```\n */\nexport async function NextAdminPage(props: {\n config: VexConfig;\n params: Promise<{ path?: string[] }>;\n token?: string;\n}) {\n const { path = [] } = await props.params;\n const [collectionSlug, documentId] = path;\n\n // Sanitize config for client components (strips storageAdapters, recursively sanitizes mediaCollections)\n const clientConfig = sanitizeConfigForClient(props.config);\n\n if (!collectionSlug) {\n return <DashboardView config={clientConfig} />;\n }\n\n if (collectionSlug === \"globals\") {\n if (!documentId) {\n return <GlobalsListView config={clientConfig} />;\n }\n // Validate the route param against the registered globals first — the\n // found config's `slug` carries the narrowed GlobalSlug type, so no cast\n // of the raw URL segment is needed downstream.\n const globalConfig = clientConfig.globals.find((g) => g.slug === documentId);\n if (!globalConfig) {\n return (\n <div>\n <p className=\"text-muted-foreground p-6\">Global &quot;{documentId}&quot; not found.</p>\n <p>TODO: add not found view</p>\n </div>\n );\n }\n const global = await fetchQuery(\n vexConvexApi.globals.get,\n { slug: globalConfig.slug },\n props.token ? { token: props.token } : undefined,\n );\n return <GlobalEditView global={globalConfig} initialData={global} />;\n }\n\n const collection = clientConfig.collections.find((c) => c.slug === collectionSlug);\n const mediaCollection = clientConfig.mediaCollections.find((mc) => mc.slug === collectionSlug);\n\n if (!collection && !mediaCollection) {\n return (\n <div>\n <p className=\"text-muted-foreground p-6\">\n Collection &quot;{collectionSlug}&quot; not found.\n </p>\n <p>TODO: add not found view</p>\n </div>\n );\n }\n\n if (mediaCollection && documentId) {\n const initialData = await fetchQuery(\n vexConvexApi.get,\n {\n id: documentId,\n collection: mediaCollection.slug,\n },\n props.token ? { token: props.token } : undefined,\n );\n return (\n <MediaCollectionEditView\n collection={mediaCollection}\n documentId={documentId}\n initialData={initialData as VexMediaDocument | null}\n />\n );\n }\n\n if (mediaCollection) {\n const numItems = Math.max(\n mediaCollection.admin.table.serverPageSize,\n mediaCollection.admin.table.defaultPageSize,\n );\n const initialData = await fetchQuery(\n vexConvexApi.find,\n {\n collection: collectionSlug as CollectionSlug,\n paginationOpts: {\n numItems,\n totalDocs: true,\n cursor: null,\n },\n },\n props.token ? { token: props.token } : undefined,\n );\n return (\n <MediaCollectionListView\n collection={mediaCollection}\n initialData={initialData as PaginationResult<VexMediaDocument>}\n />\n );\n }\n\n if (collection && documentId) {\n const initialData = await fetchQuery(\n vexConvexApi.get,\n {\n id: documentId,\n collection: collection.slug,\n },\n props.token ? { token: props.token } : undefined,\n );\n return (\n <CollectionEditView\n collection={collection}\n documentId={documentId}\n initialData={initialData}\n />\n );\n }\n\n if (!collection) {\n throw new Error(\"invalid collection slug\");\n }\n\n const numItems = Math.max(\n collection.admin.table.serverPageSize,\n collection.admin.table.defaultPageSize,\n );\n const initialData = await fetchQuery(\n vexConvexApi.findPaginated,\n {\n collection: collectionSlug as CollectionSlug,\n depth: 1,\n paginationOpts: {\n cursor: null,\n numItems,\n totalDocs: true,\n },\n },\n props.token ? { token: props.token } : undefined,\n );\n return <CollectionListView collection={collection} initialData={initialData} />;\n}\n"],"mappings":"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","names":["initialData","numItems"]}
@@ -0,0 +1,7 @@
1
+ export * from "./NextAdminPage";
2
+ export * from "./NextAdminLayout";
3
+ export { relationship, defineCollection } from "@vexcms/react";
4
+ export { text, number, select, date, url, checkbox, defineConfig, } from "@vexcms/react";
5
+ export type { AdminUser, RelationshipFieldInput, RelationshipField, AdminCollectionConfigInput, CollectionConfigInput, CollectionConfig, TextField, NumberField, SelectField, DateField, UrlField, CheckboxField, AdminField, CollectionSlug, VexDocument, VexConfig, VexConfigInput, RelationshipPreviewProps, } from "@vexcms/react";
6
+ export type { RelationshipKeysOf, TextKeysOf, SortableKeysOf, RelationshipTargetOf, Populated, PopulateShape, } from "@vexcms/core";
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAyBA,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAGlC,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAG/D,OAAO,EACL,IAAI,EACJ,MAAM,EACN,MAAM,EACN,IAAI,EACJ,GAAG,EACH,QAAQ,EACR,YAAY,GACb,MAAM,eAAe,CAAC;AAMvB,YAAY,EACV,SAAS,EAET,sBAAsB,EACtB,iBAAiB,EACjB,0BAA0B,EAC1B,qBAAqB,EACrB,gBAAgB,EAEhB,SAAS,EACT,WAAW,EACX,WAAW,EACX,SAAS,EACT,QAAQ,EACR,aAAa,EAEb,UAAU,EACV,cAAc,EACd,WAAW,EACX,SAAS,EACT,cAAc,EACd,wBAAwB,GACzB,MAAM,eAAe,CAAC;AAYvB,YAAY,EACV,kBAAkB,EAClB,UAAU,EACV,cAAc,EACd,oBAAoB,EACpB,SAAS,EACT,aAAa,GACd,MAAM,cAAc,CAAC"}
package/package.json ADDED
@@ -0,0 +1,94 @@
1
+ {
2
+ "name": "@vexcms/next",
3
+ "version": "0.1.0-alpha.2",
4
+ "description": "Next.js adapter and admin routes for VexCMS",
5
+ "keywords": [
6
+ "cms",
7
+ "headless-cms",
8
+ "convex",
9
+ "typescript",
10
+ "nextjs"
11
+ ],
12
+ "license": "Apache-2.0",
13
+ "author": "Isaiah Anyimi",
14
+ "homepage": "https://docs.vexcms.dev",
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "git+https://github.com/ianyimi/vex.git",
18
+ "directory": "packages/next"
19
+ },
20
+ "sideEffects": [
21
+ "*.css"
22
+ ],
23
+ "files": [
24
+ "dist",
25
+ "styles.css"
26
+ ],
27
+ "type": "module",
28
+ "main": "./dist/index.js",
29
+ "types": "./dist/index.d.ts",
30
+ "exports": {
31
+ ".": {
32
+ "source": "./src/index.ts",
33
+ "import": "./dist/index.js",
34
+ "types": "./dist/index.d.ts"
35
+ },
36
+ "./server": {
37
+ "source": "./src/NextAdminPage.tsx",
38
+ "import": "./dist/NextAdminPage.js",
39
+ "types": "./dist/NextAdminPage.d.ts"
40
+ },
41
+ "./client": {
42
+ "source": "./src/NextAdminLayout.tsx",
43
+ "import": "./dist/NextAdminLayout.js",
44
+ "types": "./dist/NextAdminLayout.d.ts"
45
+ },
46
+ "./styles": "./styles.css"
47
+ },
48
+ "publishConfig": {
49
+ "access": "public",
50
+ "tag": "alpha"
51
+ },
52
+ "dependencies": {
53
+ "lucide-react": "0.577.0",
54
+ "@vexcms/core": "0.1.0-alpha.2",
55
+ "@vexcms/react": "0.1.0-alpha.2"
56
+ },
57
+ "devDependencies": {
58
+ "@convex-dev/react-query": "0.1.0",
59
+ "@tanstack/react-form": "1.33.1",
60
+ "@tanstack/react-query": "5.101.2",
61
+ "@tanstack/react-table": "8.21.3",
62
+ "@types/node": "20.19.43",
63
+ "@types/react": "19.2.17",
64
+ "@types/react-dom": "19.2.3",
65
+ "convex": "1.44.0",
66
+ "next": "16.3.3",
67
+ "nuqs": "2.9.0",
68
+ "react": "19.2.7",
69
+ "react-dom": "19.2.7",
70
+ "tailwindcss": "4.3.2",
71
+ "tsup": "8.5.1",
72
+ "typescript": "6.0.3",
73
+ "zod": "4.4.3",
74
+ "@vexcms/tsconfig": "0.0.0"
75
+ },
76
+ "peerDependencies": {
77
+ "@convex-dev/react-query": ">=0.1.0 <0.2.0",
78
+ "@tanstack/react-form": ">=1.33.0 <2",
79
+ "@tanstack/react-query": ">=5.0.0 <6",
80
+ "@tanstack/react-table": ">=8.0.0 <9",
81
+ "convex": ">=1.44.0 <2",
82
+ "next": ">=15.0.0",
83
+ "nuqs": ">=2.8.0 <3",
84
+ "react": ">=18.0.0",
85
+ "react-dom": ">=18.0.0",
86
+ "zod": ">=4.0.0 <5"
87
+ },
88
+ "scripts": {
89
+ "build": "tsup && tsc -p tsconfig.build.json --emitDeclarationOnly",
90
+ "dev": "tsup --watch --no-clean",
91
+ "clean": "rm -rf dist",
92
+ "typecheck": "tsc --noEmit -p tsconfig.check.json"
93
+ }
94
+ }
package/styles.css ADDED
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @vexcms/next styles
3
+ *
4
+ * Add once to your app's global CSS:
5
+ * @import "@vexcms/next/styles";
6
+ *
7
+ * This includes all @vexcms/react styles automatically — no separate
8
+ * import needed. All component styles use your app's CSS variables
9
+ * (--background, --foreground, --primary, etc.) so colours stay
10
+ * consistent with your own theme.
11
+ */
12
+ @import "@vexcms/react/styles";
13
+ @source "./dist/**/*.js";