polen 0.10.0-next.17 → 0.10.0-next.19
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/build/api/config/configurator.d.ts +13 -1
- package/build/api/config/configurator.d.ts.map +1 -1
- package/build/api/config/configurator.js +10 -1
- package/build/api/config/configurator.js.map +1 -1
- package/build/api/vite/plugins/pages.d.ts.map +1 -1
- package/build/api/vite/plugins/pages.js +12 -0
- package/build/api/vite/plugins/pages.js.map +1 -1
- package/build/exports/mdx.d.ts +2 -0
- package/build/exports/mdx.d.ts.map +1 -0
- package/build/exports/mdx.js +2 -0
- package/build/exports/mdx.js.map +1 -0
- package/build/lib/graphql-document/components/GraphQLDocument.d.ts +2 -0
- package/build/lib/graphql-document/components/GraphQLDocument.d.ts.map +1 -1
- package/build/lib/graphql-document/components/GraphQLDocument.js +2 -2
- package/build/lib/graphql-document/components/GraphQLDocument.js.map +1 -1
- package/build/template/components/CodeBlock.d.ts +6 -3
- package/build/template/components/CodeBlock.d.ts.map +1 -1
- package/build/template/components/CodeBlock.js +19 -2
- package/build/template/components/CodeBlock.js.map +1 -1
- package/build/template/components/CodeHikePre.d.ts +16 -0
- package/build/template/components/CodeHikePre.d.ts.map +1 -0
- package/build/template/components/CodeHikePre.js +37 -0
- package/build/template/components/CodeHikePre.js.map +1 -0
- package/build/template/layouts/SidebarLayout.d.ts.map +1 -0
- package/build/template/{components/layouts → layouts}/SidebarLayout.js +3 -3
- package/build/template/layouts/SidebarLayout.js.map +1 -0
- package/build/template/layouts/index.d.ts.map +1 -0
- package/build/template/layouts/index.js.map +1 -0
- package/build/template/routes/reference.d.ts.map +1 -1
- package/build/template/routes/reference.js +1 -2
- package/build/template/routes/reference.js.map +1 -1
- package/build/template/routes/root.d.ts.map +1 -1
- package/build/template/routes/root.js +64 -7
- package/build/template/routes/root.js.map +1 -1
- package/package.json +7 -6
- package/src/api/config/configurator.ts +25 -2
- package/src/api/vite/plugins/pages.ts +13 -0
- package/src/exports/mdx.ts +1 -0
- package/src/lib/graphql-document/components/GraphQLDocument.tsx +10 -3
- package/src/template/components/CodeBlock.tsx +29 -13
- package/src/template/components/CodeHikePre.tsx +51 -0
- package/src/template/{components/layouts → layouts}/SidebarLayout.tsx +3 -3
- package/src/template/routes/reference.tsx +1 -2
- package/src/template/routes/root.tsx +99 -8
- package/build/exports/components.d.ts +0 -5
- package/build/exports/components.d.ts.map +0 -1
- package/build/exports/components.js +0 -5
- package/build/exports/components.js.map +0 -1
- package/build/template/components/MDXComponents.d.ts +0 -10
- package/build/template/components/MDXComponents.d.ts.map +0 -1
- package/build/template/components/MDXComponents.js +0 -12
- package/build/template/components/MDXComponents.js.map +0 -1
- package/build/template/components/TestComponent.d.ts +0 -5
- package/build/template/components/TestComponent.d.ts.map +0 -1
- package/build/template/components/TestComponent.js +0 -7
- package/build/template/components/TestComponent.js.map +0 -1
- package/build/template/components/layouts/SidebarLayout.d.ts.map +0 -1
- package/build/template/components/layouts/SidebarLayout.js.map +0 -1
- package/build/template/components/layouts/index.d.ts.map +0 -1
- package/build/template/components/layouts/index.js.map +0 -1
- package/src/exports/components.ts +0 -4
- package/src/template/components/MDXComponents.tsx +0 -17
- package/src/template/components/TestComponent.tsx +0 -6
- /package/build/template/{components/layouts → layouts}/SidebarLayout.d.ts +0 -0
- /package/build/template/{components/layouts → layouts}/index.d.ts +0 -0
- /package/build/template/{components/layouts → layouts}/index.js +0 -0
- /package/src/template/{components/layouts → layouts}/index.ts +0 -0
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "polen",
|
3
|
-
"version": "0.10.0-next.
|
3
|
+
"version": "0.10.0-next.19",
|
4
4
|
"type": "module",
|
5
5
|
"description": "A framework for delightful GraphQL developer portals",
|
6
6
|
"author": {
|
@@ -76,16 +76,15 @@
|
|
76
76
|
".": {
|
77
77
|
"default": "./build/exports/index.js"
|
78
78
|
},
|
79
|
-
"./components": {
|
80
|
-
"import": "./build/exports/components.js",
|
81
|
-
"default": "./build/exports/components.js"
|
82
|
-
},
|
83
79
|
"./polen": {
|
84
80
|
"default": "./build/exports/polen.js"
|
85
81
|
},
|
86
82
|
"./react": {
|
87
83
|
"default": "./build/exports/react.js"
|
88
84
|
},
|
85
|
+
"./mdx": {
|
86
|
+
"default": "./build/exports/mdx.js"
|
87
|
+
},
|
89
88
|
"./react-dom/server": {
|
90
89
|
"default": "./build/exports/react-dom/server.js"
|
91
90
|
},
|
@@ -122,6 +121,7 @@
|
|
122
121
|
"@wollybeard/projector": "^0.2.0",
|
123
122
|
"ansis": "^4.1.0",
|
124
123
|
"clean-stack": "^5.2.0",
|
124
|
+
"codehike": "^1.0.7",
|
125
125
|
"consola": "^3.4.2",
|
126
126
|
"defu": "^6.1.4",
|
127
127
|
"es-toolkit": "^1.39.6",
|
@@ -156,7 +156,8 @@
|
|
156
156
|
"vite-plugin-inspect": "^11.3.0",
|
157
157
|
"vite-plugin-restart": "^0.4.2",
|
158
158
|
"youch-core": "^0.3.3",
|
159
|
-
"zx": "8.6.1"
|
159
|
+
"zx": "8.6.1",
|
160
|
+
"@mdx-js/react": "^3.1.0"
|
160
161
|
},
|
161
162
|
"devDependencies": {
|
162
163
|
"@actions/core": "^1.11.1",
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import type { Vite } from '#dep/vite/index'
|
2
2
|
import { assertPathAbsolute } from '#lib/kit-temp'
|
3
3
|
import { type PackagePaths, packagePaths } from '#package-paths'
|
4
|
-
import { Path } from '@wollybeard/kit'
|
4
|
+
import { Err, Manifest, Path, Str } from '@wollybeard/kit'
|
5
5
|
import { z } from 'zod'
|
6
6
|
import type { SchemaAugmentation } from '../../api/schema-augmentation/index.js'
|
7
7
|
import type { Schema } from '../schema/index.js'
|
@@ -86,7 +86,19 @@ export interface ConfigInput {
|
|
86
86
|
*
|
87
87
|
* Used in the navigation bar and in the title tag.
|
88
88
|
*
|
89
|
-
*
|
89
|
+
* If not provided, Polen will try to use your project's package.json name
|
90
|
+
* field, converting it to title case (e.g., "my-project" → "My Project").
|
91
|
+
*
|
92
|
+
* @default Your package.json name (title-cased) or "My Developer Portal"
|
93
|
+
* @example
|
94
|
+
* ```ts
|
95
|
+
* // Explicit title
|
96
|
+
* title: 'Acme GraphQL API'
|
97
|
+
*
|
98
|
+
* // Falls back to package.json name
|
99
|
+
* // If package.json has { "name": "acme-graphql" }
|
100
|
+
* // Title will be "Acme Graphql"
|
101
|
+
* ```
|
90
102
|
*/
|
91
103
|
title?: string
|
92
104
|
}
|
@@ -377,6 +389,17 @@ export const normalizeInput = async (
|
|
377
389
|
config.paths = buildPaths(baseRootDirPath)
|
378
390
|
}
|
379
391
|
|
392
|
+
// Try to read package.json name as fallback for title
|
393
|
+
if (!configInput?.templateVariables?.title) {
|
394
|
+
const packageJson = await Manifest.resource.read(config.paths.project.rootDir)
|
395
|
+
|
396
|
+
// todo: let the user know there was an error...
|
397
|
+
if (!Err.is(packageJson) && packageJson.name) {
|
398
|
+
// Package name will be used as default, but can still be overridden below
|
399
|
+
config.templateVariables.title = Str.Case.title(packageJson.name)
|
400
|
+
}
|
401
|
+
}
|
402
|
+
|
380
403
|
if (configInput?.advanced?.vite) {
|
381
404
|
config.advanced.vite = configInput.advanced.vite
|
382
405
|
}
|
@@ -8,6 +8,7 @@ import { debugPolen } from '#singletons/debug'
|
|
8
8
|
import { superjson } from '#singletons/superjson'
|
9
9
|
import mdx from '@mdx-js/rollup'
|
10
10
|
import { Arr, Cache, Path, Str } from '@wollybeard/kit'
|
11
|
+
import { recmaCodeHike, remarkCodeHike } from 'codehike/mdx'
|
11
12
|
import remarkFrontmatter from 'remark-frontmatter'
|
12
13
|
import remarkGfm from 'remark-gfm'
|
13
14
|
import { viProjectData } from './core.js'
|
@@ -93,16 +94,28 @@ export const Pages = ({
|
|
93
94
|
return s.render()
|
94
95
|
}
|
95
96
|
|
97
|
+
const chConfig = {
|
98
|
+
components: { code: 'CodeBlock' },
|
99
|
+
syntaxHighlighting: {
|
100
|
+
theme: `github-light`,
|
101
|
+
},
|
102
|
+
}
|
103
|
+
|
96
104
|
return [
|
97
105
|
// Plugin 1: MDX Processing
|
98
106
|
{
|
99
107
|
enforce: `pre`,
|
100
108
|
...mdx({
|
101
109
|
jsxImportSource: `polen/react`,
|
110
|
+
providerImportSource: `polen/mdx`,
|
102
111
|
remarkPlugins: [
|
103
112
|
// Parse frontmatter blocks so they're removed from content
|
104
113
|
remarkFrontmatter,
|
105
114
|
remarkGfm,
|
115
|
+
[remarkCodeHike, chConfig],
|
116
|
+
],
|
117
|
+
recmaPlugins: [
|
118
|
+
[recmaCodeHike, chConfig],
|
106
119
|
],
|
107
120
|
rehypePlugins: [],
|
108
121
|
}),
|
@@ -0,0 +1 @@
|
|
1
|
+
export { MDXProvider, useMDXComponents } from '@mdx-js/react'
|
@@ -24,6 +24,8 @@ export interface GraphQLDocumentOptions {
|
|
24
24
|
validate?: boolean
|
25
25
|
/** Custom class name for the container */
|
26
26
|
className?: string
|
27
|
+
/** Custom render function for the code block */
|
28
|
+
renderCode?: () => React.ReactNode
|
27
29
|
}
|
28
30
|
|
29
31
|
/**
|
@@ -55,6 +57,7 @@ export const GraphQLDocument: React.FC<GraphQLDocumentProps> = ({
|
|
55
57
|
onNavigate,
|
56
58
|
validate = true,
|
57
59
|
className = ``,
|
60
|
+
renderCode,
|
58
61
|
} = options
|
59
62
|
|
60
63
|
const navigate = useNavigate()
|
@@ -199,9 +202,13 @@ export const GraphQLDocument: React.FC<GraphQLDocumentProps> = ({
|
|
199
202
|
data-testid='graphql-document'
|
200
203
|
>
|
201
204
|
{/* Base code block */}
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
+
{renderCode ? (
|
206
|
+
renderCode()
|
207
|
+
) : (
|
208
|
+
<pre className='code-block'>
|
209
|
+
<code>{children}</code>
|
210
|
+
</pre>
|
211
|
+
)}
|
205
212
|
|
206
213
|
{/* Interactive overlay layer */}
|
207
214
|
{!plain && isReady && (
|
@@ -1,19 +1,35 @@
|
|
1
|
+
import { type HighlightedCode, Pre } from 'codehike/code'
|
1
2
|
import React from 'react'
|
3
|
+
import { GraphQLDocument } from '../../lib/graphql-document/components/GraphQLDocument.js'
|
2
4
|
|
3
5
|
interface CodeBlockProps {
|
4
|
-
|
5
|
-
language?: string
|
6
|
-
className?: string
|
6
|
+
codeblock: HighlightedCode
|
7
7
|
}
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
}) => {
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
9
|
+
/**
|
10
|
+
* Code block component for Code Hike
|
11
|
+
* Handles pre-highlighted code blocks and interactive GraphQL blocks
|
12
|
+
*/
|
13
|
+
export const CodeBlock: React.FC<CodeBlockProps> = ({ codeblock }) => {
|
14
|
+
// Check if this is an interactive GraphQL block
|
15
|
+
if (codeblock.lang === 'graphql' && codeblock.meta?.includes('interactive')) {
|
16
|
+
const schema = typeof window !== 'undefined'
|
17
|
+
? (window as any).__POLEN_GRAPHQL_SCHEMA__
|
18
|
+
: null
|
19
|
+
|
20
|
+
return (
|
21
|
+
<GraphQLDocument
|
22
|
+
schema={schema}
|
23
|
+
options={{
|
24
|
+
className: 'ch-code-container',
|
25
|
+
renderCode: () => <Pre code={codeblock} />,
|
26
|
+
}}
|
27
|
+
>
|
28
|
+
{codeblock.value}
|
29
|
+
</GraphQLDocument>
|
30
|
+
)
|
31
|
+
}
|
32
|
+
|
33
|
+
// For regular code blocks, use Code Hike's Pre component with pre-highlighted code
|
34
|
+
return <Pre code={codeblock} />
|
19
35
|
}
|
@@ -0,0 +1,51 @@
|
|
1
|
+
import { Pre as CodeHikePre } from 'codehike/code'
|
2
|
+
import React from 'react'
|
3
|
+
import { GraphQLDocument } from '../../lib/graphql-document/components/GraphQLDocument.js'
|
4
|
+
|
5
|
+
type CodeHikePreProps = React.ComponentProps<typeof CodeHikePre>
|
6
|
+
type HTMLPreProps = React.ComponentPropsWithoutRef<'pre'>
|
7
|
+
type PreProps = CodeHikePreProps | HTMLPreProps
|
8
|
+
|
9
|
+
/**
|
10
|
+
* Custom Pre component that adds interactive GraphQL support to Code Hike
|
11
|
+
*
|
12
|
+
* Usage in MDX:
|
13
|
+
* ```graphql interactive
|
14
|
+
* query { ... }
|
15
|
+
* ```
|
16
|
+
*/
|
17
|
+
export const Pre: React.FC<PreProps> = (props) => {
|
18
|
+
// Check if this is a Code Hike pre component (has 'code' prop)
|
19
|
+
if ('code' in props && props.code) {
|
20
|
+
const { code } = props
|
21
|
+
|
22
|
+
// Check if this is an interactive GraphQL block
|
23
|
+
if (code.lang === 'graphql' && code.meta?.includes('interactive')) {
|
24
|
+
// Extract the GraphQL schema if available
|
25
|
+
const schema = typeof window !== 'undefined'
|
26
|
+
? (window as any).__POLEN_GRAPHQL_SCHEMA__
|
27
|
+
: null
|
28
|
+
|
29
|
+
// For interactive GraphQL blocks, we need to apply Code Hike's styling
|
30
|
+
// but add GraphQLDocument's interactive features
|
31
|
+
return (
|
32
|
+
<GraphQLDocument
|
33
|
+
schema={schema}
|
34
|
+
options={{
|
35
|
+
className: 'ch-code-container',
|
36
|
+
// Use Code Hike's Pre component for rendering
|
37
|
+
renderCode: () => <CodeHikePre {...props as CodeHikePreProps} />,
|
38
|
+
}}
|
39
|
+
>
|
40
|
+
{code.code}
|
41
|
+
</GraphQLDocument>
|
42
|
+
)
|
43
|
+
}
|
44
|
+
|
45
|
+
// For other Code Hike code blocks, use Code Hike's Pre
|
46
|
+
return <CodeHikePre {...props as CodeHikePreProps} />
|
47
|
+
}
|
48
|
+
|
49
|
+
// For standard HTML pre elements, render as-is
|
50
|
+
return <pre {...props as HTMLPreProps} />
|
51
|
+
}
|
@@ -3,8 +3,8 @@ import { Box, Grid } from '@radix-ui/themes'
|
|
3
3
|
import type React from 'react'
|
4
4
|
import { useEffect, useState } from 'react'
|
5
5
|
import { useLocation } from 'react-router'
|
6
|
-
import { HamburgerMenu } from '../HamburgerMenu.js'
|
7
|
-
import { Sidebar } from '../sidebar/Sidebar.js'
|
6
|
+
import { HamburgerMenu } from '../components/HamburgerMenu.js'
|
7
|
+
import { Sidebar } from '../components/sidebar/Sidebar.js'
|
8
8
|
|
9
9
|
interface SidebarLayoutProps {
|
10
10
|
children: React.ReactNode
|
@@ -60,7 +60,7 @@ export const SidebarLayout: React.FC<SidebarLayoutProps> = ({ children, sidebar
|
|
60
60
|
</Box>
|
61
61
|
)}
|
62
62
|
|
63
|
-
<Box gridArea='content / content / auto / 8'
|
63
|
+
<Box gridArea='content / content / auto / 8'>
|
64
64
|
{children}
|
65
65
|
</Box>
|
66
66
|
</Grid>
|
@@ -2,11 +2,10 @@ import type { Content } from '#api/content/$'
|
|
2
2
|
import { GrafaidOld } from '#lib/grafaid-old/index'
|
3
3
|
import { createRoute } from '#lib/react-router-aid/react-router-aid'
|
4
4
|
import { createLoader, useLoaderData } from '#lib/react-router-loader/react-router-loader'
|
5
|
-
import { Box } from '@radix-ui/themes'
|
6
5
|
import { Outlet } from 'react-router'
|
7
6
|
import PROJECT_DATA from 'virtual:polen/project/data.jsonsuper'
|
8
|
-
import { SidebarLayout } from '../components/layouts/index.js'
|
9
7
|
import { MissingSchema } from '../components/MissingSchema.js'
|
8
|
+
import { SidebarLayout } from '../layouts/index.js'
|
10
9
|
import { reference$type } from './reference.$type.js'
|
11
10
|
|
12
11
|
const loader = createLoader(() => {
|
@@ -1,15 +1,39 @@
|
|
1
1
|
import type { ReactRouter } from '#dep/react-router/index'
|
2
2
|
import { createRoute } from '#lib/react-router-aid/react-router-aid'
|
3
|
-
import {
|
4
|
-
import {
|
5
|
-
import {
|
3
|
+
import { SidebarLayout } from '#template/layouts/index'
|
4
|
+
import { MDXProvider } from '@mdx-js/react'
|
5
|
+
import {
|
6
|
+
Badge,
|
7
|
+
Box,
|
8
|
+
Button,
|
9
|
+
Callout,
|
10
|
+
Card,
|
11
|
+
Code,
|
12
|
+
DataList,
|
13
|
+
Em,
|
14
|
+
Flex,
|
15
|
+
Heading,
|
16
|
+
Link,
|
17
|
+
Quote,
|
18
|
+
Separator,
|
19
|
+
Strong,
|
20
|
+
Table,
|
21
|
+
Tabs,
|
22
|
+
Text,
|
23
|
+
Theme,
|
24
|
+
Tooltip,
|
25
|
+
} from '@radix-ui/themes'
|
26
|
+
import { Link as LinkReactRouter, useLocation } from 'react-router'
|
6
27
|
import { Outlet, ScrollRestoration } from 'react-router'
|
7
28
|
import logoSrc from 'virtual:polen/project/assets/logo.svg'
|
8
29
|
import PROJECT_DATA from 'virtual:polen/project/data.jsonsuper'
|
30
|
+
import PROJECT_DATA_PAGES_CATALOG from 'virtual:polen/project/data/pages-catalog.jsonsuper'
|
9
31
|
import { routes } from 'virtual:polen/project/routes.jsx'
|
10
32
|
import { templateVariables } from 'virtual:polen/template/variables'
|
11
33
|
import { GraphQLSchemaProvider } from '../../lib/graphql-document/schema-context.js'
|
12
|
-
import {
|
34
|
+
import { CodeBlock } from '../components/CodeBlock.js'
|
35
|
+
import { Pre } from '../components/CodeHikePre.js'
|
36
|
+
import { Link as PolenLink } from '../components/Link.js'
|
13
37
|
import { Logo } from '../components/Logo.js'
|
14
38
|
import { NotFound } from '../components/NotFound.js'
|
15
39
|
import { ThemeToggle } from '../components/ThemeToggle.js'
|
@@ -61,9 +85,9 @@ const Layout = () => {
|
|
61
85
|
</LinkReactRouter>
|
62
86
|
<Flex direction='row' gap='4' style={{ flex: 1 }}>
|
63
87
|
{PROJECT_DATA.navbar.map((item, key) => (
|
64
|
-
<
|
88
|
+
<PolenLink key={key} color='gray' to={item.pathExp}>
|
65
89
|
{item.title}
|
66
|
-
</
|
90
|
+
</PolenLink>
|
67
91
|
))}
|
68
92
|
</Flex>
|
69
93
|
<ThemeToggle />
|
@@ -81,15 +105,82 @@ const Layout = () => {
|
|
81
105
|
py={{ initial: `4`, sm: `4`, md: `0` }}
|
82
106
|
>
|
83
107
|
{header}
|
84
|
-
<
|
108
|
+
<MDXProvider
|
109
|
+
components={{
|
110
|
+
// Map markdown elements to Radix with spacing
|
111
|
+
p: (props) => <Text as='p' mb='4' {...props} />,
|
112
|
+
h1: (props) => <Heading size='8' mt='6' mb='4' {...props} />,
|
113
|
+
h2: (props) => <Heading size='7' mt='6' mb='3' {...props} />,
|
114
|
+
h3: (props) => <Heading size='6' mt='5' mb='3' {...props} />,
|
115
|
+
h4: (props) => <Heading size='5' mt='5' mb='2' {...props} />,
|
116
|
+
h5: (props) => <Heading size='4' mt='4' mb='2' {...props} />,
|
117
|
+
h6: (props) => <Heading size='3' mt='4' mb='2' {...props} />,
|
118
|
+
strong: Strong,
|
119
|
+
em: Em,
|
120
|
+
code: Code,
|
121
|
+
blockquote: (props) => <Quote my='4' {...props} />,
|
122
|
+
a: Link,
|
123
|
+
hr: (props) => <Separator my='6' {...props} />,
|
124
|
+
pre: Pre,
|
125
|
+
table: Table.Root,
|
126
|
+
thead: Table.Header,
|
127
|
+
tbody: Table.Body,
|
128
|
+
tr: Table.Row,
|
129
|
+
th: Table.ColumnHeaderCell,
|
130
|
+
td: Table.Cell,
|
131
|
+
// Lists need spacing too
|
132
|
+
ul: (props) => <Box as='ul' mb='4' style={{ paddingLeft: '1.5rem' }} {...props} />,
|
133
|
+
ol: (props) => <Box as='ol' mb='4' style={{ paddingLeft: '1.5rem' }} {...props} />,
|
134
|
+
li: (props) => <Box as='li' mb='2' {...props} />,
|
135
|
+
|
136
|
+
// Direct Radix components for MDX
|
137
|
+
Badge,
|
138
|
+
Button,
|
139
|
+
// @ts-expect-error
|
140
|
+
Callout,
|
141
|
+
Card,
|
142
|
+
// @ts-expect-error
|
143
|
+
DataList,
|
144
|
+
// @ts-expect-error
|
145
|
+
Tabs,
|
146
|
+
Tooltip,
|
147
|
+
|
148
|
+
// Code Hike component
|
149
|
+
CodeBlock,
|
150
|
+
}}
|
151
|
+
>
|
152
|
+
<Outlet />
|
153
|
+
</MDXProvider>
|
85
154
|
</Box>
|
86
155
|
</Theme>
|
87
156
|
)
|
88
157
|
}
|
89
158
|
|
159
|
+
const PagesLayout = () => {
|
160
|
+
const location = useLocation() // Add this line
|
161
|
+
|
162
|
+
// Build sidebar from pages catalog
|
163
|
+
// Get the top-level path segment (e.g., '/guide/foo' -> '/guide')
|
164
|
+
const pathSegments = location.pathname.split('/').filter(Boolean)
|
165
|
+
const topLevelPath = pathSegments[0] ? `/${pathSegments[0]}` : '/'
|
166
|
+
|
167
|
+
// Get the sidebar for this section
|
168
|
+
const sidebar = PROJECT_DATA_PAGES_CATALOG.sidebarIndex[topLevelPath]?.items || []
|
169
|
+
|
170
|
+
return (
|
171
|
+
<SidebarLayout sidebar={sidebar}>
|
172
|
+
<Outlet />
|
173
|
+
</SidebarLayout>
|
174
|
+
)
|
175
|
+
}
|
176
|
+
|
90
177
|
const children: ReactRouter.RouteObject[] = [
|
91
178
|
index,
|
92
|
-
|
179
|
+
{
|
180
|
+
// Pathless layout route - doesn't affect URL paths
|
181
|
+
Component: PagesLayout,
|
182
|
+
children: [...routes], // All MDX page routes go here
|
183
|
+
},
|
93
184
|
]
|
94
185
|
|
95
186
|
//
|
@@ -1,5 +0,0 @@
|
|
1
|
-
export { Callout, Tabs } from '@radix-ui/themes';
|
2
|
-
export { GraphQLDocumentWithSchema } from '../template/components/content/GraphQLDocumentWrapper.js';
|
3
|
-
export { mdxComponents } from '../template/components/MDXComponents.js';
|
4
|
-
export { TestComponent } from '../template/components/TestComponent.js';
|
5
|
-
//# sourceMappingURL=components.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../src/exports/components.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AAChD,OAAO,EAAE,yBAAyB,EAAE,MAAM,0DAA0D,CAAA;AACpG,OAAO,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAA;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAA"}
|
@@ -1,5 +0,0 @@
|
|
1
|
-
export { Callout, Tabs } from '@radix-ui/themes';
|
2
|
-
export { GraphQLDocumentWithSchema } from '../template/components/content/GraphQLDocumentWrapper.js';
|
3
|
-
export { mdxComponents } from '../template/components/MDXComponents.js';
|
4
|
-
export { TestComponent } from '../template/components/TestComponent.js';
|
5
|
-
//# sourceMappingURL=components.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"components.js","sourceRoot":"","sources":["../../src/exports/components.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AAChD,OAAO,EAAE,yBAAyB,EAAE,MAAM,0DAA0D,CAAA;AACpG,OAAO,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAA;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAA"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"MDXComponents.d.ts","sourceRoot":"","sources":["../../../src/template/components/MDXComponents.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,UAAU,QAAQ;IAChB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AASD,eAAO,MAAM,aAAa;;CAEzB,CAAA"}
|
@@ -1,12 +0,0 @@
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
-
import React from 'react';
|
3
|
-
/**
|
4
|
-
* Simple pre component that renders code blocks as-is
|
5
|
-
*/
|
6
|
-
const Pre = ({ children, className, ...props }) => {
|
7
|
-
return _jsx("pre", { className: className, ...props, children: children });
|
8
|
-
};
|
9
|
-
export const mdxComponents = {
|
10
|
-
pre: Pre,
|
11
|
-
};
|
12
|
-
//# sourceMappingURL=MDXComponents.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"MDXComponents.js","sourceRoot":"","sources":["../../../src/template/components/MDXComponents.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAOzB;;GAEG;AACH,MAAM,GAAG,GAAuB,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,EAAE;IACpE,OAAO,cAAK,SAAS,EAAE,SAAS,KAAM,KAAK,YAAG,QAAQ,GAAO,CAAA;AAC/D,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,GAAG,EAAE,GAAG;CACT,CAAA"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"TestComponent.d.ts","sourceRoot":"","sources":["../../../src/template/components/TestComponent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,CAGjE,CAAA"}
|
@@ -1,7 +0,0 @@
|
|
1
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
-
import React from 'react';
|
3
|
-
export const TestComponent = ({ children }) => {
|
4
|
-
console.log(`TestComponent rendered!`);
|
5
|
-
return _jsxs("div", { style: { border: `2px solid red`, padding: `10px` }, children: ["TEST: ", children] });
|
6
|
-
};
|
7
|
-
//# sourceMappingURL=TestComponent.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"TestComponent.js","sourceRoot":"","sources":["../../../src/template/components/TestComponent.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,MAAM,CAAC,MAAM,aAAa,GAA4C,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;IACrF,OAAO,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAA;IACtC,OAAO,eAAK,KAAK,EAAE,EAAE,MAAM,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,EAAE,uBAAS,QAAQ,IAAO,CAAA;AACzF,CAAC,CAAA"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"SidebarLayout.d.ts","sourceRoot":"","sources":["../../../../src/template/components/layouts/SidebarLayout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AAE7C,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAM9B,UAAU,kBAAkB;IAC1B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,OAAO,EAAE,OAAO,CAAC,IAAI,EAAE,CAAA;CACxB;AAED,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAsDtD,CAAA"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"SidebarLayout.js","sourceRoot":"","sources":["../../../../src/template/components/layouts/SidebarLayout.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AAE5C,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAA;AAO/C,MAAM,CAAC,MAAM,aAAa,GAAiC,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,EAAE;IACnF,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAA;IAC9B,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;IAE3D,oCAAoC;IACpC,SAAS,CAAC,GAAG,EAAE;QACb,iBAAiB,CAAC,KAAK,CAAC,CAAA;IAC1B,CAAC,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAA;IAEvB,MAAM,aAAa,GAAG,OAAO,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,CAAA;IAEnD,OAAO,CACL,MAAC,IAAI,IACH,KAAK,EAAE;YACL,OAAO,EAAE,WAAW;YACpB,EAAE,EAAE,WAAW;YACf,EAAE,EAAE,6DAA6D;SAClE,EACD,IAAI,EAAC,MAAM,EACX,OAAO,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,gBAAgB,EAAE,EAC5D,IAAI,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,aAGvC,aAAa,IAAI,CAChB,KAAC,GAAG,IAAC,OAAO,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAC,GAAG,YACpD,KAAC,aAAa,IACZ,MAAM,EAAE,cAAc,EACtB,QAAQ,EAAE,GAAG,EAAE;wBACb,iBAAiB,CAAC,CAAC,cAAc,CAAC,CAAA;oBACpC,CAAC,EACD,OAAO,EAAE,GAAG,EAAE;wBACZ,iBAAiB,CAAC,KAAK,CAAC,CAAA;oBAC1B,CAAC,EACD,WAAW,EAAE,OAAO,GACpB,GACE,CACP,EAGA,aAAa,IAAI,CAChB,KAAC,GAAG,IACF,OAAO,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,OAAO,EAAE,EACjE,UAAU,EAAC,OAAO,EAClB,OAAO,EAAC,UAAU,YAElB,KAAC,OAAO,IAAC,IAAI,EAAE,OAAO,GAAI,GACtB,CACP,EAED,KAAC,GAAG,IAAC,QAAQ,EAAC,8BAA8B,EAAC,SAAS,EAAC,OAAO,YAC3D,QAAQ,GACL,IACD,CACR,CAAA;AACH,CAAC,CAAA"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/template/components/layouts/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/template/components/layouts/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA"}
|
@@ -1,4 +0,0 @@
|
|
1
|
-
export { Callout, Tabs } from '@radix-ui/themes'
|
2
|
-
export { GraphQLDocumentWithSchema } from '../template/components/content/GraphQLDocumentWrapper.js'
|
3
|
-
export { mdxComponents } from '../template/components/MDXComponents.js'
|
4
|
-
export { TestComponent } from '../template/components/TestComponent.js'
|
@@ -1,17 +0,0 @@
|
|
1
|
-
import React from 'react'
|
2
|
-
|
3
|
-
interface PreProps {
|
4
|
-
children: React.ReactNode
|
5
|
-
className?: string
|
6
|
-
}
|
7
|
-
|
8
|
-
/**
|
9
|
-
* Simple pre component that renders code blocks as-is
|
10
|
-
*/
|
11
|
-
const Pre: React.FC<PreProps> = ({ children, className, ...props }) => {
|
12
|
-
return <pre className={className} {...props}>{children}</pre>
|
13
|
-
}
|
14
|
-
|
15
|
-
export const mdxComponents = {
|
16
|
-
pre: Pre,
|
17
|
-
}
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|