@wrikka/create-docs 0.1.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 (380) hide show
  1. package/README.md +137 -0
  2. package/bin/cli.js +408 -0
  3. package/dist/index.cjs +20 -0
  4. package/dist/index.d.cts +475 -0
  5. package/dist/index.d.ts +475 -0
  6. package/dist/index.js +20 -0
  7. package/docs/_dir.yml +2 -0
  8. package/docs/config.md +75 -0
  9. package/docs/data-sources.md +88 -0
  10. package/docs/deploy.md +38 -0
  11. package/docs/features.md +51 -0
  12. package/docs/getting-started.md +42 -0
  13. package/docs/index.md +34 -0
  14. package/docs/markdown.md +154 -0
  15. package/docs/theming.md +53 -0
  16. package/package.json +142 -0
  17. package/scripts/generate-docs-index.ts +111 -0
  18. package/scripts/github-pull.ts +124 -0
  19. package/src/adapters/config/index.ts +1 -0
  20. package/src/adapters/config/node-config-loader.ts +36 -0
  21. package/src/adapters/fs/fs-docs-loader.ts +31 -0
  22. package/src/adapters/fs/index.ts +12 -0
  23. package/src/adapters/fs/memory-fs.ts +60 -0
  24. package/src/adapters/fs/node-fs.ts +116 -0
  25. package/src/adapters/git/index.ts +164 -0
  26. package/src/adapters/github/github-pull.ts +340 -0
  27. package/src/adapters/index.ts +6 -0
  28. package/src/adapters/velite.ts +112 -0
  29. package/src/adapters/vite/docs-watcher.ts +36 -0
  30. package/src/adapters/vite/index.ts +2 -0
  31. package/src/adapters/vite/polling-watcher.ts +89 -0
  32. package/src/code-block-enhancements/index.ts +3 -0
  33. package/src/config/index.ts +15 -0
  34. package/src/content/index.ts +11 -0
  35. package/src/content-validation/index.ts +5 -0
  36. package/src/index.ts +174 -0
  37. package/src/live-editor/index.ts +7 -0
  38. package/src/modules/analytics/application/plausible-adapter.ts +103 -0
  39. package/src/modules/analytics/application/umami-adapter.ts +109 -0
  40. package/src/modules/analytics/domain/events/index.ts +37 -0
  41. package/src/modules/analytics/domain/models/index.ts +35 -0
  42. package/src/modules/analytics/domain/operations/analytics-operations.ts +67 -0
  43. package/src/modules/analytics/domain/validators/index.ts +50 -0
  44. package/src/modules/analytics/index.ts +9 -0
  45. package/src/modules/analytics/ports/analytics-port.ts +17 -0
  46. package/src/modules/analytics/types/analytics.ts +16 -0
  47. package/src/modules/api-docs/application/type-docs-adapter.ts +34 -0
  48. package/src/modules/api-docs/domain/events/index.ts +42 -0
  49. package/src/modules/api-docs/domain/models/index.ts +40 -0
  50. package/src/modules/api-docs/domain/operations/api-docs-operations.ts +59 -0
  51. package/src/modules/api-docs/domain/validators/index.ts +56 -0
  52. package/src/modules/api-docs/index.ts +8 -0
  53. package/src/modules/api-docs/ports/api-docs-port.ts +21 -0
  54. package/src/modules/api-docs/types/api-docs.ts +15 -0
  55. package/src/modules/api-reference/openapi.ts +166 -0
  56. package/src/modules/api-reference/orpc.ts +94 -0
  57. package/src/modules/code-block-enhancements/application/usecases/index.ts +39 -0
  58. package/src/modules/code-block-enhancements/domain/code-operations.ts +72 -0
  59. package/src/modules/code-block-enhancements/domain/events/index.ts +58 -0
  60. package/src/modules/code-block-enhancements/domain/index.ts +11 -0
  61. package/src/modules/code-block-enhancements/domain/models/index.ts +36 -0
  62. package/src/modules/code-block-enhancements/domain/validators/index.ts +50 -0
  63. package/src/modules/code-block-enhancements/index.ts +10 -0
  64. package/src/modules/code-block-enhancements/ports/index.ts +18 -0
  65. package/src/modules/code-block-enhancements/types/index.ts +37 -0
  66. package/src/modules/code-execution/application/sandbox-adapter.ts +44 -0
  67. package/src/modules/code-execution/domain/events/index.ts +58 -0
  68. package/src/modules/code-execution/domain/models/index.ts +33 -0
  69. package/src/modules/code-execution/domain/operations/execution-operations.ts +60 -0
  70. package/src/modules/code-execution/domain/validators/index.ts +50 -0
  71. package/src/modules/code-execution/index.ts +8 -0
  72. package/src/modules/code-execution/ports/execution-port.ts +15 -0
  73. package/src/modules/code-execution/types/execution.ts +15 -0
  74. package/src/modules/comments/application/giscus-adapter.ts +55 -0
  75. package/src/modules/comments/domain/events/index.ts +55 -0
  76. package/src/modules/comments/domain/models/index.ts +30 -0
  77. package/src/modules/comments/domain/operations/comment-operations.ts +46 -0
  78. package/src/modules/comments/domain/validators/index.ts +50 -0
  79. package/src/modules/comments/index.ts +8 -0
  80. package/src/modules/comments/ports/comment-port.ts +18 -0
  81. package/src/modules/comments/types/comments.ts +19 -0
  82. package/src/modules/config/application/usecases/index.ts +1 -0
  83. package/src/modules/config/application/usecases/loadConfig.ts +38 -0
  84. package/src/modules/config/application/workflows/index.ts +1 -0
  85. package/src/modules/config/application/workflows/validateConfig.ts +14 -0
  86. package/src/modules/config/domain/events/index.ts +50 -0
  87. package/src/modules/config/domain/models/index.ts +9 -0
  88. package/src/modules/config/domain/operations/defaults.ts +74 -0
  89. package/src/modules/config/domain/operations/index.ts +2 -0
  90. package/src/modules/config/domain/operations/resolve.ts +40 -0
  91. package/src/modules/config/domain/validators/index.ts +152 -0
  92. package/src/modules/config/index.ts +23 -0
  93. package/src/modules/config/ports/index.ts +15 -0
  94. package/src/modules/config/types/index.ts +113 -0
  95. package/src/modules/config/types/public.ts +19 -0
  96. package/src/modules/content/application/cache/index.ts +6 -0
  97. package/src/modules/content/application/cache/parse-cache.ts +6 -0
  98. package/src/modules/content/application/cache/parseCache.ts +56 -0
  99. package/src/modules/content/application/usecases/index.ts +2 -0
  100. package/src/modules/content/application/usecases/load-doc-page.ts +1 -0
  101. package/src/modules/content/application/usecases/loadDocPage.ts +111 -0
  102. package/src/modules/content/application/usecases/scanDocsDir.ts +105 -0
  103. package/src/modules/content/application/workflows/index.ts +1 -0
  104. package/src/modules/content/application/workflows/processDocs.ts +51 -0
  105. package/src/modules/content/domain/events/index.ts +61 -0
  106. package/src/modules/content/domain/models/index.ts +13 -0
  107. package/src/modules/content/domain/operations/build-page.ts +146 -0
  108. package/src/modules/content/domain/operations/buildPage.ts +93 -0
  109. package/src/modules/content/domain/operations/index.ts +17 -0
  110. package/src/modules/content/domain/operations/parse.ts +241 -0
  111. package/src/modules/content/domain/validators/frontmatter.ts +82 -0
  112. package/src/modules/content/domain/validators/index.ts +6 -0
  113. package/src/modules/content/index.ts +27 -0
  114. package/src/modules/content/ports/index.ts +45 -0
  115. package/src/modules/content/ports/velite.ts +134 -0
  116. package/src/modules/content/types/index.ts +76 -0
  117. package/src/modules/content/types/public.ts +1 -0
  118. package/src/modules/content-linting/application/builtin-linting-adapter.ts +82 -0
  119. package/src/modules/content-linting/domain/events/index.ts +58 -0
  120. package/src/modules/content-linting/domain/models/index.ts +46 -0
  121. package/src/modules/content-linting/domain/operations/linting-operations.ts +82 -0
  122. package/src/modules/content-linting/domain/validators/index.ts +50 -0
  123. package/src/modules/content-linting/index.ts +8 -0
  124. package/src/modules/content-linting/ports/linting-port.ts +21 -0
  125. package/src/modules/content-linting/types/linting.ts +18 -0
  126. package/src/modules/content-validation/application/usecases/index.ts +18 -0
  127. package/src/modules/content-validation/domain/events/index.ts +7 -0
  128. package/src/modules/content-validation/domain/index.ts +16 -0
  129. package/src/modules/content-validation/domain/models/index.ts +33 -0
  130. package/src/modules/content-validation/domain/operations/index.ts +157 -0
  131. package/src/modules/content-validation/domain/types/index.ts +17 -0
  132. package/src/modules/content-validation/domain/validators/index.ts +8 -0
  133. package/src/modules/content-validation/index.ts +9 -0
  134. package/src/modules/content-validation/ports/index.ts +15 -0
  135. package/src/modules/content-validation/types/index.ts +5 -0
  136. package/src/modules/export/application/puppeteer-export-adapter.ts +63 -0
  137. package/src/modules/export/domain/events/index.ts +55 -0
  138. package/src/modules/export/domain/models/index.ts +38 -0
  139. package/src/modules/export/domain/operations/export-operations.ts +56 -0
  140. package/src/modules/export/domain/validators/index.ts +52 -0
  141. package/src/modules/export/index.ts +8 -0
  142. package/src/modules/export/ports/export-port.ts +15 -0
  143. package/src/modules/export/types/export.ts +15 -0
  144. package/src/modules/external-search/application/algolia-adapter.ts +182 -0
  145. package/src/modules/external-search/application/meilisearch-adapter.ts +161 -0
  146. package/src/modules/external-search/domain/events/index.ts +42 -0
  147. package/src/modules/external-search/domain/models/index.ts +42 -0
  148. package/src/modules/external-search/domain/operations/search-operations.ts +53 -0
  149. package/src/modules/external-search/domain/validators/index.ts +55 -0
  150. package/src/modules/external-search/index.ts +9 -0
  151. package/src/modules/external-search/ports/external-search-port.ts +23 -0
  152. package/src/modules/external-search/types/search.ts +19 -0
  153. package/src/modules/git-history/application/simple-git-adapter.ts +46 -0
  154. package/src/modules/git-history/domain/events/index.ts +34 -0
  155. package/src/modules/git-history/domain/models/index.ts +25 -0
  156. package/src/modules/git-history/domain/operations/git-history-operations.ts +56 -0
  157. package/src/modules/git-history/domain/validators/index.ts +52 -0
  158. package/src/modules/git-history/index.ts +8 -0
  159. package/src/modules/git-history/ports/git-history-port.ts +21 -0
  160. package/src/modules/git-history/types/git-history.ts +15 -0
  161. package/src/modules/i18n/application/fs-locale-loader.ts +39 -0
  162. package/src/modules/i18n/domain/events/index.ts +34 -0
  163. package/src/modules/i18n/domain/models/index.ts +34 -0
  164. package/src/modules/i18n/domain/operations/locale-operations.ts +74 -0
  165. package/src/modules/i18n/domain/validators/index.ts +52 -0
  166. package/src/modules/i18n/index.ts +8 -0
  167. package/src/modules/i18n/ports/locale-loader-port.ts +18 -0
  168. package/src/modules/i18n/types/locale.ts +17 -0
  169. package/src/modules/image-optimization/application/sharp-adapter.ts +58 -0
  170. package/src/modules/image-optimization/domain/events/index.ts +39 -0
  171. package/src/modules/image-optimization/domain/models/index.ts +27 -0
  172. package/src/modules/image-optimization/domain/operations/image-operations.ts +65 -0
  173. package/src/modules/image-optimization/domain/validators/index.ts +52 -0
  174. package/src/modules/image-optimization/index.ts +8 -0
  175. package/src/modules/image-optimization/ports/image-optimizer-port.ts +15 -0
  176. package/src/modules/image-optimization/types/image.ts +17 -0
  177. package/src/modules/live-editor/application/usecases/index.ts +60 -0
  178. package/src/modules/live-editor/domain/events/index.ts +37 -0
  179. package/src/modules/live-editor/domain/gitOperations.ts +110 -0
  180. package/src/modules/live-editor/domain/index.ts +15 -0
  181. package/src/modules/live-editor/domain/models/index.ts +21 -0
  182. package/src/modules/live-editor/domain/validators/index.ts +55 -0
  183. package/src/modules/live-editor/index.ts +14 -0
  184. package/src/modules/live-editor/ports/index.ts +49 -0
  185. package/src/modules/live-editor/types/index.ts +80 -0
  186. package/src/modules/live-preview/application/vite-preview-adapter.ts +20 -0
  187. package/src/modules/live-preview/domain/operations/preview-operations.ts +56 -0
  188. package/src/modules/live-preview/index.ts +8 -0
  189. package/src/modules/live-preview/ports/preview-port.ts +20 -0
  190. package/src/modules/live-preview/types/preview.ts +16 -0
  191. package/src/modules/mdx/application/mdx-js-adapter.ts +38 -0
  192. package/src/modules/mdx/domain/operations/parse-mdx.ts +43 -0
  193. package/src/modules/mdx/index.ts +8 -0
  194. package/src/modules/mdx/ports/mdx-parser-port.ts +15 -0
  195. package/src/modules/mdx/types/mdx.ts +14 -0
  196. package/src/modules/navigation/application/usecases/buildNav.ts +15 -0
  197. package/src/modules/navigation/application/usecases/buildSidebar.ts +45 -0
  198. package/src/modules/navigation/application/usecases/index.ts +2 -0
  199. package/src/modules/navigation/domain/events/index.ts +30 -0
  200. package/src/modules/navigation/domain/models/index.ts +7 -0
  201. package/src/modules/navigation/domain/operations/group.ts +79 -0
  202. package/src/modules/navigation/domain/operations/index.ts +10 -0
  203. package/src/modules/navigation/domain/operations/sort.ts +27 -0
  204. package/src/modules/navigation/domain/shared/utils/array.ts +39 -0
  205. package/src/modules/navigation/domain/validators/index.ts +88 -0
  206. package/src/modules/navigation/index.ts +15 -0
  207. package/src/modules/navigation/ports/index.ts +9 -0
  208. package/src/modules/navigation/types/index.ts +38 -0
  209. package/src/modules/navigation/types/public.ts +9 -0
  210. package/src/modules/openapi/application/swagger-parser-adapter.ts +178 -0
  211. package/src/modules/openapi/domain/operations/parse-openapi.ts +46 -0
  212. package/src/modules/openapi/index.ts +8 -0
  213. package/src/modules/openapi/ports/openapi-parser-port.ts +15 -0
  214. package/src/modules/openapi/types/openapi.ts +37 -0
  215. package/src/modules/plugin/application/usecases/build-virtual-modules.ts +53 -0
  216. package/src/modules/plugin/application/usecases/index.ts +1 -0
  217. package/src/modules/plugin/application/workflows/build-docs.ts +79 -0
  218. package/src/modules/plugin/application/workflows/index.ts +1 -0
  219. package/src/modules/plugin/domain/events/index.ts +62 -0
  220. package/src/modules/plugin/domain/models/index.ts +1 -0
  221. package/src/modules/plugin/domain/operations/build-virtual.ts +76 -0
  222. package/src/modules/plugin/domain/operations/index.ts +11 -0
  223. package/src/modules/plugin/domain/validators/index.ts +30 -0
  224. package/src/modules/plugin/index.ts +14 -0
  225. package/src/modules/plugin/ports/index.ts +21 -0
  226. package/src/modules/plugin/types/index.ts +27 -0
  227. package/src/modules/plugin/types/public.ts +1 -0
  228. package/src/modules/search/application/usecases/index.ts +1 -0
  229. package/src/modules/search/application/usecases/indexPages.ts +15 -0
  230. package/src/modules/search/domain/events/index.ts +32 -0
  231. package/src/modules/search/domain/models/index.ts +1 -0
  232. package/src/modules/search/domain/operations/build-index.ts +6 -0
  233. package/src/modules/search/domain/operations/buildIndex.ts +70 -0
  234. package/src/modules/search/domain/operations/index.ts +7 -0
  235. package/src/modules/search/domain/operations/query.ts +186 -0
  236. package/src/modules/search/domain/validators/index.ts +32 -0
  237. package/src/modules/search/index.ts +9 -0
  238. package/src/modules/search/types/index.ts +22 -0
  239. package/src/modules/search/types/public.ts +1 -0
  240. package/src/modules/search-analytics/application/local-storage-adapter.ts +68 -0
  241. package/src/modules/search-analytics/domain/operations/search-analytics-operations.ts +74 -0
  242. package/src/modules/search-analytics/index.ts +8 -0
  243. package/src/modules/search-analytics/ports/search-analytics-port.ts +20 -0
  244. package/src/modules/search-analytics/types/search-analytics.ts +16 -0
  245. package/src/modules/search-highlighting/application/dom-highlighting-adapter.ts +36 -0
  246. package/src/modules/search-highlighting/domain/operations/highlighting-operations.ts +72 -0
  247. package/src/modules/search-highlighting/index.ts +8 -0
  248. package/src/modules/search-highlighting/ports/highlighting-port.ts +14 -0
  249. package/src/modules/search-highlighting/types/highlighting.ts +15 -0
  250. package/src/modules/seo-optimization/application/usecases/index.ts +18 -0
  251. package/src/modules/seo-optimization/domain/index.ts +12 -0
  252. package/src/modules/seo-optimization/domain/seoOperations.ts +92 -0
  253. package/src/modules/seo-optimization/index.ts +8 -0
  254. package/src/modules/seo-optimization/ports/index.ts +18 -0
  255. package/src/modules/seo-optimization/types/index.ts +41 -0
  256. package/src/modules/theme/application/css-theme-adapter.ts +50 -0
  257. package/src/modules/theme/domain/operations/theme-operations.ts +68 -0
  258. package/src/modules/theme/index.ts +8 -0
  259. package/src/modules/theme/ports/theme-port.ts +8 -0
  260. package/src/modules/theme/types/theme.ts +12 -0
  261. package/src/modules/toc/application/markdown-toc-adapter.ts +106 -0
  262. package/src/modules/toc/domain/operations/toc-operations.ts +92 -0
  263. package/src/modules/toc/index.ts +8 -0
  264. package/src/modules/toc/ports/toc-port.ts +21 -0
  265. package/src/modules/toc/types/toc.ts +17 -0
  266. package/src/modules/toc-generator/application/usecases/index.ts +30 -0
  267. package/src/modules/toc-generator/domain/index.ts +12 -0
  268. package/src/modules/toc-generator/domain/tocOperations.ts +104 -0
  269. package/src/modules/toc-generator/index.ts +9 -0
  270. package/src/modules/toc-generator/ports/index.ts +20 -0
  271. package/src/modules/toc-generator/types/index.ts +50 -0
  272. package/src/modules/version-control/domain/events/index.ts +39 -0
  273. package/src/modules/version-control/domain/models/index.ts +25 -0
  274. package/src/modules/version-control/domain/validators/index.ts +50 -0
  275. package/src/modules/versioning/application/fs-version-loader.ts +44 -0
  276. package/src/modules/versioning/domain/operations/versioning-operations.ts +80 -0
  277. package/src/modules/versioning/index.ts +8 -0
  278. package/src/modules/versioning/ports/version-loader-port.ts +18 -0
  279. package/src/modules/versioning/types/versioning.ts +17 -0
  280. package/src/modules/workflow/domain/events/index.ts +55 -0
  281. package/src/modules/workflow/domain/models/index.ts +40 -0
  282. package/src/modules/workflow/domain/validators/index.ts +50 -0
  283. package/src/modules/yaml-parser/application/js-yaml-adapter.ts +34 -0
  284. package/src/modules/yaml-parser/domain/operations/parse-yaml.ts +58 -0
  285. package/src/modules/yaml-parser/index.ts +7 -0
  286. package/src/modules/yaml-parser/ports/yaml-parser-port.ts +18 -0
  287. package/src/navigation/index.ts +9 -0
  288. package/src/plugin/index.ts +4 -0
  289. package/src/presentation/index.ts +1 -0
  290. package/src/presentation/live-editor/index.ts +22 -0
  291. package/src/presentation/live-editor/live-editor-component.ts +219 -0
  292. package/src/presentation/live-editor/virtual-module.ts +16 -0
  293. package/src/presentation/solid/CodeBlock.tsx +120 -0
  294. package/src/presentation/solid/Toc.tsx +58 -0
  295. package/src/presentation/solid/index.ts +11 -0
  296. package/src/presentation/vite-plugin/docs-plugin.ts +212 -0
  297. package/src/presentation/vite-plugin/index.ts +9 -0
  298. package/src/presentation/vite-plugin/transform-markdown.ts +26 -0
  299. package/src/runtime/analytics.ts +59 -0
  300. package/src/runtime/api-diff.ts +115 -0
  301. package/src/runtime/app.tsx +32 -0
  302. package/src/runtime/components/AccentPicker.tsx +114 -0
  303. package/src/runtime/components/ApiPlayground.tsx +332 -0
  304. package/src/runtime/components/AskAiDialog.tsx +127 -0
  305. package/src/runtime/components/BackToTop.tsx +38 -0
  306. package/src/runtime/components/Banner.tsx +75 -0
  307. package/src/runtime/components/Breadcrumbs.tsx +42 -0
  308. package/src/runtime/components/CollectionDropdown.tsx +85 -0
  309. package/src/runtime/components/CustomizeDrawer.tsx +195 -0
  310. package/src/runtime/components/DocMarkdown.tsx +579 -0
  311. package/src/runtime/components/DocPrevNext.tsx +54 -0
  312. package/src/runtime/components/DocToc.tsx +147 -0
  313. package/src/runtime/components/DocsDropdown.tsx +184 -0
  314. package/src/runtime/components/Footer.tsx +52 -0
  315. package/src/runtime/components/GitHubAuth.tsx +82 -0
  316. package/src/runtime/components/GitHubStats.tsx +73 -0
  317. package/src/runtime/components/Head.tsx +225 -0
  318. package/src/runtime/components/LocaleDropdown.tsx +75 -0
  319. package/src/runtime/components/MobileBottomNav.tsx +111 -0
  320. package/src/runtime/components/NotFound.tsx +139 -0
  321. package/src/runtime/components/PageActions.tsx +144 -0
  322. package/src/runtime/components/RelatedDocs.tsx +50 -0
  323. package/src/runtime/components/ScrollProgress.tsx +32 -0
  324. package/src/runtime/components/SearchPalette.tsx +333 -0
  325. package/src/runtime/components/ShowcaseCard.tsx +87 -0
  326. package/src/runtime/components/SidebarNav.tsx +237 -0
  327. package/src/runtime/components/Skeleton.tsx +39 -0
  328. package/src/runtime/components/ThemeToggle.tsx +26 -0
  329. package/src/runtime/components/TopNav.tsx +270 -0
  330. package/src/runtime/components/VersionDropdown.tsx +189 -0
  331. package/src/runtime/components/markdown/components.ts +280 -0
  332. package/src/runtime/config.ts +225 -0
  333. package/src/runtime/content.ts +451 -0
  334. package/src/runtime/context.tsx +30 -0
  335. package/src/runtime/data.ts +93 -0
  336. package/src/runtime/github.ts +226 -0
  337. package/src/runtime/icons.ts +32 -0
  338. package/src/runtime/index.ts +153 -0
  339. package/src/runtime/layouts/DocsLayout.tsx +144 -0
  340. package/src/runtime/markdown-content.css +996 -0
  341. package/src/runtime/pages/AbTestPage.tsx +88 -0
  342. package/src/runtime/pages/AnalyticsPage.tsx +90 -0
  343. package/src/runtime/pages/ApiDiffPage.tsx +86 -0
  344. package/src/runtime/pages/ApiEndpointPage.tsx +248 -0
  345. package/src/runtime/pages/BuilderPage.tsx +150 -0
  346. package/src/runtime/pages/ChangelogPage.tsx +210 -0
  347. package/src/runtime/pages/CollectionPage.tsx +140 -0
  348. package/src/runtime/pages/CommunityPage.tsx +384 -0
  349. package/src/runtime/pages/CreatePage.tsx +448 -0
  350. package/src/runtime/pages/DocPage.tsx +193 -0
  351. package/src/runtime/pages/EditPage.tsx +201 -0
  352. package/src/runtime/pages/HomePage.tsx +187 -0
  353. package/src/runtime/pages/IssuesPage.tsx +140 -0
  354. package/src/runtime/pages/OAuthCallbackPage.tsx +80 -0
  355. package/src/runtime/pages/PluginsPage.tsx +249 -0
  356. package/src/runtime/pages/ShowcasePage.tsx +202 -0
  357. package/src/runtime/pwa.ts +39 -0
  358. package/src/runtime/router.tsx +192 -0
  359. package/src/runtime/seo.ts +192 -0
  360. package/src/runtime/theme.css +175 -0
  361. package/src/runtime/theme.ts +224 -0
  362. package/src/runtime/types.ts +217 -0
  363. package/src/search/index.ts +6 -0
  364. package/src/seo-optimization/index.ts +4 -0
  365. package/src/shared/constants/index.ts +26 -0
  366. package/src/shared/errors/index.ts +195 -0
  367. package/src/shared/index.ts +27 -0
  368. package/src/shared/types/brand.ts +14 -0
  369. package/src/shared/types/client.d.ts +45 -0
  370. package/src/shared/types/either.ts +38 -0
  371. package/src/shared/types/index.ts +42 -0
  372. package/src/shared/types/option.ts +52 -0
  373. package/src/shared/types/result.ts +81 -0
  374. package/src/shared/utils/array.ts +97 -0
  375. package/src/shared/utils/index.ts +46 -0
  376. package/src/shared/utils/object.ts +47 -0
  377. package/src/shared/utils/string.ts +74 -0
  378. package/src/toc-generator/index.ts +1 -0
  379. package/src/types/js-yaml.d.ts +42 -0
  380. package/src/worker.ts +462 -0
@@ -0,0 +1,50 @@
1
+ import { Link, useParams } from "@tanstack/solid-router";
2
+ import { For, Show } from "solid-js";
3
+ import { relatedDocs } from "../content";
4
+ import { createDocsList } from "../data";
5
+
6
+ export function RelatedDocs(props: {
7
+ currentId: string;
8
+ currentTags?: string[];
9
+ }) {
10
+ const params = useParams({ strict: false });
11
+ const collection = () => params().collection ?? "";
12
+ const [docs] = createDocsList(collection);
13
+
14
+ const related = () => {
15
+ const list = docs() ?? [];
16
+ const current = list.find((d) => d.id === props.currentId);
17
+ if (!current) return [];
18
+ return relatedDocs(list, current, 4);
19
+ };
20
+
21
+ return (
22
+ <Show when={related().length > 0}>
23
+ <div class="border-t border-border pt-6 mt-10">
24
+ <h3 class="text-sm font-semibold uppercase tracking-wider text-muted mb-3">
25
+ Related docs
26
+ </h3>
27
+ <ul class="grid gap-2 sm:grid-cols-2">
28
+ <For each={related()}>
29
+ {(doc) => (
30
+ <li>
31
+ <Link
32
+ to="/$collection/$docId"
33
+ params={{ collection: collection(), docId: doc.id }}
34
+ class="block p-3 rounded-md border border-border bg-surface hover:border-focus transition-colors no-underline text-sm text-foreground"
35
+ >
36
+ <div class="font-medium">{doc.label}</div>
37
+ <Show when={doc.description}>
38
+ <div class="text-xs text-muted truncate">
39
+ {doc.description}
40
+ </div>
41
+ </Show>
42
+ </Link>
43
+ </li>
44
+ )}
45
+ </For>
46
+ </ul>
47
+ </div>
48
+ </Show>
49
+ );
50
+ }
@@ -0,0 +1,32 @@
1
+ import { createEffect, createSignal, onCleanup } from "solid-js";
2
+
3
+ export function ScrollProgress() {
4
+ const [progress, setProgress] = createSignal(0);
5
+
6
+ createEffect(() => {
7
+ const onScroll = () => {
8
+ const h = document.documentElement;
9
+ const scrollTop = h.scrollTop || document.body.scrollTop;
10
+ const scrollHeight = h.scrollHeight - h.clientHeight;
11
+ setProgress(
12
+ scrollHeight > 0 ? Math.min(100, (scrollTop / scrollHeight) * 100) : 0,
13
+ );
14
+ };
15
+
16
+ onScroll();
17
+ window.addEventListener("scroll", onScroll, { passive: true });
18
+ onCleanup(() => window.removeEventListener("scroll", onScroll));
19
+ });
20
+
21
+ return (
22
+ <div
23
+ class="fixed top-0 left-0 right-0 h-0.5 z-[60] bg-transparent"
24
+ aria-hidden="true"
25
+ >
26
+ <div
27
+ class="h-full bg-primary transition-[width] duration-150"
28
+ style={{ width: `${progress()}%` }}
29
+ />
30
+ </div>
31
+ );
32
+ }
@@ -0,0 +1,333 @@
1
+ import { useNavigate, useParams } from "@tanstack/solid-router";
2
+ import {
3
+ createEffect,
4
+ createResource,
5
+ createSignal,
6
+ For,
7
+ Show,
8
+ } from "solid-js";
9
+ import { useDocs } from "../context";
10
+ import { searchDocs, useCollections } from "../data";
11
+ import { setTheme, useTheme } from "../theme";
12
+
13
+ export const [searchOpen, setSearchOpen] = createSignal(false);
14
+
15
+ type SearchItem =
16
+ | {
17
+ type: "doc";
18
+ collection: string;
19
+ id: string;
20
+ title: string;
21
+ snippet?: string;
22
+ }
23
+ | { type: "cmd"; id: string; title: string; icon: string; run: () => void };
24
+
25
+ export function SearchPalette() {
26
+ const navigate = useNavigate();
27
+ const params = useParams({ strict: false });
28
+ const collections = useCollections();
29
+ const config = useDocs();
30
+ const [query, setQuery] = createSignal("");
31
+ const [selected, setSelected] = createSignal(0);
32
+ const { theme } = useTheme();
33
+ let inputEl: HTMLInputElement | undefined;
34
+
35
+ const commands = (): SearchItem[] => [
36
+ {
37
+ type: "cmd",
38
+ id: "home",
39
+ title: "Go to home",
40
+ icon: "i-mdi:home",
41
+ run: () => navigate({ to: "/" }),
42
+ },
43
+ {
44
+ type: "cmd",
45
+ id: "theme",
46
+ title: `Switch to ${theme() === "dark" ? "light" : "dark"} theme`,
47
+ icon: "i-mdi:theme-light-dark",
48
+ run: () => setTheme(theme() === "dark" ? "light" : "dark"),
49
+ },
50
+ {
51
+ type: "cmd",
52
+ id: "copy-url",
53
+ title: "Copy page URL",
54
+ icon: "i-mdi:link",
55
+ run: () => navigator.clipboard.writeText(location.href),
56
+ },
57
+ {
58
+ type: "cmd",
59
+ id: "edit",
60
+ title: "Edit this page",
61
+ icon: "i-mdi:pencil-box",
62
+ run: () =>
63
+ navigate({
64
+ to: "/edit/$collection/$docId",
65
+ params: {
66
+ collection: params().collection ?? "docs",
67
+ docId: params().docId ?? "index",
68
+ },
69
+ }),
70
+ },
71
+ {
72
+ type: "cmd",
73
+ id: "github",
74
+ title: "Open GitHub repository",
75
+ icon: "i-mdi:github",
76
+ run: () => window.open(config.site.repoUrl, "_blank"),
77
+ },
78
+ ];
79
+
80
+ const [results] = createResource(query, async (q) => {
81
+ const term = q.trim();
82
+ if (!term || term.length < 2) return [];
83
+ return searchDocs(config, term);
84
+ });
85
+
86
+ const filteredCommands = (): SearchItem[] => {
87
+ const q = query().trim().toLowerCase();
88
+ if (!q) return commands();
89
+ if (q.startsWith(">"))
90
+ return commands().filter(
91
+ (c) => c.type === "cmd" && c.title.toLowerCase().includes(q.slice(1)),
92
+ );
93
+ return commands().filter(
94
+ (c) => c.type === "cmd" && c.title.toLowerCase().includes(q),
95
+ );
96
+ };
97
+
98
+ const docItems = (): SearchItem[] =>
99
+ (results() ?? []).map((r) => ({
100
+ type: "doc",
101
+ collection: r.collection,
102
+ id: r.id,
103
+ title: r.title,
104
+ snippet: r.snippet,
105
+ }));
106
+
107
+ const items = (): SearchItem[] => {
108
+ if (query().trim().length < 2) return filteredCommands();
109
+ return [...filteredCommands(), ...docItems()];
110
+ };
111
+
112
+ createEffect(() => {
113
+ if (searchOpen()) {
114
+ setQuery("");
115
+ setSelected(0);
116
+ queueMicrotask(() => inputEl?.focus());
117
+ }
118
+ });
119
+
120
+ const run = (index: number) => {
121
+ const item = items()[index];
122
+ if (!item) return;
123
+ if (item.type === "cmd") {
124
+ setSearchOpen(false);
125
+ item.run();
126
+ } else {
127
+ setSearchOpen(false);
128
+ navigate({
129
+ to: "/$collection/$docId",
130
+ params: { collection: item.collection, docId: item.id },
131
+ });
132
+ }
133
+ };
134
+
135
+ const onKey = (e: KeyboardEvent) => {
136
+ if (e.key === "Escape") setSearchOpen(false);
137
+ if (e.key === "ArrowDown") {
138
+ e.preventDefault();
139
+ setSelected((i) => Math.min(i + 1, items().length - 1));
140
+ }
141
+ if (e.key === "ArrowUp") {
142
+ e.preventDefault();
143
+ setSelected((i) => Math.max(i - 1, 0));
144
+ }
145
+ if (e.key === "Enter") run(selected());
146
+ };
147
+
148
+ const collectionLabel = (id: string) =>
149
+ collections()?.find((c) => c.id === id)?.label ?? id;
150
+
151
+ const cmdDescriptions: Record<string, string> = {
152
+ home: "Navigate back to the documentation home page.",
153
+ theme: "Toggle between the light and dark color schemes.",
154
+ "copy-url": "Copy the current page URL to your clipboard.",
155
+ edit: "Open the markdown editor for the current page.",
156
+ github: "Open this site's GitHub repository in a new tab.",
157
+ };
158
+
159
+ const selectedItem = (): SearchItem | undefined => items()[selected()];
160
+
161
+ const stripMarkdown = (md: string) =>
162
+ md
163
+ .replace(/```[\s\S]*?```/g, " [code block] ")
164
+ .replace(/!\[[^\]]*\]\([^)]*\)/g, "")
165
+ .replace(/\[([^\]]*)\]\([^)]*\)/g, "$1")
166
+ .replace(/^#{1,6}\s+/gm, "")
167
+ .replace(/^>\s?/gm, "")
168
+ .replace(/[*_`~]/g, "")
169
+ .replace(/\n{3,}/g, "\n\n")
170
+ .trim();
171
+
172
+ const [preview] = createResource(
173
+ () => {
174
+ if (!searchOpen()) return null;
175
+ const it = selectedItem();
176
+ return it?.type === "doc"
177
+ ? { collection: it.collection, id: it.id }
178
+ : null;
179
+ },
180
+ async (sel) => {
181
+ try {
182
+ const c = await config.dataSource.get(sel.collection, sel.id);
183
+ return stripMarkdown(c.content ?? "").slice(0, 1200);
184
+ } catch {
185
+ return "";
186
+ }
187
+ },
188
+ );
189
+
190
+ return (
191
+ <Show when={searchOpen()}>
192
+ <div
193
+ class="fixed inset-0 z-50 bg-overlay flex items-start justify-center pt-24 px-4"
194
+ onClick={(e) => {
195
+ if (e.target === e.currentTarget) setSearchOpen(false);
196
+ }}
197
+ onKeyDown={onKey}
198
+ role="presentation"
199
+ >
200
+ <div class="w-full max-w-3xl rounded-lg border border-border bg-surface shadow-2xl overflow-hidden">
201
+ <div class="flex items-center gap-2 px-4 border-b border-border">
202
+ <span class="i-mdi:magnify text-muted" aria-hidden="true" />
203
+ <input
204
+ ref={inputEl}
205
+ type="text"
206
+ value={query()}
207
+ onInput={(e) => {
208
+ setQuery(e.currentTarget.value);
209
+ setSelected(0);
210
+ }}
211
+ placeholder="Search docs or type '>' for commands..."
212
+ aria-label="Search documentation and commands"
213
+ class="flex-1 h-12 bg-transparent border-none outline-none text-sm text-foreground placeholder:text-muted"
214
+ />
215
+ <kbd class="text-[10px] px-1.5 py-0.5 rounded border border-border text-muted">
216
+ ESC
217
+ </kbd>
218
+ </div>
219
+ <div class="grid grid-cols-1 md:grid-cols-[minmax(0,1fr)_minmax(0,1fr)]">
220
+ <div class="max-h-80 overflow-y-auto">
221
+ <Show when={results.loading}>
222
+ <div class="px-4 py-6 text-sm text-muted text-center">
223
+ Searching…
224
+ </div>
225
+ </Show>
226
+ <Show
227
+ when={
228
+ !results.loading &&
229
+ query().trim().length >= 2 &&
230
+ docItems().length === 0
231
+ }
232
+ >
233
+ <div class="px-4 py-6 text-sm text-muted text-center">
234
+ No document results for "{query()}"
235
+ </div>
236
+ </Show>
237
+ <ul class="list-none m-0 p-1">
238
+ <For each={items()}>
239
+ {(item, i) => (
240
+ <li>
241
+ <button
242
+ type="button"
243
+ onClick={() => run(i())}
244
+ onMouseEnter={() => setSelected(i())}
245
+ class={`w-full text-left px-3 py-2 rounded-md cursor-pointer border-none transition-colors ${
246
+ selected() === i()
247
+ ? "bg-primary/10"
248
+ : "bg-transparent"
249
+ }`}
250
+ >
251
+ <div class="flex items-center gap-2">
252
+ <span
253
+ class={`${item.type === "cmd" ? item.icon : "i-mdi:file-document-outline"} text-muted shrink-0`}
254
+ aria-hidden="true"
255
+ />
256
+ <span class="text-sm font-medium text-foreground truncate">
257
+ {item.title}
258
+ </span>
259
+ <Show when={item.type === "doc"}>
260
+ <span class="ml-auto text-[10px] uppercase tracking-wide text-muted shrink-0">
261
+ {item.type === "doc" &&
262
+ collectionLabel(item.collection)}
263
+ </span>
264
+ </Show>
265
+ </div>
266
+ <Show when={item.type === "doc" && item.snippet}>
267
+ <p class="text-xs text-muted m-0 mt-0.5 pl-6 truncate">
268
+ {item.type === "doc" && item.snippet}
269
+ </p>
270
+ </Show>
271
+ </button>
272
+ </li>
273
+ )}
274
+ </For>
275
+ </ul>
276
+ </div>
277
+ <div class="hidden md:block border-l border-border max-h-80 overflow-y-auto bg-background/40">
278
+ {(() => {
279
+ const it = selectedItem();
280
+ if (it?.type === "doc") {
281
+ return (
282
+ <div class="p-4">
283
+ <div class="flex items-center gap-2 mb-1">
284
+ <span class="text-[10px] uppercase tracking-wide text-muted">
285
+ {collectionLabel(it.collection)}
286
+ </span>
287
+ </div>
288
+ <h3 class="text-sm font-semibold text-foreground m-0 mb-2">
289
+ {it.title}
290
+ </h3>
291
+ <p class="text-xs text-muted leading-relaxed whitespace-pre-wrap m-0">
292
+ {preview.loading
293
+ ? "Loading preview…"
294
+ : preview() || it.snippet || "No preview available."}
295
+ </p>
296
+ </div>
297
+ );
298
+ }
299
+ return (
300
+ <div class="p-4">
301
+ <div class="flex items-center gap-2 mb-2 text-foreground">
302
+ <span
303
+ class={`${it?.type === "cmd" ? it.icon : "i-mdi:information-outline"} text-primary`}
304
+ aria-hidden="true"
305
+ />
306
+ <span class="text-sm font-semibold">
307
+ {it?.title ?? "Preview"}
308
+ </span>
309
+ </div>
310
+ <p class="text-xs text-muted leading-relaxed m-0">
311
+ {it?.type === "cmd"
312
+ ? (cmdDescriptions[it.id] ?? "Run this command.")
313
+ : "Select a result to preview it here."}
314
+ </p>
315
+ </div>
316
+ );
317
+ })()}
318
+ </div>
319
+ </div>
320
+ <div class="flex items-center gap-3 px-4 py-2 border-t border-border text-[10px] text-muted">
321
+ <span>
322
+ <kbd class="px-1 rounded border border-border">↑↓</kbd> navigate
323
+ </span>
324
+ <span>
325
+ <kbd class="px-1 rounded border border-border">↵</kbd> open
326
+ </span>
327
+ <span class="ml-auto">{items().length} results</span>
328
+ </div>
329
+ </div>
330
+ </div>
331
+ </Show>
332
+ );
333
+ }
@@ -0,0 +1,87 @@
1
+ import { Link } from "@tanstack/solid-router";
2
+ import { createResource, For, Show } from "solid-js";
3
+ import { useDocs } from "../context";
4
+ import type { DocEntry } from "../types";
5
+
6
+ function makePreview(content: string, length = 140) {
7
+ const text = content
8
+ .replace(/<[^>]+>/g, " ")
9
+ .replace(/[#*_`[\]()]/g, " ")
10
+ .replace(/\s+/g, " ")
11
+ .trim();
12
+ return text.length > length ? `${text.slice(0, length)}…` : text;
13
+ }
14
+
15
+ export function ShowcaseCard(props: { collection: string; doc: DocEntry }) {
16
+ const config = useDocs();
17
+ const [detail] = createResource(
18
+ () => ({ collection: props.collection, id: props.doc.id }),
19
+ async ({ collection, id }) => config.dataSource.get(collection, id),
20
+ );
21
+
22
+ const preview = () => {
23
+ if (props.doc.description) return props.doc.description;
24
+ const d = detail();
25
+ return d ? makePreview(d.content ?? "") : "";
26
+ };
27
+
28
+ const image = () => detail()?.frontmatter?.seo?.image;
29
+ const tags = () =>
30
+ (props.doc.tags?.length ? props.doc.tags : detail()?.frontmatter?.tags) ??
31
+ [];
32
+
33
+ return (
34
+ <Link
35
+ to="/$collection/$docId"
36
+ params={{ collection: props.collection, docId: props.doc.id }}
37
+ class="group flex flex-col border border-border rounded-xl bg-surface/30 overflow-hidden no-underline hover:border-focus transition-colors"
38
+ >
39
+ <div class="h-40 bg-surface border-b border-border flex items-center justify-center overflow-hidden relative">
40
+ <Show
41
+ when={image()}
42
+ fallback={
43
+ <span
44
+ class={`${props.doc.icon ?? "i-mdi:view-dashboard"} text-5xl text-primary/60 group-hover:text-primary transition-colors`}
45
+ aria-hidden="true"
46
+ />
47
+ }
48
+ >
49
+ {(src) => (
50
+ <img
51
+ src={src() as string}
52
+ alt={props.doc.label}
53
+ class="w-full h-full object-cover group-hover:scale-105 transition-transform"
54
+ loading="lazy"
55
+ />
56
+ )}
57
+ </Show>
58
+ </div>
59
+ <div class="p-5 flex flex-col flex-1">
60
+ <div class="flex items-center gap-2 mb-2">
61
+ <h2 class="font-semibold text-foreground m-0 flex-1 min-w-0 truncate">
62
+ {props.doc.label}
63
+ </h2>
64
+ <Show when={props.doc.badge}>
65
+ <span class="text-[10px] px-1.5 py-0.5 rounded bg-primary/10 text-primary">
66
+ {props.doc.badge}
67
+ </span>
68
+ </Show>
69
+ </div>
70
+ <p class="text-sm text-muted m-0 mb-3 flex-1 leading-relaxed">
71
+ {preview()}
72
+ </p>
73
+ <Show when={tags().length > 0}>
74
+ <div class="flex flex-wrap gap-1 mt-auto">
75
+ <For each={tags().slice(0, 4)}>
76
+ {(tag) => (
77
+ <span class="text-[10px] px-1.5 py-0.5 rounded bg-background border border-border text-muted">
78
+ {tag}
79
+ </span>
80
+ )}
81
+ </For>
82
+ </div>
83
+ </Show>
84
+ </div>
85
+ </Link>
86
+ );
87
+ }