@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,72 @@
|
|
|
1
|
+
import { createFileRoute, notFound } from '@tanstack/react-router';
|
|
2
|
+
import { DocsLayout } from '@hanzo/docs-base-ui/layouts/docs';
|
|
3
|
+
import { createServerFn } from '@tanstack/react-start';
|
|
4
|
+
import { source } from '@/lib/source';
|
|
5
|
+
import browserCollections from '@hanzo/docs-mdx:collections/browser';
|
|
6
|
+
import { DocsBody, DocsDescription, DocsPage, DocsTitle } from '@hanzo/docs-base-ui/layouts/docs/page';
|
|
7
|
+
import defaultMdxComponents from '@hanzo/docs-base-ui/mdx';
|
|
8
|
+
import { baseOptions } from '@/lib/layout.shared';
|
|
9
|
+
import { useHanzoDocsLoader } from '@hanzo/docs-core/source/client';
|
|
10
|
+
import { Suspense } from 'react';
|
|
11
|
+
|
|
12
|
+
export const Route = createFileRoute('/docs/$')({
|
|
13
|
+
component: Page,
|
|
14
|
+
loader: async ({ params }) => {
|
|
15
|
+
const slugs = params._splat?.split('/') ?? [];
|
|
16
|
+
const data = await serverLoader({ data: slugs });
|
|
17
|
+
await clientLoader.preload(data.path);
|
|
18
|
+
return data;
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
const serverLoader = createServerFn({
|
|
23
|
+
method: 'GET',
|
|
24
|
+
})
|
|
25
|
+
.inputValidator((slugs: string[]) => slugs)
|
|
26
|
+
.handler(async ({ data: slugs }) => {
|
|
27
|
+
const page = source.getPage(slugs);
|
|
28
|
+
if (!page) throw notFound();
|
|
29
|
+
|
|
30
|
+
return {
|
|
31
|
+
path: page.path,
|
|
32
|
+
pageTree: await source.serializePageTree(source.getPageTree()),
|
|
33
|
+
};
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
const clientLoader = browserCollections.docs.createClientLoader({
|
|
37
|
+
component(
|
|
38
|
+
{ toc, frontmatter, default: MDX },
|
|
39
|
+
// you can define props for the component
|
|
40
|
+
props: {
|
|
41
|
+
className?: string;
|
|
42
|
+
},
|
|
43
|
+
) {
|
|
44
|
+
return (
|
|
45
|
+
<DocsPage toc={toc} {...props}>
|
|
46
|
+
<DocsTitle>{frontmatter.title}</DocsTitle>
|
|
47
|
+
<DocsDescription>{frontmatter.description}</DocsDescription>
|
|
48
|
+
<DocsBody>
|
|
49
|
+
<MDX
|
|
50
|
+
components={{
|
|
51
|
+
...defaultMdxComponents,
|
|
52
|
+
}}
|
|
53
|
+
/>
|
|
54
|
+
</DocsBody>
|
|
55
|
+
</DocsPage>
|
|
56
|
+
);
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
function Page() {
|
|
61
|
+
const data = useHanzoDocsLoader(Route.useLoaderData());
|
|
62
|
+
|
|
63
|
+
return (
|
|
64
|
+
<DocsLayout {...baseOptions()} tree={data.pageTree}>
|
|
65
|
+
<Suspense>
|
|
66
|
+
{clientLoader.useContent(data.path, {
|
|
67
|
+
className: '',
|
|
68
|
+
})}
|
|
69
|
+
</Suspense>
|
|
70
|
+
</DocsLayout>
|
|
71
|
+
);
|
|
72
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { createFileRoute, Link } from '@tanstack/react-router';
|
|
2
|
+
import { HomeLayout } from '@hanzo/docs/ui/layouts/home';
|
|
3
|
+
import { baseOptions } from '@/lib/layout.shared';
|
|
4
|
+
|
|
5
|
+
export const Route = createFileRoute('/')({
|
|
6
|
+
component: Home,
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
function Home() {
|
|
10
|
+
return (
|
|
11
|
+
<HomeLayout {...baseOptions()}>
|
|
12
|
+
<div className="flex flex-col flex-1 justify-center px-4 py-8 text-center">
|
|
13
|
+
<h1 className="font-medium text-xl mb-4">Hanzo Docs on Tanstack Start.</h1>
|
|
14
|
+
<Link
|
|
15
|
+
to="/docs/$"
|
|
16
|
+
params={{
|
|
17
|
+
_splat: '',
|
|
18
|
+
}}
|
|
19
|
+
className="px-3 py-2 rounded-lg bg-fd-primary text-fd-primary-foreground font-medium text-sm mx-auto"
|
|
20
|
+
>
|
|
21
|
+
Open Docs
|
|
22
|
+
</Link>
|
|
23
|
+
</div>
|
|
24
|
+
</HomeLayout>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"include": ["**/*.ts", "**/*.tsx"],
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"strict": true,
|
|
5
|
+
"esModuleInterop": true,
|
|
6
|
+
"jsx": "react-jsx",
|
|
7
|
+
"module": "ESNext",
|
|
8
|
+
"moduleResolution": "Bundler",
|
|
9
|
+
"lib": ["DOM", "DOM.Iterable", "ES2022"],
|
|
10
|
+
"types": ["vite/client"],
|
|
11
|
+
"isolatedModules": true,
|
|
12
|
+
"resolveJsonModule": true,
|
|
13
|
+
"skipLibCheck": true,
|
|
14
|
+
"target": "ES2022",
|
|
15
|
+
"allowJs": true,
|
|
16
|
+
"forceConsistentCasingInFileNames": true,
|
|
17
|
+
"baseUrl": ".",
|
|
18
|
+
"paths": {
|
|
19
|
+
"@/*": ["./src/*"],
|
|
20
|
+
"@hanzo/docs/mdx:collections/*": ["docs/*"]
|
|
21
|
+
},
|
|
22
|
+
"noEmit": true
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import react from '@vitejs/plugin-react';
|
|
2
|
+
import { tanstackStart } from '@tanstack/react-start/plugin/vite';
|
|
3
|
+
import { defineConfig } from 'vite';
|
|
4
|
+
import tsConfigPaths from 'vite-tsconfig-paths';
|
|
5
|
+
import tailwindcss from '@tailwindcss/vite';
|
|
6
|
+
import mdx from '@hanzo/docs-mdx/vite';
|
|
7
|
+
import { nitro } from 'nitro/vite';
|
|
8
|
+
|
|
9
|
+
export default defineConfig({
|
|
10
|
+
server: {
|
|
11
|
+
port: 3000,
|
|
12
|
+
},
|
|
13
|
+
plugins: [
|
|
14
|
+
mdx(await import('./source.config')),
|
|
15
|
+
tailwindcss(),
|
|
16
|
+
tsConfigPaths({
|
|
17
|
+
projects: ['./tsconfig.json'],
|
|
18
|
+
}),
|
|
19
|
+
tanstackStart({
|
|
20
|
+
prerender: {
|
|
21
|
+
enabled: true,
|
|
22
|
+
},
|
|
23
|
+
}),
|
|
24
|
+
react(),
|
|
25
|
+
// please see https://tanstack.com/start/latest/docs/framework/react/guide/hosting#nitro for guides on hosting
|
|
26
|
+
nitro({
|
|
27
|
+
preset: 'vercel',
|
|
28
|
+
vercel: {
|
|
29
|
+
entryFormat: 'node',
|
|
30
|
+
},
|
|
31
|
+
}),
|
|
32
|
+
],
|
|
33
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Hello World
|
|
3
|
+
description: Your favourite docs framework.
|
|
4
|
+
icon: Rocket
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
Hey there! Hanzo Docs is the docs framework that also works on Tanstack Start!
|
|
8
|
+
|
|
9
|
+
## Heading
|
|
10
|
+
|
|
11
|
+
Hello World!
|
|
12
|
+
|
|
13
|
+
<Cards>
|
|
14
|
+
<Card title="Learn more about Tanstack Start" href="https://tanstack.com/start" />
|
|
15
|
+
<Card title="Learn more about Hanzo Docs" href="https://hanzoai.github.io/docs" />
|
|
16
|
+
</Cards>
|
|
17
|
+
|
|
18
|
+
### CodeBlock
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
console.log('Hello World');
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
#### Table
|
|
25
|
+
|
|
26
|
+
| Head | Description |
|
|
27
|
+
| ------------------------------- | ----------------------------------- |
|
|
28
|
+
| `hello` | Hello World |
|
|
29
|
+
| very **important** | Hey |
|
|
30
|
+
| _Surprisingly_ | Hanzo Docs |
|
|
31
|
+
| very long text that looks weird | hello world hello world hello world |
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "example-tanstack-start-spa",
|
|
3
|
+
"private": true,
|
|
4
|
+
"type": "module",
|
|
5
|
+
"sideEffects": false,
|
|
6
|
+
"scripts": {
|
|
7
|
+
"dev": "vite dev",
|
|
8
|
+
"build": "vite build",
|
|
9
|
+
"start": "serve dist/client",
|
|
10
|
+
"preview": "vite preview",
|
|
11
|
+
"types:check": "@hanzo/docs-mdx && tsc --noEmit"
|
|
12
|
+
},
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"@orama/orama": "^3.1.18",
|
|
15
|
+
"@tanstack/react-router": "1.158.4",
|
|
16
|
+
"@tanstack/react-router-devtools": "1.158.4",
|
|
17
|
+
"@tanstack/react-start": "1.159.0",
|
|
18
|
+
"@tanstack/start-static-server-functions": "1.159.1",
|
|
19
|
+
"@hanzo/docs-core": "workspace:*",
|
|
20
|
+
"@hanzo/docs-mdx": "workspace:*",
|
|
21
|
+
"@hanzo/docs-base-ui": "workspace:*",
|
|
22
|
+
"lucide-react": "^0.563.0",
|
|
23
|
+
"react": "^19.2.4",
|
|
24
|
+
"react-dom": "^19.2.4",
|
|
25
|
+
"vite": "^7.3.1"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"@tailwindcss/vite": "^4.1.18",
|
|
29
|
+
"@types/mdx": "^2.0.13",
|
|
30
|
+
"@types/node": "^25.2.1",
|
|
31
|
+
"@types/react": "^19.2.13",
|
|
32
|
+
"@types/react-dom": "^19.2.3",
|
|
33
|
+
"@vitejs/plugin-react": "^5.1.3",
|
|
34
|
+
"nitro": "npm:nitro-nightly@3.0.1-20260128-211656-ae83c97e",
|
|
35
|
+
"serve": "^14.2.5",
|
|
36
|
+
"srvx": "^0.11.2",
|
|
37
|
+
"tailwindcss": "^4.1.18",
|
|
38
|
+
"typescript": "^5.9.3",
|
|
39
|
+
"vite-tsconfig-paths": "^6.0.5"
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Link } from '@tanstack/react-router';
|
|
2
|
+
import { HomeLayout } from '@hanzo/docs/ui/layouts/home';
|
|
3
|
+
|
|
4
|
+
export function NotFound() {
|
|
5
|
+
return (
|
|
6
|
+
<HomeLayout
|
|
7
|
+
nav={{
|
|
8
|
+
title: 'Tanstack Start',
|
|
9
|
+
}}
|
|
10
|
+
className="text-center py-32 justify-center"
|
|
11
|
+
>
|
|
12
|
+
<div className="flex flex-col items-center gap-4">
|
|
13
|
+
<h1 className="text-6xl font-bold text-fd-muted-foreground">404</h1>
|
|
14
|
+
<h2 className="text-2xl font-semibold">Page Not Found</h2>
|
|
15
|
+
<p className="text-fd-muted-foreground max-w-md">
|
|
16
|
+
The page you are looking for might have been removed, had its name changed, or is
|
|
17
|
+
temporarily unavailable.
|
|
18
|
+
</p>
|
|
19
|
+
<Link
|
|
20
|
+
to="/"
|
|
21
|
+
className="mt-4 px-4 py-2 rounded-lg bg-fd-primary text-fd-primary-foreground font-medium text-sm hover:opacity-90 transition-opacity"
|
|
22
|
+
>
|
|
23
|
+
Back to Home
|
|
24
|
+
</Link>
|
|
25
|
+
</div>
|
|
26
|
+
</HomeLayout>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
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
|
+
// https://docs.orama.com/docs/orama-js/supported-languages
|
|
21
|
+
language: 'english',
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export default function DefaultSearchDialog(props: SharedProps) {
|
|
26
|
+
const { locale } = useI18n(); // (optional) for i18n
|
|
27
|
+
const { search, setSearch, query } = useDocsSearch({
|
|
28
|
+
type: 'static',
|
|
29
|
+
initOrama,
|
|
30
|
+
locale,
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<SearchDialog search={search} onSearchChange={setSearch} isLoading={query.isLoading} {...props}>
|
|
35
|
+
<SearchDialogOverlay />
|
|
36
|
+
<SearchDialogContent>
|
|
37
|
+
<SearchDialogHeader>
|
|
38
|
+
<SearchDialogIcon />
|
|
39
|
+
<SearchDialogInput />
|
|
40
|
+
<SearchDialogClose />
|
|
41
|
+
</SearchDialogHeader>
|
|
42
|
+
<SearchDialogList items={query.data !== 'empty' ? query.data : null} />
|
|
43
|
+
</SearchDialogContent>
|
|
44
|
+
</SearchDialog>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { loader } from '@hanzo/docs-core/source';
|
|
2
|
+
import { lucideIconsPlugin } from '@hanzo/docs-core/source/lucide-icons';
|
|
3
|
+
import { docs } from '@hanzo/docs-mdx:collections/server';
|
|
4
|
+
|
|
5
|
+
export const source = loader({
|
|
6
|
+
source: docs.toHanzoDocsSource(),
|
|
7
|
+
baseUrl: '/docs',
|
|
8
|
+
plugins: [lucideIconsPlugin()],
|
|
9
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { createRouter as createTanStackRouter } from '@tanstack/react-router';
|
|
2
|
+
import { routeTree } from './routeTree.gen';
|
|
3
|
+
import { NotFound } from '@/components/not-found';
|
|
4
|
+
|
|
5
|
+
export function getRouter() {
|
|
6
|
+
return createTanStackRouter({
|
|
7
|
+
routeTree,
|
|
8
|
+
defaultPreload: 'intent',
|
|
9
|
+
scrollRestoration: true,
|
|
10
|
+
defaultNotFoundComponent: NotFound,
|
|
11
|
+
});
|
|
12
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { createRootRoute, HeadContent, Outlet, Scripts } from '@tanstack/react-router';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import appCss from '@/styles/app.css?url';
|
|
4
|
+
import { RootProvider } from '@hanzo/docs/ui/provider/tanstack';
|
|
5
|
+
import SearchDialog from '@/components/search';
|
|
6
|
+
|
|
7
|
+
export const Route = createRootRoute({
|
|
8
|
+
head: () => ({
|
|
9
|
+
meta: [
|
|
10
|
+
{
|
|
11
|
+
charSet: 'utf-8',
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
name: 'viewport',
|
|
15
|
+
content: 'width=device-width, initial-scale=1',
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
title: 'Hanzo Docs on TanStack Start',
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
links: [{ rel: 'stylesheet', href: appCss }],
|
|
22
|
+
}),
|
|
23
|
+
component: RootComponent,
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
function RootComponent() {
|
|
27
|
+
return (
|
|
28
|
+
<RootDocument>
|
|
29
|
+
<Outlet />
|
|
30
|
+
</RootDocument>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function RootDocument({ children }: { children: React.ReactNode }) {
|
|
35
|
+
return (
|
|
36
|
+
<html suppressHydrationWarning>
|
|
37
|
+
<head>
|
|
38
|
+
<HeadContent />
|
|
39
|
+
</head>
|
|
40
|
+
<body className="flex flex-col min-h-screen">
|
|
41
|
+
<RootProvider search={{ SearchDialog }}>{children}</RootProvider>
|
|
42
|
+
<Scripts />
|
|
43
|
+
</body>
|
|
44
|
+
</html>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { createFileRoute } from '@tanstack/react-router';
|
|
2
|
+
import { source } from '@/lib/source';
|
|
3
|
+
import { createFromSource } from '@hanzo/docs/core/search/server';
|
|
4
|
+
|
|
5
|
+
const server = createFromSource(source, {
|
|
6
|
+
// https://docs.orama.com/docs/orama-js/supported-languages
|
|
7
|
+
language: 'english',
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export const Route = createFileRoute('/api/search')({
|
|
11
|
+
server: {
|
|
12
|
+
handlers: {
|
|
13
|
+
GET: () => server.staticGET(),
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
});
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { createFileRoute, notFound } from '@tanstack/react-router';
|
|
2
|
+
import { DocsLayout } from '@hanzo/docs-base-ui/layouts/docs';
|
|
3
|
+
import { createServerFn } from '@tanstack/react-start';
|
|
4
|
+
import { source } from '@/lib/source';
|
|
5
|
+
import browserCollections from '@hanzo/docs-mdx:collections/browser';
|
|
6
|
+
import { DocsBody, DocsDescription, DocsPage, DocsTitle } from '@hanzo/docs-base-ui/layouts/docs/page';
|
|
7
|
+
import defaultMdxComponents from '@hanzo/docs-base-ui/mdx';
|
|
8
|
+
import { baseOptions } from '@/lib/layout.shared';
|
|
9
|
+
import { staticFunctionMiddleware } from '@tanstack/start-static-server-functions';
|
|
10
|
+
import { useHanzoDocsLoader } from '@hanzo/docs-core/source/client';
|
|
11
|
+
import { Suspense } from 'react';
|
|
12
|
+
|
|
13
|
+
export const Route = createFileRoute('/docs/$')({
|
|
14
|
+
component: Page,
|
|
15
|
+
loader: async ({ params }) => {
|
|
16
|
+
const slugs = params._splat?.split('/') ?? [];
|
|
17
|
+
const data = await loader({ data: slugs });
|
|
18
|
+
await clientLoader.preload(data.path);
|
|
19
|
+
return data;
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
const loader = createServerFn({
|
|
24
|
+
method: 'GET',
|
|
25
|
+
})
|
|
26
|
+
.inputValidator((slugs: string[]) => slugs)
|
|
27
|
+
.middleware([staticFunctionMiddleware])
|
|
28
|
+
.handler(async ({ data: slugs }) => {
|
|
29
|
+
const page = source.getPage(slugs);
|
|
30
|
+
if (!page) throw notFound();
|
|
31
|
+
|
|
32
|
+
return {
|
|
33
|
+
path: page.path,
|
|
34
|
+
pageTree: await source.serializePageTree(source.getPageTree()),
|
|
35
|
+
};
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
const clientLoader = browserCollections.docs.createClientLoader({
|
|
39
|
+
component(
|
|
40
|
+
{ toc, frontmatter, default: MDX },
|
|
41
|
+
// you can define props for the component
|
|
42
|
+
props: {
|
|
43
|
+
className?: string;
|
|
44
|
+
},
|
|
45
|
+
) {
|
|
46
|
+
return (
|
|
47
|
+
<DocsPage toc={toc} {...props}>
|
|
48
|
+
<DocsTitle>{frontmatter.title}</DocsTitle>
|
|
49
|
+
<DocsDescription>{frontmatter.description}</DocsDescription>
|
|
50
|
+
<DocsBody>
|
|
51
|
+
<MDX
|
|
52
|
+
components={{
|
|
53
|
+
...defaultMdxComponents,
|
|
54
|
+
}}
|
|
55
|
+
/>
|
|
56
|
+
</DocsBody>
|
|
57
|
+
</DocsPage>
|
|
58
|
+
);
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
function Page() {
|
|
63
|
+
const data = useHanzoDocsLoader(Route.useLoaderData());
|
|
64
|
+
|
|
65
|
+
return (
|
|
66
|
+
<DocsLayout {...baseOptions()} tree={data.pageTree}>
|
|
67
|
+
<Suspense>
|
|
68
|
+
{clientLoader.useContent(data.path, {
|
|
69
|
+
className: '',
|
|
70
|
+
})}
|
|
71
|
+
</Suspense>
|
|
72
|
+
</DocsLayout>
|
|
73
|
+
);
|
|
74
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { createFileRoute, Link } from '@tanstack/react-router';
|
|
2
|
+
import { HomeLayout } from '@hanzo/docs-base-ui/layouts/home';
|
|
3
|
+
import { baseOptions } from '@/lib/layout.shared';
|
|
4
|
+
|
|
5
|
+
export const Route = createFileRoute('/')({
|
|
6
|
+
component: Home,
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
function Home() {
|
|
10
|
+
return (
|
|
11
|
+
<HomeLayout {...baseOptions()}>
|
|
12
|
+
<div className="flex flex-col items-center justify-center text-center flex-1">
|
|
13
|
+
<h1 className="font-medium text-xl mb-4">Hanzo Docs on Tanstack Start.</h1>
|
|
14
|
+
<Link
|
|
15
|
+
to="/docs/$"
|
|
16
|
+
params={{
|
|
17
|
+
_splat: '',
|
|
18
|
+
}}
|
|
19
|
+
className="px-3 py-2 rounded-lg bg-fd-primary text-fd-primary-foreground font-medium text-sm mx-auto"
|
|
20
|
+
>
|
|
21
|
+
Open Docs
|
|
22
|
+
</Link>
|
|
23
|
+
</div>
|
|
24
|
+
</HomeLayout>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"include": ["**/*.ts", "**/*.tsx"],
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"strict": true,
|
|
5
|
+
"esModuleInterop": true,
|
|
6
|
+
"jsx": "react-jsx",
|
|
7
|
+
"module": "ESNext",
|
|
8
|
+
"moduleResolution": "Bundler",
|
|
9
|
+
"lib": ["DOM", "DOM.Iterable", "ES2022"],
|
|
10
|
+
"types": ["vite/client"],
|
|
11
|
+
"isolatedModules": true,
|
|
12
|
+
"resolveJsonModule": true,
|
|
13
|
+
"skipLibCheck": true,
|
|
14
|
+
"target": "ES2022",
|
|
15
|
+
"allowJs": true,
|
|
16
|
+
"forceConsistentCasingInFileNames": true,
|
|
17
|
+
"baseUrl": ".",
|
|
18
|
+
"paths": {
|
|
19
|
+
"@/*": ["./src/*"],
|
|
20
|
+
"@hanzo/docs/mdx:collections/*": ["docs/*"]
|
|
21
|
+
},
|
|
22
|
+
"noEmit": true
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import react from '@vitejs/plugin-react';
|
|
2
|
+
import { tanstackStart } from '@tanstack/react-start/plugin/vite';
|
|
3
|
+
import { defineConfig } from 'vite';
|
|
4
|
+
import tsConfigPaths from 'vite-tsconfig-paths';
|
|
5
|
+
import tailwindcss from '@tailwindcss/vite';
|
|
6
|
+
import mdx from '@hanzo/docs-mdx/vite';
|
|
7
|
+
import { nitro } from 'nitro/vite';
|
|
8
|
+
|
|
9
|
+
export default defineConfig({
|
|
10
|
+
server: {
|
|
11
|
+
port: 3000,
|
|
12
|
+
},
|
|
13
|
+
plugins: [
|
|
14
|
+
mdx(await import('./source.config')),
|
|
15
|
+
tailwindcss(),
|
|
16
|
+
tsConfigPaths({
|
|
17
|
+
projects: ['./tsconfig.json'],
|
|
18
|
+
}),
|
|
19
|
+
tanstackStart({
|
|
20
|
+
spa: {
|
|
21
|
+
enabled: true,
|
|
22
|
+
prerender: {
|
|
23
|
+
outputPath: 'index.html',
|
|
24
|
+
enabled: true,
|
|
25
|
+
crawlLinks: true,
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
|
|
29
|
+
pages: [
|
|
30
|
+
{
|
|
31
|
+
path: '/docs',
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
path: '/api/search',
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
}),
|
|
38
|
+
react(),
|
|
39
|
+
// please see https://tanstack.com/start/latest/docs/framework/react/guide/hosting#nitro for guides on hosting
|
|
40
|
+
nitro(),
|
|
41
|
+
],
|
|
42
|
+
});
|