Skip to content

refactor(flame): v2.0.0-alpha.1 — eval-free MDX hydration, package merges - #347

Merged
gitfromwildan merged 4 commits into
mainfrom
2x
Aug 13, 2026
Merged

gitfromwildan merged 4 commits into
mainfrom
2x

Conversation

@gitfromwildan

@gitfromwildan gitfromwildan commented Aug 10, 2026 •

Copy link
Copy Markdown
Member

Summary

Flame v2.0.0-alpha.1 — markdown-native authoring, eval-free hydration, and build performance. 2x against main: +10,888 / −8,139 across 232 files.

The v2 direction: content is markdown + directives (readable by humans and agents alike), compiled to flat static HTML. No runtime, no RSC path, no 'unsafe-eval'.

Breaking changes

  • Eval-free MDX hydration — new Function(compiledSource) replaced by statically bundled ESM modules (mdxModules); 'unsafe-eval' dropped from build, preview, and nginx CSPs
  • @docubook/mdx-content renamed to @docubook/markdown — markdown components + directives; old name stays published and deprecated
  • @docubook/mdx-remote merged into @docubook/core — RSC path removed (content is local filesystem, not remote); renamed to mdx-compiler, MDXRemoteProps re-exported
  • @docubook/runt merged into flame — runtime adapters (bun/deno/node) now in .docu/node/runtime/
  • @docubook/ui/react renamed to @docubook/ui-react
  • Merged/deprecated packages stay resolvable — flame v1 users keep working

Package changes

@docubook/core — major

  • feat: mdx-remote merged in — mdx-compiler (serialize, format-mdx-error, sanitizer plugins) lives in core
  • feat: remarkDirectiveToMdx plugin — :: leaf / ::: item / :::: wrapper directives compile to MDX without authored JSX
  • refactor: legacy content.ts service and createMdxContentService removed; compile pipeline tightened (parse-once, TocItem-only types)

@docubook/markdown — major (renamed from @docubook/mdx-content)

  • feat: markdown-first authoring — directives only, no authored JSX; one inline exception :tooltip[label]{tip="…"} (single-colon text stays literal for URL safety)
  • feat: Mermaid fullscreen canvas UI — ESC badge, zoom bar (− / % / +, percentage click resets to 100%), one-time help panel with keyboard shortcuts; native double-tap/pinch/ctrl+wheel zoom blocked; touch drag pan; shortcuts on window so Esc works without focus
  • refactor: components migrated (Note→Callout, Files→TreeMdx), dropped Release/Button/Kbd; Tooltip reduced to (text, tip) with auto-positioning chat-bubble
  • refactor: client.ts/server.ts entry split removed → single createMdxComponents registry + per-file "use client" directives

@docubook/flame — major

  • feat: eval-free MDX hydration (static ESM modules); CSP without 'unsafe-eval'; docs-root island hydrates (empty-slug lookup fixed)
  • feat: build perf — mdx-manifest keys sorted so the bundle hash is stable: no-change builds skip all pages, single-file edits rebuild one; dev server memoizes MDX compile by (path, mtime)
  • feat: @docubook/runt runtime adapters (bun/deno/node) merged in; docker builder image renamed docubook/flame
  • fix: TOC anchor precision — observer, URL hash, and click jumps now agree (single source of truth: CSS scroll-margin; manual scrollTo for iOS Safari; container-offset formula on desktop; sub-pixel rounding; mobile-bar collapse + scrollend); anchor offset reduced 216px → 64px mobile, 80px → 16px desktop

@docubook/themes-colors — major

  • feat: contrast utilities — relativeLuminance, contrastRatio, getContrastingForeground
  • fix: hex-to-hsl accuracy reworked; theme tokens updated (default, coffee, freshlime)

@docubook/ui-react — major

  • refactor: package directory renamed @docubook/ui/react → @docubook/ui-react; dropdown + shared type tweaks

Migration notes

Package v1 → v2
@docubook/mdx-content import @docubook/markdown instead (deprecated alias kept)
@docubook/mdx-remote use @docubook/core mdx-compiler (no RSC path)
@docubook/runt adapters live in flame .docu/node/runtime/
@docubook/ui/react import @docubook/ui-react
Authored JSX in docs rewrite to directives (::, :::, ::::, :tooltip[...])

Testing

  • vitest: 441 flame + 99 markdown tests passing (both packages, clean typecheck)
  • Playwright-verified (Chrome, mobile 390px + desktop 1280px): Mermaid fullscreen controls, TOC click anchors land below the mobile bar (64px) / at the container offset (16px desktop) with matching URL hash and active highlight

@pullfrog

pullfrog Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Pullfrog  | Review this ➔

@vercel

vercel Bot commented Aug 10, 2026 •

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docu Ignored Ignored Preview Aug 13, 2026 12:41am

Authoring contract — directives only, no authored JSX: `::` leaf
(youtube), `:::` item, `::::` wrapper, and the one inline exception
`:tooltip[label]{tip="…"}` (other single-colon text stays literal for
URL safety). Content compiles with format "md"; migrated legacy
components (Note→Callout, Files→TreeMdx) and dropped Release/Button/Kbd
plus the dead Release TOC parsing in core.

Tooltip: reduced to two props (text, tip); bubble auto-positions with
position:fixed (flips to the side with more room, clamps to the
viewport, edge-aligns with the trigger) and renders a chat-bubble with a
quadratic Bézier notched tail (computed geometry, sharp wide-to-point
taper).

Build perf — the build cache never hit because the prePass filled
mdxSources via Promise.all, so manifest key order (and the bundle hash)
changed every run; sorting the mdx-manifest keys makes the hash stable,
so no-change builds skip all pages and single-file edits rebuild one.
Dev server memoizes MDX compile by (path, mtime). Production hydration
is eval-free (static ESM modules; CSP without 'unsafe-eval'), and the
docs-root island now hydrates (empty-slug lookup fixed) — mermaid and
client components work on /docs.

Packages: docker builder image renamed to docubook/flame; CardMdx
follows the home Features card; flame README takes hero copy from
docu.json and syncs to the template.

Docs: formatting contract (triple vs quad fences, task lists, inline
tooltips), introduction positioning (build-time bridge, not a runtime;
markdown for humans and agents), v1-vs-v2 benchmark section with
measured times and sizes, home hero copy ("Compile markdown. Deploy
anything."), and a new OG image.
…sion

Mermaid fullscreen (markdown):
- Modern canvas UI: ESC badge top-right, zoom bar (− / % / +) bottom-center,
  percentage button resets to 100%; one-time help panel under the ESC badge
  with keyboard shortcuts, collapsible into a '?' icon
- Block native browser gestures (double-tap/pinch/ctrl+wheel zoom) via
  non-passive wheel+touchstart listeners; touch-action none
- Touch drag pan; keyboard shortcuts moved to a window listener so Esc and
  pan/zoom keys work regardless of focus

TOC anchors (flame):
- Observer offset now reads the CSS scroll-margin-top so the active
  highlight, URL hash, and click jumps agree on mobile and desktop
- Manual scrollTo replaces scrollIntoView (iOS Safari ignores
  scroll-margin on window scroll); desktop formula accounts for the
  container's offset below the viewport top
- Gate the desktop TOC observer to >=1024px (hidden island was hijacking
  the mobile hash); MobileBar TOC: direct activeId on click, scrollend
  listener, sub-pixel rounding
- Reduce mobile anchor offset scroll-mt-54 -> scroll-mt-16 (was 216px
  over-clearance; bar is 53px)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant