The Open Standard for Generative UI
Blog (#329)
Rabi Shanker Guha5571b578be90
diff --git a/docs/app/(home)/components/Navbar/Navbar.tsx b/docs/app/(home)/components/Navbar/Navbar.tsxindex 938b91f8c..5da6d286a 100644--- a/docs/app/(home)/components/Navbar/Navbar.tsx+++ b/docs/app/(home)/components/Navbar/Navbar.tsx@@ -17,12 +17,13 @@ import styles from "./Navbar.module.css";// Constants// ----------------------------------------------------------------------------const NAV_TABS = ["OpenUI Lang", "Playground", "API Reference"] as const;+const NAV_TABS = ["OpenUI Lang", "Playground", "API Reference", "Blog"] as const;const TAB_URLS: Record<string, string> = {"OpenUI Lang": "/docs/openui-lang",Playground: "/playground","API Reference": "/docs/api-reference",Components: "/docs/components",+ Blog: "/blog",};const NAVBAR_BORDER_COLOR = "rgba(0,0,0,0.1)";const MOBILE_GITHUB_BUTTON_STYLE = {diff --git a/docs/app/blog/[slug]/page.tsx b/docs/app/blog/[slug]/page.tsxnew file mode 100644index 000000000..e0122576f--- /dev/null+++ b/docs/app/blog/[slug]/page.tsx@@ -0,0 +1,68 @@+import { blog } from "@/lib/source";+import { getMDXComponents } from "@/mdx-components";+import { TOCProvider, TOCScrollArea } from "fumadocs-ui/components/toc/index";+import { TOCItems } from "fumadocs-ui/components/toc/default";+import type { Metadata } from "next";+import { notFound } from "next/navigation";++export default async function BlogPostPage(props: {+ params: Promise<{ slug: string }>;+}) {+ const params = await props.params;+ const page = blog.getPage([params.slug]);++ if (!page) notFound();+ const Mdx = page.data.body;++ return (+ <TOCProvider toc={page.data.toc}>+ <main className="mx-auto flex w-full max-w-[1200px] gap-10 px-4 py-12 md:px-8">+ <aside className="hidden w-56 shrink-0 lg:block">+ <div className="sticky top-24">+ <p className="mb-3 text-sm font-medium text-fd-foreground">+ On this page+ </p>+ <TOCScrollArea className="max-h-[calc(100vh-8rem)]">+ <TOCItems />+ </TOCScrollArea>+ </div>+ </aside>++ <div className="min-w-0 flex-1">+ <h1 className="mb-2 text-3xl font-bold">{page.data.title}</h1>+ <p className="mb-4 text-fd-muted-foreground">+ {page.data.description}+ </p>+ <div className="flex items-center gap-3 border-b pb-6 text-sm text-fd-muted-foreground">+ <span>{page.data.author}</span>+ <span>·</span>+ <time>{new Date(page.data.date).toDateString()}</time>+ </div>+ <article className="prose mt-8 min-w-0">+ <Mdx components={getMDXComponents()} />+ </article>+ </div>+ </main>+ </TOCProvider>+ );+}++export async function generateMetadata(props: {+ params: Promise<{ slug: string }>;+}): Promise<Metadata> {+ const params = await props.params;+ const page = blog.getPage([params.slug]);++ if (!page) notFound();++ return {+ title: page.data.title,+ description: page.data.description,+ };+}++export function generateStaticParams(): { slug: string }[] {+ return blog.getPages().map((page) => ({+ slug: page.slugs[0],+ }));+}diff --git a/docs/app/blog/components/BlogNavbar.tsx b/docs/app/blog/components/BlogNavbar.tsxnew file mode 100644index 000000000..f4823b52e--- /dev/null+++ b/docs/app/blog/components/BlogNavbar.tsx@@ -0,0 +1,208 @@+"use client";++import {+ GitHubIcon,+ OpenUILogo,+ StarCountBadge,+ ThesysLogo,+ useGitHubStarCount,+} from "@/components/brand-logo";+import { ThemeToggle } from "@/components/theme-toggle";+import { AnimatePresence, motion } from "motion/react";+import { useTheme } from "next-themes";+import { useCallback, useEffect, useState, type CSSProperties } from "react";++const BUTTON_SHADOW = "0px 1px 3px 0px rgba(22,34,51,0.08), 0px 12px 24px 0px rgba(22,34,51,0.04)";++const NAV_TABS = ["OpenUI Lang", "Playground", "API Reference", "Blog"] as const;+const TAB_URLS: Record<string, string> = {+ "OpenUI Lang": "/docs/openui-lang",+ Playground: "/playground",+ "API Reference": "/docs/api-reference",+ Blog: "/blog",+};++function DesktopNavTabs() {+ return (+ <div className="hidden lg:flex items-center gap-2">+ {NAV_TABS.map((tab) => (+ <a+ key={tab}+ href={TAB_URLS[tab]}+ className="flex h-8 items-center px-2 rounded-md text-[var(--blog-nav-text)] no-underline transition-colors duration-200 font-['Inter_Display',sans-serif] text-[15px] leading-6 hover:bg-[var(--blog-nav-hover)]"+ >+ {tab}+ </a>+ ))}+ </div>+ );+}++function HamburgerIcon({ isOpen }: { isOpen: boolean }) {+ return (+ <svg+ className="size-5"+ fill="none"+ viewBox="0 0 24 24"+ stroke="currentColor"+ strokeWidth="2"+ strokeLinecap="round"+ strokeLinejoin="round"+ >+ {isOpen ? (+ <>+ <path d="M18 6L6 18" />+ <path d="M6 6l12 12" />+ </>+ ) : (+ <>+ <path d="M3 12h18" />+ <path d="M3 6h18" />+ <path d="M3 18h18" />+ </>+ )}+ </svg>+ );+}++function MobileMenu({ starCount, onClose }: { starCount: number; onClose: () => void }) {+ const mobileGithubStyle = {+ "--mobile-github-button-shadow": BUTTON_SHADOW,+ } as CSSProperties;++ return (+ <>+ <motion.div+ className="absolute top-full left-0 right-0 z-40 h-screen cursor-pointer bg-black/60 backdrop-blur-[12px]"+ initial={{ opacity: 0 }}+ animate={{ opacity: 1 }}+ exit={{ opacity: 0 }}+ transition={{ duration: 0.2 }}+ onClick={onClose}+ />+ <motion.div+ className="absolute top-full left-0 right-0 z-50 pointer-events-none lg:hidden"+ initial={{ opacity: 0, y: -8 }}+ animate={{ opacity: 1, y: 0 }}+ exit={{ opacity: 0, y: -8 }}+ transition={{ duration: 0.2 }}+ >+ <div className="pointer-events-auto border-t border-[var(--blog-nav-border)] rounded-b-[18px] bg-[var(--blog-nav-bg)] shadow-[0_10px_20px_rgb(0_0_0/0.1)]">+ <div className="flex max-w-[75rem] mx-auto flex-col gap-0 pt-3 px-[1.75rem] pb-5">+ {NAV_TABS.map((tab, index) => (+ <div key={tab}>+ {index > 0 && <div className="h-px mx-3 bg-[var(--blog-nav-border)]" />}+ <a+ href={TAB_URLS[tab]}+ className="flex w-full h-14 items-center gap-1 px-3 rounded-md text-[var(--blog-nav-text)] text-left no-underline transition-colors duration-200 font-['Inter',sans-serif] text-lg leading-6 hover:bg-[var(--blog-nav-hover)]"+ >+ {tab}+ </a>+ </div>+ ))}+ </div>+ </div>+ <div className="flex justify-center pt-20 pointer-events-auto">+ <a+ href="https://github.com/thesysdev/openui"+ target="_blank"+ rel="noopener noreferrer"+ className="group relative flex h-[38px] items-center gap-1.5 pl-3 pr-2 border-0 rounded-full bg-[var(--blog-nav-bg)] cursor-pointer scale-[1.17]"+ >+ <div+ aria-hidden="true"+ className="absolute inset-0 pointer-events-none border border-[var(--blog-nav-border)] rounded-full shadow-[var(--mobile-github-button-shadow,none)] transition-shadow duration-200 group-hover:shadow-none"+ style={mobileGithubStyle}+ />+ <GitHubIcon />+ <StarCountBadge count={starCount} isHighlighted={false} />+ </a>+ </div>+ </motion.div>+ </>+ );+}++export function BlogNavbar() {+ const [isLogoHovered, setIsLogoHovered] = useState(false);+ const [isMobileMenuOpen, setIsMobileMenuOpen] = useState(false);+ const [isScrolled, setIsScrolled] = useState(false);+ const starCount = useGitHubStarCount("thesysdev/openui");+ const { resolvedTheme } = useTheme();+ const [mounted, setMounted] = useState(false);++ useEffect(() => {+ setMounted(true);+ }, []);++ useEffect(() => {+ const handleScroll = () => setIsScrolled(window.scrollY > 0);+ window.addEventListener("scroll", handleScroll, { passive: true });+ handleScroll();+ return () => window.removeEventListener("scroll", handleScroll);+ }, []);++ const toggleMobileMenu = useCallback(() => {+ setIsMobileMenuOpen((prev) => !prev);+ }, []);++ const isDark = mounted && resolvedTheme === "dark";+ const logoVariant = isDark ? "dark" : "light";+ const borderColor = isDark ? "rgba(255,255,255,0.1)" : "rgba(0,0,0,0.1)";++ const navStyle = {+ "--blog-nav-bg": isDark ? "#0b0b0f" : "#fff",+ "--blog-nav-text": isDark ? "#e2e1e6" : "#000",+ "--blog-nav-border": isDark ? "rgba(255,255,255,0.08)" : "rgba(0,0,0,0.1)",+ "--blog-nav-hover": isDark ? "rgba(255,255,255,0.06)" : "rgba(0,0,0,0.05)",+ borderBottom: `1px solid ${isScrolled ? borderColor : "transparent"}`,+ } as CSSProperties;++ return (+ <nav+ className="sticky top-0 z-50 w-full py-3 px-8 bg-[var(--blog-nav-bg)] transition-[border-color] duration-200 ease-in-out"+ style={navStyle}+ >+ <div className="flex max-w-[75rem] mx-auto items-center justify-between">+ <div className="flex items-center gap-2">+ <ThesysLogo+ isHovered={isLogoHovered}+ onHoverChange={setIsLogoHovered}+ variant={logoVariant}+ />+ <div className="h-4 w-px bg-[var(--blog-nav-border)]" />+ <OpenUILogo variant={logoVariant} />+ </div>++ <DesktopNavTabs />++ <div className="hidden lg:flex items-center gap-2">+ <a+ href="https://github.com/thesysdev/openui"+ target="_blank"+ rel="noopener noreferrer"+ className="flex items-center justify-center size-9 rounded-lg text-fd-muted-foreground no-underline hover:text-fd-foreground hover:bg-fd-accent transition-colors"+ aria-label="GitHub"+ >+ <svg viewBox="0 0 24 24" width="20" height="20" fill="currentColor">+ <path d="M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0 1 12 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0 0 22 12.017C22 6.484 17.522 2 12 2z" />+ </svg>+ </a>+ <ThemeToggle />+ </div>++ <button+ className="flex size-10 items-center justify-center border-0 rounded-lg bg-transparent text-[var(--blog-nav-text)] cursor-pointer transition-colors duration-200 hover:bg-[var(--blog-nav-hover)] lg:hidden"+ onClick={toggleMobileMenu}+ aria-label="Toggle menu"+ >+ <HamburgerIcon isOpen={isMobileMenuOpen} />+ </button>+ </div>++ <AnimatePresence>+ {isMobileMenuOpen && <MobileMenu starCount={starCount} onClose={toggleMobileMenu} />}+ </AnimatePresence>+ </nav>+ );+}diff --git a/docs/app/blog/layout.tsx b/docs/app/blog/layout.tsxnew file mode 100644index 000000000..a19a904d7--- /dev/null+++ b/docs/app/blog/layout.tsx@@ -0,0 +1,10 @@+import { BlogNavbar } from "./components/BlogNavbar";++export default function BlogLayout({ children }: { children: React.ReactNode }) {+ return (+ <>+ <BlogNavbar />+ {children}+ </>+ );+}diff --git a/docs/app/blog/page.tsx b/docs/app/blog/page.tsxnew file mode 100644index 000000000..e3661d00e--- /dev/null+++ b/docs/app/blog/page.tsx@@ -0,0 +1,33 @@+import { blog } from "@/lib/source";+import Link from "next/link";++export default function BlogIndex() {+ const posts = blog.getPages().sort((a, b) => {+ return new Date(b.data.date).getTime() - new Date(a.data.date).getTime();+ });++ return (+ <main className="mx-auto w-full max-w-[800px] flex-1 px-4 py-16 md:px-8">+ <h1 className="mb-12 text-4xl font-bold">Blog</h1>+ <div className="flex flex-col divide-y divide-fd-border">+ {posts.map((post) => (+ <Link+ key={post.url}+ href={post.url}+ className="group flex flex-col gap-1 py-6 no-underline"+ >+ <div className="flex items-baseline justify-between gap-4">+ <h2 className="text-lg font-semibold transition-colors group-hover:text-fd-primary">+ {post.data.title}+ </h2>+ <time className="shrink-0 text-sm text-fd-muted-foreground">+ {new Date(post.data.date).toLocaleDateString()}+ </time>+ </div>+ <p className="text-sm text-fd-muted-foreground">{post.data.description}</p>+ </Link>+ ))}+ </div>+ </main>+ );+}diff --git a/docs/app/sitemap.ts b/docs/app/sitemap.tsindex f27018ae8..8ab517728 100644--- a/docs/app/sitemap.ts+++ b/docs/app/sitemap.ts@@ -1,6 +1,6 @@-import { BASE_URL, source } from "@/lib/source";+import { BASE_URL, blog, source } from "@/lib/source";-const STATIC_PATHS = ["/", "/playground"];+const STATIC_PATHS = ["/", "/playground", "/blog"];export default async function sitemap() {const staticRoutes = STATIC_PATHS.map((path) => ({@@ -15,5 +15,11 @@ export default async function sitemap() {changeFrequency: "weekly" as const,}));- return [...staticRoutes, ...docsRoutes];+ const blogRoutes = blog.getPages().map((page) => ({+ url: `${BASE_URL}${page.url}`,+ lastModified: new Date(),+ changeFrequency: "weekly" as const,+ }));++ return [...staticRoutes, ...docsRoutes, ...blogRoutes];}diff --git a/docs/content/blog/rust-wasm-parser.mdx b/docs/content/blog/rust-wasm-parser.mdxnew file mode 100644index 000000000..357b57370--- /dev/null+++ b/docs/content/blog/rust-wasm-parser.mdx@@ -0,0 +1,186 @@+---+title: Rewriting our Rust WASM Parser in TypeScript+description: We rewrote our Rust WASM Parser in TypeScript - and it got 3x Faster+author: Thesys Engineering Team+date: 2026-03-13+---++We built the openui-lang parser in Rust and compiled it to WASM.+The logic was sound: Rust is fast, WASM gives you near-native speed in the browser,+and our parser is a reasonably complex multi-stage pipeline.+Why wouldn't you want that in Rust?++Turns out we were optimising the wrong thing.++## The Pipeline++The openui-lang parser converts a custom DSL emitted by an LLM into a React component tree. It runs on every streaming chunk — so latency matters a lot. The pipeline has six stages:++```+autocloser → lexer → splitter → parser → resolver → mapper → ParseResult+```++- **Autocloser**: makes partial (mid-stream) text syntactically valid by appending minimal closing brackets/quotes+- **Lexer**: single-pass character scanner, emits typed tokens+- **Splitter**: cuts the token stream into `id = expression` statements+- **Parser**: recursive-descent expression parser, builds an AST+- **Resolver**: inline all variable references (hoisting support, circular ref detection)+- **Mapper**: converts internal AST into the public `OutputNode` format consumed by the React renderer++## The WASM Boundary Tax++Every call to the WASM parser pays a mandatory overhead regardless of how fast the Rust code itself runs:++```+JS world WASM world+────────────────────────────────────────────────────────+wasmParse(input)+ │+ ├─ copy string: JS heap → WASM linear memory (allocation + memcpy)+ │+ │ Rust parses ✓ fast+ │ serde_json::to_string() ← serialize result+ │+ ├─ copy JSON string: WASM → JS heap (allocation + memcpy)+ │+ JSON.parse(jsonString) ← deserialize result+ │+ return ParseResult+```++The Rust parsing itself was never the slow part. The overhead was entirely in the boundary: copy string in, serialize result to JSON string, copy JSON string out, then V8 deserializes it back into a JS object.++## Attempted Fix: Skip the JSON Round-Trip++The natural question was: what if WASM returned a JS object directly, skipping the JSON serialization step? We integrated `serde-wasm-bindgen` which does exactly this — it converts the Rust struct into a `JsValue` and returns it directly.++It was **30% slower**.++Here's why. JS cannot read a Rust struct's bytes from WASM linear memory as a native JS object — the two runtimes use completely different memory layouts. To construct a JS object from Rust data, `serde-wasm-bindgen` must recursively materialise Rust data into real JS arrays and objects, which involves many fine-grained conversions across the runtime boundary per `parse()` invocation.++Compare that to the JSON approach: `serde_json::to_string()` runs in pure Rust with zero boundary crossings, produces one string, one `memcpy` copies it to the JS heap, then V8's native C++ `JSON.parse` processes it in a single optimised pass. Fewer, larger, and more optimised operations win over many small ones.++### Benchmark: JSON string vs direct JsValue (1000 runs, µs per call)++| Fixture | JSON round-trip | serde-wasm-bindgen | Change |+|---|---|---|---|+| simple-table | 20.5 | 22.5 | -9% slower |+| contact-form | 61.4 | 79.4 | -29% slower |+| dashboard | 57.9 | 74.0 | -28% slower |++We reverted this change immediately.++## The Real Fix: Eliminate the Boundary Entirely++We ported the full parser pipeline to TypeScript. Same six-stage architecture, same `ParseResult` output shape — no WASM, no boundary, runs entirely in the V8 heap.++### Benchmark Method: One-Shot Parse++**What is measured:** A single `parse(completeString)` call on the finished output string. This isolates per-call parser cost.++**How it was run:** 30 warm-up iterations to stabilise JIT, then 1000 timed iterations using `performance.now()` (µs precision). The median is reported. Fixtures are real LLM-generated component trees serialised in each format's real streaming syntax.++**Fixtures:**+- `simple-table` — root + one Table with 3 columns and 5 rows (~180 chars)+- `contact-form` — root + form layout with 6 input fields + submit button (~400 chars)+- `dashboard` — root + sidebar nav + 3 metric cards + chart + data table (~950 chars)++### Results: One-Shot Parse (median µs, 1000 runs)++| Fixture | TypeScript | WASM | Speedup |+|---|---|---|---|+| simple-table | 9.3 | 20.5 | **2.2x** |+| contact-form | 13.4 | 61.4 | **4.6x** |+| dashboard | 19.4 | 57.9 | **3.0x** |++## The Algorithmic Problem: O(N²) Streaming++Eliminating WASM fixed the per-call cost, but the streaming architecture still had a deeper inefficiency.++The parser is called on every LLM chunk. The naïve approach accumulates chunks and re-parses the entire string from scratch each time:++```+Chunk 1: parse("root = Root([t") → 14 chars+Chunk 2: parse("root = Root([tbl])\ntbl = T") → 27 chars+Chunk 3: parse(full_accumulated_string) → ...+```++For a 1000-char output delivered in 20-char chunks: 50 parse calls processing a cumulative total of ~25,000 characters. O(N²) in the number of chunks.++### The Fix: Statement-Level Incremental Caching++Statements terminated by a depth-0 newline are **immutable** — the LLM will never come back and modify them. We added a streaming parser that caches completed statement ASTs:++```+State: { buf, completedEnd, completedSyms, firstId }++On each push(chunk):+ 1. Scan buf from completedEnd for depth-0 newlines+ 2. For each complete statement found: parse + cache AST → advance completedEnd+ 3. Pending (last, incomplete) statement: autoclose + parse fresh+ 4. Merge cached + pending → resolve + map → return ParseResult+```++Completed statements are never re-parsed. Only the trailing in-progress statement is re-parsed per chunk. O(total_length) instead of O(N²).++### Benchmark Method: Full-Stream Total Parse Cost++**What is measured:** The **total parse overhead accumulated across every chunk call for one complete document**. This is different from the one-shot benchmark — it measures the sum of all parse calls during a real stream, not a single call. This is the number that affects actual user-perceived responsiveness.++**How it was run:** Documents are replayed in 20-char chunks. Each chunk triggers a `parse()` (naïve) or `push()` (incremental) call. Total time across all calls is recorded. 100 full-stream replays, median taken.++### Results: Full-Stream Total Parse Cost (median µs across all chunks)++| Fixture | Naïve TS (re-parse every chunk) | Incremental TS (cache completed) | Speedup |+|---|---|---|---|+| simple-table | 69 | 77 | none (single statement, no cache benefit) |+| contact-form | 316 | 122 | **2.6x** |+| dashboard | 840 | 255 | **3.3x** |++The `simple-table` fixture is a single statement — there's nothing to cache, so both approaches are equivalent. The benefit scales with the number of statements because more of the document gets cached and skipped on each chunk.++### Why the two TS numbers look different++The one-shot table shows 13.4µs for `contact-form`; the streaming table shows 316µs (naïve). These are not contradictory — they measure different things:++- **13.4µs** = cost of one `parse()` call on the complete 400-char string+- **316µs** = total cost of ~20 `parse()` calls during the stream (chunk 1 parses 20 chars, chunk 2 parses 40 chars, ..., chunk 20 parses 400 chars — cumulative sum of all those growing calls)++## Summary++| Approach | Per-call cost | Full-stream total | Notes |+|---|---|---|---|+| WASM + JSON round-trip | 20-61µs | baseline | Copy overhead each call |+| WASM + serde-wasm-bindgen | 22-79µs | +9-29% slower | Hundreds of internal boundary crossings |+| TypeScript (naïve re-parse) | 9-19µs | 69-840µs | No boundary, but O(N²) streaming |+| TypeScript (incremental) | 9-19µs | 69-255µs | No boundary + O(N) streaming |++**End result: 2.2-4.6x faster per call and 2.6-3.3x lower total streaming cost.**++## When WASM Actually Helps++This experience sharpened our thinking on the right use cases for WASM:++✅ **Compute-bound with minimal interop**: image/video processing, cryptography, physics simulations, audio codecs. Large input → scalar output or in-place mutation. The boundary is crossed rarely.++✅ **Portable native libraries**: shipping C/C++ libraries (SQLite, OpenCV, libpng) to the browser without a full JS rewrite.++❌ **Parsing structured text into JS objects**: you pay the serialization cost either way. The parsing computation is fast enough that V8's JIT eliminates any Rust advantage. The boundary overhead dominates.++❌ **Frequently-called functions on small inputs**: if the function is called 50 times per stream and the computation takes 5µs, you cannot amortise the boundary cost.++## Key Takeaways++1. **Profile where time is actually spent before choosing the implementation language.**+ For us, the cost was never in the computation - it was always in data transfer across the WASM-JS boundary.++2. **"Direct object passing" through `serde-wasm-bindgen` is not cheaper.**+ Constructing a JS object field-by-field from Rust involves more boundary crossings than a single JSON string transfer, not fewer.+ The boundary crossings happen inside the single FFI call, invisibly.++3. **Algorithmic complexity improvements dominate language-level optimisations.**+ Going from O(N²) to O(N) in the streaming case had a larger practical impact than switching from WASM to TypeScript.++4. **WASM and JS do not share a heap.**+ WASM has a flat linear memory (`WebAssembly.Memory`) that JS can read as raw bytes, but those bytes are Rust's internal layout - pointers, enum discriminants, alignment padding - completely opaque to the JS runtime.+ Conversion is always required and always costs something.diff --git a/docs/generated/chat-system-prompt.txt b/docs/generated/chat-system-prompt.txtindex b655c131e..9a444471c 100644--- a/docs/generated/chat-system-prompt.txt+++ b/docs/generated/chat-system-prompt.txt@@ -61,7 +61,7 @@ TextArea(name: string, placeholder?: string, rows?: number, rules?: {required?:Select(name: string, items: SelectItem[], placeholder?: string, rules?: {required?: boolean, email?: boolean, url?: boolean, numeric?: boolean, min?: number, max?: number, minLength?: number, maxLength?: number, pattern?: string})SelectItem(value: string, label: string) — Option for SelectDatePicker(name: string, mode: "single" | "range", rules?: {required?: boolean, email?: boolean, url?: boolean, numeric?: boolean, min?: number, max?: number, minLength?: number, maxLength?: number, pattern?: string})-Slider(name: string, variant: "continuous" | "discrete", min: number, max: number, step?: number, defaultValue?: number[], rules?: {required?: boolean, email?: boolean, url?: boolean, numeric?: boolean, min?: number, max?: number, minLength?: number, maxLength?: number, pattern?: string}) — Numeric slider input; supports continuous and discrete (stepped) variants+Slider(name: string, variant: "continuous" | "discrete", min: number, max: number, step?: number, defaultValue?: number[], label?: string, rules?: {required?: boolean, email?: boolean, url?: boolean, numeric?: boolean, min?: number, max?: number, minLength?: number, maxLength?: number, pattern?: string}) — Numeric slider input; supports continuous and discrete (stepped) variantsCheckBoxGroup(name: string, items: CheckBoxItem[], rules?: {required?: boolean, email?: boolean, url?: boolean, numeric?: boolean, min?: number, max?: number, minLength?: number, maxLength?: number, pattern?: string})CheckBoxItem(label: string, description: string, name: string, defaultChecked?: boolean)RadioGroup(name: string, items: RadioItem[], defaultValue?: string, rules?: {required?: boolean, email?: boolean, url?: boolean, numeric?: boolean, min?: number, max?: number, minLength?: number, maxLength?: number, pattern?: string})diff --git a/docs/generated/playground-system-prompt.txt b/docs/generated/playground-system-prompt.txtindex 382a5ecd8..d873ba87f 100644--- a/docs/generated/playground-system-prompt.txt+++ b/docs/generated/playground-system-prompt.txt@@ -75,7 +75,7 @@ TextArea(name: string, placeholder?: string, rows?: number, rules?: {required?:Select(name: string, items: SelectItem[], placeholder?: string, rules?: {required?: boolean, email?: boolean, url?: boolean, numeric?: boolean, min?: number, max?: number, minLength?: number, maxLength?: number, pattern?: string})SelectItem(value: string, label: string) — Option for SelectDatePicker(name: string, mode: "single" | "range", rules?: {required?: boolean, email?: boolean, url?: boolean, numeric?: boolean, min?: number, max?: number, minLength?: number, maxLength?: number, pattern?: string})-Slider(name: string, variant: "continuous" | "discrete", min: number, max: number, step?: number, defaultValue?: number[], rules?: {required?: boolean, email?: boolean, url?: boolean, numeric?: boolean, min?: number, max?: number, minLength?: number, maxLength?: number, pattern?: string}) — Numeric slider input; supports continuous and discrete (stepped) variants+Slider(name: string, variant: "continuous" | "discrete", min: number, max: number, step?: number, defaultValue?: number[], label?: string, rules?: {required?: boolean, email?: boolean, url?: boolean, numeric?: boolean, min?: number, max?: number, minLength?: number, maxLength?: number, pattern?: string}) — Numeric slider input; supports continuous and discrete (stepped) variantsCheckBoxGroup(name: string, items: CheckBoxItem[], rules?: {required?: boolean, email?: boolean, url?: boolean, numeric?: boolean, min?: number, max?: number, minLength?: number, maxLength?: number, pattern?: string})CheckBoxItem(label: string, description: string, name: string, defaultChecked?: boolean)RadioGroup(name: string, items: RadioItem[], defaultValue?: string, rules?: {required?: boolean, email?: boolean, url?: boolean, numeric?: boolean, min?: number, max?: number, minLength?: number, maxLength?: number, pattern?: string})diff --git a/docs/lib/source.ts b/docs/lib/source.tsindex f96c83c2d..bef5cc7e3 100644--- a/docs/lib/source.ts+++ b/docs/lib/source.ts@@ -1,6 +1,7 @@import { type InferPageType, loader } from "fumadocs-core/source";import { lucideIconsPlugin } from "fumadocs-core/source/lucide-icons";-import { docs } from "fumadocs-mdx:collections/server";+import { toFumadocsSource } from "fumadocs-mdx/runtime/server";+import { blogPosts, docs } from "fumadocs-mdx:collections/server";export const BASE_URL = "https://www.openui.com";@@ -11,6 +12,11 @@ export const source = loader({plugins: [lucideIconsPlugin()],});+export const blog = loader({+ baseUrl: "/blog",+ source: toFumadocsSource(blogPosts, []),+});+export function getPageImage(page: InferPageType<typeof source>) {const segments = [...page.slugs, "image.webp"];diff --git a/docs/source.config.ts b/docs/source.config.tsindex c026ff074..6f5903f2b 100644--- a/docs/source.config.ts+++ b/docs/source.config.ts@@ -1,6 +1,7 @@import { metaSchema, pageSchema } from "fumadocs-core/source/schema";-import { defineConfig, defineDocs } from "fumadocs-mdx/config";+import { defineCollections, defineConfig, defineDocs } from "fumadocs-mdx/config";import lastModified from "fumadocs-mdx/plugins/last-modified";+import { z } from "zod";// You can customise Zod schemas for frontmatter and `meta.json` here// see https://fumadocs.dev/docs/mdx/collections@@ -17,6 +18,15 @@ export const docs = defineDocs({},});+export const blogPosts = defineCollections({+ type: "doc",+ dir: "content/blog",+ schema: pageSchema.extend({+ author: z.string(),+ date: z.string().date().or(z.date()),+ }),+});+export default defineConfig({plugins: [lastModified()],});