@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,147 @@
1
+ import {
2
+ createEffect,
3
+ createResource,
4
+ createSignal,
5
+ For,
6
+ onCleanup,
7
+ Show,
8
+ } from "solid-js";
9
+
10
+ interface TocLink {
11
+ id: string;
12
+ text: string;
13
+ depth: number;
14
+ children?: TocLink[];
15
+ }
16
+
17
+ async function parseToc(source: string): Promise<TocLink[]> {
18
+ const [{ parseMarkdown }, { default: toc }] = await Promise.all([
19
+ import("comark"),
20
+ import("@comark/html/plugins/toc"),
21
+ ]);
22
+ const result = await parseMarkdown(source, {
23
+ plugins: [toc({ depth: 3, searchDepth: 3 })],
24
+ });
25
+ return result.meta?.toc?.links ?? [];
26
+ }
27
+
28
+ function collectIds(links: TocLink[]): string[] {
29
+ const out: string[] = [];
30
+ for (const l of links) {
31
+ out.push(l.id);
32
+ if (l.children) out.push(...collectIds(l.children));
33
+ }
34
+ return out;
35
+ }
36
+
37
+ function TocLinkItem(props: {
38
+ link: TocLink;
39
+ activeId?: string;
40
+ onClick: (id: string) => void;
41
+ }) {
42
+ const isActive = () => props.activeId === props.link.id;
43
+ return (
44
+ <li class={`rt-toc__item rt-toc__item--depth-${props.link.depth}`}>
45
+ <button
46
+ type="button"
47
+ class={`rt-toc__link ${isActive() ? "rt-toc__link--active" : ""}`}
48
+ onClick={() => props.onClick(props.link.id)}
49
+ aria-label={`Jump to ${props.link.text}`}
50
+ aria-current={isActive() ? "location" : undefined}
51
+ >
52
+ {props.link.text}
53
+ </button>
54
+ <Show when={props.link.children?.length}>
55
+ <ul class="rt-toc__list">
56
+ <For each={props.link.children}>
57
+ {(child) => (
58
+ <TocLinkItem
59
+ link={child}
60
+ activeId={props.activeId}
61
+ onClick={props.onClick}
62
+ />
63
+ )}
64
+ </For>
65
+ </ul>
66
+ </Show>
67
+ </li>
68
+ );
69
+ }
70
+
71
+ export function DocToc(props: { source: string }) {
72
+ const [toc] = createResource(() => props.source, parseToc);
73
+ const [activeId, setActiveId] = createSignal<string | undefined>();
74
+ let listRef: HTMLUListElement | undefined;
75
+
76
+ const scrollTo = (id: string) => {
77
+ const el = document.getElementById(id);
78
+ if (!el) return;
79
+ el.scrollIntoView({ behavior: "smooth", block: "start" });
80
+ setActiveId(id);
81
+ };
82
+
83
+ createEffect(() => {
84
+ const ids = collectIds(toc() ?? []);
85
+ if (ids.length === 0) return;
86
+
87
+ const observer = new IntersectionObserver(
88
+ (entries) => {
89
+ const visible = entries
90
+ .filter((e) => e.isIntersecting)
91
+ .map((e) => e.target.id);
92
+ if (visible.length) {
93
+ setActiveId(visible[0]);
94
+ }
95
+ },
96
+ { rootMargin: "-15% 0px -60% 0px", threshold: 0 },
97
+ );
98
+
99
+ for (const id of ids) {
100
+ const el = document.getElementById(id);
101
+ if (el) observer.observe(el);
102
+ }
103
+
104
+ onCleanup(() => observer.disconnect());
105
+ });
106
+
107
+ createEffect(() => {
108
+ const id = activeId();
109
+ if (!id || !listRef) return;
110
+ const activeBtn = listRef.querySelector(
111
+ `button[aria-current="location"]`,
112
+ ) as HTMLElement | null;
113
+ if (activeBtn) {
114
+ activeBtn.scrollIntoView({ behavior: "smooth", block: "nearest" });
115
+ }
116
+ });
117
+
118
+ return (
119
+ <nav aria-label="On this page" class="rt-toc">
120
+ <div class="sticky top-0 bg-background z-10 pb-2 border-b border-border mb-2">
121
+ <div class="rt-toc__title flex items-center gap-1.5">
122
+ <span class="i-mdi:format-list-bulleted" aria-hidden="true" />
123
+ <span>On this page</span>
124
+ </div>
125
+ </div>
126
+ <Show
127
+ when={!toc.loading && (toc() ?? []).length > 0}
128
+ fallback={<div class="rt-toc__empty">No headings</div>}
129
+ >
130
+ <ul
131
+ class="rt-toc__list max-h-[calc(100vh-12rem)] overflow-y-auto"
132
+ ref={listRef}
133
+ >
134
+ <For each={toc()}>
135
+ {(link) => (
136
+ <TocLinkItem
137
+ link={link}
138
+ activeId={activeId()}
139
+ onClick={scrollTo}
140
+ />
141
+ )}
142
+ </For>
143
+ </ul>
144
+ </Show>
145
+ </nav>
146
+ );
147
+ }
@@ -0,0 +1,184 @@
1
+ import { Link, useParams } from "@tanstack/solid-router";
2
+ import {
3
+ createMemo,
4
+ createSignal,
5
+ For,
6
+ onCleanup,
7
+ onMount,
8
+ Show,
9
+ } from "solid-js";
10
+ import { createDocsList, useCollections } from "../data";
11
+ import { categoryIcon } from "../icons";
12
+ import type { DocEntry } from "../types";
13
+
14
+ function sortDocs(items: DocEntry[]): DocEntry[] {
15
+ return [...items].sort(
16
+ (a, b) => (a.order ?? 0) - (b.order ?? 0) || a.label.localeCompare(b.label),
17
+ );
18
+ }
19
+
20
+ export function DocsDropdown() {
21
+ const params = useParams({ strict: false });
22
+ const [open, setOpen] = createSignal(false);
23
+ const collections = useCollections();
24
+ const [docs] = createDocsList(() => params().collection ?? "");
25
+ let rootEl: HTMLDivElement | undefined;
26
+
27
+ const current = () => params().collection;
28
+ const currentMeta = () => collections()?.find((c) => c.id === current());
29
+
30
+ const grouped = createMemo((): [string, DocEntry[]][] => {
31
+ const groups = new Map<string, DocEntry[]>();
32
+ for (const d of docs() ?? []) {
33
+ const g = groups.get(d.category) ?? [];
34
+ g.push(d);
35
+ groups.set(d.category, g);
36
+ }
37
+ const entries = [...groups.entries()].map(
38
+ ([cat, items]) => [cat, sortDocs(items)] as [string, DocEntry[]],
39
+ );
40
+ const sections = currentMeta()?.sections;
41
+ if (sections?.length) {
42
+ const order = new Map<string, number>();
43
+ sections.forEach((s, i) => {
44
+ order.set(s.id, i);
45
+ order.set(s.label, i);
46
+ });
47
+ return entries.sort(([a], [b]) => {
48
+ const ia = order.get(a) ?? Number.MAX_SAFE_INTEGER;
49
+ const ib = order.get(b) ?? Number.MAX_SAFE_INTEGER;
50
+ return ia - ib || a.localeCompare(b);
51
+ });
52
+ }
53
+ return entries.sort(([a], [b]) => a.localeCompare(b));
54
+ });
55
+
56
+ const onDocClick = (e: MouseEvent) => {
57
+ if (rootEl && !rootEl.contains(e.target as Node)) setOpen(false);
58
+ };
59
+ const onKey = (e: KeyboardEvent) => {
60
+ if (e.key === "Escape") setOpen(false);
61
+ };
62
+
63
+ onMount(() => {
64
+ document.addEventListener("click", onDocClick);
65
+ document.addEventListener("keydown", onKey);
66
+ });
67
+ onCleanup(() => {
68
+ document.removeEventListener("click", onDocClick);
69
+ document.removeEventListener("keydown", onKey);
70
+ });
71
+
72
+ return (
73
+ <div ref={rootEl} class="relative">
74
+ <button
75
+ type="button"
76
+ onClick={() => setOpen(!open())}
77
+ aria-expanded={open()}
78
+ aria-haspopup="menu"
79
+ class={`px-3 h-9 inline-flex items-center gap-1.5 rounded-md text-sm no-underline transition-colors cursor-pointer border-none ${
80
+ open() || current()
81
+ ? "bg-surface text-foreground"
82
+ : "bg-transparent text-muted hover:text-foreground hover:bg-surface"
83
+ }`}
84
+ >
85
+ <span class="i-mdi:book-open-page-variant" aria-hidden="true" />
86
+ Docs
87
+ <span
88
+ class={`i-mdi:chevron-down text-xs text-muted transition-transform ${open() ? "rotate-180" : ""}`}
89
+ aria-hidden="true"
90
+ />
91
+ </button>
92
+ <Show when={open()}>
93
+ <div
94
+ role="menu"
95
+ aria-label="Documentation pages"
96
+ class="absolute left-0 top-full mt-2 w-[min(36rem,calc(100vw-2rem))] rounded-lg border border-border bg-surface shadow-xl z-50 overflow-hidden"
97
+ >
98
+ <div class="grid sm:grid-cols-[11rem_minmax(0,1fr)]">
99
+ <div class="border-b sm:border-b-0 sm:border-r border-border bg-background/50 p-2">
100
+ <div class="px-2 pb-1 text-[10px] uppercase tracking-wider font-semibold text-muted">
101
+ Collections
102
+ </div>
103
+ <ul class="list-none m-0 p-0">
104
+ <For each={collections()}>
105
+ {(c) => (
106
+ <li>
107
+ <Link
108
+ to="/$collection"
109
+ params={{ collection: c.id }}
110
+ onClick={() => setOpen(false)}
111
+ class={`flex items-center gap-2 px-2 py-1.5 rounded-md text-sm no-underline transition-colors ${
112
+ c.id === current()
113
+ ? "bg-primary/10 text-primary font-medium"
114
+ : "text-muted hover:text-foreground hover:bg-surface"
115
+ }`}
116
+ >
117
+ <Show when={c.icon}>
118
+ <span
119
+ class={`${c.icon} shrink-0`}
120
+ aria-hidden="true"
121
+ />
122
+ </Show>
123
+ <span class="truncate">{c.label}</span>
124
+ </Link>
125
+ </li>
126
+ )}
127
+ </For>
128
+ </ul>
129
+ </div>
130
+ <div class="max-h-80 overflow-y-auto p-2">
131
+ <Show
132
+ when={grouped().length > 0}
133
+ fallback={
134
+ <div class="px-3 py-6 text-sm text-muted text-center">
135
+ {docs.loading
136
+ ? "Loading pages…"
137
+ : "Select a collection to browse its pages."}
138
+ </div>
139
+ }
140
+ >
141
+ <For each={grouped()}>
142
+ {([category, items]) => (
143
+ <div class="mb-3 last:mb-0">
144
+ <div class="flex items-center gap-1.5 px-2 pb-1 text-[10px] uppercase tracking-wider font-semibold text-muted">
145
+ <span
146
+ class={categoryIcon(category)}
147
+ aria-hidden="true"
148
+ />
149
+ {category}
150
+ </div>
151
+ <ul class="list-none m-0 p-0">
152
+ <For each={items}>
153
+ {(d) => (
154
+ <li>
155
+ <Link
156
+ to="/$collection/$docId"
157
+ params={{
158
+ collection: params().collection ?? "",
159
+ docId: d.id,
160
+ }}
161
+ onClick={() => setOpen(false)}
162
+ class={`block px-2 py-1.5 rounded-md text-sm no-underline transition-colors truncate ${
163
+ params().docId === d.id
164
+ ? "bg-primary/10 text-primary font-medium"
165
+ : "text-muted hover:text-foreground hover:bg-background"
166
+ }`}
167
+ >
168
+ {d.label}
169
+ </Link>
170
+ </li>
171
+ )}
172
+ </For>
173
+ </ul>
174
+ </div>
175
+ )}
176
+ </For>
177
+ </Show>
178
+ </div>
179
+ </div>
180
+ </div>
181
+ </Show>
182
+ </div>
183
+ );
184
+ }
@@ -0,0 +1,52 @@
1
+ import { For, Show } from "solid-js";
2
+ import { useDocs } from "../context";
3
+
4
+ export function Footer() {
5
+ const config = useDocs();
6
+ const year = new Date().getFullYear();
7
+ const links = () => config.footer?.links ?? [];
8
+
9
+ return (
10
+ <footer class="border-t border-border bg-surface py-10 px-6 text-sm text-muted">
11
+ <div class="max-w-6xl mx-auto flex flex-col md:flex-row gap-6 md:items-center justify-between">
12
+ <div class="space-y-1">
13
+ <div class="font-medium text-foreground">{config.site.title}</div>
14
+ <Show when={config.site.description}>
15
+ {(d) => <p class="text-xs max-w-md">{d()}</p>}
16
+ </Show>
17
+ <div class="text-xs">
18
+ © {year} {config.footer?.copyright ?? config.site.title}
19
+ </div>
20
+ <Show when={config.features?.mcp}>
21
+ <a
22
+ href="/mcp"
23
+ target="_blank"
24
+ rel="noreferrer"
25
+ class="inline-flex items-center gap-1 mt-1 px-2 py-0.5 w-fit rounded-full border border-border bg-background text-[11px] font-semibold text-muted hover:text-foreground hover:border-focus transition-colors no-underline"
26
+ >
27
+ <span
28
+ class="i-mdi:robot-outline text-primary"
29
+ aria-hidden="true"
30
+ />
31
+ MCP available · /mcp
32
+ </a>
33
+ </Show>
34
+ </div>
35
+ <Show when={links().length}>
36
+ <nav class="flex flex-wrap gap-4" aria-label="Footer">
37
+ <For each={links()}>
38
+ {(link) => (
39
+ <a
40
+ href={link.to}
41
+ class="text-muted hover:text-foreground transition-colors no-underline"
42
+ >
43
+ {link.label}
44
+ </a>
45
+ )}
46
+ </For>
47
+ </nav>
48
+ </Show>
49
+ </div>
50
+ </footer>
51
+ );
52
+ }
@@ -0,0 +1,82 @@
1
+ import { createSignal, onMount, Show } from "solid-js";
2
+ import { useDocs } from "../context";
3
+
4
+ const STORAGE_KEY = "create-docs:github-token";
5
+
6
+ export function getGitHubToken(): string | null {
7
+ if (typeof window === "undefined") return null;
8
+ return localStorage.getItem(STORAGE_KEY);
9
+ }
10
+
11
+ export function setGitHubToken(token: string) {
12
+ if (typeof window === "undefined") return;
13
+ localStorage.setItem(STORAGE_KEY, token);
14
+ }
15
+
16
+ export function clearGitHubToken() {
17
+ if (typeof window === "undefined") return;
18
+ localStorage.removeItem(STORAGE_KEY);
19
+ }
20
+
21
+ export function GitHubAuthButton(props: {
22
+ onToken?: (token: string) => void;
23
+ label?: string;
24
+ scope?: string;
25
+ }) {
26
+ const config = useDocs();
27
+ const [loading, setLoading] = createSignal(false);
28
+ const [error, setError] = createSignal("");
29
+
30
+ onMount(() => {
31
+ const existing = getGitHubToken();
32
+ if (existing) props.onToken?.(existing);
33
+ });
34
+
35
+ const oauth = () => config.github?.oauth;
36
+ const disabled = () => oauth()?.enabled === false || loading();
37
+
38
+ const startOAuth = async () => {
39
+ const cfg = oauth();
40
+ if (!cfg || cfg.enabled === false) {
41
+ setError("GitHub OAuth is not configured.");
42
+ return;
43
+ }
44
+ setLoading(true);
45
+ setError("");
46
+ try {
47
+ const redirectUri =
48
+ cfg.redirectUri ?? `${location.origin}/auth/github/callback`;
49
+ const state = crypto.randomUUID();
50
+ sessionStorage.setItem("create-docs:oauth-state", state);
51
+ const res = await fetch(
52
+ `/api/github/auth?redirect_uri=${encodeURIComponent(redirectUri)}&state=${state}&scope=${encodeURIComponent(props.scope ?? cfg.scope ?? "repo")}`,
53
+ );
54
+ const data = (await res.json()) as { url?: string; error?: string };
55
+ if (!res.ok || data.error) {
56
+ throw new Error(data.error ?? "Failed to start OAuth.");
57
+ }
58
+ if (data.url) location.href = data.url;
59
+ } catch (e) {
60
+ setError(e instanceof Error ? e.message : "OAuth start failed.");
61
+ } finally {
62
+ setLoading(false);
63
+ }
64
+ };
65
+
66
+ return (
67
+ <div class="space-y-2">
68
+ <button
69
+ type="button"
70
+ onClick={startOAuth}
71
+ disabled={disabled()}
72
+ class="inline-flex items-center gap-2 px-4 h-10 rounded-lg bg-primary text-primary-foreground font-medium hover:bg-primary-hover transition-colors disabled:opacity-50 disabled:cursor-not-allowed cursor-pointer"
73
+ >
74
+ <span class="i-mdi:github" aria-hidden="true" />
75
+ {loading() ? "Redirecting…" : (props.label ?? "Authorize with GitHub")}
76
+ </button>
77
+ <Show when={error()}>
78
+ <p class="text-sm text-destructive m-0">{error()}</p>
79
+ </Show>
80
+ </div>
81
+ );
82
+ }
@@ -0,0 +1,73 @@
1
+ import { createResource, Show } from "solid-js";
2
+ import { useDocs } from "../context";
3
+ import { fetchRepoStats, shieldsBadge } from "../github";
4
+
5
+ export function GitHubStats() {
6
+ const config = useDocs();
7
+ const github = () => config.github;
8
+ const enabled = () => github()?.stats;
9
+
10
+ const [stats] = createResource(
11
+ () => (enabled() ? github() : undefined),
12
+ async (cfg) => {
13
+ if (!cfg) return null;
14
+ return fetchRepoStats(cfg);
15
+ },
16
+ );
17
+
18
+ return (
19
+ <Show when={enabled() && github()}>
20
+ {(cfg) => (
21
+ <section
22
+ class="flex items-center gap-2 flex-wrap"
23
+ aria-label="GitHub stats"
24
+ >
25
+ <a
26
+ href={`https://github.com/${cfg().owner}/${cfg().repo}/stargazers`}
27
+ target="_blank"
28
+ rel="noreferrer"
29
+ class="inline-block"
30
+ >
31
+ <img
32
+ src={shieldsBadge(cfg().owner, cfg().repo, "stars")}
33
+ alt="GitHub stars"
34
+ loading="lazy"
35
+ class="h-5"
36
+ />
37
+ </a>
38
+ <a
39
+ href={`https://github.com/${cfg().owner}/${cfg().repo}/forks`}
40
+ target="_blank"
41
+ rel="noreferrer"
42
+ class="inline-block"
43
+ >
44
+ <img
45
+ src={shieldsBadge(cfg().owner, cfg().repo, "forks")}
46
+ alt="GitHub forks"
47
+ loading="lazy"
48
+ class="h-5"
49
+ />
50
+ </a>
51
+ <a
52
+ href={`https://github.com/${cfg().owner}/${cfg().repo}/issues`}
53
+ target="_blank"
54
+ rel="noreferrer"
55
+ class="inline-block"
56
+ >
57
+ <img
58
+ src={shieldsBadge(cfg().owner, cfg().repo, "issues")}
59
+ alt="GitHub issues"
60
+ loading="lazy"
61
+ class="h-5"
62
+ />
63
+ </a>
64
+ <Show when={stats()}>
65
+ {(s) => (
66
+ <span class="text-xs text-muted">{s().openPRs} open PRs</span>
67
+ )}
68
+ </Show>
69
+ </section>
70
+ )}
71
+ </Show>
72
+ );
73
+ }