@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.
@@ -1,13 +1,13 @@
1
- import * as react from 'react';
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
- }): react.JSX.Element;
8
+ }): react_jsx_runtime.JSX.Element;
9
9
  declare function DocsPage({ slug }: {
10
10
  slug?: string[];
11
- }): Promise<react.JSX.Element>;
11
+ }): Promise<react_jsx_runtime.JSX.Element>;
12
12
 
13
13
  export { DocsPage, RdxLayout };
@@ -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__ */ React.createElement("h1", { ...props }),
8
- h2: (props) => /* @__PURE__ */ React.createElement("h2", { ...props }),
9
- h3: (props) => /* @__PURE__ */ React.createElement("h3", { ...props }),
10
- p: (props) => /* @__PURE__ */ React.createElement("p", { ...props }),
11
- ul: (props) => /* @__PURE__ */ React.createElement("ul", { ...props }),
12
- ol: (props) => /* @__PURE__ */ React.createElement("ol", { ...props }),
13
- li: (props) => /* @__PURE__ */ React.createElement("li", { ...props }),
14
- blockquote: (props) => /* @__PURE__ */ React.createElement("blockquote", { ...props }),
15
- pre: (props) => /* @__PURE__ */ React.createElement("pre", { ...props }),
16
- code: (props) => /* @__PURE__ */ React.createElement("code", { ...props }),
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__ */ React.createElement(
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__ */ React.createElement("html", { lang: "en" }, /* @__PURE__ */ React.createElement("body", null, /* @__PURE__ */ React.createElement("header", { className: "rdx-header" }, /* @__PURE__ */ React.createElement(Link, { className: "rdx-brand", href: "/docs" }, brand), config.navbar?.actions?.github?.visible && config.navbar.actions.github.url && /* @__PURE__ */ React.createElement(
36
- "a",
37
- {
38
- className: "rdx-github-link",
39
- href: config.navbar.actions.github.url,
40
- rel: "noreferrer",
41
- target: "_blank"
42
- },
43
- "GitHub"
44
- )), children));
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__ */ React.createElement("main", { className: "rdx-empty-state" }, /* @__PURE__ */ React.createElement("h1", null, "Your documentation is ready."), /* @__PURE__ */ React.createElement("p", null, "Add an `.mdx` file inside `docs/` to create your first page."));
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__ */ React.createElement("div", { className: "rdx-docs-layout" }, /* @__PURE__ */ React.createElement("aside", { className: "rdx-sidebar", "aria-label": "Documentation navigation" }, categories.map((category) => /* @__PURE__ */ React.createElement("section", { key: category.id, className: "rdx-sidebar-category" }, /* @__PURE__ */ React.createElement("h2", null, category.title), /* @__PURE__ */ React.createElement("ul", null, category.pages.map((page) => {
61
- const href = `/docs/${page.slug}`;
62
- const isCurrentPage = page.slug === currentSlug;
63
- return /* @__PURE__ */ React.createElement("li", { key: page.slug }, /* @__PURE__ */ React.createElement(
64
- Link,
65
- {
66
- "aria-current": isCurrentPage ? "page" : void 0,
67
- className: isCurrentPage ? "is-active" : void 0,
68
- href
69
- },
70
- page.title
71
- ));
72
- }))))), /* @__PURE__ */ React.createElement("main", { className: "rdx-document" }, /* @__PURE__ */ React.createElement("header", { className: "rdx-document-header" }, /* @__PURE__ */ React.createElement("p", { className: "rdx-breadcrumb" }, currentSlug), /* @__PURE__ */ React.createElement("h1", null, title), description && /* @__PURE__ */ React.createElement("p", { className: "rdx-description" }, description)), /* @__PURE__ */ React.createElement("article", { className: "rdx-mdx-content" }, content)));
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,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lexibase/rdx-next",
3
- "version": "1.0.0-beta.0",
3
+ "version": "1.0.0-beta.1",
4
4
  "description": "The Next.js runtime for RDX documentation projects.",
5
5
  "license": "MIT",
6
6
  "type": "module",