jamdesk 1.0.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/LICENSE +21 -0
- package/README.md +323 -0
- package/bin/jamdesk.js +76 -0
- package/dist/__tests__/integration/deprecated-components.integration.test.d.ts +8 -0
- package/dist/__tests__/integration/deprecated-components.integration.test.d.ts.map +1 -0
- package/dist/__tests__/integration/deprecated-components.integration.test.js +165 -0
- package/dist/__tests__/integration/deprecated-components.integration.test.js.map +1 -0
- package/dist/__tests__/integration/migrate.integration.test.d.ts +2 -0
- package/dist/__tests__/integration/migrate.integration.test.d.ts.map +1 -0
- package/dist/__tests__/integration/migrate.integration.test.js +64 -0
- package/dist/__tests__/integration/migrate.integration.test.js.map +1 -0
- package/dist/__tests__/integration/prepublish.integration.test.d.ts +2 -0
- package/dist/__tests__/integration/prepublish.integration.test.d.ts.map +1 -0
- package/dist/__tests__/integration/prepublish.integration.test.js +27 -0
- package/dist/__tests__/integration/prepublish.integration.test.js.map +1 -0
- package/dist/__tests__/integration/validate.integration.test.d.ts +2 -0
- package/dist/__tests__/integration/validate.integration.test.d.ts.map +1 -0
- package/dist/__tests__/integration/validate.integration.test.js +56 -0
- package/dist/__tests__/integration/validate.integration.test.js.map +1 -0
- package/dist/__tests__/unit/deploy-templates.test.d.ts +2 -0
- package/dist/__tests__/unit/deploy-templates.test.d.ts.map +1 -0
- package/dist/__tests__/unit/deploy-templates.test.js +124 -0
- package/dist/__tests__/unit/deploy-templates.test.js.map +1 -0
- package/dist/__tests__/unit/deprecated-components-sync.test.d.ts +2 -0
- package/dist/__tests__/unit/deprecated-components-sync.test.d.ts.map +1 -0
- package/dist/__tests__/unit/deprecated-components-sync.test.js +69 -0
- package/dist/__tests__/unit/deprecated-components-sync.test.js.map +1 -0
- package/dist/__tests__/unit/deps-sync.test.d.ts +14 -0
- package/dist/__tests__/unit/deps-sync.test.d.ts.map +1 -0
- package/dist/__tests__/unit/deps-sync.test.js +166 -0
- package/dist/__tests__/unit/deps-sync.test.js.map +1 -0
- package/dist/__tests__/unit/docs-config.test.d.ts +2 -0
- package/dist/__tests__/unit/docs-config.test.d.ts.map +1 -0
- package/dist/__tests__/unit/docs-config.test.js +288 -0
- package/dist/__tests__/unit/docs-config.test.js.map +1 -0
- package/dist/__tests__/unit/errors.test.d.ts +2 -0
- package/dist/__tests__/unit/errors.test.d.ts.map +1 -0
- package/dist/__tests__/unit/errors.test.js +27 -0
- package/dist/__tests__/unit/errors.test.js.map +1 -0
- package/dist/__tests__/unit/extract-hooks.test.d.ts +5 -0
- package/dist/__tests__/unit/extract-hooks.test.d.ts.map +1 -0
- package/dist/__tests__/unit/extract-hooks.test.js +205 -0
- package/dist/__tests__/unit/extract-hooks.test.js.map +1 -0
- package/dist/__tests__/unit/frontmatter-sync.test.d.ts +8 -0
- package/dist/__tests__/unit/frontmatter-sync.test.d.ts.map +1 -0
- package/dist/__tests__/unit/frontmatter-sync.test.js +26 -0
- package/dist/__tests__/unit/frontmatter-sync.test.js.map +1 -0
- package/dist/__tests__/unit/mdx-validator.test.d.ts +2 -0
- package/dist/__tests__/unit/mdx-validator.test.d.ts.map +1 -0
- package/dist/__tests__/unit/mdx-validator.test.js +264 -0
- package/dist/__tests__/unit/mdx-validator.test.js.map +1 -0
- package/dist/__tests__/unit/migrate-convert.test.d.ts +2 -0
- package/dist/__tests__/unit/migrate-convert.test.d.ts.map +1 -0
- package/dist/__tests__/unit/migrate-convert.test.js +297 -0
- package/dist/__tests__/unit/migrate-convert.test.js.map +1 -0
- package/dist/__tests__/unit/migrate-detect.test.d.ts +2 -0
- package/dist/__tests__/unit/migrate-detect.test.d.ts.map +1 -0
- package/dist/__tests__/unit/migrate-detect.test.js +35 -0
- package/dist/__tests__/unit/migrate-detect.test.js.map +1 -0
- package/dist/__tests__/unit/migrate-mdx.test.d.ts +2 -0
- package/dist/__tests__/unit/migrate-mdx.test.d.ts.map +1 -0
- package/dist/__tests__/unit/migrate-mdx.test.js +158 -0
- package/dist/__tests__/unit/migrate-mdx.test.js.map +1 -0
- package/dist/__tests__/unit/openapi.test.d.ts +2 -0
- package/dist/__tests__/unit/openapi.test.d.ts.map +1 -0
- package/dist/__tests__/unit/openapi.test.js +52 -0
- package/dist/__tests__/unit/openapi.test.js.map +1 -0
- package/dist/__tests__/unit/package-config.test.d.ts +2 -0
- package/dist/__tests__/unit/package-config.test.d.ts.map +1 -0
- package/dist/__tests__/unit/package-config.test.js +63 -0
- package/dist/__tests__/unit/package-config.test.js.map +1 -0
- package/dist/__tests__/unit/port.test.d.ts +2 -0
- package/dist/__tests__/unit/port.test.d.ts.map +1 -0
- package/dist/__tests__/unit/port.test.js +20 -0
- package/dist/__tests__/unit/port.test.js.map +1 -0
- package/dist/__tests__/unit/vendored-sync.test.d.ts +14 -0
- package/dist/__tests__/unit/vendored-sync.test.d.ts.map +1 -0
- package/dist/__tests__/unit/vendored-sync.test.js +90 -0
- package/dist/__tests__/unit/vendored-sync.test.js.map +1 -0
- package/dist/commands/broken-links.d.ts +11 -0
- package/dist/commands/broken-links.d.ts.map +1 -0
- package/dist/commands/broken-links.js +95 -0
- package/dist/commands/broken-links.js.map +1 -0
- package/dist/commands/clean.d.ts +7 -0
- package/dist/commands/clean.d.ts.map +1 -0
- package/dist/commands/clean.js +59 -0
- package/dist/commands/clean.js.map +1 -0
- package/dist/commands/deploy/cloudflare.d.ts +12 -0
- package/dist/commands/deploy/cloudflare.d.ts.map +1 -0
- package/dist/commands/deploy/cloudflare.js +409 -0
- package/dist/commands/deploy/cloudflare.js.map +1 -0
- package/dist/commands/deploy/templates.d.ts +23 -0
- package/dist/commands/deploy/templates.d.ts.map +1 -0
- package/dist/commands/deploy/templates.js +179 -0
- package/dist/commands/deploy/templates.js.map +1 -0
- package/dist/commands/deploy/types.d.ts +19 -0
- package/dist/commands/deploy/types.d.ts.map +1 -0
- package/dist/commands/deploy/types.js +5 -0
- package/dist/commands/deploy/types.js.map +1 -0
- package/dist/commands/dev.d.ts +14 -0
- package/dist/commands/dev.d.ts.map +1 -0
- package/dist/commands/dev.js +817 -0
- package/dist/commands/dev.js.map +1 -0
- package/dist/commands/doctor.d.ts +7 -0
- package/dist/commands/doctor.d.ts.map +1 -0
- package/dist/commands/doctor.js +159 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/init.d.ts +7 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +96 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/migrate/convert-mdx.d.ts +50 -0
- package/dist/commands/migrate/convert-mdx.d.ts.map +1 -0
- package/dist/commands/migrate/convert-mdx.js +108 -0
- package/dist/commands/migrate/convert-mdx.js.map +1 -0
- package/dist/commands/migrate/convert.d.ts +80 -0
- package/dist/commands/migrate/convert.d.ts.map +1 -0
- package/dist/commands/migrate/convert.js +158 -0
- package/dist/commands/migrate/convert.js.map +1 -0
- package/dist/commands/migrate/detect.d.ts +31 -0
- package/dist/commands/migrate/detect.d.ts.map +1 -0
- package/dist/commands/migrate/detect.js +62 -0
- package/dist/commands/migrate/detect.js.map +1 -0
- package/dist/commands/migrate/extract-hooks.d.ts +71 -0
- package/dist/commands/migrate/extract-hooks.d.ts.map +1 -0
- package/dist/commands/migrate/extract-hooks.js +473 -0
- package/dist/commands/migrate/extract-hooks.js.map +1 -0
- package/dist/commands/migrate/index.d.ts +17 -0
- package/dist/commands/migrate/index.d.ts.map +1 -0
- package/dist/commands/migrate/index.js +282 -0
- package/dist/commands/migrate/index.js.map +1 -0
- package/dist/commands/migrate/prompts.d.ts +22 -0
- package/dist/commands/migrate/prompts.d.ts.map +1 -0
- package/dist/commands/migrate/prompts.js +67 -0
- package/dist/commands/migrate/prompts.js.map +1 -0
- package/dist/commands/migrate/types.d.ts +22 -0
- package/dist/commands/migrate/types.d.ts.map +1 -0
- package/dist/commands/migrate/types.js +26 -0
- package/dist/commands/migrate/types.js.map +1 -0
- package/dist/commands/openapi-check.d.ts +11 -0
- package/dist/commands/openapi-check.d.ts.map +1 -0
- package/dist/commands/openapi-check.js +88 -0
- package/dist/commands/openapi-check.js.map +1 -0
- package/dist/commands/rename.d.ts +10 -0
- package/dist/commands/rename.d.ts.map +1 -0
- package/dist/commands/rename.js +125 -0
- package/dist/commands/rename.js.map +1 -0
- package/dist/commands/update.d.ts +10 -0
- package/dist/commands/update.d.ts.map +1 -0
- package/dist/commands/update.js +57 -0
- package/dist/commands/update.js.map +1 -0
- package/dist/commands/validate.d.ts +12 -0
- package/dist/commands/validate.d.ts.map +1 -0
- package/dist/commands/validate.js +163 -0
- package/dist/commands/validate.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +334 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/config.d.ts +7 -0
- package/dist/lib/config.d.ts.map +1 -0
- package/dist/lib/config.js +18 -0
- package/dist/lib/config.js.map +1 -0
- package/dist/lib/deprecated-components.d.ts +72 -0
- package/dist/lib/deprecated-components.d.ts.map +1 -0
- package/dist/lib/deprecated-components.js +138 -0
- package/dist/lib/deprecated-components.js.map +1 -0
- package/dist/lib/deps.d.ts +17 -0
- package/dist/lib/deps.d.ts.map +1 -0
- package/dist/lib/deps.js +186 -0
- package/dist/lib/deps.js.map +1 -0
- package/dist/lib/docs-config.d.ts +67 -0
- package/dist/lib/docs-config.d.ts.map +1 -0
- package/dist/lib/docs-config.js +294 -0
- package/dist/lib/docs-config.js.map +1 -0
- package/dist/lib/errors.d.ts +23 -0
- package/dist/lib/errors.d.ts.map +1 -0
- package/dist/lib/errors.js +32 -0
- package/dist/lib/errors.js.map +1 -0
- package/dist/lib/frontmatter-utils.d.ts +25 -0
- package/dist/lib/frontmatter-utils.d.ts.map +1 -0
- package/dist/lib/frontmatter-utils.js +64 -0
- package/dist/lib/frontmatter-utils.js.map +1 -0
- package/dist/lib/mdx-validator.d.ts +27 -0
- package/dist/lib/mdx-validator.d.ts.map +1 -0
- package/dist/lib/mdx-validator.js +148 -0
- package/dist/lib/mdx-validator.js.map +1 -0
- package/dist/lib/navigation-validator.d.ts +31 -0
- package/dist/lib/navigation-validator.d.ts.map +1 -0
- package/dist/lib/navigation-validator.js +75 -0
- package/dist/lib/navigation-validator.js.map +1 -0
- package/dist/lib/normalize-config.d.ts +57 -0
- package/dist/lib/normalize-config.d.ts.map +1 -0
- package/dist/lib/normalize-config.js +63 -0
- package/dist/lib/normalize-config.js.map +1 -0
- package/dist/lib/openapi/cache.d.ts +40 -0
- package/dist/lib/openapi/cache.d.ts.map +1 -0
- package/dist/lib/openapi/cache.js +76 -0
- package/dist/lib/openapi/cache.js.map +1 -0
- package/dist/lib/openapi/errors.d.ts +36 -0
- package/dist/lib/openapi/errors.d.ts.map +1 -0
- package/dist/lib/openapi/errors.js +162 -0
- package/dist/lib/openapi/errors.js.map +1 -0
- package/dist/lib/openapi/index.d.ts +10 -0
- package/dist/lib/openapi/index.d.ts.map +1 -0
- package/dist/lib/openapi/index.js +12 -0
- package/dist/lib/openapi/index.js.map +1 -0
- package/dist/lib/openapi/types.d.ts +198 -0
- package/dist/lib/openapi/types.d.ts.map +1 -0
- package/dist/lib/openapi/types.js +8 -0
- package/dist/lib/openapi/types.js.map +1 -0
- package/dist/lib/openapi/validator.d.ts +45 -0
- package/dist/lib/openapi/validator.d.ts.map +1 -0
- package/dist/lib/openapi/validator.js +128 -0
- package/dist/lib/openapi/validator.js.map +1 -0
- package/dist/lib/openapi.d.ts +7 -0
- package/dist/lib/openapi.d.ts.map +1 -0
- package/dist/lib/openapi.js +7 -0
- package/dist/lib/openapi.js.map +1 -0
- package/dist/lib/output.d.ts +14 -0
- package/dist/lib/output.d.ts.map +1 -0
- package/dist/lib/output.js +19 -0
- package/dist/lib/output.js.map +1 -0
- package/dist/lib/path-security.d.ts +23 -0
- package/dist/lib/path-security.d.ts.map +1 -0
- package/dist/lib/path-security.js +35 -0
- package/dist/lib/path-security.js.map +1 -0
- package/dist/lib/port.d.ts +18 -0
- package/dist/lib/port.d.ts.map +1 -0
- package/dist/lib/port.js +65 -0
- package/dist/lib/port.js.map +1 -0
- package/dist/lib/spinner.d.ts +4 -0
- package/dist/lib/spinner.d.ts.map +1 -0
- package/dist/lib/spinner.js +16 -0
- package/dist/lib/spinner.js.map +1 -0
- package/dist/lib/version.d.ts +2 -0
- package/dist/lib/version.d.ts.map +1 -0
- package/dist/lib/version.js +49 -0
- package/dist/lib/version.js.map +1 -0
- package/dist/utils/update-checker.d.ts +34 -0
- package/dist/utils/update-checker.d.ts.map +1 -0
- package/dist/utils/update-checker.js +142 -0
- package/dist/utils/update-checker.js.map +1 -0
- package/package.json +125 -0
- package/templates/docs.json +11 -0
- package/templates/introduction.mdx +19 -0
- package/templates/quickstart.mdx +20 -0
- package/vendored/app/[[...slug]]/error.tsx +103 -0
- package/vendored/app/[[...slug]]/page.tsx +690 -0
- package/vendored/app/api/assets/[...path]/route.ts +78 -0
- package/vendored/app/api/ev/route.ts +61 -0
- package/vendored/app/api/isr-health/route.ts +66 -0
- package/vendored/app/api/mcp/[project]/route.ts +435 -0
- package/vendored/app/api/og/route.tsx +167 -0
- package/vendored/app/api/r2/[project]/[...path]/route.ts +214 -0
- package/vendored/app/api/revalidate/route.ts +76 -0
- package/vendored/app/globals.css +37 -0
- package/vendored/app/layout.tsx +571 -0
- package/vendored/app/not-found.tsx +47 -0
- package/vendored/components/CodeBlockCopyButton.tsx +146 -0
- package/vendored/components/HeaderLinkCopy.tsx +135 -0
- package/vendored/components/errors/NotFoundContent.tsx +147 -0
- package/vendored/components/layout/LayoutWrapper.tsx +128 -0
- package/vendored/components/mdx/Accordion.tsx +91 -0
- package/vendored/components/mdx/ApiCodePanel.tsx +51 -0
- package/vendored/components/mdx/ApiEndpoint.tsx +104 -0
- package/vendored/components/mdx/ApiPage.tsx +379 -0
- package/vendored/components/mdx/Badge.tsx +169 -0
- package/vendored/components/mdx/Callouts.tsx +140 -0
- package/vendored/components/mdx/Card.tsx +214 -0
- package/vendored/components/mdx/CodeGroup.tsx +136 -0
- package/vendored/components/mdx/Color.tsx +244 -0
- package/vendored/components/mdx/Columns.tsx +37 -0
- package/vendored/components/mdx/Expandable.tsx +37 -0
- package/vendored/components/mdx/Frame.tsx +51 -0
- package/vendored/components/mdx/Icon.tsx +132 -0
- package/vendored/components/mdx/Latex.tsx +75 -0
- package/vendored/components/mdx/MDXComponents.tsx +414 -0
- package/vendored/components/mdx/Mermaid.tsx +35 -0
- package/vendored/components/mdx/MermaidInner.tsx +342 -0
- package/vendored/components/mdx/OpenApiEndpoint.tsx +971 -0
- package/vendored/components/mdx/Panel.tsx +26 -0
- package/vendored/components/mdx/PanelWrapper.tsx +100 -0
- package/vendored/components/mdx/ParamField.tsx +75 -0
- package/vendored/components/mdx/RequestExample.tsx +91 -0
- package/vendored/components/mdx/ResponseExample.tsx +145 -0
- package/vendored/components/mdx/ResponseField.tsx +109 -0
- package/vendored/components/mdx/Steps.tsx +173 -0
- package/vendored/components/mdx/Table.tsx +352 -0
- package/vendored/components/mdx/Tabs.tsx +147 -0
- package/vendored/components/mdx/Tile.tsx +127 -0
- package/vendored/components/mdx/Tooltip.tsx +111 -0
- package/vendored/components/mdx/Tree.tsx +484 -0
- package/vendored/components/mdx/Update.tsx +90 -0
- package/vendored/components/mdx/View.tsx +354 -0
- package/vendored/components/mdx/YouTube.tsx +35 -0
- package/vendored/components/mdx/ZoomableImage.tsx +83 -0
- package/vendored/components/navigation/Breadcrumb.tsx +241 -0
- package/vendored/components/navigation/DefaultLogo.tsx +81 -0
- package/vendored/components/navigation/Header.tsx +512 -0
- package/vendored/components/navigation/LanguageSelector.tsx +249 -0
- package/vendored/components/navigation/PageNavigation.tsx +174 -0
- package/vendored/components/navigation/Sidebar.tsx +713 -0
- package/vendored/components/navigation/SocialFooter.tsx +186 -0
- package/vendored/components/navigation/TableOfContents.tsx +435 -0
- package/vendored/components/navigation/TabsNav.tsx +182 -0
- package/vendored/components/search/LazySearchModal.tsx +19 -0
- package/vendored/components/search/SearchModal.tsx +573 -0
- package/vendored/components/snippets/ProjectSnippets.tsx +4 -0
- package/vendored/components/theme/ThemeProvider.tsx +31 -0
- package/vendored/components/theme/ThemeToggle.tsx +134 -0
- package/vendored/components/ui/CodePanel.tsx +517 -0
- package/vendored/components/ui/CodePanelModal.tsx +342 -0
- package/vendored/contexts/TabSyncContext.tsx +30 -0
- package/vendored/hooks/useFocusTrap.ts +42 -0
- package/vendored/hooks/useHashNavigation.ts +39 -0
- package/vendored/hooks/useShikiHighlight.ts +101 -0
- package/vendored/lib/analytics-client.ts +77 -0
- package/vendored/lib/build/cache.ts +138 -0
- package/vendored/lib/build/error-parser.ts +690 -0
- package/vendored/lib/build/estimation.ts +113 -0
- package/vendored/lib/build/index.ts +17 -0
- package/vendored/lib/build/page-file-map.ts +48 -0
- package/vendored/lib/build/r2-upload.ts +179 -0
- package/vendored/lib/cache-keys.ts +117 -0
- package/vendored/lib/code-utils.ts +42 -0
- package/vendored/lib/content-loader.ts +176 -0
- package/vendored/lib/deprecated-components.ts +185 -0
- package/vendored/lib/docs-isr.ts +180 -0
- package/vendored/lib/docs-types.ts +874 -0
- package/vendored/lib/docs.ts +203 -0
- package/vendored/lib/domain-helpers.ts +107 -0
- package/vendored/lib/email-notifier.ts +102 -0
- package/vendored/lib/email-templates/build-failure.tsx +193 -0
- package/vendored/lib/email-templates/components/base-layout.tsx +150 -0
- package/vendored/lib/email-templates/components/error-box.tsx +88 -0
- package/vendored/lib/email-templates/components/info-row.tsx +63 -0
- package/vendored/lib/email-templates/index.ts +13 -0
- package/vendored/lib/empty-polyfill.js +3 -0
- package/vendored/lib/extract-highlights.ts +124 -0
- package/vendored/lib/fonts.ts +227 -0
- package/vendored/lib/frontmatter-utils.ts +77 -0
- package/vendored/lib/fs-utils.ts +20 -0
- package/vendored/lib/git-utils.ts +87 -0
- package/vendored/lib/health-checks.ts +224 -0
- package/vendored/lib/icon-utils.ts +492 -0
- package/vendored/lib/infer-page-type.ts +14 -0
- package/vendored/lib/isr-build-executor.ts +185 -0
- package/vendored/lib/language-icons.ts +152 -0
- package/vendored/lib/language-utils.ts +338 -0
- package/vendored/lib/latex-config.ts +64 -0
- package/vendored/lib/link-prefix-context.tsx +32 -0
- package/vendored/lib/logger.ts +63 -0
- package/vendored/lib/mcp-search.ts +255 -0
- package/vendored/lib/mdx-inline-components.ts +155 -0
- package/vendored/lib/mdx.ts +100 -0
- package/vendored/lib/middleware-helpers.ts +519 -0
- package/vendored/lib/navigation-resolver.ts +621 -0
- package/vendored/lib/navigation-utils.ts +103 -0
- package/vendored/lib/normalize-config.ts +94 -0
- package/vendored/lib/openapi/cache.ts +92 -0
- package/vendored/lib/openapi/code-examples.ts +389 -0
- package/vendored/lib/openapi/errors.ts +253 -0
- package/vendored/lib/openapi/generator.ts +230 -0
- package/vendored/lib/openapi/index.ts +84 -0
- package/vendored/lib/openapi/parser.ts +474 -0
- package/vendored/lib/openapi/types.ts +232 -0
- package/vendored/lib/openapi/validator.ts +156 -0
- package/vendored/lib/openapi-isr.ts +121 -0
- package/vendored/lib/page-isr-helpers.ts +137 -0
- package/vendored/lib/path-safety.ts +130 -0
- package/vendored/lib/paths.ts +35 -0
- package/vendored/lib/preprocess-mdx.ts +951 -0
- package/vendored/lib/process-mdx-with-exports.ts +75 -0
- package/vendored/lib/project-resolver.ts +165 -0
- package/vendored/lib/r2-content.ts +60 -0
- package/vendored/lib/r2-manifest.ts +84 -0
- package/vendored/lib/recent-searches.ts +41 -0
- package/vendored/lib/recma-compound-components.ts +84 -0
- package/vendored/lib/redirect-compiler.ts +160 -0
- package/vendored/lib/redirect-matcher.ts +296 -0
- package/vendored/lib/redis.ts +23 -0
- package/vendored/lib/rehype-class-to-classname.ts +31 -0
- package/vendored/lib/rehype-code-meta.ts +275 -0
- package/vendored/lib/rehype-nozoom-to-data.ts +45 -0
- package/vendored/lib/remark-extract-exports.ts +104 -0
- package/vendored/lib/resilience.ts +260 -0
- package/vendored/lib/revalidation-helpers.ts +200 -0
- package/vendored/lib/revalidation-trigger.ts +150 -0
- package/vendored/lib/screenshot-capture.ts +229 -0
- package/vendored/lib/search-client.ts +91 -0
- package/vendored/lib/search-suggestions.ts +38 -0
- package/vendored/lib/search.ts +158 -0
- package/vendored/lib/seo.ts +264 -0
- package/vendored/lib/shiki-client.ts +131 -0
- package/vendored/lib/shiki-config.ts +289 -0
- package/vendored/lib/shiki-css-theme.ts +46 -0
- package/vendored/lib/shiki-highlighter.ts +62 -0
- package/vendored/lib/shiki-transformers.ts +337 -0
- package/vendored/lib/slack-notifier.ts +248 -0
- package/vendored/lib/snippet-compiler-isr.ts +114 -0
- package/vendored/lib/snippet-loader-isr.ts +276 -0
- package/vendored/lib/static-artifacts.ts +375 -0
- package/vendored/lib/static-file-route.ts +72 -0
- package/vendored/lib/tracking-script.ts +19 -0
- package/vendored/lib/typography-config.ts +42 -0
- package/vendored/lib/validate-config.ts +268 -0
- package/vendored/next.config.js +45 -0
- package/vendored/postcss.config.js +6 -0
- package/vendored/schema/README.md +28 -0
- package/vendored/schema/docs-schema.json +4631 -0
- package/vendored/scripts/build-project.cjs +174 -0
- package/vendored/scripts/build-search-index.cjs +347 -0
- package/vendored/scripts/compile-snippets.cjs +488 -0
- package/vendored/scripts/copy-files.cjs +295 -0
- package/vendored/scripts/dev-project.cjs +534 -0
- package/vendored/scripts/enhance-navigation.cjs +354 -0
- package/vendored/scripts/validate-links.cjs +423 -0
- package/vendored/shared/constants.ts +6 -0
- package/vendored/shared/index.ts +19 -0
- package/vendored/shared/logger.ts +62 -0
- package/vendored/shared/memory-monitor.ts +190 -0
- package/vendored/shared/navigation-validator.ts +101 -0
- package/vendored/shared/path-security.ts +39 -0
- package/vendored/shared/status-reporter.ts +199 -0
- package/vendored/shared/timer.ts +51 -0
- package/vendored/shared/types.ts +102 -0
- package/vendored/tailwind.config.ts +39 -0
- package/vendored/themes/base.css +1311 -0
- package/vendored/themes/index.ts +119 -0
- package/vendored/themes/jam/variables.css +835 -0
- package/vendored/themes/nebula/variables.css +282 -0
- package/vendored/themes/pulsar/variables.css +1009 -0
- package/vendored/themes/types.ts +89 -0
- package/vendored/tsconfig.json +48 -0
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { getIconClass } from '@/lib/icon-utils';
|
|
2
|
+
|
|
3
|
+
interface CalloutProps {
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
interface CustomCalloutProps extends CalloutProps {
|
|
8
|
+
icon?: string;
|
|
9
|
+
color?: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// Base callout styles - items-baseline aligns icon with text baseline (centers for single line, top for multi-line)
|
|
13
|
+
const baseStyles = "rounded-lg border px-4 py-3 my-4 flex items-baseline gap-3 not-prose";
|
|
14
|
+
|
|
15
|
+
// Link styles for callouts - underline to distinguish from plain text
|
|
16
|
+
const linkStyles = "[&_a]:underline [&_a]:decoration-current/50 [&_a:hover]:decoration-current";
|
|
17
|
+
|
|
18
|
+
// Icon wrapper - no special sizing needed with baseline alignment
|
|
19
|
+
const iconWrapperStyles = "flex-shrink-0";
|
|
20
|
+
|
|
21
|
+
// Content styles
|
|
22
|
+
// List and paragraph styles are handled in base.css (.callout-content rules)
|
|
23
|
+
const contentStyles = "text-sm callout-content flex-1 [&>*:first-child]:!mt-0 [&>*:last-child:not(.badge)]:!mb-0 [&_.badge]:!mt-2";
|
|
24
|
+
|
|
25
|
+
// Note - informational callout (blue)
|
|
26
|
+
export function Note({ children }: CalloutProps) {
|
|
27
|
+
return (
|
|
28
|
+
<div className={`${baseStyles} border-[var(--color-note-border)] bg-[var(--color-note-bg)]`}>
|
|
29
|
+
<div className={iconWrapperStyles}>
|
|
30
|
+
<i className="fa-light fa-circle-exclamation text-[var(--color-note-text)]" aria-hidden="true" />
|
|
31
|
+
</div>
|
|
32
|
+
<div className={`${contentStyles} text-[var(--color-note-text)] ${linkStyles}`}>
|
|
33
|
+
{children}
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Info - draws attention to important information (blue)
|
|
40
|
+
export function Info({ children }: CalloutProps) {
|
|
41
|
+
return (
|
|
42
|
+
<div className={`${baseStyles} border-[var(--color-info-border)] bg-[var(--color-info-bg)]`}>
|
|
43
|
+
<div className={iconWrapperStyles}>
|
|
44
|
+
<i className="fa-solid fa-circle-info text-[var(--color-info-text)]" aria-hidden="true" />
|
|
45
|
+
</div>
|
|
46
|
+
<div className={`${contentStyles} text-[var(--color-info-text)] ${linkStyles}`}>
|
|
47
|
+
{children}
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Warning - raises a warning (amber/yellow)
|
|
54
|
+
export function Warning({ children }: CalloutProps) {
|
|
55
|
+
return (
|
|
56
|
+
<div className={`${baseStyles} border-[var(--color-warning-border)] bg-[var(--color-warning-bg)]`}>
|
|
57
|
+
<div className={iconWrapperStyles}>
|
|
58
|
+
<i className="fa-solid fa-triangle-exclamation text-[var(--color-warning-text)]" aria-hidden="true" />
|
|
59
|
+
</div>
|
|
60
|
+
<div className={`${contentStyles} text-[var(--color-warning-text)] ${linkStyles}`}>
|
|
61
|
+
{children}
|
|
62
|
+
</div>
|
|
63
|
+
</div>
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Tip - suggests a helpful tip (green)
|
|
68
|
+
export function Tip({ children }: CalloutProps) {
|
|
69
|
+
return (
|
|
70
|
+
<div className={`${baseStyles} border-[var(--color-success-border)] bg-[var(--color-success-bg)]`}>
|
|
71
|
+
<div className={iconWrapperStyles}>
|
|
72
|
+
<i className="fa-solid fa-lightbulb text-[var(--color-success-text)]" aria-hidden="true" />
|
|
73
|
+
</div>
|
|
74
|
+
<div className={`${contentStyles} text-[var(--color-success-text)] ${linkStyles}`}>
|
|
75
|
+
{children}
|
|
76
|
+
</div>
|
|
77
|
+
</div>
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// Check - indicates success or completion (green)
|
|
82
|
+
export function Check({ children }: CalloutProps) {
|
|
83
|
+
return (
|
|
84
|
+
<div className={`${baseStyles} border-[var(--color-success-border)] bg-[var(--color-success-bg)]`}>
|
|
85
|
+
<div className={iconWrapperStyles}>
|
|
86
|
+
<i className="fa-solid fa-circle-check text-[var(--color-success-text)]" aria-hidden="true" />
|
|
87
|
+
</div>
|
|
88
|
+
<div className={`${contentStyles} text-[var(--color-success-text)] ${linkStyles}`}>
|
|
89
|
+
{children}
|
|
90
|
+
</div>
|
|
91
|
+
</div>
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// Danger - indicates danger or critical warning (red)
|
|
96
|
+
export function Danger({ children }: CalloutProps) {
|
|
97
|
+
return (
|
|
98
|
+
<div className={`${baseStyles} border-[var(--color-error-border)] bg-[var(--color-error-bg)]`}>
|
|
99
|
+
<div className={iconWrapperStyles}>
|
|
100
|
+
<i className="fa-solid fa-octagon-exclamation text-[var(--color-error-text)]" aria-hidden="true" />
|
|
101
|
+
</div>
|
|
102
|
+
<div className={`${contentStyles} text-[var(--color-error-text)] ${linkStyles}`}>
|
|
103
|
+
{children}
|
|
104
|
+
</div>
|
|
105
|
+
</div>
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// Custom Callout - allows custom icon and color
|
|
110
|
+
export function Callout({ children, icon, color }: CustomCalloutProps) {
|
|
111
|
+
// Use custom color or default to accent color
|
|
112
|
+
const iconColor = color || 'var(--color-accent)';
|
|
113
|
+
const bgColor = color ? `${color}15` : 'var(--color-accent-muted)';
|
|
114
|
+
const borderColor = color ? `${color}40` : 'var(--color-accent-border)';
|
|
115
|
+
const iconClass = icon ? getIconClass(icon) : 'fa-solid fa-circle-info';
|
|
116
|
+
|
|
117
|
+
return (
|
|
118
|
+
<div
|
|
119
|
+
className={`${baseStyles}`}
|
|
120
|
+
style={{
|
|
121
|
+
borderColor: borderColor,
|
|
122
|
+
backgroundColor: bgColor,
|
|
123
|
+
}}
|
|
124
|
+
>
|
|
125
|
+
<div className={iconWrapperStyles}>
|
|
126
|
+
<i
|
|
127
|
+
className={iconClass}
|
|
128
|
+
style={{ color: iconColor }}
|
|
129
|
+
aria-hidden="true"
|
|
130
|
+
/>
|
|
131
|
+
</div>
|
|
132
|
+
<div
|
|
133
|
+
className={`${contentStyles} ${linkStyles}`}
|
|
134
|
+
style={{ color: iconColor }}
|
|
135
|
+
>
|
|
136
|
+
{children}
|
|
137
|
+
</div>
|
|
138
|
+
</div>
|
|
139
|
+
);
|
|
140
|
+
}
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { memo } from 'react';
|
|
4
|
+
import { useRouter } from 'next/navigation';
|
|
5
|
+
import { getIconClass } from '@/lib/icon-utils';
|
|
6
|
+
import { useLinkPrefix } from '@/lib/link-prefix-context';
|
|
7
|
+
|
|
8
|
+
interface CardProps {
|
|
9
|
+
title?: string;
|
|
10
|
+
icon?: string | React.ReactElement;
|
|
11
|
+
img?: string;
|
|
12
|
+
href?: string;
|
|
13
|
+
children?: React.ReactNode;
|
|
14
|
+
horizontal?: boolean;
|
|
15
|
+
ariaLabel?: string;
|
|
16
|
+
arrow?: boolean | string;
|
|
17
|
+
cta?: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const Card = memo(function Card({ title, icon, img, href, children, horizontal, ariaLabel, arrow, cta }: CardProps) {
|
|
21
|
+
const router = useRouter();
|
|
22
|
+
const linkPrefix = useLinkPrefix();
|
|
23
|
+
const isExternalLink = href?.startsWith('http://') || href?.startsWith('https://');
|
|
24
|
+
const showArrow = arrow === true || arrow === 'true' || (arrow === undefined && isExternalLink);
|
|
25
|
+
|
|
26
|
+
const cardContent = (
|
|
27
|
+
<div
|
|
28
|
+
className="group"
|
|
29
|
+
style={{
|
|
30
|
+
position: 'relative',
|
|
31
|
+
borderRadius: 'var(--radius-lg)',
|
|
32
|
+
border: 'var(--border-width, 1px) solid var(--color-border)',
|
|
33
|
+
overflow: 'hidden',
|
|
34
|
+
height: '100%',
|
|
35
|
+
display: 'flex',
|
|
36
|
+
flexDirection: horizontal ? 'row' : 'column',
|
|
37
|
+
alignItems: horizontal ? 'center' : undefined,
|
|
38
|
+
cursor: href ? 'pointer' : undefined,
|
|
39
|
+
boxShadow: 'var(--shadow-lg)',
|
|
40
|
+
transition: 'border-color 0.15s ease',
|
|
41
|
+
}}
|
|
42
|
+
onMouseEnter={(e) => href && (e.currentTarget.style.borderColor = 'var(--color-primary)')}
|
|
43
|
+
onMouseLeave={(e) => href && (e.currentTarget.style.borderColor = 'var(--color-border)')}
|
|
44
|
+
>
|
|
45
|
+
{showArrow && href && (
|
|
46
|
+
<div
|
|
47
|
+
className="arrow-icon"
|
|
48
|
+
style={{
|
|
49
|
+
position: 'absolute',
|
|
50
|
+
top: '0.75rem',
|
|
51
|
+
right: '0.75rem',
|
|
52
|
+
color: cta ? 'var(--color-border)' : 'var(--color-text-muted)',
|
|
53
|
+
transition: 'color 0.15s ease',
|
|
54
|
+
}}
|
|
55
|
+
>
|
|
56
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
|
|
57
|
+
<path d="M7 17L17 7" />
|
|
58
|
+
<path d="M7 7h10v10" />
|
|
59
|
+
</svg>
|
|
60
|
+
</div>
|
|
61
|
+
)}
|
|
62
|
+
{img && (
|
|
63
|
+
<img
|
|
64
|
+
src={img}
|
|
65
|
+
alt={title || ''}
|
|
66
|
+
style={{
|
|
67
|
+
display: 'block',
|
|
68
|
+
width: horizontal ? '33.333%' : '100%',
|
|
69
|
+
height: 'auto',
|
|
70
|
+
objectFit: 'cover',
|
|
71
|
+
margin: 0,
|
|
72
|
+
flexShrink: horizontal ? 0 : undefined,
|
|
73
|
+
}}
|
|
74
|
+
/>
|
|
75
|
+
)}
|
|
76
|
+
<div
|
|
77
|
+
style={{
|
|
78
|
+
flex: 1,
|
|
79
|
+
padding: '1rem',
|
|
80
|
+
display: (horizontal && !img) || (!horizontal && !img) ? 'flex' : undefined,
|
|
81
|
+
flexDirection: (!horizontal && !img) ? 'column' : undefined,
|
|
82
|
+
alignItems: (horizontal && !img) ? 'center' : undefined,
|
|
83
|
+
gap: (horizontal && !img) ? '1rem' : (!horizontal && !img) ? '0.5rem' : undefined,
|
|
84
|
+
}}
|
|
85
|
+
>
|
|
86
|
+
{icon && !img && (
|
|
87
|
+
<div style={{ flexShrink: horizontal ? 0 : undefined, display: horizontal ? 'flex' : undefined, alignItems: horizontal ? 'center' : undefined }}>
|
|
88
|
+
{typeof icon === 'string' ? (
|
|
89
|
+
<i className={getIconClass(icon)} style={{ fontSize: '24px', color: 'var(--color-primary)', lineHeight: 1 }} aria-hidden="true" />
|
|
90
|
+
) : (
|
|
91
|
+
<span style={{ display: 'inline-flex', alignItems: 'center', width: 24, height: 24, color: 'var(--color-primary)' }}>
|
|
92
|
+
{icon}
|
|
93
|
+
</span>
|
|
94
|
+
)}
|
|
95
|
+
</div>
|
|
96
|
+
)}
|
|
97
|
+
<div style={{ flex: 1 }}>
|
|
98
|
+
{title && (
|
|
99
|
+
<div style={{ fontSize: '16px', lineHeight: 1.375, fontWeight: 600, color: 'var(--color-text-primary)', marginBottom: children ? '0.25rem' : undefined }}>
|
|
100
|
+
{title}
|
|
101
|
+
</div>
|
|
102
|
+
)}
|
|
103
|
+
{children && (
|
|
104
|
+
<div className="card-content" style={{ fontSize: '1rem', fontWeight: 300, color: 'var(--color-text-tertiary)', lineHeight: 1.375 }}>
|
|
105
|
+
{children}
|
|
106
|
+
</div>
|
|
107
|
+
)}
|
|
108
|
+
{cta && href && (
|
|
109
|
+
<div
|
|
110
|
+
className="cta-text"
|
|
111
|
+
style={{
|
|
112
|
+
marginTop: '0.75rem',
|
|
113
|
+
fontSize: '14px',
|
|
114
|
+
fontWeight: 400,
|
|
115
|
+
color: 'var(--color-text-secondary)',
|
|
116
|
+
display: 'flex',
|
|
117
|
+
alignItems: 'center',
|
|
118
|
+
gap: '0.25rem',
|
|
119
|
+
transition: 'color 0.15s ease',
|
|
120
|
+
}}
|
|
121
|
+
>
|
|
122
|
+
{cta}
|
|
123
|
+
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
|
|
124
|
+
<path d="M9 18l6-6-6-6" />
|
|
125
|
+
</svg>
|
|
126
|
+
</div>
|
|
127
|
+
)}
|
|
128
|
+
</div>
|
|
129
|
+
</div>
|
|
130
|
+
<style jsx global>{`
|
|
131
|
+
.group:hover .arrow-icon {
|
|
132
|
+
color: var(--color-primary) !important;
|
|
133
|
+
}
|
|
134
|
+
.group:hover .cta-text {
|
|
135
|
+
color: var(--color-primary) !important;
|
|
136
|
+
}
|
|
137
|
+
.card-content > p {
|
|
138
|
+
margin: 0 0 0.75rem 0;
|
|
139
|
+
font-weight: 300;
|
|
140
|
+
line-height: 1.375;
|
|
141
|
+
}
|
|
142
|
+
.card-content > p:last-child {
|
|
143
|
+
margin-bottom: 0;
|
|
144
|
+
}
|
|
145
|
+
.card-content > *:first-child {
|
|
146
|
+
margin-top: 0;
|
|
147
|
+
}
|
|
148
|
+
.card-content > *:last-child {
|
|
149
|
+
margin-bottom: 0;
|
|
150
|
+
}
|
|
151
|
+
.card-content ul,
|
|
152
|
+
.card-content ol {
|
|
153
|
+
margin: 0.5rem 0 !important;
|
|
154
|
+
padding-left: 0 !important;
|
|
155
|
+
margin-left: 0 !important;
|
|
156
|
+
list-style-position: inside !important;
|
|
157
|
+
}
|
|
158
|
+
.card-content ul {
|
|
159
|
+
list-style-type: disc !important;
|
|
160
|
+
}
|
|
161
|
+
.card-content ol {
|
|
162
|
+
list-style-type: decimal !important;
|
|
163
|
+
}
|
|
164
|
+
.card-content li {
|
|
165
|
+
margin-bottom: 0.25rem !important;
|
|
166
|
+
padding-left: 1rem !important;
|
|
167
|
+
}
|
|
168
|
+
.card-content li::before {
|
|
169
|
+
left: 0 !important;
|
|
170
|
+
}
|
|
171
|
+
.card-content li p {
|
|
172
|
+
line-height: 1.375 !important;
|
|
173
|
+
margin: 0 !important;
|
|
174
|
+
}
|
|
175
|
+
.card-content > strong {
|
|
176
|
+
font-weight: 600;
|
|
177
|
+
color: var(--color-text-secondary);
|
|
178
|
+
}
|
|
179
|
+
.card-content > a {
|
|
180
|
+
color: var(--color-accent);
|
|
181
|
+
text-decoration: none;
|
|
182
|
+
}
|
|
183
|
+
`}</style>
|
|
184
|
+
</div>
|
|
185
|
+
);
|
|
186
|
+
|
|
187
|
+
const handleClick = (e: React.MouseEvent<HTMLDivElement>) => {
|
|
188
|
+
if (!href) return;
|
|
189
|
+
const target = e.target as HTMLElement;
|
|
190
|
+
if (target.closest('a') || target.closest('button')) {
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
if (isExternalLink) {
|
|
194
|
+
window.open(href, '_blank', 'noopener,noreferrer');
|
|
195
|
+
} else {
|
|
196
|
+
// Prefix absolute internal links (starting with /) with linkPrefix
|
|
197
|
+
const targetHref = href.startsWith('/') ? `${linkPrefix}${href}` : href;
|
|
198
|
+
router.push(targetHref);
|
|
199
|
+
}
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
return (
|
|
203
|
+
<div
|
|
204
|
+
style={{ margin: '1rem 0', height: '100%' }}
|
|
205
|
+
onClick={handleClick}
|
|
206
|
+
role={href ? 'link' : undefined}
|
|
207
|
+
aria-label={href ? (ariaLabel || (title ? `Learn about ${title}` : undefined)) : undefined}
|
|
208
|
+
tabIndex={href ? 0 : undefined}
|
|
209
|
+
onKeyDown={href ? (e) => { if (e.key === 'Enter' || e.key === ' ') handleClick(e as any); } : undefined}
|
|
210
|
+
>
|
|
211
|
+
{cardContent}
|
|
212
|
+
</div>
|
|
213
|
+
);
|
|
214
|
+
});
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { ReactNode, Children, isValidElement, memo } from 'react';
|
|
4
|
+
import { CodePanel, CodePanelTab } from '../ui/CodePanel';
|
|
5
|
+
import { formatLanguage } from '@/lib/code-utils';
|
|
6
|
+
import { getLanguageIcon } from '@/lib/language-icons';
|
|
7
|
+
|
|
8
|
+
interface CodeGroupProps {
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Extract raw language identifier from a pre element
|
|
14
|
+
* Priority: data-language > className language-*
|
|
15
|
+
*/
|
|
16
|
+
function getRawLanguage(child: ReactNode): string | undefined {
|
|
17
|
+
if (!isValidElement(child)) return undefined;
|
|
18
|
+
|
|
19
|
+
const childProps = child.props as any;
|
|
20
|
+
|
|
21
|
+
// Check for data-language on the pre element (added by Shiki transformer)
|
|
22
|
+
const preLanguage = childProps['data-language'];
|
|
23
|
+
if (preLanguage) return preLanguage;
|
|
24
|
+
|
|
25
|
+
const codeElement = childProps?.children;
|
|
26
|
+
if (!isValidElement(codeElement)) return undefined;
|
|
27
|
+
|
|
28
|
+
const codeProps = codeElement.props as any;
|
|
29
|
+
|
|
30
|
+
// Fall back to language from className (pre-Shiki format)
|
|
31
|
+
const className = codeProps?.className || '';
|
|
32
|
+
const match = className.match(/language-(\w+)/);
|
|
33
|
+
if (match) return match[1];
|
|
34
|
+
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Extract custom icon from a pre element's code child
|
|
40
|
+
* Returns data-icon attribute if present
|
|
41
|
+
*/
|
|
42
|
+
function getCustomIcon(child: ReactNode): string | undefined {
|
|
43
|
+
if (!isValidElement(child)) return undefined;
|
|
44
|
+
|
|
45
|
+
const childProps = child.props as any;
|
|
46
|
+
const codeElement = childProps?.children;
|
|
47
|
+
|
|
48
|
+
if (!isValidElement(codeElement)) return undefined;
|
|
49
|
+
|
|
50
|
+
const codeProps = codeElement.props as any;
|
|
51
|
+
return codeProps['data-icon'];
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Extract title from a pre element's code child
|
|
56
|
+
* Returns data-title attribute if present (e.g., title="utils.js")
|
|
57
|
+
*/
|
|
58
|
+
function getTitle(child: ReactNode): string | undefined {
|
|
59
|
+
if (!isValidElement(child)) return undefined;
|
|
60
|
+
|
|
61
|
+
const childProps = child.props as any;
|
|
62
|
+
const codeElement = childProps?.children;
|
|
63
|
+
|
|
64
|
+
if (!isValidElement(codeElement)) return undefined;
|
|
65
|
+
|
|
66
|
+
const codeProps = codeElement.props as any;
|
|
67
|
+
return codeProps['data-title'];
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Extract tab label from a pre element
|
|
72
|
+
* Priority: data-language > data-meta > className language-*
|
|
73
|
+
*/
|
|
74
|
+
function getTabLabel(child: ReactNode): string {
|
|
75
|
+
if (!isValidElement(child)) return 'Code';
|
|
76
|
+
|
|
77
|
+
const childProps = child.props as any;
|
|
78
|
+
|
|
79
|
+
// Check for data-language on the pre element (added by Shiki transformer)
|
|
80
|
+
const preLanguage = childProps['data-language'];
|
|
81
|
+
if (preLanguage) {
|
|
82
|
+
return formatLanguage(preLanguage);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const codeElement = childProps?.children;
|
|
86
|
+
if (!isValidElement(codeElement)) return 'Code';
|
|
87
|
+
|
|
88
|
+
const codeProps = codeElement.props as any;
|
|
89
|
+
|
|
90
|
+
// Check for title in data-meta or meta props (e.g., "Success Response")
|
|
91
|
+
const metaString = codeProps['data-meta'] || codeProps.meta || '';
|
|
92
|
+
if (metaString) {
|
|
93
|
+
return metaString;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// Fall back to language name from className (pre-Shiki format)
|
|
97
|
+
const className = codeProps?.className || '';
|
|
98
|
+
const match = className.match(/language-(\w+)/);
|
|
99
|
+
|
|
100
|
+
if (match) {
|
|
101
|
+
return formatLanguage(match[1]);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
return 'Code';
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* CodeGroup wraps multiple code blocks in a tabbed interface.
|
|
109
|
+
* Uses the shared CodePanel component for consistent styling.
|
|
110
|
+
*/
|
|
111
|
+
export const CodeGroup = memo(function CodeGroup({ children }: CodeGroupProps) {
|
|
112
|
+
// Extract code blocks from children
|
|
113
|
+
const codeBlocks = Children.toArray(children).filter(
|
|
114
|
+
(child) => isValidElement(child) && child.type === 'pre'
|
|
115
|
+
);
|
|
116
|
+
|
|
117
|
+
if (codeBlocks.length === 0) {
|
|
118
|
+
return <div>{children}</div>;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// Convert code blocks to CodePanel tabs
|
|
122
|
+
// Note: Icons disabled by default - can be enabled via docs.json in future
|
|
123
|
+
const tabs: CodePanelTab[] = codeBlocks.map((block) => {
|
|
124
|
+
const language = getRawLanguage(block);
|
|
125
|
+
return {
|
|
126
|
+
label: getTabLabel(block),
|
|
127
|
+
content: block as ReactNode,
|
|
128
|
+
language,
|
|
129
|
+
};
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
// Extract title from first code block (only shown for single blocks)
|
|
133
|
+
const title = codeBlocks.length === 1 ? getTitle(codeBlocks[0]) : undefined;
|
|
134
|
+
|
|
135
|
+
return <CodePanel tabs={tabs} title={title} className="my-6" enableFullscreen />;
|
|
136
|
+
});
|