docs-i18n 0.6.3 → 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.
Files changed (169) hide show
  1. package/{src/admin/ui → admin/app}/components/JobDialog.tsx +21 -2
  2. package/{src/admin/ui → admin/app}/components/JobPanel.tsx +1 -1
  3. package/{src/admin/ui → admin/app}/components/Preview.tsx +2 -5
  4. package/{src/admin/ui → admin/app}/lib/api.ts +18 -39
  5. package/admin/app/routeTree.gen.ts +68 -0
  6. package/admin/app/router.tsx +23 -0
  7. package/admin/app/routes/__root.tsx +55 -0
  8. package/admin/app/routes/index.tsx +416 -0
  9. package/{src/admin/ui → admin/app}/styles.css +36 -3
  10. package/admin/package.json +27 -0
  11. package/admin/server/functions/jobs.ts +53 -0
  12. package/admin/server/functions/misc.ts +84 -0
  13. package/{src/admin/server/routes → admin/server/functions}/models.ts +16 -29
  14. package/admin/server/functions/status.ts +61 -0
  15. package/admin/server/index.ts +35 -0
  16. package/admin/server/init.ts +46 -0
  17. package/{src/admin → admin}/server/services/job-manager.ts +39 -10
  18. package/{src/admin → admin}/server/services/status.ts +6 -6
  19. package/admin/tsconfig.json +19 -0
  20. package/{src/admin → admin}/vite.config.ts +8 -2
  21. package/dist/{assemble-7H4QCW35.js → assemble-CP2BRYQJ.js} +6 -4
  22. package/dist/{chunk-A3YQNPKZ.js → chunk-CLYUAWZE.js} +1 -1
  23. package/dist/{chunk-YN4VJHCQ.js → chunk-JHBSHTXC.js} +1 -1
  24. package/dist/chunk-L64GJ4OB.js +32 -0
  25. package/dist/{chunk-SKKZIV3L.js → chunk-PNKVD2UK.js} +1 -29
  26. package/dist/{chunk-XEOYZUHS.js → chunk-QKIR7RKQ.js} +4 -31
  27. package/dist/chunk-TRURQFP4.js +31 -0
  28. package/dist/cli.js +108 -7
  29. package/dist/index.d.ts +41 -1
  30. package/dist/index.js +92 -3
  31. package/dist/{rescan-O5D3CYC2.js → rescan-HXMWFAOC.js} +5 -3
  32. package/dist/{status-F4MYIAAY.js → status-AGZDXOTZ.js} +4 -2
  33. package/dist/{translate-ZIVKNAC4.js → translate-A5X6MX4Y.js} +14 -7
  34. package/dist/upload-XL6KG6S2.js +132 -0
  35. package/package.json +17 -15
  36. package/template/app/components/BlogArticle.tsx +159 -0
  37. package/template/app/components/BlogList.tsx +88 -0
  38. package/template/app/components/Breadcrumbs.tsx +81 -0
  39. package/template/app/components/Card.tsx +31 -0
  40. package/template/app/components/Doc.tsx +191 -0
  41. package/template/app/components/DocBreadcrumb.tsx +60 -0
  42. package/template/app/components/DocContainer.tsx +13 -0
  43. package/template/app/components/DocTitle.tsx +11 -0
  44. package/template/app/components/DocsLayout.tsx +715 -0
  45. package/template/app/components/Dropdown.tsx +116 -0
  46. package/template/app/components/FallbackBanner.tsx +36 -0
  47. package/template/app/components/Footer.tsx +29 -0
  48. package/template/app/components/FrameworkSelect.tsx +150 -0
  49. package/template/app/components/LibraryCard.tsx +178 -0
  50. package/template/app/components/LocaleSwitcher.tsx +43 -0
  51. package/template/app/components/Navbar.tsx +430 -0
  52. package/template/app/components/PostNotFound.tsx +20 -0
  53. package/template/app/components/SearchButton.tsx +32 -0
  54. package/template/app/components/Select.tsx +103 -0
  55. package/template/app/components/Spinner.tsx +18 -0
  56. package/template/app/components/ThemeProvider.tsx +141 -0
  57. package/template/app/components/ThemeToggle.tsx +31 -0
  58. package/template/app/components/Toc.tsx +86 -0
  59. package/template/app/components/VersionSelect.tsx +118 -0
  60. package/template/app/components/icons/BSkyIcon.tsx +27 -0
  61. package/template/app/components/icons/BaseballCapIcon.tsx +25 -0
  62. package/template/app/components/icons/BrandXIcon.tsx +28 -0
  63. package/template/app/components/icons/CheckCircleIcon.tsx +28 -0
  64. package/template/app/components/icons/CogsIcon.tsx +25 -0
  65. package/template/app/components/icons/DiscordIcon.tsx +24 -0
  66. package/template/app/components/icons/GithubIcon.tsx +24 -0
  67. package/template/app/components/icons/GoogleIcon.tsx +24 -0
  68. package/template/app/components/icons/InstagramIcon.tsx +24 -0
  69. package/template/app/components/icons/NpmIcon.tsx +26 -0
  70. package/template/app/components/icons/YinYangIcon.tsx +26 -0
  71. package/template/app/components/icons/YouTubeIcon.tsx +24 -0
  72. package/template/app/components/markdown/CodeBlock.tsx +254 -0
  73. package/template/app/components/markdown/FileTabs.tsx +58 -0
  74. package/template/app/components/markdown/FrameworkContent.tsx +76 -0
  75. package/template/app/components/markdown/Markdown.tsx +216 -0
  76. package/template/app/components/markdown/MarkdownContent.tsx +89 -0
  77. package/template/app/components/markdown/MarkdownFrameworkHandler.tsx +66 -0
  78. package/template/app/components/markdown/MarkdownHeadingContext.tsx +35 -0
  79. package/template/app/components/markdown/MarkdownLink.tsx +46 -0
  80. package/template/app/components/markdown/MarkdownTabsHandler.tsx +109 -0
  81. package/template/app/components/markdown/PackageManagerTabs.tsx +95 -0
  82. package/template/app/components/markdown/Tabs.tsx +139 -0
  83. package/template/app/components/markdown/index.ts +15 -0
  84. package/template/app/components/ui/Button.tsx +141 -0
  85. package/template/app/components/ui/InlineCode.tsx +16 -0
  86. package/template/app/components/ui/MarkdownImg.tsx +21 -0
  87. package/template/app/config/frameworks.ts +93 -0
  88. package/template/app/contexts/SearchContext.tsx +36 -0
  89. package/template/app/db/index.ts +17 -0
  90. package/template/app/db/schema.ts +74 -0
  91. package/template/app/hooks/useClickOutside.ts +106 -0
  92. package/template/app/routeTree.gen.ts +584 -0
  93. package/template/app/router.tsx +29 -0
  94. package/template/app/routes/$lang.$project.$version.docs.$.tsx +128 -0
  95. package/template/app/routes/$lang.$project.$version.docs.framework.$framework.$.tsx +106 -0
  96. package/template/app/routes/$lang.$project.$version.docs.framework.$framework.index.tsx +27 -0
  97. package/template/app/routes/$lang.$project.$version.docs.framework.index.tsx +44 -0
  98. package/template/app/routes/$lang.$project.$version.docs.index.tsx +27 -0
  99. package/template/app/routes/$lang.$project.$version.docs.tsx +70 -0
  100. package/template/app/routes/$lang.$project.$version.tsx +69 -0
  101. package/template/app/routes/$lang.$project.docs.$.tsx +104 -0
  102. package/template/app/routes/$lang.$project.docs.index.tsx +20 -0
  103. package/template/app/routes/$lang.$project.docs.tsx +79 -0
  104. package/template/app/routes/$lang.$project.tsx +89 -0
  105. package/template/app/routes/$lang.blog.$.tsx +82 -0
  106. package/template/app/routes/$lang.blog.index.tsx +56 -0
  107. package/template/app/routes/$lang.blog.tsx +26 -0
  108. package/template/app/routes/$lang.docs.$.tsx +100 -0
  109. package/template/app/routes/$lang.docs.framework.$framework.$.tsx +104 -0
  110. package/template/app/routes/$lang.docs.framework.$framework.index.tsx +32 -0
  111. package/template/app/routes/$lang.docs.framework.index.tsx +47 -0
  112. package/template/app/routes/$lang.docs.index.tsx +20 -0
  113. package/template/app/routes/$lang.docs.tsx +90 -0
  114. package/template/app/routes/$lang.tsx +16 -0
  115. package/template/app/routes/__root.tsx +180 -0
  116. package/template/app/routes/index.tsx +89 -0
  117. package/template/app/site.config.ts +182 -0
  118. package/template/app/styles/app.css +1029 -0
  119. package/template/app/types/index.ts +77 -0
  120. package/template/app/utils/blog.server.ts +193 -0
  121. package/template/app/utils/blog.ts +42 -0
  122. package/template/app/utils/config.ts +120 -0
  123. package/template/app/utils/content-loader.ts +400 -0
  124. package/template/app/utils/dates.ts +29 -0
  125. package/template/app/utils/docs.server.ts +150 -0
  126. package/template/app/utils/markdown/filterFrameworkContent.ts +233 -0
  127. package/template/app/utils/markdown/index.ts +2 -0
  128. package/template/app/utils/markdown/installCommand.ts +143 -0
  129. package/template/app/utils/markdown/plugins/collectHeadings.ts +104 -0
  130. package/template/app/utils/markdown/plugins/extractCodeMeta.ts +57 -0
  131. package/template/app/utils/markdown/plugins/helpers.ts +33 -0
  132. package/template/app/utils/markdown/plugins/index.ts +8 -0
  133. package/template/app/utils/markdown/plugins/parseCommentComponents.ts +103 -0
  134. package/template/app/utils/markdown/plugins/transformCommentComponents.ts +23 -0
  135. package/template/app/utils/markdown/plugins/transformFrameworkComponent.ts +217 -0
  136. package/template/app/utils/markdown/plugins/transformTabsComponent.ts +359 -0
  137. package/template/app/utils/markdown/processor.ts +75 -0
  138. package/template/app/utils/site-config.tsx +11 -0
  139. package/template/app/utils/upload.ts +232 -0
  140. package/template/app/utils/useLocalStorage.ts +65 -0
  141. package/template/app/utils/utils.ts +23 -0
  142. package/template/package.json +54 -0
  143. package/template/public/favicon.svg +1 -0
  144. package/template/public/fonts/Inter-latin-ext.woff2 +0 -0
  145. package/template/public/fonts/Inter-latin.woff2 +0 -0
  146. package/template/public/images/frameworks/angular-logo.svg +1 -0
  147. package/template/public/images/frameworks/js-logo.svg +1 -0
  148. package/template/public/images/frameworks/lit-logo.svg +1 -0
  149. package/template/public/images/frameworks/preact-logo.svg +6 -0
  150. package/template/public/images/frameworks/qwik-logo.svg +1 -0
  151. package/template/public/images/frameworks/react-logo.svg +1 -0
  152. package/template/public/images/frameworks/solid-logo.svg +1 -0
  153. package/template/public/images/frameworks/svelte-logo.svg +1 -0
  154. package/template/public/images/frameworks/vue-logo.svg +4 -0
  155. package/template/tsconfig.json +24 -0
  156. package/template/vite.config.ts +43 -0
  157. package/template/wrangler.jsonc +16 -0
  158. package/README.md +0 -161
  159. package/dist/server-73AVSOL5.js +0 -598
  160. package/src/admin/index.html +0 -13
  161. package/src/admin/server/index.ts +0 -138
  162. package/src/admin/server/routes/jobs.ts +0 -113
  163. package/src/admin/server/routes/status.ts +0 -57
  164. package/src/admin/ui/App.tsx +0 -332
  165. package/src/admin/ui/main.tsx +0 -19
  166. /package/{src/admin/ui → admin/app}/components/FileList.tsx +0 -0
  167. /package/{src/admin/ui → admin/app}/components/LangGrid.tsx +0 -0
  168. /package/{src/admin/ui → admin/app}/components/ProgressBar.tsx +0 -0
  169. /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
- fetch('/api/open-file', {
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
- const BASE = '/api';
2
-
3
- async function request<T>(path: string, init?: RequestInit): Promise<T> {
4
- const res = await fetch(`${BASE}${path}`, init);
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
- export const api = {
108
- version: () => request<{ version: string }>('/version'),
101
+ // ── API ──
109
102
 
110
- status: () => request<StatusOverview>('/status'),
103
+ export const api = {
104
+ version: () => fetchVersion() as Promise<{ version: string }>,
111
105
 
112
- fileCoverage: (version: string, lang: string) =>
113
- request<FileCoverage[]>(`/status/${version}/${lang}`),
106
+ llmConfig: () => fetchLlmConfig() as Promise<{ model: string | null; provider: string | null; hasApiKey: boolean }>,
114
107
 
115
- fileContent: (version: string, lang: string, file: string) =>
116
- request<FileContent>(`/status/content/${version}/${lang}/${file}`),
108
+ status: () => fetchStatus() as Promise<StatusOverview>,
117
109
 
118
- fileDetail: (version: string, lang: string, file: string) =>
119
- request<FileNode[]>(
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
- request<FileBlocksResponse>(
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
- request<{ deleted: string }>(
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: () => request<Model[]>('/models'),
119
+ models: () => fetchModels() as Promise<Model[]>,
135
120
 
136
- jobs: () => request<Job[]>('/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
- request<Job>('/jobs', {
149
- method: 'POST',
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
+ }