Skip to content

Feat/tweaks#241

Draft
Benonii wants to merge 5 commits into
farming-labs:mainfrom
Benonii:feat/tweaks
Draft

Feat/tweaks#241
Benonii wants to merge 5 commits into
farming-labs:mainfrom
Benonii:feat/tweaks

Conversation

@Benonii
Copy link
Copy Markdown

@Benonii Benonii commented Jun 4, 2026

Draft PR of the tweaks dialog implementation


Summary by cubic

Add a runtime Tweaks dialog to live‑tune the docs theme. Reader mode gives visitors simple controls; author mode unlocks full tokens, layout sliders, and TS/CSS export with FOUC-safe style injection to avoid hydration issues.

  • New Features

    • DocsConfig.tweaks (off by default) in @farming-labs/docs: true | false | TweaksConfig (true shorthands to { author: true }).
    • Modes: reader (accent, density, radius, preset, font) and author (all 16 color tokens, sidebar/content/TOC widths, export to createTheme or CSS).
    • Pre‑paint script injects a <style> in <head> (no inline mutations, no hydration warnings). Auto‑included when tweaks is enabled.
    • Triggers: auto‑portal next to the theme toggle, floating FAB, both, or manual (position: "sidebar-footer" | "floating" | "both" | "manual").
    • Persistence via localStorage with storageKey, persist, and onApply analytics hook.
    • New exports in packages/fumadocs: ./tweaks with TweaksControl, TweaksAutoPortalTrigger, TweaksSidebarTrigger, TweaksFoucScript.
    • Styles: new tweaks.css; density scaling via --fd-font-scale applied in base.css.
    • Examples enable tweaks with reader mode in prod and author mode in dev (Next sets position: "both").
  • Migration

    • Enable in your docs config: tweaks: { reader: true } or tweaks: { author: process.env.NODE_ENV !== "production" }.
    • Choose trigger placement with position (default "both"). For manual placement, set "manual" and render TweaksSidebarTrigger.
    • If offering custom fonts, ensure they’re loaded and pass fontOptions (e.g., ["Inter", "Geist", "system-ui"]).
    • Persistence is on by default; disable with persist: false or change storageKey as needed.

Written for commit 81154e2. Summary will update on new commits.

Review in cubic

Benonii added 4 commits June 3, 2026 17:11
Adds a typed, opt-in `DocsConfig.tweaks` field that mounts a
runtime theme tweaker. Reader mode exposes accent, density,
radius, preset, and font; author mode adds the full 16-token
grid, sidebar/content/TOC width sliders, and exportable
createTheme / CSS snippets.

Persisted via localStorage with a pre-paint FOUC script that
injects a `<style>` block in `<head>` rather than mutating
`<html>`/`<body>` inline — so consumers don't need
`suppressHydrationWarning`.

Inspired by Claude's design tweaks dialog and the framework's
own theme-customizer in the official example site.
@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 4, 2026

@Benonii is attempting to deploy a commit to the farming-labs Team on Vercel.

A member of the Team first needs to authorize it.

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.

2 participants