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