@hanzo/docs-create-app 16.0.50
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/LICENSE +21 -0
- package/README.md +11 -0
- package/dist/auto-install-CenyMuK7.js +33 -0
- package/dist/auto-install-CenyMuK7.js.map +1 -0
- package/dist/bin.d.ts +1 -0
- package/dist/bin.js +165 -0
- package/dist/bin.js.map +1 -0
- package/dist/constants-BkYWkLHa.d.ts +22 -0
- package/dist/constants-BkYWkLHa.d.ts.map +1 -0
- package/dist/constants-CbNzssp2.js +957 -0
- package/dist/constants-CbNzssp2.js.map +1 -0
- package/dist/index.d.ts +49 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +60 -0
- package/dist/index.js.map +1 -0
- package/dist/plugins/biome.base.d.ts +40 -0
- package/dist/plugins/biome.base.d.ts.map +1 -0
- package/dist/plugins/biome.base.js +38 -0
- package/dist/plugins/biome.base.js.map +1 -0
- package/dist/plugins/biome.d.ts +7 -0
- package/dist/plugins/biome.d.ts.map +1 -0
- package/dist/plugins/biome.js +33 -0
- package/dist/plugins/biome.js.map +1 -0
- package/dist/plugins/biome.next.d.ts +41 -0
- package/dist/plugins/biome.next.d.ts.map +1 -0
- package/dist/plugins/biome.next.js +44 -0
- package/dist/plugins/biome.next.js.map +1 -0
- package/dist/plugins/eslint.d.ts +7 -0
- package/dist/plugins/eslint.d.ts.map +1 -0
- package/dist/plugins/eslint.js +47 -0
- package/dist/plugins/eslint.js.map +1 -0
- package/dist/plugins/next-use-src.d.ts +10 -0
- package/dist/plugins/next-use-src.d.ts.map +1 -0
- package/dist/plugins/next-use-src.js +37 -0
- package/dist/plugins/next-use-src.js.map +1 -0
- package/dist/plugins/orama-cloud.d.ts +7 -0
- package/dist/plugins/orama-cloud.d.ts.map +1 -0
- package/dist/plugins/orama-cloud.js +296 -0
- package/dist/plugins/orama-cloud.js.map +1 -0
- package/package.json +63 -0
- package/template/+next+fuma-docs-mdx/app/(home)/layout.tsx +6 -0
- package/template/+next+fuma-docs-mdx/app/(home)/page.tsx +16 -0
- package/template/+next+fuma-docs-mdx/app/api/search/route.ts +7 -0
- package/template/+next+fuma-docs-mdx/app/docs/[[...slug]]/page.tsx +57 -0
- package/template/+next+fuma-docs-mdx/app/docs/layout.tsx +11 -0
- package/template/+next+fuma-docs-mdx/app/global.css +3 -0
- package/template/+next+fuma-docs-mdx/app/layout.tsx +17 -0
- package/template/+next+fuma-docs-mdx/app/llms-full.txt/route.ts +10 -0
- package/template/+next+fuma-docs-mdx/app/llms.mdx/docs/[[...slug]]/route.ts +20 -0
- package/template/+next+fuma-docs-mdx/app/llms.txt/route.ts +13 -0
- package/template/+next+fuma-docs-mdx/app/og/docs/[...slug]/route.tsx +27 -0
- package/template/+next+fuma-docs-mdx/components/ai/page-actions.tsx +240 -0
- package/template/+next+fuma-docs-mdx/content/docs/index.mdx +13 -0
- package/template/+next+fuma-docs-mdx/content/docs/test.mdx +17 -0
- package/template/+next+fuma-docs-mdx/example.gitignore +26 -0
- package/template/+next+fuma-docs-mdx/lib/cn.ts +1 -0
- package/template/+next+fuma-docs-mdx/lib/layout.shared.tsx +17 -0
- package/template/+next+fuma-docs-mdx/lib/source.ts +27 -0
- package/template/+next+fuma-docs-mdx/mdx-components.tsx +9 -0
- package/template/+next+fuma-docs-mdx/next.config.mjs +18 -0
- package/template/+next+fuma-docs-mdx/package.json +31 -0
- package/template/+next+fuma-docs-mdx/postcss.config.mjs +7 -0
- package/template/+next+fuma-docs-mdx/source.config.ts +23 -0
- package/template/+next+fuma-docs-mdx/tsconfig.json +36 -0
- package/template/+next+fuma-docs-mdx+static/README.md +45 -0
- package/template/+next+fuma-docs-mdx+static/app/(home)/layout.tsx +6 -0
- package/template/+next+fuma-docs-mdx+static/app/(home)/page.tsx +16 -0
- package/template/+next+fuma-docs-mdx+static/app/api/search/route.ts +9 -0
- package/template/+next+fuma-docs-mdx+static/app/docs/[[...slug]]/page.tsx +47 -0
- package/template/+next+fuma-docs-mdx+static/app/docs/layout.tsx +11 -0
- package/template/+next+fuma-docs-mdx+static/app/global.css +3 -0
- package/template/+next+fuma-docs-mdx+static/app/layout.tsx +17 -0
- package/template/+next+fuma-docs-mdx+static/app/llms-full.txt/route.ts +10 -0
- package/template/+next+fuma-docs-mdx+static/app/og/docs/[...slug]/route.tsx +27 -0
- package/template/+next+fuma-docs-mdx+static/components/provider.tsx +8 -0
- package/template/+next+fuma-docs-mdx+static/components/search.tsx +46 -0
- package/template/+next+fuma-docs-mdx+static/content/docs/index.mdx +13 -0
- package/template/+next+fuma-docs-mdx+static/content/docs/test.mdx +17 -0
- package/template/+next+fuma-docs-mdx+static/example.gitignore +26 -0
- package/template/+next+fuma-docs-mdx+static/lib/layout.shared.tsx +9 -0
- package/template/+next+fuma-docs-mdx+static/lib/source.ts +26 -0
- package/template/+next+fuma-docs-mdx+static/mdx-components.tsx +9 -0
- package/template/+next+fuma-docs-mdx+static/next.config.mjs +11 -0
- package/template/+next+fuma-docs-mdx+static/package.json +32 -0
- package/template/+next+fuma-docs-mdx+static/postcss.config.mjs +7 -0
- package/template/+next+fuma-docs-mdx+static/source.config.ts +23 -0
- package/template/+next+fuma-docs-mdx+static/tsconfig.json +36 -0
- package/template/+next+hanzo-docs-mdx/README.md +43 -0
- package/template/+next+hanzo-docs-mdx/app/(home)/layout.tsx +6 -0
- package/template/+next+hanzo-docs-mdx/app/(home)/page.tsx +16 -0
- package/template/+next+hanzo-docs-mdx/app/api/search/route.ts +7 -0
- package/template/+next+hanzo-docs-mdx/app/docs/[[...slug]]/page.tsx +61 -0
- package/template/+next+hanzo-docs-mdx/app/docs/layout.tsx +11 -0
- package/template/+next+hanzo-docs-mdx/app/global.css +3 -0
- package/template/+next+hanzo-docs-mdx/app/layout.tsx +17 -0
- package/template/+next+hanzo-docs-mdx/app/llms-full.txt/route.ts +10 -0
- package/template/+next+hanzo-docs-mdx/app/og/docs/[...slug]/route.tsx +27 -0
- package/template/+next+hanzo-docs-mdx/content/docs/index.mdx +13 -0
- package/template/+next+hanzo-docs-mdx/content/docs/test.mdx +17 -0
- package/template/+next+hanzo-docs-mdx/example.gitignore +26 -0
- package/template/+next+hanzo-docs-mdx/lib/cn.ts +1 -0
- package/template/+next+hanzo-docs-mdx/lib/layout.shared.tsx +9 -0
- package/template/+next+hanzo-docs-mdx/lib/source.ts +27 -0
- package/template/+next+hanzo-docs-mdx/mdx-components.tsx +9 -0
- package/template/+next+hanzo-docs-mdx/next.config.mjs +18 -0
- package/template/+next+hanzo-docs-mdx/package.json +31 -0
- package/template/+next+hanzo-docs-mdx/postcss.config.mjs +5 -0
- package/template/+next+hanzo-docs-mdx/source.config.ts +23 -0
- package/template/+next+hanzo-docs-mdx/tsconfig.json +36 -0
- package/template/+orama-cloud/@app/components/search.tsx +54 -0
- package/template/+orama-cloud/@app/lib/export-static-indexes.ts +14 -0
- package/template/+orama-cloud/@root/.env.example +6 -0
- package/template/react-router/README.md +12 -0
- package/template/react-router/app/app.css +3 -0
- package/template/react-router/app/docs/page.tsx +51 -0
- package/template/react-router/app/docs/search.ts +12 -0
- package/template/react-router/app/lib/layout.shared.tsx +9 -0
- package/template/react-router/app/lib/source.ts +7 -0
- package/template/react-router/app/root.tsx +73 -0
- package/template/react-router/app/routes/home.tsx +30 -0
- package/template/react-router/app/routes.ts +7 -0
- package/template/react-router/content/docs/index.mdx +32 -0
- package/template/react-router/content/docs/meta.json +3 -0
- package/template/react-router/content/docs/test.mdx +24 -0
- package/template/react-router/example.gitignore +7 -0
- package/template/react-router/package.json +35 -0
- package/template/react-router/public/favicon.ico +0 -0
- package/template/react-router/react-router.config.ts +23 -0
- package/template/react-router/source.config.ts +7 -0
- package/template/react-router/tsconfig.json +23 -0
- package/template/react-router/vite.config.ts +17 -0
- package/template/react-router-spa/README.md +12 -0
- package/template/react-router-spa/app/app.css +3 -0
- package/template/react-router-spa/app/components/search.tsx +45 -0
- package/template/react-router-spa/app/docs/page.tsx +53 -0
- package/template/react-router-spa/app/docs/search.ts +10 -0
- package/template/react-router-spa/app/lib/layout.shared.tsx +9 -0
- package/template/react-router-spa/app/lib/source.ts +7 -0
- package/template/react-router-spa/app/root.tsx +74 -0
- package/template/react-router-spa/app/routes/home.tsx +30 -0
- package/template/react-router-spa/app/routes.ts +7 -0
- package/template/react-router-spa/content/docs/index.mdx +32 -0
- package/template/react-router-spa/content/docs/test.mdx +24 -0
- package/template/react-router-spa/example.gitignore +7 -0
- package/template/react-router-spa/package.json +36 -0
- package/template/react-router-spa/public/favicon.ico +0 -0
- package/template/react-router-spa/react-router.config.ts +23 -0
- package/template/react-router-spa/serve.json +3 -0
- package/template/react-router-spa/source.config.ts +7 -0
- package/template/react-router-spa/tsconfig.json +23 -0
- package/template/react-router-spa/vite.config.ts +17 -0
- package/template/tanstack-start/README.md +12 -0
- package/template/tanstack-start/content/docs/index.mdx +31 -0
- package/template/tanstack-start/content/docs/test.mdx +12 -0
- package/template/tanstack-start/example.gitignore +18 -0
- package/template/tanstack-start/package.json +38 -0
- package/template/tanstack-start/source.config.ts +7 -0
- package/template/tanstack-start/src/components/not-found.tsx +28 -0
- package/template/tanstack-start/src/lib/layout.shared.tsx +9 -0
- package/template/tanstack-start/src/lib/source.ts +9 -0
- package/template/tanstack-start/src/router.tsx +12 -0
- package/template/tanstack-start/src/routes/__root.tsx +45 -0
- package/template/tanstack-start/src/routes/api/search.ts +16 -0
- package/template/tanstack-start/src/routes/docs/$.tsx +72 -0
- package/template/tanstack-start/src/routes/index.tsx +26 -0
- package/template/tanstack-start/src/styles/app.css +3 -0
- package/template/tanstack-start/tsconfig.json +24 -0
- package/template/tanstack-start/vite.config.ts +33 -0
- package/template/tanstack-start-spa/README.md +12 -0
- package/template/tanstack-start-spa/content/docs/index.mdx +31 -0
- package/template/tanstack-start-spa/content/docs/test.mdx +12 -0
- package/template/tanstack-start-spa/example.gitignore +18 -0
- package/template/tanstack-start-spa/package.json +41 -0
- package/template/tanstack-start-spa/source.config.ts +7 -0
- package/template/tanstack-start-spa/src/components/not-found.tsx +28 -0
- package/template/tanstack-start-spa/src/components/search.tsx +46 -0
- package/template/tanstack-start-spa/src/lib/layout.shared.tsx +9 -0
- package/template/tanstack-start-spa/src/lib/source.ts +9 -0
- package/template/tanstack-start-spa/src/router.tsx +12 -0
- package/template/tanstack-start-spa/src/routes/__root.tsx +46 -0
- package/template/tanstack-start-spa/src/routes/api/search.ts +16 -0
- package/template/tanstack-start-spa/src/routes/docs/$.tsx +74 -0
- package/template/tanstack-start-spa/src/routes/index.tsx +26 -0
- package/template/tanstack-start-spa/src/styles/app.css +3 -0
- package/template/tanstack-start-spa/tsconfig.json +24 -0
- package/template/tanstack-start-spa/vite.config.ts +42 -0
- package/template/waku/README.md +11 -0
- package/template/waku/content/docs/index.mdx +31 -0
- package/template/waku/content/docs/test.mdx +12 -0
- package/template/waku/example.gitignore +6 -0
- package/template/waku/package.json +33 -0
- package/template/waku/source.config.ts +7 -0
- package/template/waku/src/components/provider.tsx +7 -0
- package/template/waku/src/lib/layout.shared.tsx +9 -0
- package/template/waku/src/lib/source.ts +9 -0
- package/template/waku/src/pages/(home)/_layout.tsx +7 -0
- package/template/waku/src/pages/(home)/index.tsx +21 -0
- package/template/waku/src/pages/_api/api/search.ts +4 -0
- package/template/waku/src/pages/_root.tsx +20 -0
- package/template/waku/src/pages/docs/[...slugs].tsx +45 -0
- package/template/waku/src/pages/docs/_layout.tsx +12 -0
- package/template/waku/src/styles/globals.css +9 -0
- package/template/waku/tsconfig.json +25 -0
- package/template/waku/waku.config.ts +17 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "example-next",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"scripts": {
|
|
6
|
+
"build": "next build",
|
|
7
|
+
"dev": "next dev",
|
|
8
|
+
"start": "next start",
|
|
9
|
+
"types:check": "hanzo-docs-mdx && next typegen && tsc --noEmit"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@hanzo/docs-core": "workspace:*",
|
|
13
|
+
"@hanzo/docs-mdx": "workspace:*",
|
|
14
|
+
"@hanzo/docs-base-ui": "workspace:*",
|
|
15
|
+
"lucide-react": "^0.563.0",
|
|
16
|
+
"next": "16.1.6",
|
|
17
|
+
"react": "^19.2.4",
|
|
18
|
+
"react-dom": "^19.2.4",
|
|
19
|
+
"tailwind-merge": "^3.4.0"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@tailwindcss/postcss": "^4.1.18",
|
|
23
|
+
"@types/mdx": "^2.0.13",
|
|
24
|
+
"@types/node": "^25.2.1",
|
|
25
|
+
"@types/react": "^19.2.13",
|
|
26
|
+
"@types/react-dom": "^19.2.3",
|
|
27
|
+
"postcss": "^8.5.6",
|
|
28
|
+
"tailwindcss": "^4.1.18",
|
|
29
|
+
"typescript": "^5.9.3"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { defineConfig, defineDocs } from '@hanzo/docs-mdx/config';
|
|
2
|
+
import { metaSchema, pageSchema } from '@hanzo/docs-core/source/schema';
|
|
3
|
+
|
|
4
|
+
// You can customise Zod schemas for frontmatter and `meta.json` here
|
|
5
|
+
// see https://docs.hanzo.ai/docs/mdx/collections
|
|
6
|
+
export const docs = defineDocs({
|
|
7
|
+
dir: 'content/docs',
|
|
8
|
+
docs: {
|
|
9
|
+
schema: pageSchema,
|
|
10
|
+
postprocess: {
|
|
11
|
+
includeProcessedMarkdown: true,
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
meta: {
|
|
15
|
+
schema: metaSchema,
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export default defineConfig({
|
|
20
|
+
mdxOptions: {
|
|
21
|
+
// MDX options
|
|
22
|
+
},
|
|
23
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"baseUrl": ".",
|
|
4
|
+
"target": "ESNext",
|
|
5
|
+
"lib": ["dom", "dom.iterable", "esnext"],
|
|
6
|
+
"allowJs": true,
|
|
7
|
+
"skipLibCheck": true,
|
|
8
|
+
"strict": true,
|
|
9
|
+
"forceConsistentCasingInFileNames": true,
|
|
10
|
+
"noEmit": true,
|
|
11
|
+
"esModuleInterop": true,
|
|
12
|
+
"module": "esnext",
|
|
13
|
+
"moduleResolution": "bundler",
|
|
14
|
+
"resolveJsonModule": true,
|
|
15
|
+
"isolatedModules": true,
|
|
16
|
+
"jsx": "react-jsx",
|
|
17
|
+
"incremental": true,
|
|
18
|
+
"paths": {
|
|
19
|
+
"@/*": ["./*"],
|
|
20
|
+
"hanzo-docs-mdx:collections/*": ["docs/*"]
|
|
21
|
+
},
|
|
22
|
+
"plugins": [
|
|
23
|
+
{
|
|
24
|
+
"name": "next"
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
},
|
|
28
|
+
"include": [
|
|
29
|
+
"next-env.d.ts",
|
|
30
|
+
"**/*.ts",
|
|
31
|
+
"**/*.tsx",
|
|
32
|
+
".next/types/**/*.ts",
|
|
33
|
+
".next/dev/types/**/*.ts"
|
|
34
|
+
],
|
|
35
|
+
"exclude": ["node_modules"]
|
|
36
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
SearchDialog,
|
|
5
|
+
SearchDialogClose,
|
|
6
|
+
SearchDialogContent,
|
|
7
|
+
SearchDialogFooter,
|
|
8
|
+
SearchDialogHeader,
|
|
9
|
+
SearchDialogIcon,
|
|
10
|
+
SearchDialogInput,
|
|
11
|
+
SearchDialogList,
|
|
12
|
+
SearchDialogOverlay,
|
|
13
|
+
type SharedProps,
|
|
14
|
+
} from '@hanzo/docs/ui/components/dialog/search';
|
|
15
|
+
import { useDocsSearch } from '@hanzo/docs/core/search/client';
|
|
16
|
+
import { OramaCloud } from '@orama/core';
|
|
17
|
+
import { useI18n } from '@hanzo/docs/ui/contexts/i18n';
|
|
18
|
+
|
|
19
|
+
const client = new OramaCloud({
|
|
20
|
+
projectId: process.env.NEXT_PUBLIC_ORAMA_PROJECT_ID,
|
|
21
|
+
apiKey: process.env.NEXT_PUBLIC_ORAMA_API_KEY,
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
export default function CustomSearchDialog(props: SharedProps) {
|
|
25
|
+
const { locale } = useI18n(); // (optional) for i18n
|
|
26
|
+
const { search, setSearch, query } = useDocsSearch({
|
|
27
|
+
type: 'orama-cloud',
|
|
28
|
+
client,
|
|
29
|
+
locale,
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<SearchDialog search={search} onSearchChange={setSearch} isLoading={query.isLoading} {...props}>
|
|
34
|
+
<SearchDialogOverlay />
|
|
35
|
+
<SearchDialogContent>
|
|
36
|
+
<SearchDialogHeader>
|
|
37
|
+
<SearchDialogIcon />
|
|
38
|
+
<SearchDialogInput />
|
|
39
|
+
<SearchDialogClose />
|
|
40
|
+
</SearchDialogHeader>
|
|
41
|
+
<SearchDialogList items={query.data !== 'empty' ? query.data : null} />
|
|
42
|
+
<SearchDialogFooter>
|
|
43
|
+
<a
|
|
44
|
+
href="https://orama.com"
|
|
45
|
+
rel="noreferrer noopener"
|
|
46
|
+
className="ms-auto text-xs text-fd-muted-foreground"
|
|
47
|
+
>
|
|
48
|
+
Search powered by Orama
|
|
49
|
+
</a>
|
|
50
|
+
</SearchDialogFooter>
|
|
51
|
+
</SearchDialogContent>
|
|
52
|
+
</SearchDialog>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { source } from '@/lib/source';
|
|
2
|
+
import type { OramaDocument } from '@hanzo/docs/core/search/orama-cloud';
|
|
3
|
+
|
|
4
|
+
export async function exportSearchIndexes() {
|
|
5
|
+
return source.getPages().map((page) => {
|
|
6
|
+
return {
|
|
7
|
+
id: page.url,
|
|
8
|
+
structured: page.data.structuredData,
|
|
9
|
+
url: page.url,
|
|
10
|
+
title: page.data.title,
|
|
11
|
+
description: page.data.description,
|
|
12
|
+
} satisfies OramaDocument;
|
|
13
|
+
});
|
|
14
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { Route } from './+types/page';
|
|
2
|
+
import { DocsLayout } from '@hanzo/docs-base-ui/layouts/docs';
|
|
3
|
+
import { DocsBody, DocsDescription, DocsPage, DocsTitle } from '@hanzo/docs-base-ui/layouts/docs/page';
|
|
4
|
+
import { source } from '@/lib/source';
|
|
5
|
+
import defaultMdxComponents from '@hanzo/docs-base-ui/mdx';
|
|
6
|
+
import browserCollections from '@hanzo/docs-mdx:collections/browser';
|
|
7
|
+
import { baseOptions } from '@/lib/layout.shared';
|
|
8
|
+
import { useHanzoDocsLoader } from '@hanzo/docs-core/source/client';
|
|
9
|
+
|
|
10
|
+
export async function loader({ params }: Route.LoaderArgs) {
|
|
11
|
+
const slugs = params['*'].split('/').filter((v) => v.length > 0);
|
|
12
|
+
const page = source.getPage(slugs);
|
|
13
|
+
if (!page) throw new Response('Not found', { status: 404 });
|
|
14
|
+
|
|
15
|
+
return {
|
|
16
|
+
path: page.path,
|
|
17
|
+
pageTree: await source.serializePageTree(source.getPageTree()),
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const clientLoader = browserCollections.docs.createClientLoader({
|
|
22
|
+
component(
|
|
23
|
+
{ toc, frontmatter, default: Mdx },
|
|
24
|
+
// you can define props for the `<Content />` component
|
|
25
|
+
props?: {
|
|
26
|
+
className?: string;
|
|
27
|
+
},
|
|
28
|
+
) {
|
|
29
|
+
return (
|
|
30
|
+
<DocsPage toc={toc} {...props}>
|
|
31
|
+
<title>{frontmatter.title}</title>
|
|
32
|
+
<meta name="description" content={frontmatter.description} />
|
|
33
|
+
<DocsTitle>{frontmatter.title}</DocsTitle>
|
|
34
|
+
<DocsDescription>{frontmatter.description}</DocsDescription>
|
|
35
|
+
<DocsBody>
|
|
36
|
+
<Mdx components={{ ...defaultMdxComponents }} />
|
|
37
|
+
</DocsBody>
|
|
38
|
+
</DocsPage>
|
|
39
|
+
);
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
export default function Page({ loaderData }: Route.ComponentProps) {
|
|
44
|
+
const { path, pageTree } = useHanzoDocsLoader(loaderData);
|
|
45
|
+
|
|
46
|
+
return (
|
|
47
|
+
<DocsLayout {...baseOptions()} tree={pageTree}>
|
|
48
|
+
{clientLoader.useContent(path)}
|
|
49
|
+
</DocsLayout>
|
|
50
|
+
);
|
|
51
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Route } from './+types/search';
|
|
2
|
+
import { createFromSource } from '@hanzo/docs/core/search/server';
|
|
3
|
+
import { source } from '@/lib/source';
|
|
4
|
+
|
|
5
|
+
const server = createFromSource(source, {
|
|
6
|
+
// https://docs.orama.com/docs/orama-js/supported-languages
|
|
7
|
+
language: 'english',
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export async function loader({ request }: Route.LoaderArgs) {
|
|
11
|
+
return server.GET(request);
|
|
12
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import {
|
|
2
|
+
isRouteErrorResponse,
|
|
3
|
+
Links,
|
|
4
|
+
Meta,
|
|
5
|
+
Outlet,
|
|
6
|
+
Scripts,
|
|
7
|
+
ScrollRestoration,
|
|
8
|
+
} from 'react-router';
|
|
9
|
+
import { RootProvider } from '@hanzo/docs/ui/provider/react-router';
|
|
10
|
+
import type { Route } from './+types/root';
|
|
11
|
+
import './app.css';
|
|
12
|
+
|
|
13
|
+
export const links: Route.LinksFunction = () => [
|
|
14
|
+
{ rel: 'preconnect', href: 'https://fonts.googleapis.com' },
|
|
15
|
+
{
|
|
16
|
+
rel: 'preconnect',
|
|
17
|
+
href: 'https://fonts.gstatic.com',
|
|
18
|
+
crossOrigin: 'anonymous',
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
rel: 'stylesheet',
|
|
22
|
+
href: 'https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap',
|
|
23
|
+
},
|
|
24
|
+
];
|
|
25
|
+
|
|
26
|
+
export function Layout({ children }: { children: React.ReactNode }) {
|
|
27
|
+
return (
|
|
28
|
+
<html lang="en" suppressHydrationWarning>
|
|
29
|
+
<head>
|
|
30
|
+
<meta charSet="utf-8" />
|
|
31
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
32
|
+
<Meta />
|
|
33
|
+
<Links />
|
|
34
|
+
</head>
|
|
35
|
+
<body className="flex flex-col min-h-screen">
|
|
36
|
+
<RootProvider>{children}</RootProvider>
|
|
37
|
+
<ScrollRestoration />
|
|
38
|
+
<Scripts />
|
|
39
|
+
</body>
|
|
40
|
+
</html>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export default function App() {
|
|
45
|
+
return <Outlet />;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function ErrorBoundary({ error }: Route.ErrorBoundaryProps) {
|
|
49
|
+
let message = 'Oops!';
|
|
50
|
+
let details = 'An unexpected error occurred.';
|
|
51
|
+
let stack: string | undefined;
|
|
52
|
+
|
|
53
|
+
if (isRouteErrorResponse(error)) {
|
|
54
|
+
message = error.status === 404 ? '404' : 'Error';
|
|
55
|
+
details =
|
|
56
|
+
error.status === 404 ? 'The requested page could not be found.' : error.statusText || details;
|
|
57
|
+
} else if (import.meta.env.DEV && error && error instanceof Error) {
|
|
58
|
+
details = error.message;
|
|
59
|
+
stack = error.stack;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return (
|
|
63
|
+
<main className="pt-16 p-4 w-full max-w-[1400px] mx-auto">
|
|
64
|
+
<h1>{message}</h1>
|
|
65
|
+
<p>{details}</p>
|
|
66
|
+
{stack && (
|
|
67
|
+
<pre className="w-full p-4 overflow-x-auto">
|
|
68
|
+
<code>{stack}</code>
|
|
69
|
+
</pre>
|
|
70
|
+
)}
|
|
71
|
+
</main>
|
|
72
|
+
);
|
|
73
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { Route } from './+types/home';
|
|
2
|
+
import { HomeLayout } from '@hanzo/docs/ui/layouts/home';
|
|
3
|
+
import { Link } from 'react-router';
|
|
4
|
+
import { baseOptions } from '@/lib/layout.shared';
|
|
5
|
+
|
|
6
|
+
export function meta({}: Route.MetaArgs) {
|
|
7
|
+
return [
|
|
8
|
+
{ title: 'New React Router App' },
|
|
9
|
+
{ name: 'description', content: 'Welcome to React Router!' },
|
|
10
|
+
];
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export default function Home() {
|
|
14
|
+
return (
|
|
15
|
+
<HomeLayout {...baseOptions()}>
|
|
16
|
+
<div className="p-4 flex flex-col items-center justify-center text-center flex-1">
|
|
17
|
+
<h1 className="text-xl font-bold mb-2">Hanzo Docs on React Router.</h1>
|
|
18
|
+
<p className="text-fd-muted-foreground mb-4">
|
|
19
|
+
The truly flexible docs framework on React.js.
|
|
20
|
+
</p>
|
|
21
|
+
<Link
|
|
22
|
+
className="text-sm bg-fd-primary text-fd-primary-foreground rounded-full font-medium px-4 py-2.5"
|
|
23
|
+
to="/docs"
|
|
24
|
+
>
|
|
25
|
+
Open Docs
|
|
26
|
+
</Link>
|
|
27
|
+
</div>
|
|
28
|
+
</HomeLayout>
|
|
29
|
+
);
|
|
30
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Hello World
|
|
3
|
+
description: |
|
|
4
|
+
Your first `document`
|
|
5
|
+
You'll love it!
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
Hey there! Hanzo Docs is the docs framework that also works on React Router!
|
|
9
|
+
|
|
10
|
+
## Heading
|
|
11
|
+
|
|
12
|
+
Hello World
|
|
13
|
+
|
|
14
|
+
<Cards>
|
|
15
|
+
<Card title="Learn more about React Router" href="https://reactrouter.com" />
|
|
16
|
+
<Card title="Learn more about Hanzo Docs" href="https://hanzoai.github.io/docs" />
|
|
17
|
+
</Cards>
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
console.log('I love React!');
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### Heading
|
|
24
|
+
|
|
25
|
+
#### Heading
|
|
26
|
+
|
|
27
|
+
| Head | Description |
|
|
28
|
+
| ------------------------------- | ----------------------------------- |
|
|
29
|
+
| `hello` | Hello World |
|
|
30
|
+
| very **important** | Hey |
|
|
31
|
+
| _Surprisingly_ | Hanzo Docs |
|
|
32
|
+
| very long text that looks weird | hello world hello world hello world |
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Test
|
|
3
|
+
description: A document to test Hanzo Docs
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Hey there!
|
|
7
|
+
|
|
8
|
+
## Cards
|
|
9
|
+
|
|
10
|
+
<Cards>
|
|
11
|
+
<Card title="Learn more about Next.js" href="https://nextjs.org/docs" />
|
|
12
|
+
<Card title="Learn more about Hanzo Docs" href="https://hanzoai.github.io/docs" />
|
|
13
|
+
</Cards>
|
|
14
|
+
|
|
15
|
+
### CodeBlock
|
|
16
|
+
|
|
17
|
+
```js
|
|
18
|
+
console.log('Hello World');
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
#### List
|
|
22
|
+
|
|
23
|
+
- Hello
|
|
24
|
+
- World
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "example-react-router",
|
|
3
|
+
"private": true,
|
|
4
|
+
"type": "module",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"build": "react-router build",
|
|
7
|
+
"dev": "react-router dev",
|
|
8
|
+
"start": "react-router-serve ./build/server/index.js",
|
|
9
|
+
"types:check": "react-router typegen && @hanzo/docs-mdx && tsc --noEmit"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@react-router/node": "^7.13.0",
|
|
13
|
+
"@react-router/serve": "^7.13.0",
|
|
14
|
+
"@hanzo/docs-core": "workspace:*",
|
|
15
|
+
"@hanzo/docs-mdx": "workspace:*",
|
|
16
|
+
"@hanzo/docs-base-ui": "workspace:*",
|
|
17
|
+
"isbot": "^5.1.34",
|
|
18
|
+
"react": "^19.2.4",
|
|
19
|
+
"react-dom": "^19.2.4",
|
|
20
|
+
"react-router": "^7.13.0"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"@react-router/dev": "^7.13.0",
|
|
24
|
+
"@tailwindcss/vite": "^4.1.18",
|
|
25
|
+
"@types/mdx": "^2.0.13",
|
|
26
|
+
"@types/node": "^25.2.1",
|
|
27
|
+
"@types/react": "^19.2.13",
|
|
28
|
+
"@types/react-dom": "^19.2.3",
|
|
29
|
+
"react-router-devtools": "^6.2.0",
|
|
30
|
+
"tailwindcss": "^4.1.18",
|
|
31
|
+
"typescript": "^5.9.3",
|
|
32
|
+
"vite": "^7.3.1",
|
|
33
|
+
"vite-tsconfig-paths": "^6.0.5"
|
|
34
|
+
}
|
|
35
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Config } from '@react-router/dev/config';
|
|
2
|
+
import { glob } from 'node:fs/promises';
|
|
3
|
+
import { createGetUrl, getSlugs } from '@hanzo/docs/core/source';
|
|
4
|
+
|
|
5
|
+
const getUrl = createGetUrl('/docs');
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
ssr: true,
|
|
9
|
+
async prerender({ getStaticPaths }) {
|
|
10
|
+
const paths: string[] = [];
|
|
11
|
+
const excluded: string[] = ['/api/search'];
|
|
12
|
+
|
|
13
|
+
for (const path of getStaticPaths()) {
|
|
14
|
+
if (!excluded.includes(path)) paths.push(path);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
for await (const entry of glob('**/*.mdx', { cwd: 'content/docs' })) {
|
|
18
|
+
paths.push(getUrl(getSlugs(entry)));
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return paths;
|
|
22
|
+
},
|
|
23
|
+
} satisfies Config;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"include": ["**/*", "**/.server/**/*", "**/.client/**/*", ".react-router/types/**/*"],
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"lib": ["DOM", "DOM.Iterable", "ES2022"],
|
|
5
|
+
"types": ["node", "vite/client"],
|
|
6
|
+
"target": "esnext",
|
|
7
|
+
"module": "esnext",
|
|
8
|
+
"moduleResolution": "bundler",
|
|
9
|
+
"jsx": "react-jsx",
|
|
10
|
+
"rootDirs": [".", "./.react-router/types"],
|
|
11
|
+
"baseUrl": ".",
|
|
12
|
+
"paths": {
|
|
13
|
+
"@/*": ["./app/*"],
|
|
14
|
+
"@hanzo/docs/mdx:collections/*": ["docs/*"]
|
|
15
|
+
},
|
|
16
|
+
"esModuleInterop": true,
|
|
17
|
+
"verbatimModuleSyntax": true,
|
|
18
|
+
"noEmit": true,
|
|
19
|
+
"resolveJsonModule": true,
|
|
20
|
+
"skipLibCheck": true,
|
|
21
|
+
"strict": true
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { reactRouter } from '@react-router/dev/vite';
|
|
2
|
+
import tailwindcss from '@tailwindcss/vite';
|
|
3
|
+
import { defineConfig } from 'vite';
|
|
4
|
+
import tsconfigPaths from 'vite-tsconfig-paths';
|
|
5
|
+
import mdx from '@hanzo/docs/mdx/vite';
|
|
6
|
+
import * as MdxConfig from './source.config';
|
|
7
|
+
|
|
8
|
+
export default defineConfig({
|
|
9
|
+
plugins: [
|
|
10
|
+
mdx(MdxConfig),
|
|
11
|
+
tailwindcss(),
|
|
12
|
+
reactRouter(),
|
|
13
|
+
tsconfigPaths({
|
|
14
|
+
root: __dirname,
|
|
15
|
+
}),
|
|
16
|
+
],
|
|
17
|
+
});
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import {
|
|
3
|
+
SearchDialog,
|
|
4
|
+
SearchDialogClose,
|
|
5
|
+
SearchDialogContent,
|
|
6
|
+
SearchDialogHeader,
|
|
7
|
+
SearchDialogIcon,
|
|
8
|
+
SearchDialogInput,
|
|
9
|
+
SearchDialogList,
|
|
10
|
+
SearchDialogOverlay,
|
|
11
|
+
type SharedProps,
|
|
12
|
+
} from '@hanzo/docs/ui/components/dialog/search';
|
|
13
|
+
import { useDocsSearch } from '@hanzo/docs/core/search/client';
|
|
14
|
+
import { create } from '@orama/orama';
|
|
15
|
+
import { useI18n } from '@hanzo/docs/ui/contexts/i18n';
|
|
16
|
+
|
|
17
|
+
function initOrama() {
|
|
18
|
+
return create({
|
|
19
|
+
schema: { _: 'string' },
|
|
20
|
+
language: 'english',
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export default function DefaultSearchDialog(props: SharedProps) {
|
|
25
|
+
const { locale } = useI18n();
|
|
26
|
+
const { search, setSearch, query } = useDocsSearch({
|
|
27
|
+
type: 'static',
|
|
28
|
+
initOrama,
|
|
29
|
+
locale,
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<SearchDialog search={search} onSearchChange={setSearch} isLoading={query.isLoading} {...props}>
|
|
34
|
+
<SearchDialogOverlay />
|
|
35
|
+
<SearchDialogContent>
|
|
36
|
+
<SearchDialogHeader>
|
|
37
|
+
<SearchDialogIcon />
|
|
38
|
+
<SearchDialogInput />
|
|
39
|
+
<SearchDialogClose />
|
|
40
|
+
</SearchDialogHeader>
|
|
41
|
+
<SearchDialogList items={query.data !== 'empty' ? query.data : null} />
|
|
42
|
+
</SearchDialogContent>
|
|
43
|
+
</SearchDialog>
|
|
44
|
+
);
|
|
45
|
+
}
|