Skip to content

v0.3.0-alpha

Pre-release
Pre-release

Choose a tag to compare

@monzeromer-lab monzeromer-lab released this 25 Mar 08:09
· 299 commits to master since this release

What's New

PDF Generation

A complete PDF output backend, built from scratch with zero external dependencies — raw PDF 1.7 object/stream generation.

  • Direct PDF compilation — .wf files compile to PDF with "output_type": "pdf" in config. No headless browser, no wkhtmltopdf — pure Rust PDF writer.
  • Page size & margins — A4, A3, A5, Letter, Legal. Configurable margins in points.
  • Base14 fonts — Helvetica, Helvetica-Bold, Times-Roman, Times-Bold, Courier, Courier-Bold with proper AFM character width tables for accurate text layout.
  • Word wrapping — All text elements wrap correctly within available width. Long single words are truncated with ellipsis.
  • Table layout — Dynamic row heights based on wrapped cell content. Cell text wraps within columns. Mid-table page breaks.
  • Auto page breaks — Content automatically flows to new pages. Code blocks split across pages when needed.
  • Header & Footer — Repeats on every page. Supports Row(justify: between) for left/right layout.
  • Page numbering — {page} and {pages} variables in header/footer text: Text("Page {page} of {pages}").
  • PDF components — Document, Section, Paragraph, Header, Footer, PageBreak for document-specific structure.
  • Full component support — Text, Heading, Table, List, Code (block/inline), Blockquote, Card, Badge, Alert, Progress, Divider, Image (placeholder), Spacer.
  • Rounded shapes — Badges render as pills, progress bars as capsules, cards with rounded borders — all via cubic Bézier curves.
  • Color system — Modifier colors (primary, success, danger, warning, info) work consistently across all components.
  • PDF validation — Compile-time rejection of interactive elements (Button, Input, Modal, Router, etc.) with clear error messages.
  • PDF init template — wf init myreport -t pdf scaffolds a report project with tables, lists, headers, and footers.

Template Engine (Server-Side Rendering)

Use WebFluent as a template engine from Rust and Node.js to render .wf templates with JSON data.

  • CLI rendering — wf render template.wf --data data.json --format html|fragment|pdf for command-line usage. Reads stdin if no --data flag.
  • Rust API — Template::from_file("invoice.wf")?.render_html(&json) / .render_pdf(&json). Theme and token overrides via builder pattern.
  • Node.js API — Template.fromFile('invoice.wf').renderHtml(data) with NAPI bindings. Works in Express, Next.js, or any Node.js app.
  • Data context — Top-level JSON keys become template variables. Supports for loops over arrays, if/else conditionals, nested property access (customer.name), and string interpolation.
  • HTML fragment mode — Render without <html> wrapper for embedding in existing pages.
  • Theme support — .with_theme("dark").with_tokens(&[("color-primary", "#8B5CF6")]) per render.

Packaging & Distribution

  • Debian package — just deb builds a .deb with proper /usr/bin/wf installation, man page, and metadata.
  • Windows cross-compilation — just build-windows produces wf.exe via x86_64-pc-windows-gnu.
  • Justfile — All build, test, package, and release tasks in one file: just release, just deb, just build-windows, just site, just clean.

CLI Improvements

  • wf render — New subcommand for template rendering to HTML/PDF.
  • PDF template — wf init <name> -t pdf creates a PDF report project.
  • Build output — Shows actual PDF page count, file size, and accessibility warnings.

Documentation Site

  • 13 pages — Added PDF and Template Engine documentation pages.
  • Template Engine page — CLI usage, Rust API, Node.js API, Express.js example, supported/unsupported features grid, use cases.
  • PDF page — Document structure, page setup, components, header/footer, and code examples.
  • Agent role file — AGENTS.md provides a complete language reference for AI agents to build WebFluent projects.

Bug Fixes

  • List component in PDF — Fixed TokenType::TypeList displaying as "TypeList" instead of "List", causing list rendering to silently fall through.
  • Divider placement — Fixed line drawing at text baselines. Now draws at the vertical midpoint of a 20pt gap.
  • Footer overflow — Footer content no longer clips below the page. Positioned with sufficient space for multi-element footers (Divider + Row).
  • Blockquote bar alignment — Bar is now drawn AFTER text rendering using exact measured positions, not predicted height.
  • Card z-order — Removed background fill that was drawn after content (covering text). Cards now use stroke-only borders.
  • Table text overflow — Cells now word-wrap and truncate. Row heights are dynamic based on content.
  • Code block page splitting — Large code blocks split across pages instead of overflowing.
  • Empty page suppression — Pages with no visible content are not emitted.
  • Header positioning — Moved from cramped margin area to 30pt from page top.