@lexibase/rdx-next 1.0.0-beta.0 → 1.0.0-beta.1
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/dist/runtime/index.d.ts +3 -3
- package/dist/runtime/index.js +58 -35
- package/package.json +1 -1
package/dist/runtime/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
import { RdxRuntimeConfig } from '@lexibase/rdx-types';
|
|
4
4
|
|
|
5
5
|
declare function RdxLayout({ children, config, }: {
|
|
6
6
|
children: ReactNode;
|
|
7
7
|
config: RdxRuntimeConfig;
|
|
8
|
-
}):
|
|
8
|
+
}): react_jsx_runtime.JSX.Element;
|
|
9
9
|
declare function DocsPage({ slug }: {
|
|
10
10
|
slug?: string[];
|
|
11
|
-
}): Promise<
|
|
11
|
+
}): Promise<react_jsx_runtime.JSX.Element>;
|
|
12
12
|
|
|
13
13
|
export { DocsPage, RdxLayout };
|
package/dist/runtime/index.js
CHANGED
|
@@ -3,20 +3,21 @@ import { getDocument, getDocsIndex, getDocsPaths } from "@lexibase/rdx-core";
|
|
|
3
3
|
import { compileMDX } from "next-mdx-remote/rsc";
|
|
4
4
|
import Link from "next/link";
|
|
5
5
|
import { notFound } from "next/navigation";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
7
|
var mdxComponents = {
|
|
7
|
-
h1: (props) => /* @__PURE__ */
|
|
8
|
-
h2: (props) => /* @__PURE__ */
|
|
9
|
-
h3: (props) => /* @__PURE__ */
|
|
10
|
-
p: (props) => /* @__PURE__ */
|
|
11
|
-
ul: (props) => /* @__PURE__ */
|
|
12
|
-
ol: (props) => /* @__PURE__ */
|
|
13
|
-
li: (props) => /* @__PURE__ */
|
|
14
|
-
blockquote: (props) => /* @__PURE__ */
|
|
15
|
-
pre: (props) => /* @__PURE__ */
|
|
16
|
-
code: (props) => /* @__PURE__ */
|
|
8
|
+
h1: (props) => /* @__PURE__ */ jsx("h1", { ...props }),
|
|
9
|
+
h2: (props) => /* @__PURE__ */ jsx("h2", { ...props }),
|
|
10
|
+
h3: (props) => /* @__PURE__ */ jsx("h3", { ...props }),
|
|
11
|
+
p: (props) => /* @__PURE__ */ jsx("p", { ...props }),
|
|
12
|
+
ul: (props) => /* @__PURE__ */ jsx("ul", { ...props }),
|
|
13
|
+
ol: (props) => /* @__PURE__ */ jsx("ol", { ...props }),
|
|
14
|
+
li: (props) => /* @__PURE__ */ jsx("li", { ...props }),
|
|
15
|
+
blockquote: (props) => /* @__PURE__ */ jsx("blockquote", { ...props }),
|
|
16
|
+
pre: (props) => /* @__PURE__ */ jsx("pre", { ...props }),
|
|
17
|
+
code: (props) => /* @__PURE__ */ jsx("code", { ...props }),
|
|
17
18
|
a: ({ href, ...props }) => {
|
|
18
19
|
const isExternal = href?.startsWith("http");
|
|
19
|
-
return /* @__PURE__ */
|
|
20
|
+
return /* @__PURE__ */ jsx(
|
|
20
21
|
"a",
|
|
21
22
|
{
|
|
22
23
|
href,
|
|
@@ -32,22 +33,31 @@ function RdxLayout({
|
|
|
32
33
|
config
|
|
33
34
|
}) {
|
|
34
35
|
const brand = config.navbar?.title || config.title;
|
|
35
|
-
return /* @__PURE__ */
|
|
36
|
-
"
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
36
|
+
return /* @__PURE__ */ jsx("html", { lang: "en", children: /* @__PURE__ */ jsxs("body", { children: [
|
|
37
|
+
/* @__PURE__ */ jsxs("header", { className: "rdx-header", children: [
|
|
38
|
+
/* @__PURE__ */ jsx(Link, { className: "rdx-brand", href: "/docs", children: brand }),
|
|
39
|
+
config.navbar?.actions?.github?.visible && config.navbar.actions.github.url && /* @__PURE__ */ jsx(
|
|
40
|
+
"a",
|
|
41
|
+
{
|
|
42
|
+
className: "rdx-github-link",
|
|
43
|
+
href: config.navbar.actions.github.url,
|
|
44
|
+
rel: "noreferrer",
|
|
45
|
+
target: "_blank",
|
|
46
|
+
children: "GitHub"
|
|
47
|
+
}
|
|
48
|
+
)
|
|
49
|
+
] }),
|
|
50
|
+
children
|
|
51
|
+
] }) });
|
|
45
52
|
}
|
|
46
53
|
async function DocsPage({ slug }) {
|
|
47
54
|
const categories = getDocsIndex();
|
|
48
55
|
const currentSlug = slug?.join("/") || getDocsPaths()[0];
|
|
49
56
|
if (!currentSlug) {
|
|
50
|
-
return /* @__PURE__ */
|
|
57
|
+
return /* @__PURE__ */ jsxs("main", { className: "rdx-empty-state", children: [
|
|
58
|
+
/* @__PURE__ */ jsx("h1", { children: "Your documentation is ready." }),
|
|
59
|
+
/* @__PURE__ */ jsx("p", { children: "Add an `.mdx` file inside `docs/` to create your first page." })
|
|
60
|
+
] });
|
|
51
61
|
}
|
|
52
62
|
const document = getDocument(currentSlug);
|
|
53
63
|
if (!document) notFound();
|
|
@@ -57,19 +67,32 @@ async function DocsPage({ slug }) {
|
|
|
57
67
|
});
|
|
58
68
|
const title = typeof document.frontmatter.title === "string" ? document.frontmatter.title : currentSlug;
|
|
59
69
|
const description = typeof document.frontmatter.description === "string" ? document.frontmatter.description : null;
|
|
60
|
-
return /* @__PURE__ */
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
70
|
+
return /* @__PURE__ */ jsxs("div", { className: "rdx-docs-layout", children: [
|
|
71
|
+
/* @__PURE__ */ jsx("aside", { className: "rdx-sidebar", "aria-label": "Documentation navigation", children: categories.map((category) => /* @__PURE__ */ jsxs("section", { className: "rdx-sidebar-category", children: [
|
|
72
|
+
/* @__PURE__ */ jsx("h2", { children: category.title }),
|
|
73
|
+
/* @__PURE__ */ jsx("ul", { children: category.pages.map((page) => {
|
|
74
|
+
const href = `/docs/${page.slug}`;
|
|
75
|
+
const isCurrentPage = page.slug === currentSlug;
|
|
76
|
+
return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(
|
|
77
|
+
Link,
|
|
78
|
+
{
|
|
79
|
+
"aria-current": isCurrentPage ? "page" : void 0,
|
|
80
|
+
className: isCurrentPage ? "is-active" : void 0,
|
|
81
|
+
href,
|
|
82
|
+
children: page.title
|
|
83
|
+
}
|
|
84
|
+
) }, page.slug);
|
|
85
|
+
}) })
|
|
86
|
+
] }, category.id)) }),
|
|
87
|
+
/* @__PURE__ */ jsxs("main", { className: "rdx-document", children: [
|
|
88
|
+
/* @__PURE__ */ jsxs("header", { className: "rdx-document-header", children: [
|
|
89
|
+
/* @__PURE__ */ jsx("p", { className: "rdx-breadcrumb", children: currentSlug }),
|
|
90
|
+
/* @__PURE__ */ jsx("h1", { children: title }),
|
|
91
|
+
description && /* @__PURE__ */ jsx("p", { className: "rdx-description", children: description })
|
|
92
|
+
] }),
|
|
93
|
+
/* @__PURE__ */ jsx("article", { className: "rdx-mdx-content", children: content })
|
|
94
|
+
] })
|
|
95
|
+
] });
|
|
73
96
|
}
|
|
74
97
|
export {
|
|
75
98
|
DocsPage,
|