@lexibase/rdx-next 1.0.0-beta.5 → 1.0.0-beta.7
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/README.md +21 -1
- package/bin/public-assets.mjs +58 -0
- package/bin/rdx.mjs +4 -0
- package/dist/runtime/index.d.ts +2 -1
- package/dist/runtime/index.js +121 -130
- package/package.json +10 -5
- package/postcss.config.mjs +1 -0
- package/src/runtime/styles.css +16 -0
- package/templates/runtime/app/globals.css +4 -369
- package/templates/runtime/app/layout.tsx +5 -1
- package/templates/runtime/next.config.mjs +1 -0
- package/templates/runtime/postcss.config.mjs +1 -0
- package/templates/runtime/tsconfig.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,26 @@
|
|
|
1
|
-
# `@rdx
|
|
1
|
+
# `@lexibase/rdx-next`
|
|
2
2
|
|
|
3
3
|
The official Next.js runtime for RDX documentation projects.
|
|
4
4
|
|
|
5
5
|
It exposes the `rdx` command used by generated projects to create their
|
|
6
6
|
internal `.rdx` application and run Next.js.
|
|
7
|
+
|
|
8
|
+
Generated sites use the same theme and components as the development website,
|
|
9
|
+
through `@lexibase/rdx-ui`: logo, navbar, Radix version dropdown, mobile/desktop
|
|
10
|
+
sidebar, landing page, MDX styles and theme provider. The adapter owns content
|
|
11
|
+
and route data; it does not implement a parallel UI theme.
|
|
12
|
+
|
|
13
|
+
Use `homepage: { enabled: true }` in `rdx.config.ts` for the centered-logo
|
|
14
|
+
homepage, or import a project-owned React component with `homepage.component`.
|
|
15
|
+
Without the option, `/` redirects to `/docs`. Additional content sources from
|
|
16
|
+
explicitly configured plugins enable the shared navbar dropdown.
|
|
17
|
+
|
|
18
|
+
`.rdx/` is generated. Configure the site or edit a project-owned `home.tsx`
|
|
19
|
+
instead of modifying files inside `.rdx/`.
|
|
20
|
+
|
|
21
|
+
Place images, favicon and downloads in the project-root `public/` directory.
|
|
22
|
+
The CLI links `.rdx/public` to it using a junction on Windows or a directory
|
|
23
|
+
symlink elsewhere. `/images/logo.svg` serves `public/images/logo.svg` in dev and
|
|
24
|
+
production. No asset copies are cached and original files are never removed.
|
|
25
|
+
Restart/redeploy production after adding/removing assets. Documentation versions
|
|
26
|
+
share this directory; snapshots do not copy its contents.
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { lstat, mkdir, realpath, symlink, unlink } from 'node:fs/promises'
|
|
2
|
+
import path from 'node:path'
|
|
3
|
+
import process from 'node:process'
|
|
4
|
+
|
|
5
|
+
async function inspect(filePath) {
|
|
6
|
+
try {
|
|
7
|
+
return await lstat(filePath)
|
|
8
|
+
} catch (error) {
|
|
9
|
+
if (error.code === 'ENOENT') return null
|
|
10
|
+
throw error
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/** Link generated Next public/ to project-owned assets; never copy or delete them. */
|
|
15
|
+
export async function preparePublicAssets(projectRoot, runtimeDirectory) {
|
|
16
|
+
const runtime = await inspect(runtimeDirectory)
|
|
17
|
+
if (!runtime?.isDirectory() || runtime.isSymbolicLink())
|
|
18
|
+
throw new Error(
|
|
19
|
+
'.rdx/ must be a real directory, not a symbolic link or junction.'
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
const publicDirectory = path.join(projectRoot, 'public')
|
|
23
|
+
const existing = await inspect(publicDirectory)
|
|
24
|
+
if (existing && (!existing.isDirectory() || existing.isSymbolicLink()))
|
|
25
|
+
throw new Error('public/ must be a real directory in the project root.')
|
|
26
|
+
await mkdir(publicDirectory, { recursive: true })
|
|
27
|
+
|
|
28
|
+
const destination = path.join(runtimeDirectory, 'public')
|
|
29
|
+
const link = await inspect(destination)
|
|
30
|
+
if (link) {
|
|
31
|
+
if (!link.isSymbolicLink())
|
|
32
|
+
throw new Error(
|
|
33
|
+
'Cannot prepare .rdx/public: a file or directory already exists there. Move any assets to the project public/ directory, then remove the conflicting .rdx/public entry and retry. RDX has not removed it.'
|
|
34
|
+
)
|
|
35
|
+
let target
|
|
36
|
+
try {
|
|
37
|
+
target = await realpath(destination)
|
|
38
|
+
} catch (error) {
|
|
39
|
+
if (error.code !== 'ENOENT') throw error
|
|
40
|
+
}
|
|
41
|
+
if (target === (await realpath(publicDirectory))) return
|
|
42
|
+
// Only unlink the internal pointer, never its old target or the user's files.
|
|
43
|
+
await unlink(destination)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const target = process.platform === 'win32' ? publicDirectory : '../public'
|
|
47
|
+
try {
|
|
48
|
+
await symlink(
|
|
49
|
+
target,
|
|
50
|
+
destination,
|
|
51
|
+
process.platform === 'win32' ? 'junction' : 'dir'
|
|
52
|
+
)
|
|
53
|
+
} catch (error) {
|
|
54
|
+
throw new Error(
|
|
55
|
+
`Could not link .rdx/public to public/: ${error.message}. Use a filesystem that supports directory links (junctions on Windows); your public files have not been removed.`
|
|
56
|
+
)
|
|
57
|
+
}
|
|
58
|
+
}
|
package/bin/rdx.mjs
CHANGED
|
@@ -10,6 +10,8 @@ import process from 'node:process'
|
|
|
10
10
|
import { createRdxProject } from '@lexibase/rdx-core/config'
|
|
11
11
|
import { createJiti } from 'jiti'
|
|
12
12
|
|
|
13
|
+
import { preparePublicAssets } from './public-assets.mjs'
|
|
14
|
+
|
|
13
15
|
const supportedCommands = new Set(['dev', 'build', 'start'])
|
|
14
16
|
const command = process.argv[2]
|
|
15
17
|
const commandArgs = process.argv.slice(3)
|
|
@@ -23,6 +25,7 @@ const runtimeDirectory = path.join(projectRoot, '.rdx')
|
|
|
23
25
|
|
|
24
26
|
async function prepareRuntime() {
|
|
25
27
|
await mkdir(runtimeDirectory, { recursive: true })
|
|
28
|
+
await preparePublicAssets(projectRoot, runtimeDirectory)
|
|
26
29
|
await cp(runtimeTemplate, runtimeDirectory, { force: true, recursive: true })
|
|
27
30
|
}
|
|
28
31
|
|
|
@@ -47,6 +50,7 @@ async function main() {
|
|
|
47
50
|
const jiti = createJiti(import.meta.url, {
|
|
48
51
|
moduleCache: false,
|
|
49
52
|
fsCache: false,
|
|
53
|
+
jsx: { runtime: 'automatic' },
|
|
50
54
|
})
|
|
51
55
|
let input
|
|
52
56
|
try {
|
package/dist/runtime/index.d.ts
CHANGED
|
@@ -3,9 +3,10 @@ import { ReactNode } from 'react';
|
|
|
3
3
|
import { RdxProject, RdxRuntimeConfig } from '@lexibase/rdx-types';
|
|
4
4
|
export { createRdxProject, getProjectDocsPaths } from '@lexibase/rdx-core';
|
|
5
5
|
|
|
6
|
-
declare function RdxLayout({ children, config, }: {
|
|
6
|
+
declare function RdxLayout({ children, config, bodyClassName, }: {
|
|
7
7
|
children: ReactNode;
|
|
8
8
|
config: RdxRuntimeConfig;
|
|
9
|
+
bodyClassName?: string;
|
|
9
10
|
}): react_jsx_runtime.JSX.Element;
|
|
10
11
|
declare function HomePage({ project }: {
|
|
11
12
|
project: RdxProject;
|
package/dist/runtime/index.js
CHANGED
|
@@ -5,50 +5,39 @@ import {
|
|
|
5
5
|
getSourceOptions,
|
|
6
6
|
resolveDocsRoute
|
|
7
7
|
} from "@lexibase/rdx-core";
|
|
8
|
+
import { Button } from "@lexibase/rdx-ui/components/button";
|
|
9
|
+
import { DocsSidebar } from "@lexibase/rdx-ui/components/docs-sidebar";
|
|
10
|
+
import { Home } from "@lexibase/rdx-ui/components/home";
|
|
11
|
+
import { Logo } from "@lexibase/rdx-ui/components/logo";
|
|
12
|
+
import { mdxComponents } from "@lexibase/rdx-ui/components/mdx-components";
|
|
13
|
+
import { Navbar } from "@lexibase/rdx-ui/components/navbar";
|
|
14
|
+
import {
|
|
15
|
+
VersionDropdown
|
|
16
|
+
} from "@lexibase/rdx-ui/components/version-dropdown";
|
|
17
|
+
import { ThemeProvider } from "@lexibase/rdx-ui/providers/theme-provider";
|
|
8
18
|
import { compileMDX } from "next-mdx-remote/rsc";
|
|
9
19
|
import Link from "next/link";
|
|
10
20
|
import { notFound, redirect } from "next/navigation";
|
|
11
21
|
import { createRdxProject, getProjectDocsPaths } from "@lexibase/rdx-core";
|
|
12
22
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
13
|
-
var mdxComponents = {
|
|
14
|
-
h1: (props) => /* @__PURE__ */ jsx("h1", { ...props }),
|
|
15
|
-
h2: (props) => /* @__PURE__ */ jsx("h2", { ...props }),
|
|
16
|
-
h3: (props) => /* @__PURE__ */ jsx("h3", { ...props }),
|
|
17
|
-
p: (props) => /* @__PURE__ */ jsx("p", { ...props }),
|
|
18
|
-
ul: (props) => /* @__PURE__ */ jsx("ul", { ...props }),
|
|
19
|
-
ol: (props) => /* @__PURE__ */ jsx("ol", { ...props }),
|
|
20
|
-
li: (props) => /* @__PURE__ */ jsx("li", { ...props }),
|
|
21
|
-
blockquote: (props) => /* @__PURE__ */ jsx("blockquote", { ...props }),
|
|
22
|
-
pre: (props) => /* @__PURE__ */ jsx("pre", { ...props }),
|
|
23
|
-
code: (props) => /* @__PURE__ */ jsx("code", { ...props }),
|
|
24
|
-
a: ({ href, ...props }) => {
|
|
25
|
-
const isExternal = href?.startsWith("http");
|
|
26
|
-
return /* @__PURE__ */ jsx(
|
|
27
|
-
"a",
|
|
28
|
-
{
|
|
29
|
-
href,
|
|
30
|
-
rel: isExternal ? "noreferrer" : void 0,
|
|
31
|
-
target: isExternal ? "_blank" : void 0,
|
|
32
|
-
...props
|
|
33
|
-
}
|
|
34
|
-
);
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
23
|
function RdxLayout({
|
|
38
24
|
children,
|
|
39
|
-
config
|
|
25
|
+
config,
|
|
26
|
+
bodyClassName
|
|
40
27
|
}) {
|
|
41
|
-
return /* @__PURE__ */ jsx(
|
|
42
|
-
|
|
28
|
+
return /* @__PURE__ */ jsx("html", { suppressHydrationWarning: true, lang: config.lang ?? "en", children: /* @__PURE__ */ jsx("body", { className: bodyClassName, children: /* @__PURE__ */ jsxs(
|
|
29
|
+
ThemeProvider,
|
|
43
30
|
{
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
31
|
+
disableTransitionOnChange: true,
|
|
32
|
+
enableSystem: true,
|
|
33
|
+
attribute: "class",
|
|
34
|
+
defaultTheme: config.theme?.defaultTheme ?? "system",
|
|
35
|
+
children: [
|
|
47
36
|
/* @__PURE__ */ jsx("a", { className: "rdx-skip-link", href: "#rdx-main", children: "Skip to content" }),
|
|
48
|
-
children
|
|
49
|
-
]
|
|
37
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-col h-dvh", children })
|
|
38
|
+
]
|
|
50
39
|
}
|
|
51
|
-
);
|
|
40
|
+
) }) });
|
|
52
41
|
}
|
|
53
42
|
function RdxHeader({
|
|
54
43
|
project,
|
|
@@ -56,78 +45,56 @@ function RdxHeader({
|
|
|
56
45
|
}) {
|
|
57
46
|
const { config } = project;
|
|
58
47
|
const { source, slug: currentSlug } = resolveDocsRoute(project, slug);
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
Link,
|
|
84
|
-
{
|
|
85
|
-
href,
|
|
86
|
-
"aria-current": edition.id === source.id ? "true" : void 0,
|
|
87
|
-
children: [
|
|
88
|
-
edition.label,
|
|
89
|
-
edition.badge ? ` (${edition.badge})` : ""
|
|
90
|
-
]
|
|
91
|
-
}
|
|
92
|
-
) }, edition.id);
|
|
93
|
-
}) })
|
|
94
|
-
] }),
|
|
95
|
-
config.navbar?.actions?.github?.visible && config.navbar.actions.github.url && /* @__PURE__ */ jsx(
|
|
96
|
-
"a",
|
|
97
|
-
{
|
|
98
|
-
className: "rdx-github-link",
|
|
99
|
-
href: config.navbar.actions.github.url,
|
|
100
|
-
rel: "noreferrer",
|
|
101
|
-
target: "_blank",
|
|
102
|
-
children: "GitHub"
|
|
103
|
-
}
|
|
104
|
-
)
|
|
105
|
-
] })
|
|
106
|
-
] });
|
|
48
|
+
const options = project.sources.map((edition) => {
|
|
49
|
+
const docs = getSourceOptions(project, edition);
|
|
50
|
+
const destination = currentSlug && getDocument(currentSlug, docs) ? currentSlug : getDocsPaths(docs)[0];
|
|
51
|
+
return {
|
|
52
|
+
id: edition.id,
|
|
53
|
+
label: edition.id === "current" ? "Current" : `Version ${edition.label}`,
|
|
54
|
+
kind: edition.id === "current" ? "live" : edition.badge === "Archived" ? "archived" : "version",
|
|
55
|
+
href: ["/docs", edition.routePrefix, destination].filter(Boolean).join("/")
|
|
56
|
+
};
|
|
57
|
+
});
|
|
58
|
+
const BrandLogo = config.navbar?.logo ?? Logo;
|
|
59
|
+
return /* @__PURE__ */ jsx(
|
|
60
|
+
Navbar,
|
|
61
|
+
{
|
|
62
|
+
title: config.navbar?.title ?? "",
|
|
63
|
+
siteTitle: config.title,
|
|
64
|
+
logo: /* @__PURE__ */ jsx(BrandLogo, { className: "size-5" }),
|
|
65
|
+
homeHref: config.homepage?.enabled ? "/" : "/docs",
|
|
66
|
+
docsHref: ["/docs", source.routePrefix].filter(Boolean).join("/"),
|
|
67
|
+
versionMenu: project.sources.length > 1 ? /* @__PURE__ */ jsx(VersionDropdown, { options, currentId: source.id }) : void 0,
|
|
68
|
+
github: config.navbar?.actions?.github,
|
|
69
|
+
showToggleMode: config.navbar?.actions?.showToggleMode
|
|
70
|
+
}
|
|
71
|
+
);
|
|
107
72
|
}
|
|
108
73
|
function HomePage({ project }) {
|
|
109
74
|
const { config } = project;
|
|
110
75
|
if (!config.homepage?.enabled) redirect("/docs");
|
|
111
76
|
const homepage = config.homepage;
|
|
112
|
-
const
|
|
113
|
-
|
|
114
|
-
];
|
|
77
|
+
const CustomHome = homepage.component;
|
|
78
|
+
const BrandLogo = config.navbar?.logo ?? Logo;
|
|
115
79
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
116
80
|
/* @__PURE__ */ jsx(RdxHeader, { project }),
|
|
117
|
-
/* @__PURE__ */
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
{
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
81
|
+
/* @__PURE__ */ jsx(
|
|
82
|
+
"main",
|
|
83
|
+
{
|
|
84
|
+
id: "rdx-main",
|
|
85
|
+
tabIndex: -1,
|
|
86
|
+
className: "flex-1 min-h-0 overflow-y-auto",
|
|
87
|
+
children: CustomHome ? /* @__PURE__ */ jsx(CustomHome, {}) : /* @__PURE__ */ jsx(
|
|
88
|
+
Home,
|
|
89
|
+
{
|
|
90
|
+
title: homepage.title ?? config.title,
|
|
91
|
+
logo: /* @__PURE__ */ jsx(BrandLogo, { className: "size-52 hover:scale-105 hover:rotate-1 transition-[scale,rotation] duration-1000" }),
|
|
92
|
+
description: homepage.description,
|
|
93
|
+
buttons: homepage.buttons
|
|
94
|
+
}
|
|
95
|
+
)
|
|
96
|
+
}
|
|
97
|
+
)
|
|
131
98
|
] });
|
|
132
99
|
}
|
|
133
100
|
async function DocsPage({
|
|
@@ -140,15 +107,14 @@ async function DocsPage({
|
|
|
140
107
|
document,
|
|
141
108
|
categories
|
|
142
109
|
} = resolveDocsRoute(project, slug);
|
|
143
|
-
if (!currentSlug)
|
|
110
|
+
if (!currentSlug)
|
|
144
111
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
145
112
|
/* @__PURE__ */ jsx(RdxHeader, { project, slug }),
|
|
146
|
-
/* @__PURE__ */ jsxs("main", { id: "rdx-main", tabIndex: -1, className: "
|
|
113
|
+
/* @__PURE__ */ jsxs("main", { id: "rdx-main", tabIndex: -1, className: "p-8", children: [
|
|
147
114
|
/* @__PURE__ */ jsx("h1", { children: "Your documentation is ready." }),
|
|
148
|
-
/* @__PURE__ */ jsx("p", { children: "Add an
|
|
115
|
+
/* @__PURE__ */ jsx("p", { children: "Add an .mdx file inside your configured documentation directory." })
|
|
149
116
|
] })
|
|
150
117
|
] });
|
|
151
|
-
}
|
|
152
118
|
if (!document) notFound();
|
|
153
119
|
const { content } = await compileMDX({
|
|
154
120
|
source: document.content,
|
|
@@ -156,37 +122,62 @@ async function DocsPage({
|
|
|
156
122
|
});
|
|
157
123
|
const title = typeof document.frontmatter.title === "string" ? document.frontmatter.title : currentSlug;
|
|
158
124
|
const description = typeof document.frontmatter.description === "string" ? document.frontmatter.description : null;
|
|
125
|
+
const hrefFor = (pageSlug) => ["/docs", source.routePrefix, pageSlug].filter(Boolean).join("/");
|
|
126
|
+
const sidebarCategories = categories.map((category2) => ({
|
|
127
|
+
title: category2.title,
|
|
128
|
+
links: category2.pages.map((page) => ({
|
|
129
|
+
label: page.title,
|
|
130
|
+
href: hrefFor(page.slug)
|
|
131
|
+
}))
|
|
132
|
+
}));
|
|
133
|
+
const pages = categories.flatMap((category2) => category2.pages);
|
|
134
|
+
const index = pages.findIndex((page) => page.slug === currentSlug);
|
|
135
|
+
const previous = pages[index - 1];
|
|
136
|
+
const next = pages[index + 1];
|
|
137
|
+
const category = categories.find(
|
|
138
|
+
(entry) => entry.pages.some((page) => page.slug === currentSlug)
|
|
139
|
+
);
|
|
159
140
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
160
141
|
/* @__PURE__ */ jsx(RdxHeader, { project, slug }),
|
|
161
|
-
/* @__PURE__ */ jsxs("div", { className: "
|
|
162
|
-
/* @__PURE__ */ jsx(
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
description && /* @__PURE__ */ jsx("p", { className: "rdx-description", children: description })
|
|
142
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-1 min-h-0 overflow-hidden relative", children: [
|
|
143
|
+
/* @__PURE__ */ jsx(
|
|
144
|
+
DocsSidebar,
|
|
145
|
+
{
|
|
146
|
+
categories: sidebarCategories,
|
|
147
|
+
pathname: hrefFor(currentSlug)
|
|
148
|
+
}
|
|
149
|
+
),
|
|
150
|
+
/* @__PURE__ */ jsx("div", { className: "flex-1 h-full overflow-y-auto pt-12 md:pt-0 outline-none", children: /* @__PURE__ */ jsxs("section", { className: "w-full min-h-full px-7 flex flex-col gap-5 pb-8 md:py-8", children: [
|
|
151
|
+
/* @__PURE__ */ jsxs("div", { className: "w-full flex flex-col gap-5 md:mx-auto md:max-w-[860px] pt-14 md:pt-0 flex-1", children: [
|
|
152
|
+
/* @__PURE__ */ jsxs("header", { className: "mb-6", children: [
|
|
153
|
+
source.badge && /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground mb-4", children: source.badge }),
|
|
154
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs text-zinc-600 font-semibold uppercase block -mb-0.5", children: category?.title }),
|
|
155
|
+
/* @__PURE__ */ jsx("h1", { className: "text-4xl uppercase font-bold mb-2", children: title }),
|
|
156
|
+
description && /* @__PURE__ */ jsx("p", { className: "text-sm text-ring max-w-[726px]", children: description })
|
|
157
|
+
] }),
|
|
158
|
+
/* @__PURE__ */ jsx(
|
|
159
|
+
"main",
|
|
160
|
+
{
|
|
161
|
+
id: "rdx-main",
|
|
162
|
+
tabIndex: -1,
|
|
163
|
+
className: "h-full w-full flex-1 max-w-[960px]",
|
|
164
|
+
children: content
|
|
165
|
+
}
|
|
166
|
+
)
|
|
187
167
|
] }),
|
|
188
|
-
/* @__PURE__ */
|
|
189
|
-
|
|
168
|
+
/* @__PURE__ */ jsxs("footer", { className: "flex flex-col", children: [
|
|
169
|
+
/* @__PURE__ */ jsxs("section", { className: "flex items-center justify-between", children: [
|
|
170
|
+
previous ? /* @__PURE__ */ jsx(Button, { variant: "outline", size: "sm", asChild: true, children: /* @__PURE__ */ jsx(Link, { href: hrefFor(previous.slug), children: previous.title }) }) : /* @__PURE__ */ jsx(Button, { variant: "outline", size: "sm", disabled: true, children: "Previous" }),
|
|
171
|
+
next ? /* @__PURE__ */ jsx(Button, { variant: "outline", size: "sm", asChild: true, children: /* @__PURE__ */ jsx(Link, { href: hrefFor(next.slug), children: next.title }) }) : /* @__PURE__ */ jsx(Button, { variant: "outline", size: "sm", disabled: true, children: "Next" })
|
|
172
|
+
] }),
|
|
173
|
+
/* @__PURE__ */ jsx("section", { className: "flex items-center justify-center w-full py-5", children: /* @__PURE__ */ jsxs("p", { className: "text-sm text-muted-foreground", children: [
|
|
174
|
+
"\xA9 ",
|
|
175
|
+
(/* @__PURE__ */ new Date()).getFullYear(),
|
|
176
|
+
" ",
|
|
177
|
+
/* @__PURE__ */ jsx("strong", { children: project.config.title })
|
|
178
|
+
] }) })
|
|
179
|
+
] })
|
|
180
|
+
] }) })
|
|
190
181
|
] })
|
|
191
182
|
] });
|
|
192
183
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lexibase/rdx-next",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.7",
|
|
4
4
|
"description": "The Next.js runtime for RDX documentation projects.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
"rdx": "./bin/rdx.mjs"
|
|
9
9
|
},
|
|
10
10
|
"exports": {
|
|
11
|
+
"./postcss.config": "./postcss.config.mjs",
|
|
12
|
+
"./styles.css": "./src/runtime/styles.css",
|
|
11
13
|
".": {
|
|
12
14
|
"types": "./dist/index.d.ts",
|
|
13
15
|
"import": "./dist/index.js"
|
|
@@ -21,13 +23,16 @@
|
|
|
21
23
|
"bin",
|
|
22
24
|
"dist",
|
|
23
25
|
"templates",
|
|
26
|
+
"postcss.config.mjs",
|
|
27
|
+
"src/runtime/styles.css",
|
|
24
28
|
"README.md"
|
|
25
29
|
],
|
|
26
30
|
"dependencies": {
|
|
27
31
|
"jiti": "^2.6.1",
|
|
28
32
|
"next-mdx-remote": "^5.0.0",
|
|
29
|
-
"@lexibase/rdx-
|
|
30
|
-
"@lexibase/rdx-core": "1.0.0-beta.
|
|
33
|
+
"@lexibase/rdx-ui": "1.0.0-beta.0",
|
|
34
|
+
"@lexibase/rdx-core": "1.0.0-beta.4",
|
|
35
|
+
"@lexibase/rdx-types": "1.0.0-beta.4"
|
|
31
36
|
},
|
|
32
37
|
"peerDependencies": {
|
|
33
38
|
"next": "^15.5.0",
|
|
@@ -55,8 +60,8 @@
|
|
|
55
60
|
"react": "19.1.0",
|
|
56
61
|
"react-dom": "19.1.0",
|
|
57
62
|
"typescript": "5.9.2",
|
|
58
|
-
"@rdx/
|
|
59
|
-
"@rdx/
|
|
63
|
+
"@rdx/eslint-config": "1.0.0",
|
|
64
|
+
"@rdx/typescript-config": "1.0.0"
|
|
60
65
|
},
|
|
61
66
|
"scripts": {
|
|
62
67
|
"build": "tsup src/index.ts src/runtime/index.tsx --format esm --dts --clean --external @lexibase/rdx-core --external @lexibase/rdx-types --external next --external react --external react-dom --external next-mdx-remote",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@lexibase/rdx-ui/postcss.config'
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
@import '@lexibase/rdx-ui/globals.css';
|
|
2
|
+
@source '../../dist/**/*.js';
|
|
3
|
+
|
|
4
|
+
/* Colors, buttons, dropdowns and typography come from the shared UI theme. */
|
|
5
|
+
.rdx-skip-link {
|
|
6
|
+
position: fixed;
|
|
7
|
+
top: -100px;
|
|
8
|
+
left: 16px;
|
|
9
|
+
z-index: 100;
|
|
10
|
+
padding: 12px;
|
|
11
|
+
background: var(--background);
|
|
12
|
+
color: var(--foreground);
|
|
13
|
+
}
|
|
14
|
+
.rdx-skip-link:focus {
|
|
15
|
+
top: 12px;
|
|
16
|
+
}
|
|
@@ -1,369 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
--rdx-border: #e7e7e7;
|
|
6
|
-
--rdx-accent: #f5f5f5;
|
|
7
|
-
--rdx-link: #0f5ed8;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
@media (prefers-color-scheme: dark) {
|
|
11
|
-
:root:not([data-theme='light']) {
|
|
12
|
-
--rdx-background: #121212;
|
|
13
|
-
--rdx-foreground: #f4f4f5;
|
|
14
|
-
--rdx-muted: #a1a1aa;
|
|
15
|
-
--rdx-border: #303033;
|
|
16
|
-
--rdx-accent: #202022;
|
|
17
|
-
--rdx-link: #7bb0ff;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
:root[data-theme='dark'] {
|
|
22
|
-
--rdx-background: #121212;
|
|
23
|
-
--rdx-foreground: #f4f4f5;
|
|
24
|
-
--rdx-muted: #a1a1aa;
|
|
25
|
-
--rdx-border: #303033;
|
|
26
|
-
--rdx-accent: #202022;
|
|
27
|
-
--rdx-link: #7bb0ff;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
.rdx-source-badge {
|
|
31
|
-
color: var(--rdx-muted);
|
|
32
|
-
font-size: 0.85rem;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
* {
|
|
36
|
-
box-sizing: border-box;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
html,
|
|
40
|
-
body {
|
|
41
|
-
margin: 0;
|
|
42
|
-
min-height: 100%;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
body {
|
|
46
|
-
background: var(--rdx-background);
|
|
47
|
-
color: var(--rdx-foreground);
|
|
48
|
-
font-family: Arial, Helvetica, sans-serif;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
a {
|
|
52
|
-
color: inherit;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
.rdx-header {
|
|
56
|
-
align-items: center;
|
|
57
|
-
border-bottom: 1px solid var(--rdx-border);
|
|
58
|
-
display: flex;
|
|
59
|
-
min-height: 64px;
|
|
60
|
-
gap: 16px;
|
|
61
|
-
flex-wrap: wrap;
|
|
62
|
-
justify-content: space-between;
|
|
63
|
-
padding: 12px 24px;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
.rdx-header-actions {
|
|
67
|
-
align-items: center;
|
|
68
|
-
display: flex;
|
|
69
|
-
flex-wrap: wrap;
|
|
70
|
-
gap: 20px;
|
|
71
|
-
font-size: 0.9rem;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
.rdx-header-actions a {
|
|
75
|
-
text-decoration: none;
|
|
76
|
-
}
|
|
77
|
-
.rdx-header-actions a:hover {
|
|
78
|
-
color: var(--rdx-link);
|
|
79
|
-
}
|
|
80
|
-
.rdx-brand {
|
|
81
|
-
overflow-wrap: anywhere;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
:where(a, summary):focus-visible {
|
|
85
|
-
outline: 2px solid var(--rdx-link);
|
|
86
|
-
outline-offset: 4px;
|
|
87
|
-
border-radius: 4px;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
.rdx-skip-link {
|
|
91
|
-
position: fixed;
|
|
92
|
-
top: -100px;
|
|
93
|
-
left: 16px;
|
|
94
|
-
z-index: 20;
|
|
95
|
-
padding: 12px;
|
|
96
|
-
background: var(--rdx-background);
|
|
97
|
-
}
|
|
98
|
-
.rdx-skip-link:focus {
|
|
99
|
-
top: 12px;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
.rdx-version-menu {
|
|
103
|
-
position: relative;
|
|
104
|
-
}
|
|
105
|
-
.rdx-version-menu summary {
|
|
106
|
-
cursor: pointer;
|
|
107
|
-
padding: 8px 12px;
|
|
108
|
-
border: 1px solid var(--rdx-border);
|
|
109
|
-
border-radius: 8px;
|
|
110
|
-
background: var(--rdx-accent);
|
|
111
|
-
}
|
|
112
|
-
.rdx-version-menu ul {
|
|
113
|
-
position: absolute;
|
|
114
|
-
right: 0;
|
|
115
|
-
z-index: 10;
|
|
116
|
-
min-width: 180px;
|
|
117
|
-
max-width: calc(100vw - 48px);
|
|
118
|
-
max-height: 320px;
|
|
119
|
-
overflow: auto;
|
|
120
|
-
list-style: none;
|
|
121
|
-
margin: 8px 0 0;
|
|
122
|
-
padding: 6px;
|
|
123
|
-
border: 1px solid var(--rdx-border);
|
|
124
|
-
border-radius: 10px;
|
|
125
|
-
background: var(--rdx-background);
|
|
126
|
-
box-shadow: 0 8px 24px #0002;
|
|
127
|
-
}
|
|
128
|
-
.rdx-version-menu a {
|
|
129
|
-
display: block;
|
|
130
|
-
padding: 10px;
|
|
131
|
-
border-radius: 6px;
|
|
132
|
-
overflow-wrap: anywhere;
|
|
133
|
-
}
|
|
134
|
-
.rdx-version-menu a:hover,
|
|
135
|
-
.rdx-version-menu a[aria-current] {
|
|
136
|
-
background: var(--rdx-accent);
|
|
137
|
-
}
|
|
138
|
-
.rdx-sidebar-menu > summary {
|
|
139
|
-
display: list-item;
|
|
140
|
-
cursor: pointer;
|
|
141
|
-
font-weight: 600;
|
|
142
|
-
margin-bottom: 20px;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
.rdx-homepage {
|
|
146
|
-
max-width: 1040px;
|
|
147
|
-
margin: 0 auto;
|
|
148
|
-
padding: clamp(72px, 16vh, 160px) 24px;
|
|
149
|
-
text-align: center;
|
|
150
|
-
}
|
|
151
|
-
.rdx-homepage-eyebrow {
|
|
152
|
-
color: var(--rdx-link);
|
|
153
|
-
font-weight: 600;
|
|
154
|
-
}
|
|
155
|
-
.rdx-homepage h1 {
|
|
156
|
-
font-size: clamp(2.5rem, 7vw, 5rem);
|
|
157
|
-
line-height: 1.05;
|
|
158
|
-
letter-spacing: -0.05em;
|
|
159
|
-
margin: 24px 0;
|
|
160
|
-
overflow-wrap: anywhere;
|
|
161
|
-
}
|
|
162
|
-
.rdx-homepage-description {
|
|
163
|
-
color: var(--rdx-muted);
|
|
164
|
-
font-size: 1.2rem;
|
|
165
|
-
line-height: 1.7;
|
|
166
|
-
max-width: 640px;
|
|
167
|
-
margin: 0 auto;
|
|
168
|
-
}
|
|
169
|
-
.rdx-homepage-buttons {
|
|
170
|
-
display: flex;
|
|
171
|
-
flex-wrap: wrap;
|
|
172
|
-
gap: 12px;
|
|
173
|
-
justify-content: center;
|
|
174
|
-
margin-top: 32px;
|
|
175
|
-
}
|
|
176
|
-
.rdx-button {
|
|
177
|
-
border: 1px solid var(--rdx-border);
|
|
178
|
-
border-radius: 8px;
|
|
179
|
-
padding: 14px 20px;
|
|
180
|
-
text-decoration: none;
|
|
181
|
-
font-weight: 600;
|
|
182
|
-
}
|
|
183
|
-
.rdx-button-primary {
|
|
184
|
-
background: var(--rdx-foreground);
|
|
185
|
-
color: var(--rdx-background);
|
|
186
|
-
}
|
|
187
|
-
.rdx-button:hover {
|
|
188
|
-
outline: 2px solid var(--rdx-link);
|
|
189
|
-
outline-offset: 2px;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
.rdx-brand {
|
|
193
|
-
font-size: 1.1rem;
|
|
194
|
-
font-weight: 700;
|
|
195
|
-
text-decoration: none;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
.rdx-github-link {
|
|
199
|
-
color: var(--rdx-muted);
|
|
200
|
-
font-size: 0.9rem;
|
|
201
|
-
text-decoration: none;
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
.rdx-docs-layout {
|
|
205
|
-
display: grid;
|
|
206
|
-
grid-template-columns: minmax(190px, 250px) minmax(0, 1fr);
|
|
207
|
-
min-height: calc(100vh - 64px);
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
.rdx-sidebar {
|
|
211
|
-
border-right: 1px solid var(--rdx-border);
|
|
212
|
-
padding: 24px;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
.rdx-sidebar-category + .rdx-sidebar-category {
|
|
216
|
-
border-top: 1px solid var(--rdx-border);
|
|
217
|
-
margin-top: 20px;
|
|
218
|
-
padding-top: 20px;
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
.rdx-sidebar h2 {
|
|
222
|
-
color: var(--rdx-muted);
|
|
223
|
-
font-size: 0.72rem;
|
|
224
|
-
letter-spacing: 0.08em;
|
|
225
|
-
margin: 0 0 8px;
|
|
226
|
-
text-transform: uppercase;
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
.rdx-sidebar ul {
|
|
230
|
-
list-style: none;
|
|
231
|
-
margin: 0;
|
|
232
|
-
padding: 0;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
.rdx-sidebar a {
|
|
236
|
-
border-radius: 6px;
|
|
237
|
-
display: block;
|
|
238
|
-
font-size: 0.92rem;
|
|
239
|
-
padding: 7px 8px;
|
|
240
|
-
text-decoration: none;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
.rdx-sidebar a:hover,
|
|
244
|
-
.rdx-sidebar a.is-active {
|
|
245
|
-
background: var(--rdx-accent);
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
.rdx-sidebar a.is-active {
|
|
249
|
-
font-weight: 600;
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
.rdx-document,
|
|
253
|
-
.rdx-empty-state {
|
|
254
|
-
margin: 0 auto;
|
|
255
|
-
max-width: 860px;
|
|
256
|
-
padding: 56px 40px 80px;
|
|
257
|
-
width: 100%;
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
.rdx-document-header {
|
|
261
|
-
border-bottom: 1px solid var(--rdx-border);
|
|
262
|
-
margin-bottom: 36px;
|
|
263
|
-
padding-bottom: 28px;
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
.rdx-document-header h1,
|
|
267
|
-
.rdx-mdx-content h1 {
|
|
268
|
-
font-size: clamp(2rem, 5vw, 3rem);
|
|
269
|
-
letter-spacing: -0.04em;
|
|
270
|
-
line-height: 1.1;
|
|
271
|
-
margin: 0;
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
.rdx-breadcrumb {
|
|
275
|
-
color: var(--rdx-muted);
|
|
276
|
-
font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
|
|
277
|
-
font-size: 0.8rem;
|
|
278
|
-
margin: 0 0 12px;
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
.rdx-description {
|
|
282
|
-
color: var(--rdx-muted);
|
|
283
|
-
font-size: 1.05rem;
|
|
284
|
-
line-height: 1.6;
|
|
285
|
-
margin: 14px 0 0;
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
.rdx-mdx-content {
|
|
289
|
-
font-size: 1rem;
|
|
290
|
-
line-height: 1.75;
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
.rdx-mdx-content h2,
|
|
294
|
-
.rdx-mdx-content h3 {
|
|
295
|
-
letter-spacing: -0.02em;
|
|
296
|
-
line-height: 1.25;
|
|
297
|
-
margin: 2.2em 0 0.7em;
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
.rdx-mdx-content p,
|
|
301
|
-
.rdx-mdx-content ul,
|
|
302
|
-
.rdx-mdx-content ol {
|
|
303
|
-
margin: 1em 0;
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
.rdx-mdx-content li + li {
|
|
307
|
-
margin-top: 0.4em;
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
.rdx-mdx-content a {
|
|
311
|
-
color: var(--rdx-link);
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
.rdx-mdx-content blockquote {
|
|
315
|
-
border-left: 3px solid var(--rdx-border);
|
|
316
|
-
color: var(--rdx-muted);
|
|
317
|
-
margin: 1.5em 0;
|
|
318
|
-
padding-left: 16px;
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
.rdx-mdx-content code {
|
|
322
|
-
background: var(--rdx-accent);
|
|
323
|
-
border-radius: 4px;
|
|
324
|
-
font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
|
|
325
|
-
font-size: 0.9em;
|
|
326
|
-
padding: 0.16em 0.35em;
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
.rdx-mdx-content pre {
|
|
330
|
-
background: var(--rdx-accent);
|
|
331
|
-
border: 1px solid var(--rdx-border);
|
|
332
|
-
border-radius: 8px;
|
|
333
|
-
overflow-x: auto;
|
|
334
|
-
padding: 16px;
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
.rdx-mdx-content pre code {
|
|
338
|
-
background: transparent;
|
|
339
|
-
padding: 0;
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
@media (max-width: 720px) {
|
|
343
|
-
.rdx-header {
|
|
344
|
-
padding: 12px 20px;
|
|
345
|
-
}
|
|
346
|
-
.rdx-header-actions {
|
|
347
|
-
gap: 12px;
|
|
348
|
-
}
|
|
349
|
-
.rdx-sidebar-menu > summary {
|
|
350
|
-
display: list-item;
|
|
351
|
-
padding: 4px 0;
|
|
352
|
-
}
|
|
353
|
-
.rdx-sidebar-menu[open] > summary {
|
|
354
|
-
margin-bottom: 20px;
|
|
355
|
-
}
|
|
356
|
-
.rdx-docs-layout {
|
|
357
|
-
display: block;
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
.rdx-sidebar {
|
|
361
|
-
border-bottom: 1px solid var(--rdx-border);
|
|
362
|
-
border-right: 0;
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
.rdx-document,
|
|
366
|
-
.rdx-empty-state {
|
|
367
|
-
padding: 36px 24px 60px;
|
|
368
|
-
}
|
|
369
|
-
}
|
|
1
|
+
@import '@lexibase/rdx-next/styles.css';
|
|
2
|
+
@source '../../home.{ts,tsx}';
|
|
3
|
+
@source '../../components/**/*.{ts,tsx}';
|
|
4
|
+
@source '../../docs/**/*.mdx';
|
|
@@ -18,5 +18,9 @@ export default async function RootLayout({
|
|
|
18
18
|
children,
|
|
19
19
|
}: Readonly<{ children: React.ReactNode }>) {
|
|
20
20
|
const { config } = await getProject()
|
|
21
|
-
return
|
|
21
|
+
return (
|
|
22
|
+
<RdxLayout config={config} bodyClassName="antialiased">
|
|
23
|
+
{children}
|
|
24
|
+
</RdxLayout>
|
|
25
|
+
)
|
|
22
26
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@lexibase/rdx-next/postcss.config'
|