docs-i18n 0.6.2 → 0.7.0
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/{src/admin/ui → admin/app}/components/JobDialog.tsx +21 -2
- package/{src/admin/ui → admin/app}/components/JobPanel.tsx +1 -1
- package/{src/admin/ui → admin/app}/components/Preview.tsx +2 -5
- package/{src/admin/ui → admin/app}/lib/api.ts +18 -39
- package/admin/app/routeTree.gen.ts +68 -0
- package/admin/app/router.tsx +23 -0
- package/admin/app/routes/__root.tsx +55 -0
- package/admin/app/routes/index.tsx +416 -0
- package/{src/admin/ui → admin/app}/styles.css +36 -3
- package/admin/package.json +27 -0
- package/admin/server/functions/jobs.ts +53 -0
- package/admin/server/functions/misc.ts +84 -0
- package/{src/admin/server/routes → admin/server/functions}/models.ts +16 -29
- package/admin/server/functions/status.ts +61 -0
- package/admin/server/index.ts +35 -0
- package/admin/server/init.ts +46 -0
- package/{src/admin → admin}/server/services/job-manager.ts +39 -10
- package/{src/admin → admin}/server/services/status.ts +6 -6
- package/admin/tsconfig.json +19 -0
- package/{src/admin → admin}/vite.config.ts +8 -2
- package/dist/{assemble-7H4QCW35.js → assemble-CP2BRYQJ.js} +6 -4
- package/dist/{chunk-A3YQNPKZ.js → chunk-CLYUAWZE.js} +1 -1
- package/dist/{chunk-YN4VJHCQ.js → chunk-JHBSHTXC.js} +1 -1
- package/dist/chunk-L64GJ4OB.js +32 -0
- package/dist/{chunk-SKKZIV3L.js → chunk-PNKVD2UK.js} +1 -29
- package/dist/{chunk-XEOYZUHS.js → chunk-QKIR7RKQ.js} +4 -31
- package/dist/chunk-TRURQFP4.js +31 -0
- package/dist/cli.js +108 -23
- package/dist/index.d.ts +41 -1
- package/dist/index.js +92 -3
- package/dist/{rescan-O5D3CYC2.js → rescan-HXMWFAOC.js} +5 -3
- package/dist/{status-F4MYIAAY.js → status-AGZDXOTZ.js} +4 -2
- package/dist/{translate-ZIVKNAC4.js → translate-A5X6MX4Y.js} +14 -7
- package/dist/upload-XL6KG6S2.js +132 -0
- package/package.json +17 -15
- package/template/app/components/BlogArticle.tsx +159 -0
- package/template/app/components/BlogList.tsx +88 -0
- package/template/app/components/Breadcrumbs.tsx +81 -0
- package/template/app/components/Card.tsx +31 -0
- package/template/app/components/Doc.tsx +191 -0
- package/template/app/components/DocBreadcrumb.tsx +60 -0
- package/template/app/components/DocContainer.tsx +13 -0
- package/template/app/components/DocTitle.tsx +11 -0
- package/template/app/components/DocsLayout.tsx +715 -0
- package/template/app/components/Dropdown.tsx +116 -0
- package/template/app/components/FallbackBanner.tsx +36 -0
- package/template/app/components/Footer.tsx +29 -0
- package/template/app/components/FrameworkSelect.tsx +150 -0
- package/template/app/components/LibraryCard.tsx +178 -0
- package/template/app/components/LocaleSwitcher.tsx +43 -0
- package/template/app/components/Navbar.tsx +430 -0
- package/template/app/components/PostNotFound.tsx +20 -0
- package/template/app/components/SearchButton.tsx +32 -0
- package/template/app/components/Select.tsx +103 -0
- package/template/app/components/Spinner.tsx +18 -0
- package/template/app/components/ThemeProvider.tsx +141 -0
- package/template/app/components/ThemeToggle.tsx +31 -0
- package/template/app/components/Toc.tsx +86 -0
- package/template/app/components/VersionSelect.tsx +118 -0
- package/template/app/components/icons/BSkyIcon.tsx +27 -0
- package/template/app/components/icons/BaseballCapIcon.tsx +25 -0
- package/template/app/components/icons/BrandXIcon.tsx +28 -0
- package/template/app/components/icons/CheckCircleIcon.tsx +28 -0
- package/template/app/components/icons/CogsIcon.tsx +25 -0
- package/template/app/components/icons/DiscordIcon.tsx +24 -0
- package/template/app/components/icons/GithubIcon.tsx +24 -0
- package/template/app/components/icons/GoogleIcon.tsx +24 -0
- package/template/app/components/icons/InstagramIcon.tsx +24 -0
- package/template/app/components/icons/NpmIcon.tsx +26 -0
- package/template/app/components/icons/YinYangIcon.tsx +26 -0
- package/template/app/components/icons/YouTubeIcon.tsx +24 -0
- package/template/app/components/markdown/CodeBlock.tsx +254 -0
- package/template/app/components/markdown/FileTabs.tsx +58 -0
- package/template/app/components/markdown/FrameworkContent.tsx +76 -0
- package/template/app/components/markdown/Markdown.tsx +216 -0
- package/template/app/components/markdown/MarkdownContent.tsx +89 -0
- package/template/app/components/markdown/MarkdownFrameworkHandler.tsx +66 -0
- package/template/app/components/markdown/MarkdownHeadingContext.tsx +35 -0
- package/template/app/components/markdown/MarkdownLink.tsx +46 -0
- package/template/app/components/markdown/MarkdownTabsHandler.tsx +109 -0
- package/template/app/components/markdown/PackageManagerTabs.tsx +95 -0
- package/template/app/components/markdown/Tabs.tsx +139 -0
- package/template/app/components/markdown/index.ts +15 -0
- package/template/app/components/ui/Button.tsx +141 -0
- package/template/app/components/ui/InlineCode.tsx +16 -0
- package/template/app/components/ui/MarkdownImg.tsx +21 -0
- package/template/app/config/frameworks.ts +93 -0
- package/template/app/contexts/SearchContext.tsx +36 -0
- package/template/app/db/index.ts +17 -0
- package/template/app/db/schema.ts +74 -0
- package/template/app/hooks/useClickOutside.ts +106 -0
- package/template/app/routeTree.gen.ts +584 -0
- package/template/app/router.tsx +29 -0
- package/template/app/routes/$lang.$project.$version.docs.$.tsx +128 -0
- package/template/app/routes/$lang.$project.$version.docs.framework.$framework.$.tsx +106 -0
- package/template/app/routes/$lang.$project.$version.docs.framework.$framework.index.tsx +27 -0
- package/template/app/routes/$lang.$project.$version.docs.framework.index.tsx +44 -0
- package/template/app/routes/$lang.$project.$version.docs.index.tsx +27 -0
- package/template/app/routes/$lang.$project.$version.docs.tsx +70 -0
- package/template/app/routes/$lang.$project.$version.tsx +69 -0
- package/template/app/routes/$lang.$project.docs.$.tsx +104 -0
- package/template/app/routes/$lang.$project.docs.index.tsx +20 -0
- package/template/app/routes/$lang.$project.docs.tsx +79 -0
- package/template/app/routes/$lang.$project.tsx +89 -0
- package/template/app/routes/$lang.blog.$.tsx +82 -0
- package/template/app/routes/$lang.blog.index.tsx +56 -0
- package/template/app/routes/$lang.blog.tsx +26 -0
- package/template/app/routes/$lang.docs.$.tsx +100 -0
- package/template/app/routes/$lang.docs.framework.$framework.$.tsx +104 -0
- package/template/app/routes/$lang.docs.framework.$framework.index.tsx +32 -0
- package/template/app/routes/$lang.docs.framework.index.tsx +47 -0
- package/template/app/routes/$lang.docs.index.tsx +20 -0
- package/template/app/routes/$lang.docs.tsx +90 -0
- package/template/app/routes/$lang.tsx +16 -0
- package/template/app/routes/__root.tsx +180 -0
- package/template/app/routes/index.tsx +89 -0
- package/template/app/site.config.ts +182 -0
- package/template/app/styles/app.css +1029 -0
- package/template/app/types/index.ts +77 -0
- package/template/app/utils/blog.server.ts +193 -0
- package/template/app/utils/blog.ts +42 -0
- package/template/app/utils/config.ts +120 -0
- package/template/app/utils/content-loader.ts +400 -0
- package/template/app/utils/dates.ts +29 -0
- package/template/app/utils/docs.server.ts +150 -0
- package/template/app/utils/markdown/filterFrameworkContent.ts +233 -0
- package/template/app/utils/markdown/index.ts +2 -0
- package/template/app/utils/markdown/installCommand.ts +143 -0
- package/template/app/utils/markdown/plugins/collectHeadings.ts +104 -0
- package/template/app/utils/markdown/plugins/extractCodeMeta.ts +57 -0
- package/template/app/utils/markdown/plugins/helpers.ts +33 -0
- package/template/app/utils/markdown/plugins/index.ts +8 -0
- package/template/app/utils/markdown/plugins/parseCommentComponents.ts +103 -0
- package/template/app/utils/markdown/plugins/transformCommentComponents.ts +23 -0
- package/template/app/utils/markdown/plugins/transformFrameworkComponent.ts +217 -0
- package/template/app/utils/markdown/plugins/transformTabsComponent.ts +359 -0
- package/template/app/utils/markdown/processor.ts +75 -0
- package/template/app/utils/site-config.tsx +11 -0
- package/template/app/utils/upload.ts +232 -0
- package/template/app/utils/useLocalStorage.ts +65 -0
- package/template/app/utils/utils.ts +23 -0
- package/template/package.json +54 -0
- package/template/public/favicon.svg +1 -0
- package/template/public/fonts/Inter-latin-ext.woff2 +0 -0
- package/template/public/fonts/Inter-latin.woff2 +0 -0
- package/template/public/images/frameworks/angular-logo.svg +1 -0
- package/template/public/images/frameworks/js-logo.svg +1 -0
- package/template/public/images/frameworks/lit-logo.svg +1 -0
- package/template/public/images/frameworks/preact-logo.svg +6 -0
- package/template/public/images/frameworks/qwik-logo.svg +1 -0
- package/template/public/images/frameworks/react-logo.svg +1 -0
- package/template/public/images/frameworks/solid-logo.svg +1 -0
- package/template/public/images/frameworks/svelte-logo.svg +1 -0
- package/template/public/images/frameworks/vue-logo.svg +4 -0
- package/template/tsconfig.json +24 -0
- package/template/vite.config.ts +43 -0
- package/template/wrangler.jsonc +16 -0
- package/README.md +0 -161
- package/dist/server-73AVSOL5.js +0 -598
- package/src/admin/index.html +0 -13
- package/src/admin/server/index.ts +0 -138
- package/src/admin/server/routes/jobs.ts +0 -113
- package/src/admin/server/routes/status.ts +0 -57
- package/src/admin/ui/App.tsx +0 -332
- package/src/admin/ui/main.tsx +0 -19
- /package/{src/admin/ui → admin/app}/components/FileList.tsx +0 -0
- /package/{src/admin/ui → admin/app}/components/LangGrid.tsx +0 -0
- /package/{src/admin/ui → admin/app}/components/ProgressBar.tsx +0 -0
- /package/{src/admin/ui → admin/app}/lib/flags.ts +0 -0
|
@@ -55,6 +55,12 @@ export function JobDialog({
|
|
|
55
55
|
|
|
56
56
|
const minCtx = CTX_STEPS[ctxSlider] * 1000;
|
|
57
57
|
|
|
58
|
+
const { data: llmConfig } = useQuery({
|
|
59
|
+
queryKey: ['llmConfig'],
|
|
60
|
+
queryFn: api.llmConfig,
|
|
61
|
+
staleTime: 60 * 1000,
|
|
62
|
+
});
|
|
63
|
+
|
|
58
64
|
const { data: models, isLoading: modelsLoading } = useQuery({
|
|
59
65
|
queryKey: ['models'],
|
|
60
66
|
queryFn: api.models,
|
|
@@ -139,6 +145,19 @@ export function JobDialog({
|
|
|
139
145
|
|
|
140
146
|
{error && <div className="dialog-error">{error}</div>}
|
|
141
147
|
|
|
148
|
+
{llmConfig && !llmConfig.hasApiKey && (
|
|
149
|
+
<div className="dialog-error">
|
|
150
|
+
⚠ No API key found. Set <code>OPENROUTER_API_KEY</code> in <code>.env</code> or configure <code>llm.apiKey</code> in config.
|
|
151
|
+
</div>
|
|
152
|
+
)}
|
|
153
|
+
|
|
154
|
+
{llmConfig?.model && (
|
|
155
|
+
<div className="dialog-mode-hint">
|
|
156
|
+
Default model: <strong>{llmConfig.model}</strong>
|
|
157
|
+
{llmConfig.provider && <span> ({llmConfig.provider})</span>}
|
|
158
|
+
</div>
|
|
159
|
+
)}
|
|
160
|
+
|
|
142
161
|
{files?.length && (
|
|
143
162
|
<div className="dialog-mode-hint">
|
|
144
163
|
Translating {files.length} selected file
|
|
@@ -312,10 +331,10 @@ export function JobDialog({
|
|
|
312
331
|
<button
|
|
313
332
|
type="button"
|
|
314
333
|
className="btn"
|
|
315
|
-
disabled={create.isPending}
|
|
334
|
+
disabled={create.isPending || (llmConfig && !llmConfig.hasApiKey)}
|
|
316
335
|
onClick={() => create.mutate()}
|
|
317
336
|
>
|
|
318
|
-
{create.isPending ? 'Starting...' : 'Start Job →'}
|
|
337
|
+
{create.isPending ? 'Starting...' : llmConfig && !llmConfig.hasApiKey ? 'No API Key' : 'Start Job →'}
|
|
319
338
|
</button>
|
|
320
339
|
</div>
|
|
321
340
|
</div>
|
|
@@ -51,7 +51,7 @@ function JobItem({ job }: { job: Job }) {
|
|
|
51
51
|
</button>
|
|
52
52
|
</div>
|
|
53
53
|
<div className="progress-bar">
|
|
54
|
-
<div className="progress-fill" style={{ width: `${pct}%` }} />
|
|
54
|
+
<div className="progress-fill" style={{ width: `${Math.min(100, pct)}%` }} />
|
|
55
55
|
</div>
|
|
56
56
|
<div className="job-meta">
|
|
57
57
|
{progress} · {new Date(job.startedAt).toLocaleTimeString()}
|
|
@@ -2,6 +2,7 @@ import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
|
|
|
2
2
|
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
3
3
|
import { api, type FileBlock } from '../lib/api';
|
|
4
4
|
import { FLAGS } from '../lib/flags';
|
|
5
|
+
import { openFile } from '../../server/functions/misc';
|
|
5
6
|
|
|
6
7
|
interface ContextMenuState {
|
|
7
8
|
x: number;
|
|
@@ -155,11 +156,7 @@ export function Preview({
|
|
|
155
156
|
title="Click to open in editor"
|
|
156
157
|
onClick={(e) => {
|
|
157
158
|
e.preventDefault();
|
|
158
|
-
|
|
159
|
-
method: 'POST',
|
|
160
|
-
headers: { 'Content-Type': 'application/json' },
|
|
161
|
-
body: JSON.stringify({ file: `content/${version}/${file}` }),
|
|
162
|
-
});
|
|
159
|
+
openFile({ data: { file: `content/${version}/${file}` } });
|
|
163
160
|
}}
|
|
164
161
|
>
|
|
165
162
|
{file}
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const data = await res.json();
|
|
6
|
-
if (!res.ok) throw new Error(data.error || `HTTP ${res.status}`);
|
|
7
|
-
return data as T;
|
|
8
|
-
}
|
|
1
|
+
import { fetchStatus, fetchFileCoverage, fetchFileBlocks, deleteCacheEntry } from '../../server/functions/status';
|
|
2
|
+
import { fetchJobs, createJob, deleteJob } from '../../server/functions/jobs';
|
|
3
|
+
import { fetchModels } from '../../server/functions/models';
|
|
4
|
+
import { fetchVersion, fetchLlmConfig } from '../../server/functions/misc';
|
|
9
5
|
|
|
10
6
|
// ── Types ──
|
|
11
7
|
|
|
@@ -89,8 +85,6 @@ export interface Job {
|
|
|
89
85
|
logLines?: string[];
|
|
90
86
|
}
|
|
91
87
|
|
|
92
|
-
// ── API ──
|
|
93
|
-
|
|
94
88
|
export interface Model {
|
|
95
89
|
id: string;
|
|
96
90
|
name: string;
|
|
@@ -104,36 +98,27 @@ export interface Model {
|
|
|
104
98
|
provider: string;
|
|
105
99
|
}
|
|
106
100
|
|
|
107
|
-
|
|
108
|
-
version: () => request<{ version: string }>('/version'),
|
|
101
|
+
// ── API ──
|
|
109
102
|
|
|
110
|
-
|
|
103
|
+
export const api = {
|
|
104
|
+
version: () => fetchVersion() as Promise<{ version: string }>,
|
|
111
105
|
|
|
112
|
-
|
|
113
|
-
request<FileCoverage[]>(`/status/${version}/${lang}`),
|
|
106
|
+
llmConfig: () => fetchLlmConfig() as Promise<{ model: string | null; provider: string | null; hasApiKey: boolean }>,
|
|
114
107
|
|
|
115
|
-
|
|
116
|
-
request<FileContent>(`/status/content/${version}/${lang}/${file}`),
|
|
108
|
+
status: () => fetchStatus() as Promise<StatusOverview>,
|
|
117
109
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
`/status/${version}/${lang}/file?path=${encodeURIComponent(file)}`,
|
|
121
|
-
),
|
|
110
|
+
fileCoverage: (version: string, lang: string) =>
|
|
111
|
+
fetchFileCoverage({ data: { version, lang } }) as Promise<FileCoverage[]>,
|
|
122
112
|
|
|
123
113
|
fileBlocks: (version: string, lang: string, file: string) =>
|
|
124
|
-
|
|
125
|
-
`/status/${version}/${lang}/blocks?path=${encodeURIComponent(file)}`,
|
|
126
|
-
),
|
|
114
|
+
fetchFileBlocks({ data: { version, lang, path: file } }) as Promise<FileBlocksResponse>,
|
|
127
115
|
|
|
128
116
|
deleteCache: (version: string, lang: string, key: string) =>
|
|
129
|
-
|
|
130
|
-
`/status/${version}/${lang}/cache?key=${encodeURIComponent(key)}`,
|
|
131
|
-
{ method: 'DELETE' },
|
|
132
|
-
),
|
|
117
|
+
deleteCacheEntry({ data: { version, lang, key } }) as Promise<{ deleted: string; lang: string }>,
|
|
133
118
|
|
|
134
|
-
models: () =>
|
|
119
|
+
models: () => fetchModels() as Promise<Model[]>,
|
|
135
120
|
|
|
136
|
-
jobs: () =>
|
|
121
|
+
jobs: () => fetchJobs() as Promise<Job[]>,
|
|
137
122
|
|
|
138
123
|
createJob: (body: {
|
|
139
124
|
lang: string;
|
|
@@ -144,13 +129,7 @@ export const api = {
|
|
|
144
129
|
modelRotate?: string[];
|
|
145
130
|
md5?: boolean;
|
|
146
131
|
files?: string[];
|
|
147
|
-
}) =>
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
headers: { 'Content-Type': 'application/json' },
|
|
151
|
-
body: JSON.stringify(body),
|
|
152
|
-
}),
|
|
153
|
-
|
|
154
|
-
deleteJob: (id: string) =>
|
|
155
|
-
request<{ ok: boolean }>(`/jobs/${id}`, { method: 'DELETE' }),
|
|
132
|
+
}) => createJob({ data: body }) as Promise<Job>,
|
|
133
|
+
|
|
134
|
+
deleteJob: (id: string) => deleteJob({ data: { id } }) as Promise<{ ok: boolean }>,
|
|
156
135
|
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
|
|
3
|
+
// @ts-nocheck
|
|
4
|
+
|
|
5
|
+
// noinspection JSUnusedGlobalSymbols
|
|
6
|
+
|
|
7
|
+
// This file was automatically generated by TanStack Router.
|
|
8
|
+
// You should NOT make any changes in this file as it will be overwritten.
|
|
9
|
+
// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
|
|
10
|
+
|
|
11
|
+
import { Route as rootRouteImport } from './routes/__root'
|
|
12
|
+
import { Route as IndexRouteImport } from './routes/index'
|
|
13
|
+
|
|
14
|
+
const IndexRoute = IndexRouteImport.update({
|
|
15
|
+
id: '/',
|
|
16
|
+
path: '/',
|
|
17
|
+
getParentRoute: () => rootRouteImport,
|
|
18
|
+
} as any)
|
|
19
|
+
|
|
20
|
+
export interface FileRoutesByFullPath {
|
|
21
|
+
'/': typeof IndexRoute
|
|
22
|
+
}
|
|
23
|
+
export interface FileRoutesByTo {
|
|
24
|
+
'/': typeof IndexRoute
|
|
25
|
+
}
|
|
26
|
+
export interface FileRoutesById {
|
|
27
|
+
__root__: typeof rootRouteImport
|
|
28
|
+
'/': typeof IndexRoute
|
|
29
|
+
}
|
|
30
|
+
export interface FileRouteTypes {
|
|
31
|
+
fileRoutesByFullPath: FileRoutesByFullPath
|
|
32
|
+
fullPaths: '/'
|
|
33
|
+
fileRoutesByTo: FileRoutesByTo
|
|
34
|
+
to: '/'
|
|
35
|
+
id: '__root__' | '/'
|
|
36
|
+
fileRoutesById: FileRoutesById
|
|
37
|
+
}
|
|
38
|
+
export interface RootRouteChildren {
|
|
39
|
+
IndexRoute: typeof IndexRoute
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
declare module '@tanstack/react-router' {
|
|
43
|
+
interface FileRoutesByPath {
|
|
44
|
+
'/': {
|
|
45
|
+
id: '/'
|
|
46
|
+
path: '/'
|
|
47
|
+
fullPath: '/'
|
|
48
|
+
preLoaderRoute: typeof IndexRouteImport
|
|
49
|
+
parentRoute: typeof rootRouteImport
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const rootRouteChildren: RootRouteChildren = {
|
|
55
|
+
IndexRoute: IndexRoute,
|
|
56
|
+
}
|
|
57
|
+
export const routeTree = rootRouteImport
|
|
58
|
+
._addFileChildren(rootRouteChildren)
|
|
59
|
+
._addFileTypes<FileRouteTypes>()
|
|
60
|
+
|
|
61
|
+
import type { getRouter } from './router.tsx'
|
|
62
|
+
import type { createStart } from '@tanstack/react-start'
|
|
63
|
+
declare module '@tanstack/react-start' {
|
|
64
|
+
interface Register {
|
|
65
|
+
ssr: true
|
|
66
|
+
router: Awaited<ReturnType<typeof getRouter>>
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { createRouter as createTanStackRouter } from '@tanstack/react-router';
|
|
2
|
+
import { QueryClient } from '@tanstack/react-query';
|
|
3
|
+
import { routeTree } from './routeTree.gen';
|
|
4
|
+
|
|
5
|
+
export function getRouter() {
|
|
6
|
+
const queryClient = new QueryClient({
|
|
7
|
+
defaultOptions: {
|
|
8
|
+
queries: { refetchOnWindowFocus: false, retry: 1 },
|
|
9
|
+
},
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
return createTanStackRouter({
|
|
13
|
+
routeTree,
|
|
14
|
+
context: { queryClient },
|
|
15
|
+
scrollRestoration: true,
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
declare module '@tanstack/react-router' {
|
|
20
|
+
interface Register {
|
|
21
|
+
router: ReturnType<typeof getRouter>;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/// <reference types="vite/client" />
|
|
2
|
+
import {
|
|
3
|
+
HeadContent,
|
|
4
|
+
Outlet,
|
|
5
|
+
Scripts,
|
|
6
|
+
createRootRouteWithContext,
|
|
7
|
+
} from '@tanstack/react-router';
|
|
8
|
+
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
9
|
+
import * as React from 'react';
|
|
10
|
+
import appCss from '../styles.css?url';
|
|
11
|
+
|
|
12
|
+
export const Route = createRootRouteWithContext<{
|
|
13
|
+
queryClient: QueryClient;
|
|
14
|
+
}>()({
|
|
15
|
+
head: () => ({
|
|
16
|
+
meta: [
|
|
17
|
+
{ charSet: 'utf-8' },
|
|
18
|
+
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
|
|
19
|
+
],
|
|
20
|
+
links: [{ rel: 'stylesheet', href: appCss }],
|
|
21
|
+
}),
|
|
22
|
+
component: RootComponent,
|
|
23
|
+
notFoundComponent: () => <div style={{ padding: 20 }}>Page not found</div>,
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
function RootComponent() {
|
|
27
|
+
const { queryClient } = Route.useRouteContext();
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<RootDocument>
|
|
31
|
+
<QueryClientProvider client={queryClient}>
|
|
32
|
+
<Outlet />
|
|
33
|
+
</QueryClientProvider>
|
|
34
|
+
</RootDocument>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function RootDocument({ children }: { children: React.ReactNode }) {
|
|
39
|
+
return (
|
|
40
|
+
<html lang="en" data-theme="dark" suppressHydrationWarning>
|
|
41
|
+
<head>
|
|
42
|
+
<HeadContent />
|
|
43
|
+
</head>
|
|
44
|
+
<body>
|
|
45
|
+
<script
|
|
46
|
+
dangerouslySetInnerHTML={{
|
|
47
|
+
__html: `document.documentElement.dataset.theme=localStorage.getItem('theme')||'dark'`,
|
|
48
|
+
}}
|
|
49
|
+
/>
|
|
50
|
+
{children}
|
|
51
|
+
<Scripts />
|
|
52
|
+
</body>
|
|
53
|
+
</html>
|
|
54
|
+
);
|
|
55
|
+
}
|