@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.
- package/README.md +137 -0
- package/bin/cli.js +408 -0
- package/dist/index.cjs +20 -0
- package/dist/index.d.cts +475 -0
- package/dist/index.d.ts +475 -0
- package/dist/index.js +20 -0
- package/docs/_dir.yml +2 -0
- package/docs/config.md +75 -0
- package/docs/data-sources.md +88 -0
- package/docs/deploy.md +38 -0
- package/docs/features.md +51 -0
- package/docs/getting-started.md +42 -0
- package/docs/index.md +34 -0
- package/docs/markdown.md +154 -0
- package/docs/theming.md +53 -0
- package/package.json +142 -0
- package/scripts/generate-docs-index.ts +111 -0
- package/scripts/github-pull.ts +124 -0
- package/src/adapters/config/index.ts +1 -0
- package/src/adapters/config/node-config-loader.ts +36 -0
- package/src/adapters/fs/fs-docs-loader.ts +31 -0
- package/src/adapters/fs/index.ts +12 -0
- package/src/adapters/fs/memory-fs.ts +60 -0
- package/src/adapters/fs/node-fs.ts +116 -0
- package/src/adapters/git/index.ts +164 -0
- package/src/adapters/github/github-pull.ts +340 -0
- package/src/adapters/index.ts +6 -0
- package/src/adapters/velite.ts +112 -0
- package/src/adapters/vite/docs-watcher.ts +36 -0
- package/src/adapters/vite/index.ts +2 -0
- package/src/adapters/vite/polling-watcher.ts +89 -0
- package/src/code-block-enhancements/index.ts +3 -0
- package/src/config/index.ts +15 -0
- package/src/content/index.ts +11 -0
- package/src/content-validation/index.ts +5 -0
- package/src/index.ts +174 -0
- package/src/live-editor/index.ts +7 -0
- package/src/modules/analytics/application/plausible-adapter.ts +103 -0
- package/src/modules/analytics/application/umami-adapter.ts +109 -0
- package/src/modules/analytics/domain/events/index.ts +37 -0
- package/src/modules/analytics/domain/models/index.ts +35 -0
- package/src/modules/analytics/domain/operations/analytics-operations.ts +67 -0
- package/src/modules/analytics/domain/validators/index.ts +50 -0
- package/src/modules/analytics/index.ts +9 -0
- package/src/modules/analytics/ports/analytics-port.ts +17 -0
- package/src/modules/analytics/types/analytics.ts +16 -0
- package/src/modules/api-docs/application/type-docs-adapter.ts +34 -0
- package/src/modules/api-docs/domain/events/index.ts +42 -0
- package/src/modules/api-docs/domain/models/index.ts +40 -0
- package/src/modules/api-docs/domain/operations/api-docs-operations.ts +59 -0
- package/src/modules/api-docs/domain/validators/index.ts +56 -0
- package/src/modules/api-docs/index.ts +8 -0
- package/src/modules/api-docs/ports/api-docs-port.ts +21 -0
- package/src/modules/api-docs/types/api-docs.ts +15 -0
- package/src/modules/api-reference/openapi.ts +166 -0
- package/src/modules/api-reference/orpc.ts +94 -0
- package/src/modules/code-block-enhancements/application/usecases/index.ts +39 -0
- package/src/modules/code-block-enhancements/domain/code-operations.ts +72 -0
- package/src/modules/code-block-enhancements/domain/events/index.ts +58 -0
- package/src/modules/code-block-enhancements/domain/index.ts +11 -0
- package/src/modules/code-block-enhancements/domain/models/index.ts +36 -0
- package/src/modules/code-block-enhancements/domain/validators/index.ts +50 -0
- package/src/modules/code-block-enhancements/index.ts +10 -0
- package/src/modules/code-block-enhancements/ports/index.ts +18 -0
- package/src/modules/code-block-enhancements/types/index.ts +37 -0
- package/src/modules/code-execution/application/sandbox-adapter.ts +44 -0
- package/src/modules/code-execution/domain/events/index.ts +58 -0
- package/src/modules/code-execution/domain/models/index.ts +33 -0
- package/src/modules/code-execution/domain/operations/execution-operations.ts +60 -0
- package/src/modules/code-execution/domain/validators/index.ts +50 -0
- package/src/modules/code-execution/index.ts +8 -0
- package/src/modules/code-execution/ports/execution-port.ts +15 -0
- package/src/modules/code-execution/types/execution.ts +15 -0
- package/src/modules/comments/application/giscus-adapter.ts +55 -0
- package/src/modules/comments/domain/events/index.ts +55 -0
- package/src/modules/comments/domain/models/index.ts +30 -0
- package/src/modules/comments/domain/operations/comment-operations.ts +46 -0
- package/src/modules/comments/domain/validators/index.ts +50 -0
- package/src/modules/comments/index.ts +8 -0
- package/src/modules/comments/ports/comment-port.ts +18 -0
- package/src/modules/comments/types/comments.ts +19 -0
- package/src/modules/config/application/usecases/index.ts +1 -0
- package/src/modules/config/application/usecases/loadConfig.ts +38 -0
- package/src/modules/config/application/workflows/index.ts +1 -0
- package/src/modules/config/application/workflows/validateConfig.ts +14 -0
- package/src/modules/config/domain/events/index.ts +50 -0
- package/src/modules/config/domain/models/index.ts +9 -0
- package/src/modules/config/domain/operations/defaults.ts +74 -0
- package/src/modules/config/domain/operations/index.ts +2 -0
- package/src/modules/config/domain/operations/resolve.ts +40 -0
- package/src/modules/config/domain/validators/index.ts +152 -0
- package/src/modules/config/index.ts +23 -0
- package/src/modules/config/ports/index.ts +15 -0
- package/src/modules/config/types/index.ts +113 -0
- package/src/modules/config/types/public.ts +19 -0
- package/src/modules/content/application/cache/index.ts +6 -0
- package/src/modules/content/application/cache/parse-cache.ts +6 -0
- package/src/modules/content/application/cache/parseCache.ts +56 -0
- package/src/modules/content/application/usecases/index.ts +2 -0
- package/src/modules/content/application/usecases/load-doc-page.ts +1 -0
- package/src/modules/content/application/usecases/loadDocPage.ts +111 -0
- package/src/modules/content/application/usecases/scanDocsDir.ts +105 -0
- package/src/modules/content/application/workflows/index.ts +1 -0
- package/src/modules/content/application/workflows/processDocs.ts +51 -0
- package/src/modules/content/domain/events/index.ts +61 -0
- package/src/modules/content/domain/models/index.ts +13 -0
- package/src/modules/content/domain/operations/build-page.ts +146 -0
- package/src/modules/content/domain/operations/buildPage.ts +93 -0
- package/src/modules/content/domain/operations/index.ts +17 -0
- package/src/modules/content/domain/operations/parse.ts +241 -0
- package/src/modules/content/domain/validators/frontmatter.ts +82 -0
- package/src/modules/content/domain/validators/index.ts +6 -0
- package/src/modules/content/index.ts +27 -0
- package/src/modules/content/ports/index.ts +45 -0
- package/src/modules/content/ports/velite.ts +134 -0
- package/src/modules/content/types/index.ts +76 -0
- package/src/modules/content/types/public.ts +1 -0
- package/src/modules/content-linting/application/builtin-linting-adapter.ts +82 -0
- package/src/modules/content-linting/domain/events/index.ts +58 -0
- package/src/modules/content-linting/domain/models/index.ts +46 -0
- package/src/modules/content-linting/domain/operations/linting-operations.ts +82 -0
- package/src/modules/content-linting/domain/validators/index.ts +50 -0
- package/src/modules/content-linting/index.ts +8 -0
- package/src/modules/content-linting/ports/linting-port.ts +21 -0
- package/src/modules/content-linting/types/linting.ts +18 -0
- package/src/modules/content-validation/application/usecases/index.ts +18 -0
- package/src/modules/content-validation/domain/events/index.ts +7 -0
- package/src/modules/content-validation/domain/index.ts +16 -0
- package/src/modules/content-validation/domain/models/index.ts +33 -0
- package/src/modules/content-validation/domain/operations/index.ts +157 -0
- package/src/modules/content-validation/domain/types/index.ts +17 -0
- package/src/modules/content-validation/domain/validators/index.ts +8 -0
- package/src/modules/content-validation/index.ts +9 -0
- package/src/modules/content-validation/ports/index.ts +15 -0
- package/src/modules/content-validation/types/index.ts +5 -0
- package/src/modules/export/application/puppeteer-export-adapter.ts +63 -0
- package/src/modules/export/domain/events/index.ts +55 -0
- package/src/modules/export/domain/models/index.ts +38 -0
- package/src/modules/export/domain/operations/export-operations.ts +56 -0
- package/src/modules/export/domain/validators/index.ts +52 -0
- package/src/modules/export/index.ts +8 -0
- package/src/modules/export/ports/export-port.ts +15 -0
- package/src/modules/export/types/export.ts +15 -0
- package/src/modules/external-search/application/algolia-adapter.ts +182 -0
- package/src/modules/external-search/application/meilisearch-adapter.ts +161 -0
- package/src/modules/external-search/domain/events/index.ts +42 -0
- package/src/modules/external-search/domain/models/index.ts +42 -0
- package/src/modules/external-search/domain/operations/search-operations.ts +53 -0
- package/src/modules/external-search/domain/validators/index.ts +55 -0
- package/src/modules/external-search/index.ts +9 -0
- package/src/modules/external-search/ports/external-search-port.ts +23 -0
- package/src/modules/external-search/types/search.ts +19 -0
- package/src/modules/git-history/application/simple-git-adapter.ts +46 -0
- package/src/modules/git-history/domain/events/index.ts +34 -0
- package/src/modules/git-history/domain/models/index.ts +25 -0
- package/src/modules/git-history/domain/operations/git-history-operations.ts +56 -0
- package/src/modules/git-history/domain/validators/index.ts +52 -0
- package/src/modules/git-history/index.ts +8 -0
- package/src/modules/git-history/ports/git-history-port.ts +21 -0
- package/src/modules/git-history/types/git-history.ts +15 -0
- package/src/modules/i18n/application/fs-locale-loader.ts +39 -0
- package/src/modules/i18n/domain/events/index.ts +34 -0
- package/src/modules/i18n/domain/models/index.ts +34 -0
- package/src/modules/i18n/domain/operations/locale-operations.ts +74 -0
- package/src/modules/i18n/domain/validators/index.ts +52 -0
- package/src/modules/i18n/index.ts +8 -0
- package/src/modules/i18n/ports/locale-loader-port.ts +18 -0
- package/src/modules/i18n/types/locale.ts +17 -0
- package/src/modules/image-optimization/application/sharp-adapter.ts +58 -0
- package/src/modules/image-optimization/domain/events/index.ts +39 -0
- package/src/modules/image-optimization/domain/models/index.ts +27 -0
- package/src/modules/image-optimization/domain/operations/image-operations.ts +65 -0
- package/src/modules/image-optimization/domain/validators/index.ts +52 -0
- package/src/modules/image-optimization/index.ts +8 -0
- package/src/modules/image-optimization/ports/image-optimizer-port.ts +15 -0
- package/src/modules/image-optimization/types/image.ts +17 -0
- package/src/modules/live-editor/application/usecases/index.ts +60 -0
- package/src/modules/live-editor/domain/events/index.ts +37 -0
- package/src/modules/live-editor/domain/gitOperations.ts +110 -0
- package/src/modules/live-editor/domain/index.ts +15 -0
- package/src/modules/live-editor/domain/models/index.ts +21 -0
- package/src/modules/live-editor/domain/validators/index.ts +55 -0
- package/src/modules/live-editor/index.ts +14 -0
- package/src/modules/live-editor/ports/index.ts +49 -0
- package/src/modules/live-editor/types/index.ts +80 -0
- package/src/modules/live-preview/application/vite-preview-adapter.ts +20 -0
- package/src/modules/live-preview/domain/operations/preview-operations.ts +56 -0
- package/src/modules/live-preview/index.ts +8 -0
- package/src/modules/live-preview/ports/preview-port.ts +20 -0
- package/src/modules/live-preview/types/preview.ts +16 -0
- package/src/modules/mdx/application/mdx-js-adapter.ts +38 -0
- package/src/modules/mdx/domain/operations/parse-mdx.ts +43 -0
- package/src/modules/mdx/index.ts +8 -0
- package/src/modules/mdx/ports/mdx-parser-port.ts +15 -0
- package/src/modules/mdx/types/mdx.ts +14 -0
- package/src/modules/navigation/application/usecases/buildNav.ts +15 -0
- package/src/modules/navigation/application/usecases/buildSidebar.ts +45 -0
- package/src/modules/navigation/application/usecases/index.ts +2 -0
- package/src/modules/navigation/domain/events/index.ts +30 -0
- package/src/modules/navigation/domain/models/index.ts +7 -0
- package/src/modules/navigation/domain/operations/group.ts +79 -0
- package/src/modules/navigation/domain/operations/index.ts +10 -0
- package/src/modules/navigation/domain/operations/sort.ts +27 -0
- package/src/modules/navigation/domain/shared/utils/array.ts +39 -0
- package/src/modules/navigation/domain/validators/index.ts +88 -0
- package/src/modules/navigation/index.ts +15 -0
- package/src/modules/navigation/ports/index.ts +9 -0
- package/src/modules/navigation/types/index.ts +38 -0
- package/src/modules/navigation/types/public.ts +9 -0
- package/src/modules/openapi/application/swagger-parser-adapter.ts +178 -0
- package/src/modules/openapi/domain/operations/parse-openapi.ts +46 -0
- package/src/modules/openapi/index.ts +8 -0
- package/src/modules/openapi/ports/openapi-parser-port.ts +15 -0
- package/src/modules/openapi/types/openapi.ts +37 -0
- package/src/modules/plugin/application/usecases/build-virtual-modules.ts +53 -0
- package/src/modules/plugin/application/usecases/index.ts +1 -0
- package/src/modules/plugin/application/workflows/build-docs.ts +79 -0
- package/src/modules/plugin/application/workflows/index.ts +1 -0
- package/src/modules/plugin/domain/events/index.ts +62 -0
- package/src/modules/plugin/domain/models/index.ts +1 -0
- package/src/modules/plugin/domain/operations/build-virtual.ts +76 -0
- package/src/modules/plugin/domain/operations/index.ts +11 -0
- package/src/modules/plugin/domain/validators/index.ts +30 -0
- package/src/modules/plugin/index.ts +14 -0
- package/src/modules/plugin/ports/index.ts +21 -0
- package/src/modules/plugin/types/index.ts +27 -0
- package/src/modules/plugin/types/public.ts +1 -0
- package/src/modules/search/application/usecases/index.ts +1 -0
- package/src/modules/search/application/usecases/indexPages.ts +15 -0
- package/src/modules/search/domain/events/index.ts +32 -0
- package/src/modules/search/domain/models/index.ts +1 -0
- package/src/modules/search/domain/operations/build-index.ts +6 -0
- package/src/modules/search/domain/operations/buildIndex.ts +70 -0
- package/src/modules/search/domain/operations/index.ts +7 -0
- package/src/modules/search/domain/operations/query.ts +186 -0
- package/src/modules/search/domain/validators/index.ts +32 -0
- package/src/modules/search/index.ts +9 -0
- package/src/modules/search/types/index.ts +22 -0
- package/src/modules/search/types/public.ts +1 -0
- package/src/modules/search-analytics/application/local-storage-adapter.ts +68 -0
- package/src/modules/search-analytics/domain/operations/search-analytics-operations.ts +74 -0
- package/src/modules/search-analytics/index.ts +8 -0
- package/src/modules/search-analytics/ports/search-analytics-port.ts +20 -0
- package/src/modules/search-analytics/types/search-analytics.ts +16 -0
- package/src/modules/search-highlighting/application/dom-highlighting-adapter.ts +36 -0
- package/src/modules/search-highlighting/domain/operations/highlighting-operations.ts +72 -0
- package/src/modules/search-highlighting/index.ts +8 -0
- package/src/modules/search-highlighting/ports/highlighting-port.ts +14 -0
- package/src/modules/search-highlighting/types/highlighting.ts +15 -0
- package/src/modules/seo-optimization/application/usecases/index.ts +18 -0
- package/src/modules/seo-optimization/domain/index.ts +12 -0
- package/src/modules/seo-optimization/domain/seoOperations.ts +92 -0
- package/src/modules/seo-optimization/index.ts +8 -0
- package/src/modules/seo-optimization/ports/index.ts +18 -0
- package/src/modules/seo-optimization/types/index.ts +41 -0
- package/src/modules/theme/application/css-theme-adapter.ts +50 -0
- package/src/modules/theme/domain/operations/theme-operations.ts +68 -0
- package/src/modules/theme/index.ts +8 -0
- package/src/modules/theme/ports/theme-port.ts +8 -0
- package/src/modules/theme/types/theme.ts +12 -0
- package/src/modules/toc/application/markdown-toc-adapter.ts +106 -0
- package/src/modules/toc/domain/operations/toc-operations.ts +92 -0
- package/src/modules/toc/index.ts +8 -0
- package/src/modules/toc/ports/toc-port.ts +21 -0
- package/src/modules/toc/types/toc.ts +17 -0
- package/src/modules/toc-generator/application/usecases/index.ts +30 -0
- package/src/modules/toc-generator/domain/index.ts +12 -0
- package/src/modules/toc-generator/domain/tocOperations.ts +104 -0
- package/src/modules/toc-generator/index.ts +9 -0
- package/src/modules/toc-generator/ports/index.ts +20 -0
- package/src/modules/toc-generator/types/index.ts +50 -0
- package/src/modules/version-control/domain/events/index.ts +39 -0
- package/src/modules/version-control/domain/models/index.ts +25 -0
- package/src/modules/version-control/domain/validators/index.ts +50 -0
- package/src/modules/versioning/application/fs-version-loader.ts +44 -0
- package/src/modules/versioning/domain/operations/versioning-operations.ts +80 -0
- package/src/modules/versioning/index.ts +8 -0
- package/src/modules/versioning/ports/version-loader-port.ts +18 -0
- package/src/modules/versioning/types/versioning.ts +17 -0
- package/src/modules/workflow/domain/events/index.ts +55 -0
- package/src/modules/workflow/domain/models/index.ts +40 -0
- package/src/modules/workflow/domain/validators/index.ts +50 -0
- package/src/modules/yaml-parser/application/js-yaml-adapter.ts +34 -0
- package/src/modules/yaml-parser/domain/operations/parse-yaml.ts +58 -0
- package/src/modules/yaml-parser/index.ts +7 -0
- package/src/modules/yaml-parser/ports/yaml-parser-port.ts +18 -0
- package/src/navigation/index.ts +9 -0
- package/src/plugin/index.ts +4 -0
- package/src/presentation/index.ts +1 -0
- package/src/presentation/live-editor/index.ts +22 -0
- package/src/presentation/live-editor/live-editor-component.ts +219 -0
- package/src/presentation/live-editor/virtual-module.ts +16 -0
- package/src/presentation/solid/CodeBlock.tsx +120 -0
- package/src/presentation/solid/Toc.tsx +58 -0
- package/src/presentation/solid/index.ts +11 -0
- package/src/presentation/vite-plugin/docs-plugin.ts +212 -0
- package/src/presentation/vite-plugin/index.ts +9 -0
- package/src/presentation/vite-plugin/transform-markdown.ts +26 -0
- package/src/runtime/analytics.ts +59 -0
- package/src/runtime/api-diff.ts +115 -0
- package/src/runtime/app.tsx +32 -0
- package/src/runtime/components/AccentPicker.tsx +114 -0
- package/src/runtime/components/ApiPlayground.tsx +332 -0
- package/src/runtime/components/AskAiDialog.tsx +127 -0
- package/src/runtime/components/BackToTop.tsx +38 -0
- package/src/runtime/components/Banner.tsx +75 -0
- package/src/runtime/components/Breadcrumbs.tsx +42 -0
- package/src/runtime/components/CollectionDropdown.tsx +85 -0
- package/src/runtime/components/CustomizeDrawer.tsx +195 -0
- package/src/runtime/components/DocMarkdown.tsx +579 -0
- package/src/runtime/components/DocPrevNext.tsx +54 -0
- package/src/runtime/components/DocToc.tsx +147 -0
- package/src/runtime/components/DocsDropdown.tsx +184 -0
- package/src/runtime/components/Footer.tsx +52 -0
- package/src/runtime/components/GitHubAuth.tsx +82 -0
- package/src/runtime/components/GitHubStats.tsx +73 -0
- package/src/runtime/components/Head.tsx +225 -0
- package/src/runtime/components/LocaleDropdown.tsx +75 -0
- package/src/runtime/components/MobileBottomNav.tsx +111 -0
- package/src/runtime/components/NotFound.tsx +139 -0
- package/src/runtime/components/PageActions.tsx +144 -0
- package/src/runtime/components/RelatedDocs.tsx +50 -0
- package/src/runtime/components/ScrollProgress.tsx +32 -0
- package/src/runtime/components/SearchPalette.tsx +333 -0
- package/src/runtime/components/ShowcaseCard.tsx +87 -0
- package/src/runtime/components/SidebarNav.tsx +237 -0
- package/src/runtime/components/Skeleton.tsx +39 -0
- package/src/runtime/components/ThemeToggle.tsx +26 -0
- package/src/runtime/components/TopNav.tsx +270 -0
- package/src/runtime/components/VersionDropdown.tsx +189 -0
- package/src/runtime/components/markdown/components.ts +280 -0
- package/src/runtime/config.ts +225 -0
- package/src/runtime/content.ts +451 -0
- package/src/runtime/context.tsx +30 -0
- package/src/runtime/data.ts +93 -0
- package/src/runtime/github.ts +226 -0
- package/src/runtime/icons.ts +32 -0
- package/src/runtime/index.ts +153 -0
- package/src/runtime/layouts/DocsLayout.tsx +144 -0
- package/src/runtime/markdown-content.css +996 -0
- package/src/runtime/pages/AbTestPage.tsx +88 -0
- package/src/runtime/pages/AnalyticsPage.tsx +90 -0
- package/src/runtime/pages/ApiDiffPage.tsx +86 -0
- package/src/runtime/pages/ApiEndpointPage.tsx +248 -0
- package/src/runtime/pages/BuilderPage.tsx +150 -0
- package/src/runtime/pages/ChangelogPage.tsx +210 -0
- package/src/runtime/pages/CollectionPage.tsx +140 -0
- package/src/runtime/pages/CommunityPage.tsx +384 -0
- package/src/runtime/pages/CreatePage.tsx +448 -0
- package/src/runtime/pages/DocPage.tsx +193 -0
- package/src/runtime/pages/EditPage.tsx +201 -0
- package/src/runtime/pages/HomePage.tsx +187 -0
- package/src/runtime/pages/IssuesPage.tsx +140 -0
- package/src/runtime/pages/OAuthCallbackPage.tsx +80 -0
- package/src/runtime/pages/PluginsPage.tsx +249 -0
- package/src/runtime/pages/ShowcasePage.tsx +202 -0
- package/src/runtime/pwa.ts +39 -0
- package/src/runtime/router.tsx +192 -0
- package/src/runtime/seo.ts +192 -0
- package/src/runtime/theme.css +175 -0
- package/src/runtime/theme.ts +224 -0
- package/src/runtime/types.ts +217 -0
- package/src/search/index.ts +6 -0
- package/src/seo-optimization/index.ts +4 -0
- package/src/shared/constants/index.ts +26 -0
- package/src/shared/errors/index.ts +195 -0
- package/src/shared/index.ts +27 -0
- package/src/shared/types/brand.ts +14 -0
- package/src/shared/types/client.d.ts +45 -0
- package/src/shared/types/either.ts +38 -0
- package/src/shared/types/index.ts +42 -0
- package/src/shared/types/option.ts +52 -0
- package/src/shared/types/result.ts +81 -0
- package/src/shared/utils/array.ts +97 -0
- package/src/shared/utils/index.ts +46 -0
- package/src/shared/utils/object.ts +47 -0
- package/src/shared/utils/string.ts +74 -0
- package/src/toc-generator/index.ts +1 -0
- package/src/types/js-yaml.d.ts +42 -0
- package/src/worker.ts +462 -0
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
import { createSignal, For, Show } from "solid-js";
|
|
2
|
+
import type { PluginInfo } from "../config";
|
|
3
|
+
import { useDocs } from "../context";
|
|
4
|
+
|
|
5
|
+
const builtIn: PluginInfo[] = [
|
|
6
|
+
{
|
|
7
|
+
name: "MCP server",
|
|
8
|
+
description:
|
|
9
|
+
"Expose docs search and content as Model Context Protocol tools at /mcp.",
|
|
10
|
+
icon: "i-mdi:robot-outline",
|
|
11
|
+
version: "built-in",
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
name: "LLM documentation",
|
|
15
|
+
description:
|
|
16
|
+
"Auto-generated /llms.txt and /llms-plugins.txt so AI agents can consume the docs.",
|
|
17
|
+
icon: "i-mdi:text-box-outline",
|
|
18
|
+
version: "built-in",
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
name: "GitHub OAuth",
|
|
22
|
+
description:
|
|
23
|
+
"Sign in with GitHub and save docs directly back to a repository.",
|
|
24
|
+
icon: "i-mdi:github",
|
|
25
|
+
version: "built-in",
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
name: "@wrikka/create-docs",
|
|
29
|
+
description: "The core docs runtime with SolidJS and TanStack Router.",
|
|
30
|
+
icon: "i-mdi:book-open-page-variant",
|
|
31
|
+
version: "built-in",
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
name: "OpenAPI adapter",
|
|
35
|
+
description: "Render OpenAPI specs as interactive API references.",
|
|
36
|
+
icon: "i-mdi:api",
|
|
37
|
+
version: "built-in",
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
name: "oRPC adapter",
|
|
41
|
+
description: "Generate docs from oRPC router definitions.",
|
|
42
|
+
icon: "i-mdi:lan-connect",
|
|
43
|
+
version: "built-in",
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
name: "Elysia adapter",
|
|
47
|
+
description: "Auto-generate docs from Elysia Eden treaties.",
|
|
48
|
+
icon: "i-mdi:server",
|
|
49
|
+
version: "built-in",
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
name: "Nitro adapter",
|
|
53
|
+
description: "Reference Nitro server handlers and API routes.",
|
|
54
|
+
icon: "i-mdi:fire",
|
|
55
|
+
version: "built-in",
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
name: "Search & command palette",
|
|
59
|
+
description:
|
|
60
|
+
"MiniSearch-backed full-text search with a two-column command palette.",
|
|
61
|
+
icon: "i-mdi:magnify",
|
|
62
|
+
version: "built-in",
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
name: "PWA",
|
|
66
|
+
description:
|
|
67
|
+
"Service worker, web manifest, and offline support out of the box.",
|
|
68
|
+
icon: "i-mdi:cellphone-arrow-down",
|
|
69
|
+
version: "built-in",
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
name: "SEO feeds",
|
|
73
|
+
description: "Sitemap, RSS/Atom, robots.txt, and Open Graph generation.",
|
|
74
|
+
icon: "i-mdi:rss",
|
|
75
|
+
version: "built-in",
|
|
76
|
+
},
|
|
77
|
+
];
|
|
78
|
+
|
|
79
|
+
export function PluginsPage() {
|
|
80
|
+
const config = useDocs();
|
|
81
|
+
const [copied, setCopied] = createSignal<string | null>(null);
|
|
82
|
+
|
|
83
|
+
const copyInstall = (name: string, cmd: string) => {
|
|
84
|
+
navigator.clipboard.writeText(cmd).catch(() => {});
|
|
85
|
+
setCopied(name);
|
|
86
|
+
setTimeout(() => setCopied(null), 1500);
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
const plugins = () =>
|
|
90
|
+
(config.plugins ?? []).length > 0 ? config.plugins : builtIn;
|
|
91
|
+
|
|
92
|
+
const categories = () => {
|
|
93
|
+
const list = plugins() ?? [];
|
|
94
|
+
const groups = new Map<string, typeof list>();
|
|
95
|
+
for (const p of list) {
|
|
96
|
+
const cat = p.name.startsWith("@")
|
|
97
|
+
? "Packages"
|
|
98
|
+
: p.name.includes("adapter")
|
|
99
|
+
? "Adapters"
|
|
100
|
+
: p.name.startsWith("MCP") ||
|
|
101
|
+
p.name.includes("LLM") ||
|
|
102
|
+
p.name.includes("OAuth") ||
|
|
103
|
+
p.name.includes("PWA") ||
|
|
104
|
+
p.name.includes("SEO") ||
|
|
105
|
+
p.name.includes("Search")
|
|
106
|
+
? "Integrations"
|
|
107
|
+
: "Core";
|
|
108
|
+
const g = groups.get(cat) ?? [];
|
|
109
|
+
g.push(p);
|
|
110
|
+
groups.set(cat, g);
|
|
111
|
+
}
|
|
112
|
+
const order = ["Core", "Integrations", "Adapters", "Packages"];
|
|
113
|
+
return [...groups.entries()].sort(([a], [b]) => {
|
|
114
|
+
const ia = order.indexOf(a);
|
|
115
|
+
const ib = order.indexOf(b);
|
|
116
|
+
if (ia !== -1 && ib !== -1) return ia - ib;
|
|
117
|
+
if (ia !== -1) return -1;
|
|
118
|
+
if (ib !== -1) return 1;
|
|
119
|
+
return a.localeCompare(b);
|
|
120
|
+
});
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
return (
|
|
124
|
+
<div class="max-w-5xl mx-auto px-6 py-10 pb-24">
|
|
125
|
+
<div class="flex items-start gap-3 mb-2">
|
|
126
|
+
<span class="i-mdi:puzzle text-3xl text-primary" aria-hidden="true" />
|
|
127
|
+
<div>
|
|
128
|
+
<h1 class="text-3xl font-bold m-0">Plugins</h1>
|
|
129
|
+
<p class="text-muted m-0">
|
|
130
|
+
Integrations, adapters, and extensions for this docs site.
|
|
131
|
+
</p>
|
|
132
|
+
</div>
|
|
133
|
+
</div>
|
|
134
|
+
|
|
135
|
+
<Show when={config.features?.mcp}>
|
|
136
|
+
<div class="mt-6 mb-8 border border-border rounded-lg p-4 bg-surface/30 flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3">
|
|
137
|
+
<div class="flex items-center gap-3">
|
|
138
|
+
<span
|
|
139
|
+
class="i-mdi:robot-outline text-2xl text-primary"
|
|
140
|
+
aria-hidden="true"
|
|
141
|
+
/>
|
|
142
|
+
<div>
|
|
143
|
+
<div class="font-medium text-foreground">MCP & LLM ready</div>
|
|
144
|
+
<div class="text-xs text-muted">
|
|
145
|
+
Point your MCP client at /mcp and grab /llms.txt
|
|
146
|
+
</div>
|
|
147
|
+
</div>
|
|
148
|
+
</div>
|
|
149
|
+
<div class="flex items-center gap-2">
|
|
150
|
+
<a
|
|
151
|
+
href="/llms.txt"
|
|
152
|
+
class="px-3 h-9 inline-flex items-center rounded-md border border-border bg-background text-xs text-muted hover:text-foreground hover:bg-surface transition-colors no-underline"
|
|
153
|
+
>
|
|
154
|
+
llms.txt
|
|
155
|
+
</a>
|
|
156
|
+
<a
|
|
157
|
+
href="/llms-plugins.txt"
|
|
158
|
+
class="px-3 h-9 inline-flex items-center rounded-md border border-border bg-background text-xs text-muted hover:text-foreground hover:bg-surface transition-colors no-underline"
|
|
159
|
+
>
|
|
160
|
+
llms-plugins.txt
|
|
161
|
+
</a>
|
|
162
|
+
</div>
|
|
163
|
+
</div>
|
|
164
|
+
</Show>
|
|
165
|
+
|
|
166
|
+
<Show when={(config.plugins ?? []).length === 0}>
|
|
167
|
+
<div class="border border-border rounded-lg p-4 bg-surface/30 mb-8">
|
|
168
|
+
<p class="text-sm text-muted m-0">
|
|
169
|
+
No custom plugins configured yet. These are built-in integrations
|
|
170
|
+
you can enable from your config.
|
|
171
|
+
</p>
|
|
172
|
+
</div>
|
|
173
|
+
</Show>
|
|
174
|
+
|
|
175
|
+
<For each={categories()}>
|
|
176
|
+
{([category, items]) => (
|
|
177
|
+
<section class="mb-10">
|
|
178
|
+
<h2 class="text-lg font-semibold mb-3 flex items-center gap-2">
|
|
179
|
+
<span class="i-mdi:folder-open-outline" aria-hidden="true" />
|
|
180
|
+
{category}
|
|
181
|
+
<span class="ml-auto text-xs font-normal text-muted">
|
|
182
|
+
{items.length}
|
|
183
|
+
</span>
|
|
184
|
+
</h2>
|
|
185
|
+
<div class="grid sm:grid-cols-2 lg:grid-cols-3 gap-4">
|
|
186
|
+
<For each={items}>
|
|
187
|
+
{(p) => (
|
|
188
|
+
<article class="border border-border rounded-xl p-5 flex flex-col gap-3 bg-surface/30 hover:border-focus transition-colors">
|
|
189
|
+
<div class="flex items-center gap-3">
|
|
190
|
+
<Show when={p.icon}>
|
|
191
|
+
<span
|
|
192
|
+
class={`${p.icon} text-2xl text-primary`}
|
|
193
|
+
aria-hidden="true"
|
|
194
|
+
/>
|
|
195
|
+
</Show>
|
|
196
|
+
<div class="min-w-0 flex-1">
|
|
197
|
+
<h3 class="font-semibold text-sm m-0 truncate">
|
|
198
|
+
{p.name}
|
|
199
|
+
</h3>
|
|
200
|
+
<Show when={p.version}>
|
|
201
|
+
<span class="text-[10px] text-muted">
|
|
202
|
+
{p.version}
|
|
203
|
+
</span>
|
|
204
|
+
</Show>
|
|
205
|
+
</div>
|
|
206
|
+
<Show when={p.url}>
|
|
207
|
+
<a
|
|
208
|
+
href={p.url}
|
|
209
|
+
target="_blank"
|
|
210
|
+
rel="noreferrer"
|
|
211
|
+
aria-label={`${p.name} docs`}
|
|
212
|
+
class="w-7 h-7 inline-flex items-center justify-center rounded-md border border-border text-muted hover:text-foreground hover:bg-surface transition-colors"
|
|
213
|
+
>
|
|
214
|
+
<span class="i-mdi:open-in-new" aria-hidden="true" />
|
|
215
|
+
</a>
|
|
216
|
+
</Show>
|
|
217
|
+
</div>
|
|
218
|
+
<p class="text-sm text-muted m-0 flex-1 leading-relaxed">
|
|
219
|
+
{p.description}
|
|
220
|
+
</p>
|
|
221
|
+
<div class="flex items-center gap-2 pt-2 border-t border-border">
|
|
222
|
+
<Show when={p.install}>
|
|
223
|
+
<code class="text-[11px] bg-background border border-border rounded px-2 py-1 flex-1 truncate font-mono">
|
|
224
|
+
{p.install}
|
|
225
|
+
</code>
|
|
226
|
+
<button
|
|
227
|
+
type="button"
|
|
228
|
+
onClick={() => copyInstall(p.name, p.install!)}
|
|
229
|
+
class="px-2.5 h-7 rounded-md border border-border text-xs text-muted hover:text-foreground hover:bg-surface transition-colors cursor-pointer shrink-0"
|
|
230
|
+
>
|
|
231
|
+
{copied() === p.name ? "Copied!" : "Copy"}
|
|
232
|
+
</button>
|
|
233
|
+
</Show>
|
|
234
|
+
<Show when={!p.install}>
|
|
235
|
+
<span class="text-xs text-muted">
|
|
236
|
+
No install needed
|
|
237
|
+
</span>
|
|
238
|
+
</Show>
|
|
239
|
+
</div>
|
|
240
|
+
</article>
|
|
241
|
+
)}
|
|
242
|
+
</For>
|
|
243
|
+
</div>
|
|
244
|
+
</section>
|
|
245
|
+
)}
|
|
246
|
+
</For>
|
|
247
|
+
</div>
|
|
248
|
+
);
|
|
249
|
+
}
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import type { JSX } from "solid-js";
|
|
2
|
+
import { createMemo, createSignal, For, Show } from "solid-js";
|
|
3
|
+
import type { ShowcaseInfo } from "../config";
|
|
4
|
+
import { useDocs } from "../context";
|
|
5
|
+
|
|
6
|
+
function Card(props: { link?: string; children: JSX.Element }) {
|
|
7
|
+
const classes =
|
|
8
|
+
"group border border-border rounded-xl overflow-hidden bg-surface/30 hover:border-focus transition-all hover:-translate-y-0.5 hover:shadow-lg flex flex-col";
|
|
9
|
+
return props.link ? (
|
|
10
|
+
<a
|
|
11
|
+
href={props.link}
|
|
12
|
+
target="_blank"
|
|
13
|
+
rel="noreferrer"
|
|
14
|
+
class={`${classes} no-underline`}
|
|
15
|
+
>
|
|
16
|
+
{props.children}
|
|
17
|
+
</a>
|
|
18
|
+
) : (
|
|
19
|
+
<div class={classes}>{props.children}</div>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function ShowcaseCard(props: { item: ShowcaseInfo }) {
|
|
24
|
+
const { item } = props;
|
|
25
|
+
const coverStyle = () => {
|
|
26
|
+
if (item.image) return {};
|
|
27
|
+
const color = item.coverColor ?? "hsl(var(--color-primary) / 0.35)";
|
|
28
|
+
return {
|
|
29
|
+
background: `linear-gradient(135deg, ${color}, transparent)`,
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<Card link={item.link}>
|
|
35
|
+
<div
|
|
36
|
+
class="relative h-44 w-full bg-background border-b border-border overflow-hidden"
|
|
37
|
+
style={coverStyle()}
|
|
38
|
+
>
|
|
39
|
+
<Show
|
|
40
|
+
when={item.image}
|
|
41
|
+
fallback={
|
|
42
|
+
<div class="w-full h-full flex items-center justify-center">
|
|
43
|
+
<span
|
|
44
|
+
class={`${item.icon ?? "i-mdi:view-dashboard"} text-6xl text-primary/60`}
|
|
45
|
+
aria-hidden="true"
|
|
46
|
+
/>
|
|
47
|
+
</div>
|
|
48
|
+
}
|
|
49
|
+
>
|
|
50
|
+
<img
|
|
51
|
+
src={item.image!}
|
|
52
|
+
alt={`${item.label} preview`}
|
|
53
|
+
class="w-full h-full object-cover transition-transform duration-300 group-hover:scale-105"
|
|
54
|
+
loading="lazy"
|
|
55
|
+
/>
|
|
56
|
+
</Show>
|
|
57
|
+
<Show when={item.badge}>
|
|
58
|
+
<span class="absolute top-3 right-3 text-[10px] px-2 py-0.5 rounded-full bg-primary/15 text-primary font-medium">
|
|
59
|
+
{item.badge}
|
|
60
|
+
</span>
|
|
61
|
+
</Show>
|
|
62
|
+
</div>
|
|
63
|
+
<div class="p-5 flex flex-col gap-2 flex-1">
|
|
64
|
+
<div class="flex items-center gap-2">
|
|
65
|
+
<Show when={item.icon && !item.image}>
|
|
66
|
+
<span
|
|
67
|
+
class={`${item.icon} text-xl text-primary`}
|
|
68
|
+
aria-hidden="true"
|
|
69
|
+
/>
|
|
70
|
+
</Show>
|
|
71
|
+
<h3 class="font-semibold text-base m-0">{item.label}</h3>
|
|
72
|
+
</div>
|
|
73
|
+
<p class="text-sm text-muted m-0 flex-1 leading-relaxed">
|
|
74
|
+
{item.description}
|
|
75
|
+
</p>
|
|
76
|
+
<Show when={item.tags?.length}>
|
|
77
|
+
<div class="flex flex-wrap gap-1.5 mt-1">
|
|
78
|
+
<For each={item.tags}>
|
|
79
|
+
{(tag) => (
|
|
80
|
+
<span class="text-[10px] px-2 py-0.5 rounded-full bg-surface border border-border text-muted">
|
|
81
|
+
{tag}
|
|
82
|
+
</span>
|
|
83
|
+
)}
|
|
84
|
+
</For>
|
|
85
|
+
</div>
|
|
86
|
+
</Show>
|
|
87
|
+
</div>
|
|
88
|
+
</Card>
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export function ShowcasePage() {
|
|
93
|
+
const config = useDocs();
|
|
94
|
+
const allItems = () => config.showcase ?? [];
|
|
95
|
+
const [search, setSearch] = createSignal("");
|
|
96
|
+
const [tag, setTag] = createSignal<string | null>(null);
|
|
97
|
+
|
|
98
|
+
const allTags = createMemo(() => {
|
|
99
|
+
const set = new Set<string>();
|
|
100
|
+
for (const item of allItems()) {
|
|
101
|
+
for (const t of item.tags ?? []) set.add(t);
|
|
102
|
+
}
|
|
103
|
+
return [...set].sort();
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
const filtered = createMemo(() => {
|
|
107
|
+
const q = search().toLowerCase();
|
|
108
|
+
const t = tag();
|
|
109
|
+
return allItems().filter((item) => {
|
|
110
|
+
const matchesSearch =
|
|
111
|
+
!q ||
|
|
112
|
+
item.label.toLowerCase().includes(q) ||
|
|
113
|
+
item.description.toLowerCase().includes(q) ||
|
|
114
|
+
item.tags?.some((tg) => tg.toLowerCase().includes(q));
|
|
115
|
+
const matchesTag = !t || item.tags?.includes(t);
|
|
116
|
+
return matchesSearch && matchesTag;
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
const featured = () => allItems()[0];
|
|
121
|
+
const rest = () =>
|
|
122
|
+
filtered().filter((i) => (featured() ? i.id !== featured()!.id : true));
|
|
123
|
+
|
|
124
|
+
return (
|
|
125
|
+
<div class="max-w-5xl mx-auto px-6 py-10 pb-24">
|
|
126
|
+
<div class="flex items-start gap-3 mb-2">
|
|
127
|
+
<span
|
|
128
|
+
class="i-mdi:view-dashboard text-3xl text-primary"
|
|
129
|
+
aria-hidden="true"
|
|
130
|
+
/>
|
|
131
|
+
<div>
|
|
132
|
+
<h1 class="text-3xl font-bold m-0">Showcase</h1>
|
|
133
|
+
<p class="text-muted m-0">
|
|
134
|
+
Featured projects and examples built with this ecosystem.
|
|
135
|
+
</p>
|
|
136
|
+
</div>
|
|
137
|
+
</div>
|
|
138
|
+
|
|
139
|
+
<div class="flex flex-col sm:flex-row gap-3 my-8">
|
|
140
|
+
<label class="flex items-center gap-2 flex-1 px-3 h-10 rounded-lg border border-border bg-surface text-muted text-sm">
|
|
141
|
+
<span class="i-mdi:magnify" aria-hidden="true" />
|
|
142
|
+
<input
|
|
143
|
+
type="search"
|
|
144
|
+
value={search()}
|
|
145
|
+
onInput={(e) => setSearch(e.currentTarget.value)}
|
|
146
|
+
placeholder="Filter showcase…"
|
|
147
|
+
aria-label="Filter showcase"
|
|
148
|
+
class="bg-transparent outline-none border-none w-full text-foreground placeholder:text-muted"
|
|
149
|
+
/>
|
|
150
|
+
</label>
|
|
151
|
+
<div class="flex flex-wrap gap-2">
|
|
152
|
+
<button
|
|
153
|
+
type="button"
|
|
154
|
+
onClick={() => setTag(null)}
|
|
155
|
+
class={`px-3 h-9 rounded-full text-xs border transition-colors cursor-pointer ${
|
|
156
|
+
tag() == null
|
|
157
|
+
? "bg-primary text-primary-foreground border-primary"
|
|
158
|
+
: "bg-surface text-muted border-border hover:border-focus"
|
|
159
|
+
}`}
|
|
160
|
+
>
|
|
161
|
+
All
|
|
162
|
+
</button>
|
|
163
|
+
<For each={allTags()}>
|
|
164
|
+
{(t) => (
|
|
165
|
+
<button
|
|
166
|
+
type="button"
|
|
167
|
+
onClick={() => setTag(t)}
|
|
168
|
+
class={`px-3 h-9 rounded-full text-xs border transition-colors cursor-pointer ${
|
|
169
|
+
tag() === t
|
|
170
|
+
? "bg-primary text-primary-foreground border-primary"
|
|
171
|
+
: "bg-surface text-muted border-border hover:border-focus"
|
|
172
|
+
}`}
|
|
173
|
+
>
|
|
174
|
+
{t}
|
|
175
|
+
</button>
|
|
176
|
+
)}
|
|
177
|
+
</For>
|
|
178
|
+
</div>
|
|
179
|
+
</div>
|
|
180
|
+
|
|
181
|
+
<Show when={!search() && !tag() && featured()}>
|
|
182
|
+
<section class="mb-10">
|
|
183
|
+
<h2 class="text-lg font-semibold mb-3 text-muted">Featured</h2>
|
|
184
|
+
<div class="sm:max-w-2xl">
|
|
185
|
+
<ShowcaseCard item={featured()!} />
|
|
186
|
+
</div>
|
|
187
|
+
</section>
|
|
188
|
+
</Show>
|
|
189
|
+
|
|
190
|
+
<Show when={filtered().length === 0}>
|
|
191
|
+
<div class="flex flex-col items-center gap-3 py-16 rounded-lg border border-dashed border-border text-muted">
|
|
192
|
+
<span class="i-mdi:image-plus text-4xl" aria-hidden="true" />
|
|
193
|
+
<p class="m-0">No showcase items match your filters.</p>
|
|
194
|
+
</div>
|
|
195
|
+
</Show>
|
|
196
|
+
|
|
197
|
+
<div class="grid sm:grid-cols-2 lg:grid-cols-3 gap-5">
|
|
198
|
+
<For each={rest()}>{(item) => <ShowcaseCard item={item} />}</For>
|
|
199
|
+
</div>
|
|
200
|
+
</div>
|
|
201
|
+
);
|
|
202
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { DocsAppConfig } from "./config";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Enables PWA support: injects the web-app manifest link and theme-color
|
|
5
|
+
* meta, then registers `/sw.js` when the browser supports service workers.
|
|
6
|
+
*
|
|
7
|
+
* The consumer is responsible for shipping `manifest.webmanifest` and
|
|
8
|
+
* `sw.js` as static assets (e.g. in `public/`).
|
|
9
|
+
*/
|
|
10
|
+
export function setupPwa(config: DocsAppConfig): void {
|
|
11
|
+
if (!config.features?.pwa) return;
|
|
12
|
+
if (typeof document === "undefined") return;
|
|
13
|
+
|
|
14
|
+
if (!document.querySelector('link[rel="manifest"]')) {
|
|
15
|
+
const link = document.createElement("link");
|
|
16
|
+
link.rel = "manifest";
|
|
17
|
+
link.href = "/manifest.webmanifest";
|
|
18
|
+
document.head.appendChild(link);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if (!document.querySelector('meta[name="theme-color"]')) {
|
|
22
|
+
const meta = document.createElement("meta");
|
|
23
|
+
meta.name = "theme-color";
|
|
24
|
+
meta.content =
|
|
25
|
+
config.theme?.defaultMode === "light" ? "#ffffff" : "#0b0d12";
|
|
26
|
+
document.head.appendChild(meta);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const canRegister =
|
|
30
|
+
"serviceWorker" in navigator &&
|
|
31
|
+
(location.protocol === "https:" ||
|
|
32
|
+
location.hostname === "localhost" ||
|
|
33
|
+
location.hostname === "127.0.0.1");
|
|
34
|
+
if (!canRegister) return;
|
|
35
|
+
|
|
36
|
+
navigator.serviceWorker.register("/sw.js").catch(() => {
|
|
37
|
+
// Service worker missing or registration blocked — offline mode off.
|
|
38
|
+
});
|
|
39
|
+
}
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createRootRoute,
|
|
3
|
+
createRoute,
|
|
4
|
+
createRouter,
|
|
5
|
+
redirect,
|
|
6
|
+
} from "@tanstack/solid-router";
|
|
7
|
+
import { trackPageView } from "./analytics";
|
|
8
|
+
import { NotFound } from "./components/NotFound";
|
|
9
|
+
import type { DocsAppConfig } from "./config";
|
|
10
|
+
import { findApiCollection } from "./context";
|
|
11
|
+
import { DocsLayout } from "./layouts/DocsLayout";
|
|
12
|
+
import { AbTestPage } from "./pages/AbTestPage";
|
|
13
|
+
import { AnalyticsPage } from "./pages/AnalyticsPage";
|
|
14
|
+
import { ApiDiffPage } from "./pages/ApiDiffPage";
|
|
15
|
+
import { ApiEndpointPage } from "./pages/ApiEndpointPage";
|
|
16
|
+
import { BuilderPage } from "./pages/BuilderPage";
|
|
17
|
+
import { ChangelogPage } from "./pages/ChangelogPage";
|
|
18
|
+
import { CollectionPage } from "./pages/CollectionPage";
|
|
19
|
+
import { CommunityPage } from "./pages/CommunityPage";
|
|
20
|
+
import { CreatePage } from "./pages/CreatePage";
|
|
21
|
+
import { DocPage } from "./pages/DocPage";
|
|
22
|
+
import { EditPage } from "./pages/EditPage";
|
|
23
|
+
import { HomePage } from "./pages/HomePage";
|
|
24
|
+
import { IssuesPage } from "./pages/IssuesPage";
|
|
25
|
+
import { OAuthCallbackPage } from "./pages/OAuthCallbackPage";
|
|
26
|
+
import { PluginsPage } from "./pages/PluginsPage";
|
|
27
|
+
import { ShowcasePage } from "./pages/ShowcasePage";
|
|
28
|
+
|
|
29
|
+
export function createDocsRouter(config: DocsAppConfig) {
|
|
30
|
+
const rootRoute = createRootRoute({
|
|
31
|
+
component: () => <DocsLayout />,
|
|
32
|
+
errorComponent: () => <NotFound />,
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
const indexRoute = createRoute({
|
|
36
|
+
getParentRoute: () => rootRoute,
|
|
37
|
+
path: "/",
|
|
38
|
+
...(config.home
|
|
39
|
+
? { component: HomePage }
|
|
40
|
+
: {
|
|
41
|
+
beforeLoad: () => {
|
|
42
|
+
const target =
|
|
43
|
+
config.defaultCollection ??
|
|
44
|
+
config.apiCollections?.[0]?.id ??
|
|
45
|
+
"docs";
|
|
46
|
+
throw redirect({
|
|
47
|
+
to: "/$collection",
|
|
48
|
+
params: { collection: target },
|
|
49
|
+
});
|
|
50
|
+
},
|
|
51
|
+
}),
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
const collectionRoute = createRoute({
|
|
55
|
+
getParentRoute: () => rootRoute,
|
|
56
|
+
path: "$collection",
|
|
57
|
+
component: CollectionPage,
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
// One detail route; the page component switches on collection type.
|
|
61
|
+
const editRoute = createRoute({
|
|
62
|
+
getParentRoute: () => rootRoute,
|
|
63
|
+
path: "edit/$collection/$docId",
|
|
64
|
+
component: EditPage,
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
const detailRoute = createRoute({
|
|
68
|
+
getParentRoute: () => rootRoute,
|
|
69
|
+
path: "$collection/$docId",
|
|
70
|
+
component: () => {
|
|
71
|
+
const params = detailRoute.useParams();
|
|
72
|
+
return findApiCollection(config, params().collection) ? (
|
|
73
|
+
<ApiEndpointPage />
|
|
74
|
+
) : (
|
|
75
|
+
<DocPage />
|
|
76
|
+
);
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
const createPageRoute = createRoute({
|
|
81
|
+
getParentRoute: () => rootRoute,
|
|
82
|
+
path: "create",
|
|
83
|
+
component: CreatePage,
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
const builderRoute = createRoute({
|
|
87
|
+
getParentRoute: () => rootRoute,
|
|
88
|
+
path: "builder",
|
|
89
|
+
component: BuilderPage,
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
const abTestRoute = createRoute({
|
|
93
|
+
getParentRoute: () => rootRoute,
|
|
94
|
+
path: "ab/$collection/$docId",
|
|
95
|
+
component: AbTestPage,
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
const extraRoutes = [];
|
|
99
|
+
if (config.github?.releases) {
|
|
100
|
+
const changelogRoute = createRoute({
|
|
101
|
+
getParentRoute: () => rootRoute,
|
|
102
|
+
path: "changelog",
|
|
103
|
+
component: ChangelogPage,
|
|
104
|
+
});
|
|
105
|
+
extraRoutes.push(changelogRoute);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
if (config.github?.contributors) {
|
|
109
|
+
const communityRoute = createRoute({
|
|
110
|
+
getParentRoute: () => rootRoute,
|
|
111
|
+
path: "community",
|
|
112
|
+
component: CommunityPage,
|
|
113
|
+
});
|
|
114
|
+
extraRoutes.push(communityRoute);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
if (config.github?.issues) {
|
|
118
|
+
const issuesRoute = createRoute({
|
|
119
|
+
getParentRoute: () => rootRoute,
|
|
120
|
+
path: "issues",
|
|
121
|
+
component: IssuesPage,
|
|
122
|
+
});
|
|
123
|
+
extraRoutes.push(issuesRoute);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
if (config.features?.analytics) {
|
|
127
|
+
const analyticsRoute = createRoute({
|
|
128
|
+
getParentRoute: () => rootRoute,
|
|
129
|
+
path: "analytics",
|
|
130
|
+
component: AnalyticsPage,
|
|
131
|
+
});
|
|
132
|
+
extraRoutes.push(analyticsRoute);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
if (config.apiDiff) {
|
|
136
|
+
const apiDiffRoute = createRoute({
|
|
137
|
+
getParentRoute: () => rootRoute,
|
|
138
|
+
path: "api-diff",
|
|
139
|
+
component: ApiDiffPage,
|
|
140
|
+
});
|
|
141
|
+
extraRoutes.push(apiDiffRoute);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
if (config.plugins?.length) {
|
|
145
|
+
const pluginsRoute = createRoute({
|
|
146
|
+
getParentRoute: () => rootRoute,
|
|
147
|
+
path: "plugins",
|
|
148
|
+
component: PluginsPage,
|
|
149
|
+
});
|
|
150
|
+
extraRoutes.push(pluginsRoute);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
const showcaseRoute = createRoute({
|
|
154
|
+
getParentRoute: () => rootRoute,
|
|
155
|
+
path: "showcase",
|
|
156
|
+
component: ShowcasePage,
|
|
157
|
+
});
|
|
158
|
+
extraRoutes.push(showcaseRoute);
|
|
159
|
+
|
|
160
|
+
const oauthCallbackRoute = createRoute({
|
|
161
|
+
getParentRoute: () => rootRoute,
|
|
162
|
+
path: "auth/github/callback",
|
|
163
|
+
component: OAuthCallbackPage,
|
|
164
|
+
});
|
|
165
|
+
extraRoutes.push(oauthCallbackRoute);
|
|
166
|
+
|
|
167
|
+
const routeTree = rootRoute.addChildren([
|
|
168
|
+
indexRoute,
|
|
169
|
+
createPageRoute,
|
|
170
|
+
editRoute,
|
|
171
|
+
builderRoute,
|
|
172
|
+
abTestRoute,
|
|
173
|
+
...extraRoutes,
|
|
174
|
+
collectionRoute,
|
|
175
|
+
detailRoute,
|
|
176
|
+
]);
|
|
177
|
+
|
|
178
|
+
const router = createRouter({
|
|
179
|
+
routeTree,
|
|
180
|
+
defaultPreload: "intent",
|
|
181
|
+
scrollRestoration: true,
|
|
182
|
+
defaultNotFoundComponent: NotFound,
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
if (config.features?.analytics) {
|
|
186
|
+
router.subscribe("onResolved", ({ toLocation }) => {
|
|
187
|
+
trackPageView(toLocation.pathname, config.analytics?.endpoint);
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
return router;
|
|
192
|
+
}
|