Skip to content

feat: devtools editor & advanced mdx collocations - #476

Draft
Kinfe123 wants to merge 1 commit into
mainfrom
feat/devtools-editor-draft
Draft

feat: devtools editor & advanced mdx collocations#476
Kinfe123 wants to merge 1 commit into
mainfrom
feat/devtools-editor-draft

Conversation

@Kinfe123

@Kinfe123 Kinfe123 commented Aug 14, 2026

Copy link
Copy Markdown
Member

Status

Draft. This restores the work from the original PR #200 so it can continue being developed and reviewed before merging again.

Scope

  • Devtools editor support.
  • Advanced MDX collocations.
  • Related docs, examples, exports, and tests from the original change.

History

The original PR was reverted by #474 because it was not ready to ship. This branch reproduces the original PR tree exactly, without unrelated changes.

Next steps

Continue refining and testing this work here. The runtime theme tweaks are maintained as a separate draft stacked on this branch.


Summary by cubic

Adds a local DevTools visual editor for MDX docs and the API endpoints it needs, gated behind a new devTools config. Themes no longer inject a Tabs style default to avoid leaking into React’s reserved style prop.

  • Opt-in: set devTools: true in defineDocs(); hidden when staticExport: true. The API rejects DevTools requests unless enabled and the request is local or not in production.
  • Endpoints:
    • /api/docs?devtools=page GET returns { relativePath, content } for the current route; POST writes file changes and invalidates indexes. Resolves custom docsPath back to app/docs/**/page.mdx.
    • /api/docs?devtools=theme POST rewrites app/global.css and docs.config.tsx imports/initializer to switch @farming-labs/theme/*.
    • /api/docs?devtools=nav-item POST updates frontmatter (e.g., title) of the target page.
    • /api/docs?devtools=publish POST forwards to Cloud; requires FARMING_CLOUD_API_KEY or FARMING_API_KEY.
  • Safeguards: path resolution constrained to docs dirs, content size limit, local-only, and “unavailable” responses when disabled.
  • UI: DocsPageClient mounts <DocsDevTools> and marks the content region (data-dt-content) when enabled.
  • Themes: removed ui.components.Tabs defaults across presets to avoid React style prop conflicts; pass tab style where you render Tabs if you relied on theme defaults.
  • Docs: added devTools to DocsConfig types and public docs; examples updated to demonstrate block-level MDX editing.

Written for commit 0b97114. Summary will update on new commits.

Review in cubic

@vercel

vercel Bot commented Aug 14, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs-website Ready Ready Preview Aug 14, 2026 11:59am
farming-labs-docs-docs-cloud Building Building Preview Aug 14, 2026 11:59am

Request Review

@pkg-pr-new

pkg-pr-new Bot commented Aug 14, 2026

Copy link
Copy Markdown

Open in StackBlitz

@farming-labs/astro

pnpm add https://pkg.pr.new/farming-labs/docs/@farming-labs/astro@476

@farming-labs/astro-theme

pnpm add https://pkg.pr.new/farming-labs/docs/@farming-labs/astro-theme@476

@farming-labs/docs

pnpm add https://pkg.pr.new/farming-labs/docs/@farming-labs/docs@476

@farming-labs/farmjs

pnpm add https://pkg.pr.new/farming-labs/docs/@farming-labs/farmjs@476

@farming-labs/theme

pnpm add https://pkg.pr.new/farming-labs/docs/@farming-labs/theme@476

@farming-labs/next

pnpm add https://pkg.pr.new/farming-labs/docs/@farming-labs/next@476

@farming-labs/nuxt

pnpm add https://pkg.pr.new/farming-labs/docs/@farming-labs/nuxt@476

@farming-labs/nuxt-theme

pnpm add https://pkg.pr.new/farming-labs/docs/@farming-labs/nuxt-theme@476

@farming-labs/svelte

pnpm add https://pkg.pr.new/farming-labs/docs/@farming-labs/svelte@476

@farming-labs/svelte-theme

pnpm add https://pkg.pr.new/farming-labs/docs/@farming-labs/svelte-theme@476

@farming-labs/tanstack-start

pnpm add https://pkg.pr.new/farming-labs/docs/@farming-labs/tanstack-start@476

commit: 0b97114

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant