The Open Standard for Generative UI
Include YAML in the benchmark (#337)
Aditya-thesys47c86e023451
diff --git a/benchmarks/README.md b/benchmarks/README.mdindex 61ee9bbb5..19f4aaf63 100644--- a/benchmarks/README.md+++ b/benchmarks/README.md@@ -1,16 +1,21 @@# OpenUI Lang Benchmark-Measures token efficiency and estimated generation latency of **OpenUI Lang** vs two JSON-based streaming formats across seven real-world UI scenarios.+Measures token efficiency and estimated generation latency of **OpenUI Lang** vs three structured streaming formats across seven real-world UI scenarios:++- **YAML**+- **Vercel JSON-Render** (RFC 6902 patch stream)+- **Thesys C1 JSON** (normalized component tree)## Formats| Format | Description || ---------------------- | -------------------------------------------------------------------------- || **OpenUI Lang** | Line-oriented DSL generated directly by the LLM |-| **Thesys C1 JSON** | Normalized component tree JSON (`component` + `props`) |+| **YAML** | YAML `root` / `elements` spec payload || **Vercel JSON-Render** | JSONL stream of [JSON Patch (RFC 6902)](https://jsonpatch.com/) operations |+| **Thesys C1 JSON** | Normalized component tree JSON (`component` + `props`) |-All three formats encode exactly the same UI. The LLM always generates OpenUI Lang — C1 JSON and Vercel JSONL are derived from the parsed AST.+All four formats encode exactly the same UI. The LLM always generates OpenUI Lang, then the parsed AST is projected into the other three formats.## Methodology@@ -18,28 +23,27 @@ All three formats encode exactly the same UI. The LLM always generates OpenUI La2. Generate OpenUI Lang once per prompt with `gpt-5.2` at `temperature: 0` using streaming completions.3. Parse the OpenUI Lang output with `createParser(schema)` so positional arguments map to named props via `schema.json`.4. Convert the same parsed AST into:- - `*.c1.json`: Thesys C1 format via `thesys-c1-converter.ts`, which recursively maps AST elements to `{ component, props }` and removes parser metadata (`type`, `typeName`, `partial`, `__typename`).- - `*.vercel.jsonl`: JSON Patch operation stream via `vercel-jsonl-converter.ts`.+ - `*.c1.json`: Thesys C1 format via `thesys-c1-converter.ts`.+ - `*.vercel.jsonl`: json-render RFC 6902 patches via `vercel-jsonl-converter.ts`.+ - `*.yaml`: json-render YAML spec payload via `yaml-converter.ts`.5. Count tokens from all saved artifacts in `samples/` using `tiktoken` with `encoding_for_model("gpt-5")`.-6. Report:- - Token counts and percentage reduction of OpenUI Lang vs each JSON format.- - Estimated decode latency at a fixed 60 tokens/second.- - Generation-time TTFT/TPS in `samples/metrics.json` captured from streaming usage data.+6. Report token counts and estimated decode latency at a fixed 60 tokens/second.## ResultsMeasured with `tiktoken` (`gpt-5` model encoder). Generated by GPT-5.2 at temperature 0.-| Scenario | Vercel JSON-Render | Thesys C1 JSON | OpenUI Lang | vs Vercel | vs C1 |-| ------------------ | -----------------: | -------------: | ----------: | ---------: | ---------: |-| simple-table | 340 | 357 | 148 | -56.5% | -58.5% |-| chart-with-data | 520 | 516 | 231 | -55.6% | -55.2% |-| contact-form | 893 | 849 | 294 | -67.1% | -65.4% |-| dashboard | 2247 | 2261 | 1226 | -45.4% | -45.8% |-| pricing-page | 2487 | 2379 | 1195 | -52.0% | -49.8% |-| settings-panel | 1244 | 1205 | 540 | -56.6% | -55.2% |-| e-commerce-product | 2449 | 2381 | 1166 | -52.4% | -51.0% |-| **TOTAL** | **10180** | **9948** | **4800** | **-52.8%** | **-51.7%** |+| Scenario | YAML | Vercel JSON-Render | Thesys C1 JSON | OpenUI Lang | vs YAML | vs Vercel | vs C1 |+| ------------------ | -------: | -----------------: | -------------: | ----------: | ---------: | ---------: | ---------: |+| simple-table | 316 | 340 | 357 | 148 | -53.2% | -56.5% | -58.5% |+| chart-with-data | 464 | 520 | 516 | 231 | -50.2% | -55.6% | -55.2% |+| contact-form | 762 | 893 | 849 | 294 | -61.4% | -67.1% | -65.4% |+| dashboard | 2128 | 2247 | 2261 | 1226 | -42.4% | -45.4% | -45.8% |+| pricing-page | 2230 | 2487 | 2379 | 1195 | -46.4% | -52.0% | -49.8% |+| settings-panel | 1077 | 1244 | 1205 | 540 | -49.9% | -56.6% | -55.2% |+| e-commerce-product | 2145 | 2449 | 2381 | 1166 | -45.6% | -52.4% | -51.0% |+| **TOTAL** | **9122** | **10180** | **9948** | **4800** | **-47.4%** | **-52.8%** | **-51.7%** |+## Running@@ -51,14 +55,14 @@ Export `OPENAI_API_KEY` in your shell:export OPENAI_API_KEY=sk-...```+### 1. Generate samples (calls OpenAI)```bash-cd js/benchmarkspnpm generate```-This calls OpenAI once per scenario, saves the raw `.oui` output, then converts it to `.c1.json` and `.vercel.jsonl`. All files land in `samples/`. A `metrics.json` with TTFT and TPS from the API response is also written.+This calls OpenAI once per scenario, saves the raw `.oui` output, then converts it to `.c1.json`, `.vercel.jsonl`, and `.yaml`. All files land in `samples/`. A `metrics.json` with TTFT and TPS from the API response is also written.### 2. Run the benchmark report (offline)@@ -66,25 +70,28 @@ This calls OpenAI once per scenario, saves the raw `.oui` output, then convertspnpm bench```-Reads the files in `samples/`, counts tokens with `tiktoken`, and prints two tables: token counts and estimated latency at 60 tok/s.+Reads the files in `samples/`, counts tokens with `tiktoken`, and prints token and latency tables.## File Layout-```+```textbenchmarks/-├── generate-samples.ts # Calls OpenAI, converts AST to all three formats-├── run-benchmark.ts # Reads samples/, prints token/latency tables-├── thesys-c1-converter.ts # AST -> normalized Thesys C1 JSON converter-├── vercel-jsonl-converter.ts # RFC 6902-compliant AST -> JSONL converter-├── schema.json # JSON Schema for the default component library-│ # (auto-generated by library.toJSONSchema())-├── system-prompt.txt # System prompt sent to the LLM-├── .env # OPENAI_API_KEY+├── generate-samples.ts # Calls OpenAI, converts AST to all four formats+├── run-benchmark.ts # Reads samples/, prints token/latency tables+├── thesys-c1-converter.ts # AST -> normalized Thesys C1 JSON converter+├── vercel-spec-converter.ts # AST -> shared json-render spec projection+├── vercel-jsonl-converter.ts # Shared spec -> RFC 6902 JSONL converter+├── yaml-converter.ts # Shared spec -> YAML document converter+├── schema.json # JSON Schema for the default component library+├── system-prompt.txt # System prompt sent to the LLM+├── package.json+├── pnpm-lock.yaml└── samples/- ├── <scenario>.oui # Raw LLM output (OpenUI Lang)- ├── <scenario>.c1.json # Normalized Thesys C1 JSON- ├── <scenario>.vercel.jsonl # Vercel JSON-Render (RFC 6902 patches)- └── metrics.json # TTFT + TPS recorded during generation+ ├── <scenario>.oui+ ├── <scenario>.c1.json+ ├── <scenario>.vercel.jsonl+ ├── <scenario>.yaml+ └── metrics.json```## Updating the Schemadiff --git a/benchmarks/generate-samples.ts b/benchmarks/generate-samples.tsindex e00b38d5a..23e0933b1 100644--- a/benchmarks/generate-samples.ts+++ b/benchmarks/generate-samples.ts@@ -1,9 +1,10 @@+import { mkdirSync, readFileSync, writeFileSync } from "fs";import { OpenAI } from "openai";-import { createParser } from "../packages/react-lang/src/parser/parser.js";-import { writeFileSync, mkdirSync, readFileSync } from "fs";import { join } from "path";-import { astToVercelJsonl } from "./vercel-jsonl-converter.js";+import { createParser } from "../packages/react-lang/src/parser/parser.js";import { astToThesysC1Json } from "./thesys-c1-converter.js";+import { astToVercelJsonl } from "./vercel-jsonl-converter.js";+import { astToYaml } from "./yaml-converter.js";const systemPrompt = readFileSync(join(process.cwd(), "system-prompt.txt"), "utf-8");@@ -19,13 +20,20 @@ const openai = new OpenAI();const MODEL = "gpt-5.2";const PROMPTS = {- "simple-table": "Create a simple table showing 5 employees with columns for Name, Department, Salary, and YoY change.",- "chart-with-data": "Create a dashboard with a metric card showing Total Revenue, and a BarChart showing 6 months of revenue data.",- "contact-form": "Create a contact form with Name, Email, Phone, Subject dropdown, and Message text area. Include Submit and Cancel buttons.",- "dashboard": "Create a product analytics dashboard. It should have a Header, a BarChart for Monthly Active Users, a PieChart for User Acquisition, a Table for Top Features, and a LineChart for MRR and ARR.",- "pricing-page": "Create a pricing page with 3 tiers: Basic, Pro, and Enterprise. Include a feature comparison table below the pricing cards.",- "settings-panel": "Create a user settings panel with tabs for Profile, Security, and Notifications. The Profile tab should have a form to update name and avatar. The Security tab should have a toggle for 2FA.",- "e-commerce-product": "Create a product detail page for a pair of sneakers. Include an ImageGallery, a title, price, size selector (Select), color options (RadioGroup), and an Add to Cart button."+ "simple-table":+ "Create a simple table showing 5 employees with columns for Name, Department, Salary, and YoY change.",+ "chart-with-data":+ "Create a dashboard with a metric card showing Total Revenue, and a BarChart showing 6 months of revenue data.",+ "contact-form":+ "Create a contact form with Name, Email, Phone, Subject dropdown, and Message text area. Include Submit and Cancel buttons.",+ dashboard:+ "Create a product analytics dashboard. It should have a Header, a BarChart for Monthly Active Users, a PieChart for User Acquisition, a Table for Top Features, and a LineChart for MRR and ARR.",+ "pricing-page":+ "Create a pricing page with 3 tiers: Basic, Pro, and Enterprise. Include a feature comparison table below the pricing cards.",+ "settings-panel":+ "Create a user settings panel with tabs for Profile, Security, and Notifications. The Profile tab should have a form to update name and avatar. The Security tab should have a toggle for 2FA.",+ "e-commerce-product":+ "Create a product detail page for a pair of sneakers. Include an ImageGallery, a title, price, size selector (Select), color options (RadioGroup), and an Add to Cart button.",};// 2. Generation Loop@@ -45,10 +53,10 @@ async function main() {temperature: 0,messages: [{ role: "system", content: systemPrompt },- { role: "user", content: userPrompt }+ { role: "user", content: userPrompt },],stream: true,- stream_options: { include_usage: true }+ stream_options: { include_usage: true },});let usage = null;@@ -75,7 +83,7 @@ async function main() {ttft_ms: ttft,total_duration_ms: totalDuration,completion_tokens: completionTokens,- tps: tps+ tps: tps,};// Save OpenUI Lang@@ -90,6 +98,9 @@ async function main() {// Save Vercel JSONLwriteFileSync(join("samples", `${name}.vercel.jsonl`), astToVercelJsonl(ast));+ // Save YAML spec payload (the content inside a yaml-spec fence)+ writeFileSync(join("samples", `${name}.yaml`), astToYaml(ast));+console.log(` Done! ${completionTokens} tokens @ ${tps.toFixed(1)} tok/s`);}diff --git a/benchmarks/package.json b/benchmarks/package.jsonindex 0f32b3448..892f30b66 100644--- a/benchmarks/package.json+++ b/benchmarks/package.json@@ -5,13 +5,15 @@"type": "module","scripts": {"generate": "tsx generate-samples.ts",- "bench": "tsx run-benchmark.ts"+ "bench": "tsx run-benchmark.ts",+ "format:fix": "prettier --write ."},"dependencies": {"@openuidev/react-lang": "workspace:*","@openuidev/react-ui": "workspace:*","openai": "^6.22.0",- "tiktoken": "^1.0.14"+ "tiktoken": "^1.0.14",+ "yaml": "^2.8.1"},"devDependencies": {"tsx": "^4.20.3"diff --git a/benchmarks/pnpm-lock.yaml b/benchmarks/pnpm-lock.yamlnew file mode 100644index 000000000..64b2f19c5--- /dev/null+++ b/benchmarks/pnpm-lock.yaml@@ -0,0 +1,452 @@+lockfileVersion: "9.0"++settings:+ autoInstallPeers: true+ excludeLinksFromLockfile: false++importers:+ .:+ dependencies:+ openai:+ specifier: ^6.22.0+ version: 6.29.0+ tiktoken:+ specifier: ^1.0.14+ version: 1.0.22+ yaml:+ specifier: ^2.8.1+ version: 2.8.2+ devDependencies:+ tsx:+ specifier: ^4.20.3+ version: 4.21.0++packages:+ "@esbuild/[email protected]":+ resolution:+ {+ integrity: sha512-cQPwL2mp2nSmHHJlCyoXgHGhbEPMrEEU5xhkcy3Hs/O7nGZqEpZ2sUtLaL9MORLtDfRvVl2/3PAuEkYZH0Ty8Q==,+ }+ engines: { node: ">=18" }+ cpu: [ppc64]+ os: [aix]++ "@esbuild/[email protected]":+ resolution:+ {+ integrity: sha512-gdLscB7v75wRfu7QSm/zg6Rx29VLdy9eTr2t44sfTW7CxwAtQghZ4ZnqHk3/ogz7xao0QAgrkradbBzcqFPasw==,+ }+ engines: { node: ">=18" }+ cpu: [arm64]+ os: [android]++ "@esbuild/[email protected]":+ resolution:+ {+ integrity: sha512-X9bUgvxiC8CHAGKYufLIHGXPJWnr0OCdR0anD2e21vdvgCI8lIfqFbnoeOz7lBjdrAGUhqLZLcQo6MLhTO2DKQ==,+ }+ engines: { node: ">=18" }+ cpu: [arm]+ os: [android]++ "@esbuild/[email protected]":+ resolution:+ {+ integrity: sha512-PzPFnBNVF292sfpfhiyiXCGSn9HZg5BcAz+ivBuSsl6Rk4ga1oEXAamhOXRFyMcjwr2DVtm40G65N3GLeH1Lvw==,+ }+ engines: { node: ">=18" }+ cpu: [x64]+ os: [android]++ "@esbuild/[email protected]":+ resolution:+ {+ integrity: sha512-b7xaGIwdJlht8ZFCvMkpDN6uiSmnxxK56N2GDTMYPr2/gzvfdQN8rTfBsvVKmIVY/X7EM+/hJKEIbbHs9oA4tQ==,+ }+ engines: { node: ">=18" }+ cpu: [arm64]+ os: [darwin]++ "@esbuild/[email protected]":+ resolution:+ {+ integrity: sha512-sR+OiKLwd15nmCdqpXMnuJ9W2kpy0KigzqScqHI3Hqwr7IXxBp3Yva+yJwoqh7rE8V77tdoheRYataNKL4QrPw==,+ }+ engines: { node: ">=18" }+ cpu: [x64]+ os: [darwin]++ "@esbuild/[email protected]":+ resolution:+ {+ integrity: sha512-jnfpKe+p79tCnm4GVav68A7tUFeKQwQyLgESwEAUzyxk/TJr4QdGog9sqWNcUbr/bZt/O/HXouspuQDd9JxFSw==,+ }+ engines: { node: ">=18" }+ cpu: [arm64]+ os: [freebsd]++ "@esbuild/[email protected]":+ resolution:+ {+ integrity: sha512-2kb4ceA/CpfUrIcTUl1wrP/9ad9Atrp5J94Lq69w7UwOMolPIGrfLSvAKJp0RTvkPPyn6CIWrNy13kyLikZRZQ==,+ }+ engines: { node: ">=18" }+ cpu: [x64]+ os: [freebsd]++ "@esbuild/[email protected]":+ resolution:+ {+ integrity: sha512-7nQOttdzVGth1iz57kxg9uCz57dxQLHWxopL6mYuYthohPKEK0vU0C3O21CcBK6KDlkYVcnDXY099HcCDXd9dA==,+ }+ engines: { node: ">=18" }+ cpu: [arm64]+ os: [linux]++ "@esbuild/[email protected]":+ resolution:+ {+ integrity: sha512-aBYgcIxX/wd5n2ys0yESGeYMGF+pv6g0DhZr3G1ZG4jMfruU9Tl1i2Z+Wnj9/KjGz1lTLCcorqE2viePZqj4Eg==,+ }+ engines: { node: ">=18" }+ cpu: [arm]+ os: [linux]++ "@esbuild/[email protected]":+ resolution:+ {+ integrity: sha512-oPtixtAIzgvzYcKBQM/qZ3R+9TEUd1aNJQu0HhGyqtx6oS7qTpvjheIWBbes4+qu1bNlo2V4cbkISr8q6gRBFA==,+ }+ engines: { node: ">=18" }+ cpu: [ia32]+ os: [linux]++ "@esbuild/[email protected]":+ resolution:+ {+ integrity: sha512-8mL/vh8qeCoRcFH2nM8wm5uJP+ZcVYGGayMavi8GmRJjuI3g1v6Z7Ni0JJKAJW+m0EtUuARb6Lmp4hMjzCBWzA==,+ }+ engines: { node: ">=18" }+ cpu: [loong64]+ os: [linux]++ "@esbuild/[email protected]":+ resolution:+ {+ integrity: sha512-1RdrWFFiiLIW7LQq9Q2NES+HiD4NyT8Itj9AUeCl0IVCA459WnPhREKgwrpaIfTOe+/2rdntisegiPWn/r/aAw==,+ }+ engines: { node: ">=18" }+ cpu: [mips64el]+ os: [linux]++ "@esbuild/[email protected]":+ resolution:+ {+ integrity: sha512-tLCwNG47l3sd9lpfyx9LAGEGItCUeRCWeAx6x2Jmbav65nAwoPXfewtAdtbtit/pJFLUWOhpv0FpS6GQAmPrHA==,+ }+ engines: { node: ">=18" }+ cpu: [ppc64]+ os: [linux]++ "@esbuild/[email protected]":+ resolution:+ {+ integrity: sha512-BnASypppbUWyqjd1KIpU4AUBiIhVr6YlHx/cnPgqEkNoVOhHg+YiSVxM1RLfiy4t9cAulbRGTNCKOcqHrEQLIw==,+ }+ engines: { node: ">=18" }+ cpu: [riscv64]+ os: [linux]++ "@esbuild/[email protected]":+ resolution:+ {+ integrity: sha512-+eUqgb/Z7vxVLezG8bVB9SfBie89gMueS+I0xYh2tJdw3vqA/0ImZJ2ROeWwVJN59ihBeZ7Tu92dF/5dy5FttA==,+ }+ engines: { node: ">=18" }+ cpu: [s390x]+ os: [linux]++ "@esbuild/[email protected]":+ resolution:+ {+ integrity: sha512-S5qOXrKV8BQEzJPVxAwnryi2+Iq5pB40gTEIT69BQONqR7JH1EPIcQ/Uiv9mCnn05jff9umq/5nqzxlqTOg9NA==,+ }+ engines: { node: ">=18" }+ cpu: [x64]+ os: [linux]++ "@esbuild/[email protected]":+ resolution:+ {+ integrity: sha512-xHT8X4sb0GS8qTqiwzHqpY00C95DPAq7nAwX35Ie/s+LO9830hrMd3oX0ZMKLvy7vsonee73x0lmcdOVXFzd6Q==,+ }+ engines: { node: ">=18" }+ cpu: [arm64]+ os: [netbsd]++ "@esbuild/[email protected]":+ resolution:+ {+ integrity: sha512-RugOvOdXfdyi5Tyv40kgQnI0byv66BFgAqjdgtAKqHoZTbTF2QqfQrFwa7cHEORJf6X2ht+l9ABLMP0dnKYsgg==,+ }+ engines: { node: ">=18" }+ cpu: [x64]+ os: [netbsd]++ "@esbuild/[email protected]":+ resolution:+ {+ integrity: sha512-2MyL3IAaTX+1/qP0O1SwskwcwCoOI4kV2IBX1xYnDDqthmq5ArrW94qSIKCAuRraMgPOmG0RDTA74mzYNQA9ow==,+ }+ engines: { node: ">=18" }+ cpu: [arm64]+ os: [openbsd]++ "@esbuild/[email protected]":+ resolution:+ {+ integrity: sha512-u8fg/jQ5aQDfsnIV6+KwLOf1CmJnfu1ShpwqdwC0uA7ZPwFws55Ngc12vBdeUdnuWoQYx/SOQLGDcdlfXhYmXQ==,+ }+ engines: { node: ">=18" }+ cpu: [x64]+ os: [openbsd]++ "@esbuild/[email protected]":+ resolution:+ {+ integrity: sha512-JkTZrl6VbyO8lDQO3yv26nNr2RM2yZzNrNHEsj9bm6dOwwu9OYN28CjzZkH57bh4w0I2F7IodpQvUAEd1mbWXg==,+ }+ engines: { node: ">=18" }+ cpu: [arm64]+ os: [openharmony]++ "@esbuild/[email protected]":+ resolution:+ {+ integrity: sha512-/gOzgaewZJfeJTlsWhvUEmUG4tWEY2Spp5M20INYRg2ZKl9QPO3QEEgPeRtLjEWSW8FilRNacPOg8R1uaYkA6g==,+ }+ engines: { node: ">=18" }+ cpu: [x64]+ os: [sunos]++ "@esbuild/[email protected]":+ resolution:+ {+ integrity: sha512-Z9SExBg2y32smoDQdf1HRwHRt6vAHLXcxD2uGgO/v2jK7Y718Ix4ndsbNMU/+1Qiem9OiOdaqitioZwxivhXYg==,+ }+ engines: { node: ">=18" }+ cpu: [arm64]+ os: [win32]++ "@esbuild/[email protected]":+ resolution:+ {+ integrity: sha512-DAyGLS0Jz5G5iixEbMHi5KdiApqHBWMGzTtMiJ72ZOLhbu/bzxgAe8Ue8CTS3n3HbIUHQz/L51yMdGMeoxXNJw==,+ }+ engines: { node: ">=18" }+ cpu: [ia32]+ os: [win32]++ "@esbuild/[email protected]":+ resolution:+ {+ integrity: sha512-+knoa0BDoeXgkNvvV1vvbZX4+hizelrkwmGJBdT17t8FNPwG2lKemmuMZlmaNQ3ws3DKKCxpb4zRZEIp3UxFCg==,+ }+ engines: { node: ">=18" }+ cpu: [x64]+ os: [win32]++ resolution:+ {+ integrity: sha512-Rq4vbHnYkK5fws5NF7MYTU68FPRE1ajX7heQ/8QXXWqNgqqJ/GkmmyxIzUnf2Sr/bakf8l54716CcMGHYhMrrQ==,+ }+ engines: { node: ">=18" }+ hasBin: true++ resolution:+ {+ integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==,+ }+ engines: { node: ^8.16.0 || ^10.6.0 || >=11.0.0 }+ os: [darwin]++ resolution:+ {+ integrity: sha512-shZT/QMiSHc/YBLxxOkMtgSid5HFoauqCE3/exfsEcwg1WkeqjG+V40yBbBrsD+jW2HDXcs28xOfcbm2jI8Ddw==,+ }++ resolution:+ {+ integrity: sha512-YxoArl2BItucdO89/sN6edksV0x47WUTgkgVfCgX7EuEMhbirENsgYe5oO4LTjBL9PtdKtk2WqND1gSLcTd2yw==,+ }+ hasBin: true+ peerDependencies:+ ws: ^8.18.0+ zod: ^3.25 || ^4.0+ peerDependenciesMeta:+ ws:+ optional: true+ zod:+ optional: true++ resolution:+ {+ integrity: sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==,+ }++ resolution:+ {+ integrity: sha512-PKvy1rVF1RibfF3JlXBSP0Jrcw2uq3yXdgcEXtKTYn3QJ/cBRBHDnrJ5jHky+MENZ6DIPwNUGWpkVx+7joCpNA==,+ }++ resolution:+ {+ integrity: sha512-5C1sg4USs1lfG0GFb2RLXsdpXqBSEhAaA/0kPL01wxzpMqLILNxIxIOKiILz+cdg/pLnOUxFYOR5yhHU666wbw==,+ }+ engines: { node: ">=18.0.0" }+ hasBin: true++ resolution:+ {+ integrity: sha512-mplynKqc1C2hTVYxd0PU2xQAc22TI1vShAYGksCCfxbn/dFwnHTNi1bvYsBTkhdUNtGIf5xNOg938rrSSYvS9A==,+ }+ engines: { node: ">= 14.6" }+ hasBin: true++snapshots:+ "@esbuild/[email protected]":+ optional: true++ "@esbuild/[email protected]":+ optional: true++ "@esbuild/[email protected]":+ optional: true++ "@esbuild/[email protected]":+ optional: true++ "@esbuild/[email protected]":+ optional: true++ "@esbuild/[email protected]":+ optional: true++ "@esbuild/[email protected]":+ optional: true++ "@esbuild/[email protected]":+ optional: true++ "@esbuild/[email protected]":+ optional: true++ "@esbuild/[email protected]":+ optional: true++ "@esbuild/[email protected]":+ optional: true++ "@esbuild/[email protected]":+ optional: true++ "@esbuild/[email protected]":+ optional: true++ "@esbuild/[email protected]":+ optional: true++ "@esbuild/[email protected]":+ optional: true++ "@esbuild/[email protected]":+ optional: true++ "@esbuild/[email protected]":+ optional: true++ "@esbuild/[email protected]":+ optional: true++ "@esbuild/[email protected]":+ optional: true++ "@esbuild/[email protected]":+ optional: true++ "@esbuild/[email protected]":+ optional: true++ "@esbuild/[email protected]":+ optional: true++ "@esbuild/[email protected]":+ optional: true++ "@esbuild/[email protected]":+ optional: true++ "@esbuild/[email protected]":+ optional: true++ "@esbuild/[email protected]":+ optional: true++ optionalDependencies:+ "@esbuild/aix-ppc64": 0.27.4+ "@esbuild/android-arm": 0.27.4+ "@esbuild/android-arm64": 0.27.4+ "@esbuild/android-x64": 0.27.4+ "@esbuild/darwin-arm64": 0.27.4+ "@esbuild/darwin-x64": 0.27.4+ "@esbuild/freebsd-arm64": 0.27.4+ "@esbuild/freebsd-x64": 0.27.4+ "@esbuild/linux-arm": 0.27.4+ "@esbuild/linux-arm64": 0.27.4+ "@esbuild/linux-ia32": 0.27.4+ "@esbuild/linux-loong64": 0.27.4+ "@esbuild/linux-mips64el": 0.27.4+ "@esbuild/linux-ppc64": 0.27.4+ "@esbuild/linux-riscv64": 0.27.4+ "@esbuild/linux-s390x": 0.27.4+ "@esbuild/linux-x64": 0.27.4+ "@esbuild/netbsd-arm64": 0.27.4+ "@esbuild/netbsd-x64": 0.27.4+ "@esbuild/openbsd-arm64": 0.27.4+ "@esbuild/openbsd-x64": 0.27.4+ "@esbuild/openharmony-arm64": 0.27.4+ "@esbuild/sunos-x64": 0.27.4+ "@esbuild/win32-arm64": 0.27.4+ "@esbuild/win32-ia32": 0.27.4+ "@esbuild/win32-x64": 0.27.4++ optional: true++ dependencies:+ resolve-pkg-maps: 1.0.0++ [email protected]: {}++ [email protected]: {}++ [email protected]: {}++ dependencies:+ esbuild: 0.27.4+ get-tsconfig: 4.13.6+ optionalDependencies:+ fsevents: 2.3.3++ [email protected]: {}diff --git a/benchmarks/run-benchmark.ts b/benchmarks/run-benchmark.tsindex 80aeb0b3e..96c829ebb 100644--- a/benchmarks/run-benchmark.ts+++ b/benchmarks/run-benchmark.ts@@ -1,77 +1,93 @@-import { readFileSync, readdirSync } from "fs";+import { readFileSync } from "fs";import { join } from "path";import { encoding_for_model } from "tiktoken";const enc = encoding_for_model("gpt-5");-const SAMPLES_DIR = "samples";--function getFiles(ext: string) {- return readdirSync(SAMPLES_DIR).filter(f => f.endsWith(ext));-}+const SCENARIOS = [+ "simple-table",+ "chart-with-data",+ "contact-form",+ "dashboard",+ "pricing-page",+ "settings-panel",+ "e-commerce-product",+] as const;+const TPS = 60;function countTokens(text: string) {return enc.encode(text).length;}function main() {- const metricsRaw = readFileSync(join(SAMPLES_DIR, "metrics.json"), "utf-8");- const metrics = JSON.parse(metricsRaw);-- const tests = ["simple-table", "chart-with-data", "contact-form", "dashboard", "pricing-page", "settings-panel", "e-commerce-product"];-console.log("\n# OpenUI Lang Benchmark Results\n");- console.log("| Scenario | Vercel JSON-Render (Tokens) | Thesys C1 JSON (Tokens) | OpenUI Lang (Tokens) | OpenUI vs Vercel | OpenUI vs C1 |");- console.log("|---|---:|---:|---:|---|---|");+ console.log(+ "| Scenario | YAML (Tokens) | Vercel JSON-Render (Tokens) | Thesys C1 JSON (Tokens) | OpenUI Lang (Tokens) | OpenUI vs YAML | OpenUI vs Vercel | OpenUI vs C1 |",+ );+ console.log("|---|---:|---:|---:|---:|---|---|---|");+ let totalYaml = 0;let totalVercel = 0;let totalC1 = 0;let totalOui = 0;- for (const test of tests) {+ for (const test of SCENARIOS) {const ouiText = readFileSync(join(SAMPLES_DIR, `${test}.oui`), "utf-8");const c1Text = readFileSync(join(SAMPLES_DIR, `${test}.c1.json`), "utf-8");+ const yamlText = readFileSync(join(SAMPLES_DIR, `${test}.yaml`), "utf-8");const vercelText = readFileSync(join(SAMPLES_DIR, `${test}.vercel.jsonl`), "utf-8");const ouiTokens = countTokens(ouiText);const c1Tokens = countTokens(c1Text);+ const yamlTokens = countTokens(yamlText);const vercelTokens = countTokens(vercelText);totalOui += ouiTokens;totalC1 += c1Tokens;+ totalYaml += yamlTokens;totalVercel += vercelTokens;- const vsVercel = ((vercelTokens - ouiTokens) / vercelTokens * 100).toFixed(1);- const vsC1 = ((c1Tokens - ouiTokens) / c1Tokens * 100).toFixed(1);+ const vsYaml = (((yamlTokens - ouiTokens) / yamlTokens) * 100).toFixed(1);+ const vsVercel = (((vercelTokens - ouiTokens) / vercelTokens) * 100).toFixed(1);+ const vsC1 = (((c1Tokens - ouiTokens) / c1Tokens) * 100).toFixed(1);- console.log(`| ${test} | ${vercelTokens} | ${c1Tokens} | ${ouiTokens} | -${vsVercel}% | -${vsC1}% |`);+ console.log(+ `| ${test} | ${yamlTokens} | ${vercelTokens} | ${c1Tokens} | ${ouiTokens} | -${vsYaml}% | -${vsVercel}% | -${vsC1}% |`,+ );}- console.log(`| **TOTAL** | **${totalVercel}** | **${totalC1}** | **${totalOui}** | **-${((totalVercel - totalOui) / totalVercel * 100).toFixed(1)}%** | **-${((totalC1 - totalOui) / totalC1 * 100).toFixed(1)}%** |`);+ console.log(+ `| **TOTAL** | **${totalYaml}** | **${totalVercel}** | **${totalC1}** | **${totalOui}** | **-${(((totalYaml - totalOui) / totalYaml) * 100).toFixed(1)}%** | **-${(((totalVercel - totalOui) / totalVercel) * 100).toFixed(1)}%** | **-${(((totalC1 - totalOui) / totalC1) * 100).toFixed(1)}%** |`,+ );console.log("\n## Estimated Latency (Based on LLM TPS)\n");- console.log("Assuming a constant generation speed of ~60 tokens per second (typical for this model).");- console.log("\n| Scenario | Vercel JSON-Render | Thesys C1 JSON | OpenUI Lang | Speedup vs Vercel |");- console.log("|---|---:|---:|---:|---|");-- const TPS = 60;-- for (const test of tests) {+ console.log(+ "Assuming a constant generation speed of ~60 tokens per second (typical for this model).",+ );+ console.log(+ "\n| Scenario | YAML | Vercel JSON-Render | Thesys C1 JSON | OpenUI Lang | Speedup vs YAML | Speedup vs Vercel |",+ );+ console.log("|---|---:|---:|---:|---:|---|---|");++ for (const test of SCENARIOS) {const ouiText = readFileSync(join(SAMPLES_DIR, `${test}.oui`), "utf-8");const c1Text = readFileSync(join(SAMPLES_DIR, `${test}.c1.json`), "utf-8");+ const yamlText = readFileSync(join(SAMPLES_DIR, `${test}.yaml`), "utf-8");const vercelText = readFileSync(join(SAMPLES_DIR, `${test}.vercel.jsonl`), "utf-8");const ouiTokens = countTokens(ouiText);const c1Tokens = countTokens(c1Text);+ const yamlTokens = countTokens(yamlText);const vercelTokens = countTokens(vercelText);const ouiTime = (ouiTokens / TPS).toFixed(2);const c1Time = (c1Tokens / TPS).toFixed(2);+ const yamlTime = (yamlTokens / TPS).toFixed(2);const vercelTime = (vercelTokens / TPS).toFixed(2);-- const speedup = (vercelTokens / ouiTokens).toFixed(2);- console.log(`| ${test} | ${vercelTime}s | ${c1Time}s | ${ouiTime}s | ${speedup}x faster |`);+ console.log(+ `| ${test} | ${yamlTime}s | ${vercelTime}s | ${c1Time}s | ${ouiTime}s | ${(yamlTokens / ouiTokens).toFixed(2)}x faster | ${(vercelTokens / ouiTokens).toFixed(2)}x faster |`,+ );}enc.free();}diff --git a/benchmarks/samples/chart-with-data.c1.json b/benchmarks/samples/chart-with-data.c1.jsonindex af0a25f8f..e5d6529d2 100644--- a/benchmarks/samples/chart-with-data.c1.json+++ b/benchmarks/samples/chart-with-data.c1.json@@ -58,27 +58,13 @@{"component": "BarChart","props": {- "labels": [- "Oct",- "Nov",- "Dec",- "Jan",- "Feb",- "Mar"- ],+ "labels": ["Oct", "Nov", "Dec", "Jan", "Feb", "Mar"],"series": [{"component": "Series","props": {"category": "Revenue",- "values": [- 198000,- 205000,- 214000,- 210000,- 223000,- 234000- ]+ "values": [198000, 205000, 214000, 210000, 223000, 234000]}}],@@ -105,4 +91,4 @@}},"error": null-}\ No newline at end of file+}diff --git a/benchmarks/samples/chart-with-data.yaml b/benchmarks/samples/chart-with-data.yamlnew file mode 100644index 000000000..39e3eb9ec--- /dev/null+++ b/benchmarks/samples/chart-with-data.yaml@@ -0,0 +1,88 @@+root: stack-1+elements:+ textcontent-2:+ type: TextContent+ props:+ text: Revenue Dashboard+ size: large-heavy+ cardheader-5:+ type: CardHeader+ props:+ title: Total Revenue+ subtitle: Last 6 months+ textcontent-6:+ type: TextContent+ props:+ text: $1,284,000+ size: large-heavy+ textcallout-7:+ type: TextCallout+ props:+ variant: success+ title: Up 8.4%+ description: Compared to the previous 6 months+ card-4:+ type: Card+ props:+ variant: card+ children:+ - cardheader-5+ - textcontent-6+ - textcallout-7+ cardheader-9:+ type: CardHeader+ props:+ title: Monthly Revenue+ subtitle: Last 6 months+ series-11:+ type: Series+ props:+ category: Revenue+ values:+ - 198000+ - 205000+ - 214000+ - 210000+ - 223000+ - 234000+ barchart-10:+ type: BarChart+ props:+ labels:+ - Oct+ - Nov+ - Dec+ - Jan+ - Feb+ - Mar+ variant: grouped+ xLabel: Month+ yLabel: Revenue (USD)+ children:+ - series-11+ card-8:+ type: Card+ props:+ variant: card+ children:+ - cardheader-9+ - barchart-10+ stack-3:+ type: Stack+ props:+ direction: row+ gap: l+ align: stretch+ justify: start+ wrap: true+ children:+ - card-4+ - card-8+ stack-1:+ type: Stack+ props:+ direction: column+ gap: l+ children:+ - textcontent-2+ - stack-3diff --git a/benchmarks/samples/contact-form.c1.json b/benchmarks/samples/contact-form.c1.jsonindex b8c921c3b..9b9d08069 100644--- a/benchmarks/samples/contact-form.c1.json+++ b/benchmarks/samples/contact-form.c1.json@@ -25,10 +25,7 @@"name": "name","placeholder": "Your full name","type": "text",- "rules": [- "required",- "minLength:2"- ]+ "rules": ["required", "minLength:2"]}}}@@ -43,10 +40,7 @@"name": "email","placeholder": "[email protected]","type": "email",- "rules": [- "required",- "email"- ]+ "rules": ["required", "email"]}}}@@ -61,11 +55,7 @@"name": "phone","placeholder": "e.g., +1 555 123 4567","type": "text",- "rules": [- "required",- "minLength:7",- "maxLength:20"- ]+ "rules": ["required", "minLength:7", "maxLength:20"]}}}@@ -116,9 +106,7 @@}],"placeholder": "Select a subject...",- "rules": [- "required"- ]+ "rules": ["required"]}}}@@ -133,10 +121,7 @@"name": "message","placeholder": "How can we help?","rows": 6,- "rules": [- "required",- "minLength:10"- ]+ "rules": ["required", "minLength:10"]}}}@@ -174,4 +159,4 @@}},"error": null-}\ No newline at end of file+}diff --git a/benchmarks/samples/contact-form.yaml b/benchmarks/samples/contact-form.yamlnew file mode 100644index 000000000..8cfff61d7--- /dev/null+++ b/benchmarks/samples/contact-form.yaml@@ -0,0 +1,150 @@+root: stack-1+elements:+ textcontent-2:+ type: TextContent+ props:+ text: Contact Us+ size: large-heavy+ input-5:+ type: Input+ props:+ name: name+ placeholder: Your full name+ type: text+ rules:+ - required+ - minLength:2+ formcontrol-4:+ type: FormControl+ props:+ label: Name+ children:+ - input-5+ input-7:+ type: Input+ props:+ name: email+ placeholder: [email protected]+ type: email+ rules:+ - required+ formcontrol-6:+ type: FormControl+ props:+ label: Email+ children:+ - input-7+ input-9:+ type: Input+ props:+ name: phone+ placeholder: e.g., +1 555 123 4567+ type: text+ rules:+ - required+ - minLength:7+ - maxLength:20+ formcontrol-8:+ type: FormControl+ props:+ label: Phone+ children:+ - input-9+ selectitem-12:+ type: SelectItem+ props:+ value: general+ label: General inquiry+ selectitem-13:+ type: SelectItem+ props:+ value: support+ label: Support+ selectitem-14:+ type: SelectItem+ props:+ value: sales+ label: Sales+ selectitem-15:+ type: SelectItem+ props:+ value: billing+ label: Billing+ selectitem-16:+ type: SelectItem+ props:+ value: feedback+ label: Feedback+ select-11:+ type: Select+ props:+ name: subject+ placeholder: Select a subject...+ rules:+ - required+ children:+ - selectitem-12+ - selectitem-13+ - selectitem-14+ - selectitem-15+ - selectitem-16+ formcontrol-10:+ type: FormControl+ props:+ label: Subject+ children:+ - select-11+ textarea-18:+ type: TextArea+ props:+ name: message+ placeholder: How can we help?+ rows: 6+ rules:+ - required+ - minLength:10+ formcontrol-17:+ type: FormControl+ props:+ label: Message+ children:+ - textarea-18+ button-20:+ type: Button+ props:+ label: Submit+ action: submit:contact+ variant: primary+ button-21:+ type: Button+ props:+ label: Cancel+ action: action:cancel_contact+ variant: secondary+ buttons-19:+ type: Buttons+ props:+ direction: row+ children:+ - button-20+ - button-21+ form-3:+ type: Form+ props:+ name: contact+ children:+ - formcontrol-4+ - formcontrol-6+ - formcontrol-8+ - formcontrol-10+ - formcontrol-17+ - buttons-19+ stack-1:+ type: Stack+ props:+ direction: column+ gap: l+ children:+ - textcontent-2+ - form-3diff --git a/benchmarks/samples/dashboard.c1.json b/benchmarks/samples/dashboard.c1.jsonindex 11efdd064..94be623a3 100644--- a/benchmarks/samples/dashboard.c1.json+++ b/benchmarks/samples/dashboard.c1.json@@ -184,18 +184,8 @@"props": {"category": "MAU","values": [- 84500,- 87200,- 90100,- 93800,- 96500,- 100200,- 104800,- 109600,- 114300,- 119900,- 123700,- 128400+ 84500, 87200, 90100, 93800, 96500, 100200, 104800, 109600, 114300,+ 119900, 123700, 128400]}}@@ -327,48 +317,13 @@}],"rows": [- [- "Dashboards",- 48200,- 62.5,- 5.8- ],- [- "Automations",- 31750,- 41.2,- 3.1- ],- [- "Integrations",- 28900,- 37.5,- 2.4- ],- [- "Team Collaboration",- 27100,- 35.2,- 4.6- ],- [- "Exports",- 19850,- 25.8,- 1.7- ],- [- "Alerts",- 17600,- 22.9,- 2- ],- [- "API Access",- 12150,- 15.8,- 6.3- ]+ ["Dashboards", 48200, 62.5, 5.8],+ ["Automations", 31750, 41.2, 3.1],+ ["Integrations", 28900, 37.5, 2.4],+ ["Team Collaboration", 27100, 35.2, 4.6],+ ["Exports", 19850, 25.8, 1.7],+ ["Alerts", 17600, 22.9, 2],+ ["API Access", 12150, 15.8, 6.3]]}}@@ -410,18 +365,8 @@"props": {"category": "MRR ($)","values": [- 332000,- 341000,- 349000,- 356000,- 364000,- 372000,- 381000,- 389000,- 397000,- 404000,- 408000,- 412000+ 332000, 341000, 349000, 356000, 364000, 372000, 381000, 389000, 397000,+ 404000, 408000, 412000]}},@@ -430,18 +375,8 @@"props": {"category": "ARR ($)","values": [- 3984000,- 4092000,- 4188000,- 4272000,- 4368000,- 4464000,- 4572000,- 4668000,- 4764000,- 4848000,- 4896000,- 4944000+ 3984000, 4092000, 4188000, 4272000, 4368000, 4464000, 4572000, 4668000,+ 4764000, 4848000, 4896000, 4944000]}}@@ -468,4 +403,4 @@}},"error": null-}\ No newline at end of file+}diff --git a/benchmarks/samples/dashboard.yaml b/benchmarks/samples/dashboard.yamlnew file mode 100644index 000000000..15cffe021--- /dev/null+++ b/benchmarks/samples/dashboard.yaml@@ -0,0 +1,387 @@+root: stack-1+elements:+ cardheader-3:+ type: CardHeader+ props:+ title: Product Analytics Dashboard+ subtitle: Usage, acquisition, feature adoption, and revenue trends+ card-2:+ type: Card+ props:+ variant: card+ children:+ - cardheader-3+ textcontent-6:+ type: TextContent+ props:+ text: Monthly Active Users (MAU)+ size: small-heavy+ textcontent-7:+ type: TextContent+ props:+ text: 128,400+ size: large-heavy+ textcontent-8:+ type: TextContent+ props:+ text: +6.2% vs last month+ size: small+ card-5:+ type: Card+ props:+ variant: sunk+ children:+ - textcontent-6+ - textcontent-7+ - textcontent-8+ textcontent-10:+ type: TextContent+ props:+ text: New Users (30d)+ size: small-heavy+ textcontent-11:+ type: TextContent+ props:+ text: 24,950+ size: large-heavy+ textcontent-12:+ type: TextContent+ props:+ text: +3.1% vs last 30d+ size: small+ card-9:+ type: Card+ props:+ variant: sunk+ children:+ - textcontent-10+ - textcontent-11+ - textcontent-12+ textcontent-14:+ type: TextContent+ props:+ text: MRR+ size: small-heavy+ textcontent-15:+ type: TextContent+ props:+ text: $412,000+ size: large-heavy+ textcontent-16:+ type: TextContent+ props:+ text: +4.4% MoM+ size: small+ card-13:+ type: Card+ props:+ variant: sunk+ children:+ - textcontent-14+ - textcontent-15+ - textcontent-16+ textcontent-18:+ type: TextContent+ props:+ text: ARR+ size: small-heavy+ textcontent-19:+ type: TextContent+ props:+ text: $4.94M+ size: large-heavy+ textcontent-20:+ type: TextContent+ props:+ text: +18.7% YoY+ size: small+ card-17:+ type: Card+ props:+ variant: sunk+ children:+ - textcontent-18+ - textcontent-19+ - textcontent-20+ stack-4:+ type: Stack+ props:+ direction: row+ gap: m+ align: stretch+ justify: start+ wrap: true+ children:+ - card-5+ - card-9+ - card-13+ - card-17+ cardheader-23:+ type: CardHeader+ props:+ title: Monthly Active Users+ subtitle: Last 12 months+ series-25:+ type: Series+ props:+ category: MAU+ values:+ - 84500+ - 87200+ - 90100+ - 93800+ - 96500+ - 100200+ - 104800+ - 109600+ - 114300+ - 119900+ - 123700+ - 128400+ barchart-24:+ type: BarChart+ props:+ labels:+ - Apr+ - May+ - Jun+ - Jul+ - Aug+ - Sep+ - Oct+ - Nov+ - Dec+ - Jan+ - Feb+ - Mar+ variant: grouped+ xLabel: Month+ yLabel: Users+ children:+ - series-25+ card-22:+ type: Card+ props:+ variant: card+ children:+ - cardheader-23+ - barchart-24+ cardheader-27:+ type: CardHeader+ props:+ title: User Acquisition+ subtitle: Share of new users (last 30 days)+ slice-29:+ type: Slice+ props:+ category: Organic Search+ value: 34+ slice-30:+ type: Slice+ props:+ category: Paid Search+ value: 22+ slice-31:+ type: Slice+ props:+ category: Referrals+ value: 16+ slice-32:+ type: Slice+ props:+ category: Social+ value: 12+ slice-33:+ type: Slice+ props:+ category: Direct / Other+ value: 16+ piechart-28:+ type: PieChart+ props:+ variant: donut+ children:+ - slice-29+ - slice-30+ - slice-31+ - slice-32+ - slice-33+ textcontent-34:+ type: TextContent+ props:+ text: "Tip: Track CAC and conversion rate by channel to explain mix shifts."+ size: small+ card-26:+ type: Card+ props:+ variant: card+ children:+ - cardheader-27+ - piechart-28+ - textcontent-34+ stack-21:+ type: Stack+ props:+ direction: row+ gap: l+ align: stretch+ justify: start+ wrap: true+ children:+ - card-22+ - card-26+ cardheader-36:+ type: CardHeader+ props:+ title: Top Features+ subtitle: Adoption and engagement (last 30 days)+ col-38:+ type: Col+ props:+ label: Feature+ type: string+ col-39:+ type: Col+ props:+ label: Weekly Active Users+ type: number+ col-40:+ type: Col+ props:+ label: Adoption Rate (%)+ type: number+ col-41:+ type: Col+ props:+ label: Avg. Uses / User+ type: number+ table-37:+ type: Table+ props:+ rows:+ - - Dashboards+ - 48200+ - 62.5+ - 5.8+ - - Automations+ - 31750+ - 41.2+ - 3.1+ - - Integrations+ - 28900+ - 37.5+ - 2.4+ - - Team Collaboration+ - 27100+ - 35.2+ - 4.6+ - - Exports+ - 19850+ - 25.8+ - 1.7+ - - Alerts+ - 17600+ - 22.9+ - 2+ - - API Access+ - 12150+ - 15.8+ - 6.3+ children:+ - col-38+ - col-39+ - col-40+ - col-41+ card-35:+ type: Card+ props:+ variant: card+ children:+ - cardheader-36+ - table-37+ cardheader-43:+ type: CardHeader+ props:+ title: Revenue Trend+ subtitle: MRR and ARR (last 12 months)+ series-45:+ type: Series+ props:+ category: MRR ($)+ values:+ - 332000+ - 341000+ - 349000+ - 356000+ - 364000+ - 372000+ - 381000+ - 389000+ - 397000+ - 404000+ - 408000+ - 412000+ series-46:+ type: Series+ props:+ category: ARR ($)+ values:+ - 3984000+ - 4092000+ - 4188000+ - 4272000+ - 4368000+ - 4464000+ - 4572000+ - 4668000+ - 4764000+ - 4848000+ - 4896000+ - 4944000+ linechart-44:+ type: LineChart+ props:+ labels:+ - Apr+ - May+ - Jun+ - Jul+ - Aug+ - Sep+ - Oct+ - Nov+ - Dec+ - Jan+ - Feb+ - Mar+ variant: natural+ xLabel: Month+ yLabel: USD+ children:+ - series-45+ - series-46+ textcontent-47:+ type: TextContent+ props:+ text: ARR shown as 12×MRR for directional tracking; replace with contracted ARR+ if you track annual commitments.+ size: small+ card-42:+ type: Card+ props:+ variant: card+ children:+ - cardheader-43+ - linechart-44+ - textcontent-47+ stack-1:+ type: Stack+ props:+ direction: column+ gap: l+ children:+ - card-2+ - stack-4+ - stack-21+ - card-35+ - card-42diff --git a/benchmarks/samples/e-commerce-product.c1.json b/benchmarks/samples/e-commerce-product.c1.jsonindex bfb9cacbb..4bbb00b6f 100644--- a/benchmarks/samples/e-commerce-product.c1.json+++ b/benchmarks/samples/e-commerce-product.c1.json@@ -200,9 +200,7 @@}],"placeholder": "Select your size...",- "rules": [- "required"- ]+ "rules": ["required"]}}}@@ -259,9 +257,7 @@}],"defaultValue": "black_white",- "rules": [- "required"- ]+ "rules": ["required"]}}],@@ -388,30 +384,12 @@}],"rows": [- [- "Weight",- "9.8 oz (US 9)"- ],- [- "Drop",- "8 mm"- ],- [- "Upper",- "Engineered mesh"- ],- [- "Midsole",- "EVA-based foam"- ],- [- "Outsole",- "High-abrasion rubber"- ],- [- "Care",- "Spot clean; air dry"- ]+ ["Weight", "9.8 oz (US 9)"],+ ["Drop", "8 mm"],+ ["Upper", "Engineered mesh"],+ ["Midsole", "EVA-based foam"],+ ["Outsole", "High-abrasion rubber"],+ ["Care", "Spot clean; air dry"]]}}@@ -438,4 +416,4 @@}},"error": null-}\ No newline at end of file+}diff --git a/benchmarks/samples/e-commerce-product.yaml b/benchmarks/samples/e-commerce-product.yamlnew file mode 100644index 000000000..4ebe1aa5d--- /dev/null+++ b/benchmarks/samples/e-commerce-product.yaml@@ -0,0 +1,358 @@+root: stack-1+elements:+ textcontent-3:+ type: TextContent+ props:+ text: Product Details+ size: large-heavy+ card-2:+ type: Card+ props:+ variant: clear+ children:+ - textcontent-3+ cardheader-7:+ type: CardHeader+ props:+ title: AeroStride Runner Sneakers+ subtitle: Lightweight daily trainers with responsive cushioning+ imagegallery-8:+ type: ImageGallery+ props:+ images:+ - src: https://images.unsplash.com/photo-1542291026-7eec264c27ff?auto=format&fit=crop&w=1200&q=80+ alt: Sneakers angled side view+ details: Side profile showing breathable mesh and cushioned midsole+ - src: https://images.unsplash.com/photo-1528701800489-20be3c1ea3b1?auto=format&fit=crop&w=1200&q=80+ alt: Sneakers top view+ details: Top view highlighting laces and padded tongue+ - src: https://images.unsplash.com/photo-1600269452121-4f2416e55c28?auto=format&fit=crop&w=1200&q=80+ alt: Sneakers outsole view+ details: Rubber outsole pattern for traction+ - src: https://images.unsplash.com/photo-1519741497674-611481863552?auto=format&fit=crop&w=1200&q=80+ alt: Sneakers lifestyle shot+ details: Everyday styling in an urban setting+ card-6:+ type: Card+ props:+ variant: card+ children:+ - cardheader-7+ - imagegallery-8+ cardheader-10:+ type: CardHeader+ props:+ title: AeroStride Runner+ subtitle: Men's / Women's • Road & casual+ textcontent-12:+ type: TextContent+ props:+ text: $129.00+ size: large-heavy+ tag-13:+ type: Tag+ props:+ text: In stock+ icon: check+ size: md+ variant: success+ stack-11:+ type: Stack+ props:+ direction: row+ gap: m+ align: center+ justify: between+ wrap: true+ children:+ - textcontent-12+ - tag-13+ separator-14:+ type: Separator+ props:+ orientation: horizontal+ decorative: true+ selectitem-18:+ type: SelectItem+ props:+ value: "7"+ label: US 7+ selectitem-19:+ type: SelectItem+ props:+ value: "7.5"+ label: US 7.5+ selectitem-20:+ type: SelectItem+ props:+ value: "8"+ label: US 8+ selectitem-21:+ type: SelectItem+ props:+ value: "8.5"+ label: US 8.5+ selectitem-22:+ type: SelectItem+ props:+ value: "9"+ label: US 9+ selectitem-23:+ type: SelectItem+ props:+ value: "9.5"+ label: US 9.5+ selectitem-24:+ type: SelectItem+ props:+ value: "10"+ label: US 10+ selectitem-25:+ type: SelectItem+ props:+ value: "10.5"+ label: US 10.5+ selectitem-26:+ type: SelectItem+ props:+ value: "11"+ label: US 11+ selectitem-27:+ type: SelectItem+ props:+ value: "12"+ label: US 12+ select-17:+ type: Select+ props:+ name: size+ placeholder: Select your size...+ rules:+ - required+ children:+ - selectitem-18+ - selectitem-19+ - selectitem-20+ - selectitem-21+ - selectitem-22+ - selectitem-23+ - selectitem-24+ - selectitem-25+ - selectitem-26+ - selectitem-27+ formcontrol-16:+ type: FormControl+ props:+ label: Size+ children:+ - select-17+ form-15:+ type: Form+ props:+ name: select_size+ children:+ - formcontrol-16+ separator-28:+ type: Separator+ props:+ orientation: horizontal+ decorative: true+ textcontent-30:+ type: TextContent+ props:+ text: Color+ size: small-heavy+ radioitem-32:+ type: RadioItem+ props:+ label: Black / White+ description: Classic contrast with white midsole+ value: black_white+ radioitem-33:+ type: RadioItem+ props:+ label: Sand / Gum+ description: Neutral upper with gum outsole+ value: sand_gum+ radioitem-34:+ type: RadioItem+ props:+ label: Slate / Neon+ description: Cool tones with neon accents+ value: slate_neon+ radiogroup-31:+ type: RadioGroup+ props:+ name: color+ defaultValue: black_white+ rules:+ - required+ children:+ - radioitem-32+ - radioitem-33+ - radioitem-34+ stack-29:+ type: Stack+ props:+ direction: column+ gap: s+ children:+ - textcontent-30+ - radiogroup-31+ separator-35:+ type: Separator+ props:+ orientation: horizontal+ decorative: true+ button-37:+ type: Button+ props:+ label: Add to Cart+ action: action:add_to_cart_sneakers+ variant: primary+ button-38:+ type: Button+ props:+ label: Save+ action: action:save_sneakers+ variant: secondary+ buttons-36:+ type: Buttons+ props:+ direction: row+ children:+ - button-37+ - button-38+ textcontent-39:+ type: TextContent+ props:+ text: Free returns within 30 days. Ships in 1–2 business days.+ size: small+ card-9:+ type: Card+ props:+ variant: card+ children:+ - cardheader-10+ - stack-11+ - separator-14+ - form-15+ - separator-28+ - stack-29+ - separator-35+ - buttons-36+ - textcontent-39+ stack-5:+ type: Stack+ props:+ direction: row+ gap: l+ align: start+ justify: start+ wrap: true+ children:+ - card-6+ - card-9+ cardheader-42:+ type: CardHeader+ props:+ title: About this item+ subtitle: Built for comfort from morning commutes to weekend miles+ markdownrenderer-43:+ type: MarkDownRenderer+ props:+ textMarkdown: >-+ The **AeroStride Runner** blends breathable mesh with a supportive heel+ counter for a secure fit. A responsive foam midsole delivers soft+ landings and quick transitions, while the durable rubber outsole adds+ traction on city streets.+++ **Fit note:** True to size. If you’re between sizes, consider going up+ 0.5.+ variant: clear+ tagblock-44:+ type: TagBlock+ props:+ tags:+ - Breathable mesh upper+ - Responsive foam cushioning+ - Rubber traction outsole+ - Padded collar & tongue+ - Everyday training+ card-41:+ type: Card+ props:+ variant: sunk+ children:+ - cardheader-42+ - markdownrenderer-43+ - tagblock-44+ cardheader-46:+ type: CardHeader+ props:+ title: Specs+ subtitle: Materials, weight, and care+ col-48:+ type: Col+ props:+ label: Detail+ type: string+ col-49:+ type: Col+ props:+ label: Value+ type: string+ table-47:+ type: Table+ props:+ rows:+ - - Weight+ - 9.8 oz (US 9)+ - - Drop+ - 8 mm+ - - Upper+ - Engineered mesh+ - - Midsole+ - EVA-based foam+ - - Outsole+ - High-abrasion rubber+ - - Care+ - Spot clean; air dry+ children:+ - col-48+ - col-49+ card-45:+ type: Card+ props:+ variant: sunk+ children:+ - cardheader-46+ - table-47+ stack-40:+ type: Stack+ props:+ direction: row+ gap: l+ align: start+ justify: start+ wrap: true+ children:+ - card-41+ - card-45+ stack-4:+ type: Stack+ props:+ direction: column+ gap: l+ children:+ - stack-5+ - stack-40+ stack-1:+ type: Stack+ props:+ direction: column+ gap: l+ children:+ - card-2+ - stack-4diff --git a/benchmarks/samples/metrics.json b/benchmarks/samples/metrics.jsonindex 1db7d0f05..896d0f2f4 100644--- a/benchmarks/samples/metrics.json+++ b/benchmarks/samples/metrics.json@@ -41,4 +41,4 @@"completion_tokens": 1169,"tps": 77.51475366355017}-}\ No newline at end of file+}diff --git a/benchmarks/samples/pricing-page.c1.json b/benchmarks/samples/pricing-page.c1.jsonindex 2210c4ad9..560afebaf 100644--- a/benchmarks/samples/pricing-page.c1.json+++ b/benchmarks/samples/pricing-page.c1.json@@ -24,11 +24,7 @@{"component": "TagBlock","props": {- "tags": [- "Monthly billing",- "Annual discounts available",- "No hidden fees"- ]+ "tags": ["Monthly billing", "Annual discounts available", "No hidden fees"]}}],@@ -303,84 +299,19 @@}],"rows": [- [- "Price (monthly)",- "$12",- "$29",- "Custom"- ],- [- "Workspaces",- "1",- "5",- "Unlimited"- ],- [- "Projects",- "Up to 3",- "Unlimited",- "Unlimited"- ],- [- "Storage",- "5 GB",- "100 GB",- "Unlimited (fair use)"- ],- [- "Team members",- "1",- "Up to 25",- "Unlimited"- ],- [- "Roles & permissions",- "—",- "Yes",- "Advanced (custom roles)"- ],- [- "Automations",- "—",- "1,000 runs/mo",- "Unlimited (policy-based)"- ],- [- "Integrations",- "Limited",- "Standard",- "Standard + custom"- ],- [- "Analytics",- "Basic",- "Advanced",- "Advanced + exports"- ],- [- "SSO (SAML)",- "—",- "—",- "Yes"- ],- [- "SCIM provisioning",- "—",- "—",- "Yes"- ],- [- "Audit logs",- "—",- "—",- "Yes"- ],- [- "Support",- "Community",- "Priority email",- "Dedicated + SLA"- ]+ ["Price (monthly)", "$12", "$29", "Custom"],+ ["Workspaces", "1", "5", "Unlimited"],+ ["Projects", "Up to 3", "Unlimited", "Unlimited"],+ ["Storage", "5 GB", "100 GB", "Unlimited (fair use)"],+ ["Team members", "1", "Up to 25", "Unlimited"],+ ["Roles & permissions", "—", "Yes", "Advanced (custom roles)"],+ ["Automations", "—", "1,000 runs/mo", "Unlimited (policy-based)"],+ ["Integrations", "Limited", "Standard", "Standard + custom"],+ ["Analytics", "Basic", "Advanced", "Advanced + exports"],+ ["SSO (SAML)", "—", "—", "Yes"],+ ["SCIM provisioning", "—", "—", "Yes"],+ ["Audit logs", "—", "—", "Yes"],+ ["Support", "Community", "Priority email", "Dedicated + SLA"]]}},@@ -457,4 +388,4 @@}},"error": null-}\ No newline at end of file+}diff --git a/benchmarks/samples/pricing-page.yaml b/benchmarks/samples/pricing-page.yamlnew file mode 100644index 000000000..01e2a196f--- /dev/null+++ b/benchmarks/samples/pricing-page.yaml@@ -0,0 +1,389 @@+root: stack-1+elements:+ textcontent-3:+ type: TextContent+ props:+ text: Pricing+ size: large-heavy+ textcontent-4:+ type: TextContent+ props:+ text: Choose the plan that fits your team today. Upgrade, downgrade, or cancel+ anytime.+ size: default+ tagblock-5:+ type: TagBlock+ props:+ tags:+ - Monthly billing+ - Annual discounts available+ - No hidden fees+ stack-2:+ type: Stack+ props:+ direction: column+ gap: s+ children:+ - textcontent-3+ - textcontent-4+ - tagblock-5+ cardheader-8:+ type: CardHeader+ props:+ title: Basic+ subtitle: For individuals and small projects+ textcontent-9:+ type: TextContent+ props:+ text: $12 / month+ size: large-heavy+ textcontent-10:+ type: TextContent+ props:+ text: Core features to get started with reliable essentials.+ size: default+ textcontent-11:+ type: TextContent+ props:+ text: "Includes:"+ size: small-heavy+ markdownrenderer-12:+ type: MarkDownRenderer+ props:+ textMarkdown: |-+ - 1 workspace+ - Up to 3 projects+ - 5 GB storage+ - Community support+ - Basic analytics+ variant: clear+ button-14:+ type: Button+ props:+ label: Start Basic+ action: action:select_plan_basic+ variant: secondary+ button-15:+ type: Button+ props:+ label: Try free+ action: action:trial_basic+ variant: tertiary+ buttons-13:+ type: Buttons+ props: {}+ children:+ - button-14+ - button-15+ card-7:+ type: Card+ props:+ variant: card+ children:+ - cardheader-8+ - textcontent-9+ - textcontent-10+ - textcontent-11+ - markdownrenderer-12+ - buttons-13+ cardheader-17:+ type: CardHeader+ props:+ title: Pro+ subtitle: For growing teams that need more power+ textcontent-18:+ type: TextContent+ props:+ text: $29 / month+ size: large-heavy+ textcontent-19:+ type: TextContent+ props:+ text: Advanced collaboration, automation, and deeper insights.+ size: default+ textcontent-20:+ type: TextContent+ props:+ text: "Everything in Basic, plus:"+ size: small-heavy+ markdownrenderer-21:+ type: MarkDownRenderer+ props:+ textMarkdown: |-+ - 5 workspaces+ - Unlimited projects+ - 100 GB storage+ - Team roles & permissions+ - Automations (1,000 runs/month)+ - Integrations (Slack, GitHub, Zapier)+ - Priority email support+ variant: clear+ button-23:+ type: Button+ props:+ label: Choose Pro+ action: action:select_plan_pro+ variant: primary+ button-24:+ type: Button+ props:+ label: Try free+ action: action:trial_pro+ variant: secondary+ buttons-22:+ type: Buttons+ props: {}+ children:+ - button-23+ - button-24+ callout-25:+ type: Callout+ props:+ variant: success+ title: Most popular+ description: Best value for teams that want to scale without switching tools later.+ card-16:+ type: Card+ props:+ variant: sunk+ children:+ - cardheader-17+ - textcontent-18+ - textcontent-19+ - textcontent-20+ - markdownrenderer-21+ - buttons-22+ - callout-25+ cardheader-27:+ type: CardHeader+ props:+ title: Enterprise+ subtitle: For organizations with advanced security and scale+ textcontent-28:+ type: TextContent+ props:+ text: Custom pricing+ size: large-heavy+ textcontent-29:+ type: TextContent+ props:+ text: Security, compliance, and dedicated support tailored to your needs.+ size: default+ textcontent-30:+ type: TextContent+ props:+ text: "Everything in Pro, plus:"+ size: small-heavy+ markdownrenderer-31:+ type: MarkDownRenderer+ props:+ textMarkdown: |-+ - Unlimited workspaces+ - Unlimited storage (fair use)+ - SSO/SAML & SCIM provisioning+ - Audit logs & data retention controls+ - Dedicated success manager+ - 99.9% uptime SLA+ - Custom legal & invoicing+ variant: clear+ button-33:+ type: Button+ props:+ label: Contact sales+ action: action:contact_sales_enterprise+ variant: primary+ button-34:+ type: Button+ props:+ label: Request demo+ action: action:request_demo_enterprise+ variant: secondary+ buttons-32:+ type: Buttons+ props: {}+ children:+ - button-33+ - button-34+ textcallout-35:+ type: TextCallout+ props:+ variant: neutral+ title: Need procurement support?+ description: We can provide security docs, vendor onboarding, and custom terms.+ card-26:+ type: Card+ props:+ variant: card+ children:+ - cardheader-27+ - textcontent-28+ - textcontent-29+ - textcontent-30+ - markdownrenderer-31+ - buttons-32+ - textcallout-35+ stack-6:+ type: Stack+ props:+ direction: row+ gap: l+ align: stretch+ justify: start+ wrap: true+ children:+ - card-7+ - card-16+ - card-26+ textcontent-36:+ type: TextContent+ props:+ text: Feature comparison+ size: large-heavy+ col-38:+ type: Col+ props:+ label: Feature+ type: string+ col-39:+ type: Col+ props:+ label: Basic+ type: string+ col-40:+ type: Col+ props:+ label: Pro+ type: string+ col-41:+ type: Col+ props:+ label: Enterprise+ type: string+ table-37:+ type: Table+ props:+ rows:+ - - Price (monthly)+ - $12+ - $29+ - Custom+ - - Workspaces+ - "1"+ - "5"+ - Unlimited+ - - Projects+ - Up to 3+ - Unlimited+ - Unlimited+ - - Storage+ - 5 GB+ - 100 GB+ - Unlimited (fair use)+ - - Team members+ - "1"+ - Up to 25+ - Unlimited+ - - Roles & permissions+ - —+ - Yes+ - Advanced (custom roles)+ - - Automations+ - —+ - 1,000 runs/mo+ - Unlimited (policy-based)+ - - Integrations+ - Limited+ - Standard+ - Standard + custom+ - - Analytics+ - Basic+ - Advanced+ - Advanced + exports+ - - SSO (SAML)+ - —+ - —+ - Yes+ - - SCIM provisioning+ - —+ - —+ - Yes+ - - Audit logs+ - —+ - —+ - Yes+ - - Support+ - Community+ - Priority email+ - Dedicated + SLA+ children:+ - col-38+ - col-39+ - col-40+ - col-41+ textcontent-44:+ type: TextContent+ props:+ text: Yes. You can upgrade or downgrade at any time. Changes take effect+ immediately, and we prorate when applicable.+ accordionitem-43:+ type: AccordionItem+ props:+ value: billing+ trigger: Can I switch plans later?+ children:+ - textcontent-44+ textcontent-46:+ type: TextContent+ props:+ text: Yes. Basic and Pro include a free trial. Enterprise trials are available+ upon request via Sales.+ accordionitem-45:+ type: AccordionItem+ props:+ value: trial+ trigger: Do you offer a free trial?+ children:+ - textcontent-46+ textcontent-48:+ type: TextContent+ props:+ text: Yes. Annual billing includes a discount. Contact Sales for Enterprise+ annual terms and invoicing.+ accordionitem-47:+ type: AccordionItem+ props:+ value: annual+ trigger: Do you offer annual billing?+ children:+ - textcontent-48+ textcontent-50:+ type: TextContent+ props:+ text: Enterprise includes SSO/SAML, SCIM, audit logs, and data retention+ controls. We can share security documentation during procurement.+ accordionitem-49:+ type: AccordionItem+ props:+ value: security+ trigger: What about security and compliance?+ children:+ - textcontent-50+ accordion-42:+ type: Accordion+ props: {}+ children:+ - accordionitem-43+ - accordionitem-45+ - accordionitem-47+ - accordionitem-49+ stack-1:+ type: Stack+ props:+ direction: column+ gap: xl+ children:+ - stack-2+ - stack-6+ - textcontent-36+ - table-37+ - accordion-42diff --git a/benchmarks/samples/settings-panel.c1.json b/benchmarks/samples/settings-panel.c1.jsonindex 299d864df..2b67f967b 100644--- a/benchmarks/samples/settings-panel.c1.json+++ b/benchmarks/samples/settings-panel.c1.json@@ -46,11 +46,7 @@"name": "display_name","placeholder": "e.g., Alex Johnson","type": "text",- "rules": [- "required",- "minLength:2",- "maxLength:60"- ]+ "rules": ["required", "minLength:2", "maxLength:60"]}}}@@ -65,9 +61,7 @@"name": "avatar_url","placeholder": "https://example.com/avatar.png","type": "url",- "rules": [- "url"- ]+ "rules": ["url"]}}}@@ -234,4 +228,4 @@}},"error": null-}\ No newline at end of file+}diff --git a/benchmarks/samples/settings-panel.yaml b/benchmarks/samples/settings-panel.yamlnew file mode 100644index 000000000..a66db8cb2--- /dev/null+++ b/benchmarks/samples/settings-panel.yaml@@ -0,0 +1,197 @@+root: stack-1+elements:+ textcontent-2:+ type: TextContent+ props:+ text: User Settings+ size: large-heavy+ cardheader-6:+ type: CardHeader+ props:+ title: Profile+ subtitle: Update your personal information and avatar.+ input-9:+ type: Input+ props:+ name: display_name+ placeholder: e.g., Alex Johnson+ type: text+ rules:+ - required+ - minLength:2+ - maxLength:60+ formcontrol-8:+ type: FormControl+ props:+ label: Display name+ children:+ - input-9+ input-11:+ type: Input+ props:+ name: avatar_url+ placeholder: https://example.com/avatar.png+ type: url+ rules:+ - url+ formcontrol-10:+ type: FormControl+ props:+ label: Avatar URL+ children:+ - input-11+ button-13:+ type: Button+ props:+ label: Save changes+ action: submit:profile_update+ variant: primary+ button-14:+ type: Button+ props:+ label: Reset+ action: action:reset_profile_form+ variant: secondary+ buttons-12:+ type: Buttons+ props: {}+ children:+ - button-13+ - button-14+ form-7:+ type: Form+ props:+ name: profile_update+ children:+ - formcontrol-8+ - formcontrol-10+ - buttons-12+ card-5:+ type: Card+ props:+ variant: card+ children:+ - cardheader-6+ - form-7+ tabitem-4:+ type: TabItem+ props:+ value: profile+ trigger: Profile+ children:+ - card-5+ cardheader-17:+ type: CardHeader+ props:+ title: Security+ subtitle: Manage sign-in protection and account security.+ switchitem-19:+ type: SwitchItem+ props:+ label: Two-factor authentication (2FA)+ description: Require a verification code when signing in.+ name: two_fa+ value: enabled+ checked: false+ defaultChecked: true+ disabled: false+ switchgroup-18:+ type: SwitchGroup+ props:+ variant: sunk+ children:+ - switchitem-19+ textcallout-20:+ type: TextCallout+ props:+ variant: info+ title: Tip+ description: After enabling 2FA, you may be asked to set up an authenticator app+ or backup codes.+ card-16:+ type: Card+ props:+ variant: card+ children:+ - cardheader-17+ - switchgroup-18+ - textcallout-20+ tabitem-15:+ type: TabItem+ props:+ value: security+ trigger: Security+ children:+ - card-16+ cardheader-23:+ type: CardHeader+ props:+ title: Notifications+ subtitle: Choose what you want to be notified about.+ switchitem-25:+ type: SwitchItem+ props:+ label: Email notifications+ description: Receive updates and account messages by email.+ name: notif_email+ value: enabled+ checked: true+ defaultChecked: true+ disabled: false+ switchitem-26:+ type: SwitchItem+ props:+ label: Product updates+ description: Get notified about new features and improvements.+ name: notif_product+ value: enabled+ checked: false+ defaultChecked: false+ disabled: false+ switchitem-27:+ type: SwitchItem+ props:+ label: Security alerts+ description: Important alerts about sign-ins and security changes.+ name: notif_security+ value: enabled+ checked: true+ defaultChecked: true+ disabled: false+ switchgroup-24:+ type: SwitchGroup+ props:+ variant: sunk+ children:+ - switchitem-25+ - switchitem-26+ - switchitem-27+ card-22:+ type: Card+ props:+ variant: card+ children:+ - cardheader-23+ - switchgroup-24+ tabitem-21:+ type: TabItem+ props:+ value: notifications+ trigger: Notifications+ children:+ - card-22+ tabs-3:+ type: Tabs+ props: {}+ children:+ - tabitem-4+ - tabitem-15+ - tabitem-21+ stack-1:+ type: Stack+ props:+ direction: column+ gap: l+ children:+ - textcontent-2+ - tabs-3diff --git a/benchmarks/samples/simple-table.c1.json b/benchmarks/samples/simple-table.c1.jsonindex 5905bf634..30e3f9846 100644--- a/benchmarks/samples/simple-table.c1.json+++ b/benchmarks/samples/simple-table.c1.json@@ -44,36 +44,11 @@}],"rows": [- [- "Ava Patel",- "Engineering",- 132000,- 6.5- ],- [- "Marcus Lee",- "Sales",- 98000,- 4.2- ],- [- "Sofia Ramirez",- "Marketing",- 105000,- 3.1- ],- [- "Ethan Brooks",- "Finance",- 118500,- 5- ],- [- "Nina Chen",- "HR",- 89000,- 2.4- ]+ ["Ava Patel", "Engineering", 132000, 6.5],+ ["Marcus Lee", "Sales", 98000, 4.2],+ ["Sofia Ramirez", "Marketing", 105000, 3.1],+ ["Ethan Brooks", "Finance", 118500, 5],+ ["Nina Chen", "HR", 89000, 2.4]]}}@@ -81,4 +56,4 @@}},"error": null-}\ No newline at end of file+}diff --git a/benchmarks/samples/simple-table.yaml b/benchmarks/samples/simple-table.yamlnew file mode 100644index 000000000..e4147c51e--- /dev/null+++ b/benchmarks/samples/simple-table.yaml@@ -0,0 +1,62 @@+root: stack-1+elements:+ textcontent-2:+ type: TextContent+ props:+ text: Employees (Sample)+ size: large-heavy+ col-4:+ type: Col+ props:+ label: Name+ type: string+ col-5:+ type: Col+ props:+ label: Department+ type: string+ col-6:+ type: Col+ props:+ label: Salary+ type: number+ col-7:+ type: Col+ props:+ label: YoY change (%)+ type: number+ table-3:+ type: Table+ props:+ rows:+ - - Ava Patel+ - Engineering+ - 132000+ - 6.5+ - - Marcus Lee+ - Sales+ - 98000+ - 4.2+ - - Sofia Ramirez+ - Marketing+ - 105000+ - 3.1+ - - Ethan Brooks+ - Finance+ - 118500+ - 5+ - - Nina Chen+ - HR+ - 89000+ - 2.4+ children:+ - col-4+ - col-5+ - col-6+ - col-7+ stack-1:+ type: Stack+ props: {}+ children:+ - textcontent-2+ - table-3diff --git a/benchmarks/schema.json b/benchmarks/schema.jsonindex d18ce389a..cba2b2633 100644--- a/benchmarks/schema.json+++ b/benchmarks/schema.json@@ -312,59 +312,29 @@},"variant": {"type": "string",- "enum": [- "card",- "sunk",- "clear"- ]+ "enum": ["card", "sunk", "clear"]},"direction": {"type": "string",- "enum": [- "row",- "column"- ]+ "enum": ["row", "column"]},"gap": {"type": "string",- "enum": [- "none",- "xs",- "s",- "m",- "l",- "xl",- "2xl"- ]+ "enum": ["none", "xs", "s", "m", "l", "xl", "2xl"]},"align": {"type": "string",- "enum": [- "start",- "center",- "end",- "stretch",- "baseline"- ]+ "enum": ["start", "center", "end", "stretch", "baseline"]},"justify": {"type": "string",- "enum": [- "start",- "center",- "end",- "between",- "around",- "evenly"- ]+ "enum": ["start", "center", "end", "between", "around", "evenly"]},"wrap": {"type": "boolean"}},- "required": [- "children"- ],+ "required": ["children"],"additionalProperties": false,"id": "Card"},@@ -376,18 +346,10 @@},"size": {"type": "string",- "enum": [- "small",- "default",- "large",- "small-heavy",- "large-heavy"- ]+ "enum": ["small", "default", "large", "small-heavy", "large-heavy"]}},- "required": [- "text"- ],+ "required": ["text"],"additionalProperties": false,"id": "TextContent"},@@ -399,16 +361,10 @@},"variant": {"type": "string",- "enum": [- "clear",- "card",- "sunk"- ]+ "enum": ["clear", "card", "sunk"]}},- "required": [- "textMarkdown"- ],+ "required": ["textMarkdown"],"additionalProperties": false,"id": "MarkDownRenderer"},@@ -430,13 +386,7 @@"properties": {"variant": {"type": "string",- "enum": [- "info",- "warning",- "error",- "success",- "neutral"- ]+ "enum": ["info", "warning", "error", "success", "neutral"]},"title": {"type": "string"@@ -445,11 +395,7 @@"type": "string"}},- "required": [- "variant",- "title",- "description"- ],+ "required": ["variant", "title", "description"],"additionalProperties": false,"id": "Callout"},@@ -458,13 +404,7 @@"properties": {"variant": {"type": "string",- "enum": [- "neutral",- "info",- "warning",- "success",- "danger"- ]+ "enum": ["neutral", "info", "warning", "success", "danger"]},"title": {"type": "string"@@ -486,10 +426,7 @@"type": "string"}},- "required": [- "language",- "codeString"- ],+ "required": ["language", "codeString"],"additionalProperties": false,"id": "CodeBlock"},@@ -503,9 +440,7 @@"type": "string"}},- "required": [- "alt"- ],+ "required": ["alt"],"additionalProperties": false,"id": "Image"},@@ -519,9 +454,7 @@"type": "string"}},- "required": [- "src"- ],+ "required": ["src"],"additionalProperties": false,"id": "ImageBlock"},@@ -543,16 +476,12 @@"type": "string"}},- "required": [- "src"- ],+ "required": ["src"],"additionalProperties": false}}},- "required": [- "images"- ],+ "required": ["images"],"additionalProperties": false,"id": "ImageGallery"},@@ -561,10 +490,7 @@"properties": {"orientation": {"type": "string",- "enum": [- "horizontal",- "vertical"- ]+ "enum": ["horizontal", "vertical"]},"decorative": {"type": "boolean"@@ -590,10 +516,7 @@},"variant": {"type": "string",- "enum": [- "grouped",- "stacked"- ]+ "enum": ["grouped", "stacked"]},"xLabel": {"type": "string"@@ -602,10 +525,7 @@"type": "string"}},- "required": [- "labels",- "series"- ],+ "required": ["labels", "series"],"additionalProperties": false,"id": "HorizontalBarChart"},@@ -622,10 +542,7 @@}}},- "required": [- "category",- "values"- ],+ "required": ["category", "values"],"additionalProperties": false,"id": "Series"},@@ -645,10 +562,7 @@}}},- "required": [- "labels",- "series"- ],+ "required": ["labels", "series"],"additionalProperties": false,"id": "RadarChart"},@@ -663,15 +577,10 @@},"variant": {"type": "string",- "enum": [- "pie",- "donut"- ]+ "enum": ["pie", "donut"]}},- "required": [- "slices"- ],+ "required": ["slices"],"additionalProperties": false,"id": "PieChart"},@@ -685,10 +594,7 @@"type": "number"}},- "required": [- "category",- "value"- ],+ "required": ["category", "value"],"additionalProperties": false,"id": "Slice"},@@ -702,9 +608,7 @@}}},- "required": [- "slices"- ],+ "required": ["slices"],"additionalProperties": false,"id": "RadialChart"},@@ -718,9 +622,7 @@}}},- "required": [- "slices"- ],+ "required": ["slices"],"additionalProperties": false,"id": "SingleStackedBarChart"},@@ -740,9 +642,7 @@"type": "string"}},- "required": [- "datasets"- ],+ "required": ["datasets"],"additionalProperties": false,"id": "ScatterChart"},@@ -759,10 +659,7 @@}}},- "required": [- "name",- "points"- ],+ "required": ["name", "points"],"additionalProperties": false,"id": "ScatterSeries"},@@ -779,10 +676,7 @@"type": "number"}},- "required": [- "x",- "y"- ],+ "required": ["x", "y"],"additionalProperties": false,"id": "Point"},@@ -803,11 +697,7 @@},"variant": {"type": "string",- "enum": [- "linear",- "natural",- "step"- ]+ "enum": ["linear", "natural", "step"]},"xLabel": {"type": "string"@@ -816,10 +706,7 @@"type": "string"}},- "required": [- "labels",- "series"- ],+ "required": ["labels", "series"],"additionalProperties": false,"id": "AreaChart"},@@ -840,10 +727,7 @@},"variant": {"type": "string",- "enum": [- "grouped",- "stacked"- ]+ "enum": ["grouped", "stacked"]},"xLabel": {"type": "string"@@ -852,10 +736,7 @@"type": "string"}},- "required": [- "labels",- "series"- ],+ "required": ["labels", "series"],"additionalProperties": false,"id": "BarChart"},@@ -876,11 +757,7 @@},"variant": {"type": "string",- "enum": [- "linear",- "natural",- "step"- ]+ "enum": ["linear", "natural", "step"]},"xLabel": {"type": "string"@@ -889,10 +766,7 @@"type": "string"}},- "required": [- "labels",- "series"- ],+ "required": ["labels", "series"],"additionalProperties": false,"id": "LineChart"},@@ -925,10 +799,7 @@}}},- "required": [- "columns",- "rows"- ],+ "required": ["columns", "rows"],"additionalProperties": false,"id": "Table"},@@ -940,16 +811,10 @@},"type": {"type": "string",- "enum": [- "string",- "number",- "action"- ]+ "enum": ["string", "number", "action"]}},- "required": [- "label"- ],+ "required": ["label"],"additionalProperties": false,"id": "Col"},@@ -963,9 +828,7 @@}}},- "required": [- "tags"- ],+ "required": ["tags"],"additionalProperties": false,"id": "TagBlock"},@@ -985,10 +848,7 @@"$ref": "#/$defs/Buttons"}},- "required": [- "name",- "fields"- ],+ "required": ["name", "fields"],"additionalProperties": false,"id": "Form"},@@ -1027,10 +887,7 @@"type": "string"}},- "required": [- "label",- "input"- ],+ "required": ["label", "input"],"additionalProperties": false,"id": "FormControl"},@@ -1045,13 +902,7 @@},"type": {"type": "string",- "enum": [- "text",- "email",- "password",- "number",- "url"- ]+ "enum": ["text", "email", "password", "number", "url"]},"rules": {"type": "array",@@ -1060,9 +911,7 @@}}},- "required": [- "name"- ],+ "required": ["name"],"additionalProperties": false,"id": "Input"},@@ -1085,9 +934,7 @@}}},- "required": [- "name"- ],+ "required": ["name"],"additionalProperties": false,"id": "TextArea"},@@ -1113,10 +960,7 @@}}},- "required": [- "name",- "items"- ],+ "required": ["name", "items"],"additionalProperties": false,"id": "Select"},@@ -1130,10 +974,7 @@"type": "string"}},- "required": [- "value",- "label"- ],+ "required": ["value", "label"],"additionalProperties": false,"id": "SelectItem"},@@ -1145,10 +986,7 @@},"mode": {"type": "string",- "enum": [- "single",- "range"- ]+ "enum": ["single", "range"]},"rules": {"type": "array",@@ -1157,10 +995,7 @@}}},- "required": [- "name",- "mode"- ],+ "required": ["name", "mode"],"additionalProperties": false,"id": "DatePicker"},@@ -1172,10 +1007,7 @@},"variant": {"type": "string",- "enum": [- "continuous",- "discrete"- ]+ "enum": ["continuous", "discrete"]},"min": {"type": "number"@@ -1196,12 +1028,7 @@}}},- "required": [- "name",- "variant",- "min",- "max"- ],+ "required": ["name", "variant", "min", "max"],"additionalProperties": false,"id": "Slider"},@@ -1224,10 +1051,7 @@}}},- "required": [- "name",- "items"- ],+ "required": ["name", "items"],"additionalProperties": false,"id": "CheckBoxGroup"},@@ -1247,11 +1071,7 @@"type": "boolean"}},- "required": [- "label",- "description",- "name"- ],+ "required": ["label", "description", "name"],"additionalProperties": false,"id": "CheckBoxItem"},@@ -1277,10 +1097,7 @@}}},- "required": [- "name",- "items"- ],+ "required": ["name", "items"],"additionalProperties": false,"id": "RadioGroup"},@@ -1297,11 +1114,7 @@"type": "string"}},- "required": [- "label",- "description",- "value"- ],+ "required": ["label", "description", "value"],"additionalProperties": false,"id": "RadioItem"},@@ -1316,15 +1129,10 @@},"direction": {"type": "string",- "enum": [- "row",- "column"- ]+ "enum": ["row", "column"]}},- "required": [- "buttons"- ],+ "required": ["buttons"],"additionalProperties": false,"id": "Buttons"},@@ -1339,33 +1147,18 @@},"variant": {"type": "string",- "enum": [- "primary",- "secondary",- "tertiary"- ]+ "enum": ["primary", "secondary", "tertiary"]},"type": {"type": "string",- "enum": [- "normal",- "destructive"- ]+ "enum": ["normal", "destructive"]},"size": {"type": "string",- "enum": [- "extra-small",- "small",- "medium",- "large"- ]+ "enum": ["extra-small", "small", "medium", "large"]}},- "required": [- "label",- "action"- ],+ "required": ["label", "action"],"additionalProperties": false,"id": "Button"},@@ -1379,9 +1172,7 @@}}},- "required": [- "items"- ],+ "required": ["items"],"additionalProperties": false,"id": "Steps"},@@ -1395,10 +1186,7 @@"type": "string"}},- "required": [- "title",- "details"- ],+ "required": ["title", "details"],"additionalProperties": false,"id": "StepsItem"},@@ -1412,9 +1200,7 @@}}},- "required": [- "items"- ],+ "required": ["items"],"additionalProperties": false,"id": "Tabs"},@@ -1507,11 +1293,7 @@}}},- "required": [- "value",- "trigger",- "content"- ],+ "required": ["value", "trigger", "content"],"additionalProperties": false,"id": "TabItem"},@@ -1526,15 +1308,10 @@},"variant": {"type": "string",- "enum": [- "card",- "sunk"- ]+ "enum": ["card", "sunk"]}},- "required": [- "children"- ],+ "required": ["children"],"additionalProperties": false,"id": "Carousel"},@@ -1547,51 +1324,25 @@},"direction": {"type": "string",- "enum": [- "row",- "column"- ]+ "enum": ["row", "column"]},"gap": {"type": "string",- "enum": [- "none",- "xs",- "s",- "m",- "l",- "xl",- "2xl"- ]+ "enum": ["none", "xs", "s", "m", "l", "xl", "2xl"]},"align": {"type": "string",- "enum": [- "start",- "center",- "end",- "stretch",- "baseline"- ]+ "enum": ["start", "center", "end", "stretch", "baseline"]},"justify": {"type": "string",- "enum": [- "start",- "center",- "end",- "between",- "around",- "evenly"- ]+ "enum": ["start", "center", "end", "between", "around", "evenly"]},"wrap": {"type": "boolean"}},- "required": [- "children"- ],+ "required": ["children"],"additionalProperties": false,"id": "Stack"},@@ -1602,9 +1353,7 @@"type": "string"}},- "required": [- "text"- ],+ "required": ["text"],"additionalProperties": false,"id": "Label"},@@ -1619,16 +1368,10 @@},"variant": {"type": "string",- "enum": [- "clear",- "card",- "sunk"- ]+ "enum": ["clear", "card", "sunk"]}},- "required": [- "items"- ],+ "required": ["items"],"additionalProperties": false,"id": "SwitchGroup"},@@ -1670,9 +1413,7 @@}}},- "required": [- "items"- ],+ "required": ["items"],"additionalProperties": false,"id": "Accordion"},@@ -1765,11 +1506,7 @@}}},- "required": [- "value",- "trigger",- "content"- ],+ "required": ["value", "trigger", "content"],"additionalProperties": false,"id": "AccordionItem"},@@ -1784,26 +1521,14 @@},"size": {"type": "string",- "enum": [- "sm",- "md",- "lg"- ]+ "enum": ["sm", "md", "lg"]},"variant": {"type": "string",- "enum": [- "neutral",- "info",- "success",- "warning",- "danger"- ]+ "enum": ["neutral", "info", "success", "warning", "danger"]}},- "required": [- "text"- ],+ "required": ["text"],"additionalProperties": false,"id": "Tag"}diff --git a/benchmarks/thesys-c1-converter.ts b/benchmarks/thesys-c1-converter.tsindex e91992bb1..d7d377bbd 100644--- a/benchmarks/thesys-c1-converter.ts+++ b/benchmarks/thesys-c1-converter.ts@@ -4,12 +4,10 @@ function isRecord(value: unknown): value is JsonRecord {return value !== null && typeof value === "object" && !Array.isArray(value);}-function isElementNode(value: unknown): value is { type: "element"; typeName: string; props?: unknown } {- return (- isRecord(value) &&- value['type'] === "element" &&- typeof value['typeName'] === "string"- );+function isElementNode(+ value: unknown,+): value is { type: "element"; typeName: string; props?: unknown } {+ return isRecord(value) && value["type"] === "element" && typeof value["typeName"] === "string";}function convertValue(value: unknown): unknown {@@ -44,6 +42,6 @@ export function astToThesysC1Json(astRoot: unknown): string {error: null,},null,- 2+ 2,);}diff --git a/benchmarks/vercel-jsonl-converter.ts b/benchmarks/vercel-jsonl-converter.tsindex 344f6f814..5851f1937 100644--- a/benchmarks/vercel-jsonl-converter.ts+++ b/benchmarks/vercel-jsonl-converter.ts@@ -1,125 +1,18 @@-export function astToVercelJsonl(astRoot: any) {- // Vercel json-render uses JSON Patch (RFC 6902) format- // Example: {"op":"add","path":"/elements/id","value":{"type":"Component","props":{},"children":[]}}-- const lines: string[] = [];- let idCounter = 1;-- function generateId(type: string) {- return `${type.toLowerCase()}-${idCounter++}`;- }-- function processNode(node: any): string | null {- if (!node || typeof node !== "object") return null;-- // If it's a primitive array, return it as is- if (Array.isArray(node)) {- return node as any;- }-- if (node.type === "element") {- const id = generateId(node.typeName);- const props: Record<string, any> = {};- const children: string[] = [];-- // Process props- for (const [key, value] of Object.entries(node.props || {})) {- if (key === "_args") {- // In openui-lang AST, _args contains the positional arguments.- // For Vercel JSONL, we need to map these to props or children.- // This is a simplified mapping: we extract primitive values to props, and elements to children.- if (Array.isArray(value)) {- value.forEach((arg, index) => {- if (Array.isArray(arg)) {- // Array of elements (children) or array of primitives- const isElementArray = arg.some(v => v && typeof v === "object" && v.type === "element");- if (isElementArray) {- for (const child of arg) {- const childId = processNode(child);- if (childId && typeof childId === "string") {- children.push(childId);- }- }- } else {- props[`arg${index}`] = arg;- }- } else if (arg && typeof arg === "object" && arg.type === "element") {- const childId = processNode(arg);- if (childId && typeof childId === "string") {- children.push(childId);- }- } else {- props[`arg${index}`] = arg;- }- });- }- continue;- }-- if (Array.isArray(value)) {- // Check if it's an array of elements- const isElementArray = value.some(v => v && typeof v === "object" && v.type === "element");- if (isElementArray) {- // For Vercel, children are usually flat references- for (const child of value) {- const childId = processNode(child);- if (childId && typeof childId === "string") {- children.push(childId);- }- }- } else {- props[key] = value;- }- } else if (value && typeof value === "object" && (value as any).type === "element") {- // Single element prop- const childId = processNode(value);- if (childId && typeof childId === "string") {- children.push(childId);- }- } else {- props[key] = value;- }- }+import { astToVercelSpec } from "./vercel-spec-converter.js";- // Process children from _args since that's how openui-lang stores positional children- // (Already handled in the _args block above, but keeping this for safety if it's not in _args)- if (node.props && node.props._args === undefined && node.props.children) {- const childrenProp = node.props.children;- if (Array.isArray(childrenProp)) {- for (const child of childrenProp) {- const childId = processNode(child);- if (childId && typeof childId === "string") {- children.push(childId);- }- }- } else if (childrenProp && typeof childrenProp === "object" && childrenProp.type === "element") {- const childId = processNode(childrenProp);- if (childId && typeof childId === "string") {- children.push(childId);- }- }- }+export function astToVercelJsonl(astRoot: unknown) {+ // Vercel json-render uses JSON Patch (RFC 6902) format.+ const spec = astToVercelSpec(astRoot);+ const lines = [JSON.stringify({ op: "add", path: "/root", value: spec.root })];- // Add the patch line- lines.push(JSON.stringify({+ for (const [id, value] of Object.entries(spec.elements)) {+ lines.push(+ JSON.stringify({op: "add",path: `/elements/${id}`,- value: {- type: node.typeName,- props,- children- }- }));-- return id;- }-- return null;- }-- const rootId = processNode(astRoot);- if (rootId) {- lines.unshift(JSON.stringify({ op: "add", path: "/root", value: rootId }));+ value,+ }),+ );}return lines.join("\n");diff --git a/benchmarks/vercel-spec-converter.ts b/benchmarks/vercel-spec-converter.tsnew file mode 100644index 000000000..e473346a3--- /dev/null+++ b/benchmarks/vercel-spec-converter.ts@@ -0,0 +1,105 @@+export type JsonRenderElement = {+ type: string;+ props: Record<string, unknown>;+ children: string[];+};++export type JsonRenderSpec = {+ root: string;+ elements: Record<string, JsonRenderElement>;+};++function isRecord(value: unknown): value is Record<string, unknown> {+ return value !== null && typeof value === "object" && !Array.isArray(value);+}++function isElementNode(value: unknown): value is {+ type: "element";+ typeName: string;+ props?: Record<string, unknown>;+} {+ return isRecord(value) && value["type"] === "element" && typeof value["typeName"] === "string";+}++function hasElementNode(values: unknown[]) {+ return values.some(isElementNode);+}++export function astToVercelSpec(astRoot: unknown): JsonRenderSpec {+ const elements: Record<string, JsonRenderElement> = {};+ let idCounter = 1;++ function generateId(type: string) {+ return `${type.toLowerCase()}-${idCounter++}`;+ }++ function processNode(node: unknown): string | null {+ if (!isElementNode(node)) return null;++ const id = generateId(node.typeName);+ const props: Record<string, unknown> = {};+ const children: string[] = [];++ for (const [key, value] of Object.entries(node.props || {})) {+ if (key === "_args") {+ if (!Array.isArray(value)) continue;++ value.forEach((arg, index) => {+ if (Array.isArray(arg)) {+ if (hasElementNode(arg)) {+ for (const child of arg) {+ const childId = processNode(child);+ if (childId) children.push(childId);+ }+ } else {+ props[`arg${index}`] = arg;+ }+ return;+ }++ const childId = processNode(arg);+ if (childId) {+ children.push(childId);+ } else {+ props[`arg${index}`] = arg;+ }+ });+ continue;+ }++ if (Array.isArray(value)) {+ if (hasElementNode(value)) {+ for (const child of value) {+ const childId = processNode(child);+ if (childId) children.push(childId);+ }+ } else {+ props[key] = value;+ }+ continue;+ }++ const childId = processNode(value);+ if (childId) {+ children.push(childId);+ } else {+ props[key] = value;+ }+ }++ elements[id] = {+ type: node.typeName,+ props,+ children,+ };++ return id;+ }++ const root = processNode(astRoot);+ if (!root) {+ throw new Error("AST root did not produce a json-render spec.");+ }++ return { root, elements };+}diff --git a/benchmarks/yaml-converter.ts b/benchmarks/yaml-converter.tsnew file mode 100644index 000000000..2f3c3ec95--- /dev/null+++ b/benchmarks/yaml-converter.ts@@ -0,0 +1,16 @@+import { stringify } from "yaml";++import { astToVercelSpec } from "./vercel-spec-converter.js";++export function astToYaml(astRoot: unknown) {+ const spec = astToVercelSpec(astRoot);++ // Strip empty children arrays — they add no information+ for (const el of Object.values(spec.elements)) {+ if (el["children"].length === 0) {+ delete (el as Record<string, unknown>)["children"];+ }+ }++ return stringify(spec, { indent: 2 }).trimEnd();+}diff --git a/docs/content/docs/openui-lang/benchmarks.mdx b/docs/content/docs/openui-lang/benchmarks.mdxindex 4dfffd66d..e5f6cdc34 100644--- a/docs/content/docs/openui-lang/benchmarks.mdx+++ b/docs/content/docs/openui-lang/benchmarks.mdx@@ -1,21 +1,22 @@---title: Benchmarks-description: Token efficiency and latency comparison of OpenUI Lang vs JSON-based streaming formats.+description: Token efficiency and latency comparison of OpenUI Lang vs YAML, Vercel JSON-Render, and Thesys C1 JSON.----OpenUI Lang is designed to be token-efficient and streaming-first. This page presents a reproducible benchmark comparing it against two JSON-based alternatives across seven real-world UI scenarios.+OpenUI Lang is designed to be token-efficient and streaming-first. This page presents a reproducible benchmark comparing it against three structured alternatives across seven real-world UI scenarios: YAML, Vercel JSON-Render, and Thesys C1 JSON.## Formats Compared| Format | Description || ---------------------- | -------------------------------------------------------------------------- || **OpenUI Lang** | Line-oriented DSL streamed directly by the LLM |-| **Thesys C1 JSON** | Normalized component tree JSON (`component` + `props`) |+| **YAML** | YAML `root` / `elements` spec payload || **Vercel JSON-Render** | JSONL stream of [JSON Patch (RFC 6902)](https://jsonpatch.com/) operations |+| **Thesys C1 JSON** | Normalized component tree JSON (`component` + `props`) |### Same output, different representations-All three formats encode exactly the same UI. Here is the same simple table in each:+All four formats encode exactly the same UI. Here is the same simple table in each:**OpenUI Lang** (148 tokens)@@ -24,7 +25,35 @@ root = Stack([title, tbl])title = TextContent("Employees (Sample)", "large-heavy")tbl = Table(cols, rows)cols = [Col("Name", "string"), Col("Department", "string"), Col("Salary", "number"), Col("YoY change (%)", "number")]-rows = [["Ava Patel", "Engineering", 128000, 6.5], ["Noah Kim", "Sales", 94000, 3.2], ["Mia Rodriguez", "Marketing", 88000, 4.1], ["Ethan Chen", "Finance", 102000, 2.4], ["Sophia Johnson", "HR", 79000, 5.0]]+rows = [["Ava Patel", "Engineering", 132000, 6.5], ["Marcus Lee", "Sales", 98000, 4.2], ["Sofia Ramirez", "Marketing", 105000, 3.1], ["Ethan Brooks", "Finance", 118500, 5.0], ["Nina Chen", "HR", 89000, 2.4]]+```++**YAML** (316 tokens)++```yaml+root: stack-1+elements:+ textcontent-2:+ type: TextContent+ props:+ text: Employees (Sample)+ size: large-heavy+ table-3:+ type: Table+ props:+ rows:+ - [...]+ children:+ - col-4+ - col-5+ - col-6+ - col-7+ stack-1:+ type: Stack+ props: {}+ children:+ - textcontent-2+ - table-3```**Vercel JSON-Render** (340 tokens)@@ -63,18 +92,18 @@ rows = [["Ava Patel", "Engineering", 128000, 6.5], ["Noah Kim", "Sales", 94000,Generated by GPT-5.2 at temperature 0. Token counts measured with `tiktoken` using the `gpt-5` model encoder.-| Scenario | Vercel JSON-Render | Thesys C1 JSON | OpenUI Lang | vs Vercel | vs C1 |-| ------------------ | -----------------: | -------------: | ----------: | ---------: | ---------: |-| simple-table | 340 | 357 | 148 | -56.5% | -58.5% |-| chart-with-data | 520 | 516 | 231 | -55.6% | -55.2% |-| contact-form | 893 | 849 | 294 | -67.1% | -65.4% |-| dashboard | 2,247 | 2,261 | 1,226 | -45.4% | -45.8% |-| pricing-page | 2,487 | 2,379 | 1,195 | -52.0% | -49.8% |-| settings-panel | 1,244 | 1,205 | 540 | -56.6% | -55.2% |-| e-commerce-product | 2,449 | 2,381 | 1,166 | -52.4% | -51.0% |-| **TOTAL** | **10,180** | **9,948** | **4,800** | **-52.8%** | **-51.7%** |+| Scenario | YAML | Vercel JSON-Render | Thesys C1 JSON | OpenUI Lang | vs YAML | vs Vercel | vs C1 |+| ------------------ | --------: | -----------------: | -------------: | ----------: | ---------: | ---------: | ---------: |+| simple-table | 316 | 340 | 357 | 148 | -53.2% | -56.5% | -58.5% |+| chart-with-data | 464 | 520 | 516 | 231 | -50.2% | -55.6% | -55.2% |+| contact-form | 762 | 893 | 849 | 294 | -61.4% | -67.1% | -65.4% |+| dashboard | 2,128 | 2,247 | 2,261 | 1,226 | -42.4% | -45.4% | -45.8% |+| pricing-page | 2,230 | 2,487 | 2,379 | 1,195 | -46.4% | -52.0% | -49.8% |+| settings-panel | 1,077 | 1,244 | 1,205 | 540 | -49.9% | -56.6% | -55.2% |+| e-commerce-product | 2,145 | 2,449 | 2,381 | 1,166 | -45.6% | -52.4% | -51.0% |+| **TOTAL** | **9,122** | **10,180** | **9,948** | **4,800** | **-47.4%** | **-52.8%** | **-51.7%** |-OpenUI Lang uses up to **67.1% fewer tokens** than both JSON alternatives across all scenarios.+OpenUI Lang uses up to **61.4% fewer tokens** than YAML, **67.1% fewer** than Vercel JSON-Render, and **65.4% fewer** than Thesys C1 JSON.---@@ -82,15 +111,15 @@ OpenUI Lang uses up to **67.1% fewer tokens** than both JSON alternatives acrossLatency scales linearly with output token count at a given generation speed. At **60 tokens/second** (typical for hosted frontier models):-| Scenario | Vercel JSON-Render | Thesys C1 JSON | OpenUI Lang | Speedup vs Vercel |-| ------------------ | -----------------: | -------------: | ----------: | ----------------: |-| simple-table | 5.67s | 5.95s | 2.47s | **2.3x faster** |-| chart-with-data | 8.67s | 8.60s | 3.85s | **2.3x faster** |-| contact-form | 14.88s | 14.15s | 4.90s | **3.0x faster** |-| dashboard | 37.45s | 37.68s | 20.43s | **1.8x faster** |-| pricing-page | 41.45s | 39.65s | 19.92s | **2.1x faster** |-| settings-panel | 20.73s | 20.08s | 9.00s | **2.3x faster** |-| e-commerce-product | 40.82s | 39.68s | 19.43s | **2.1x faster** |+| Scenario | YAML | Vercel JSON-Render | Thesys C1 JSON | OpenUI Lang | Speedup vs YAML | Speedup vs Vercel |+| ------------------ | -----: | -----------------: | -------------: | ----------: | ---------------: | ----------------: |+| simple-table | 5.27s | 5.67s | 5.95s | 2.47s | **2.14x faster** | **2.30x faster** |+| chart-with-data | 7.73s | 8.67s | 8.60s | 3.85s | **2.01x faster** | **2.25x faster** |+| contact-form | 12.70s | 14.88s | 14.15s | 4.90s | **2.59x faster** | **3.04x faster** |+| dashboard | 35.47s | 37.45s | 37.68s | 20.43s | **1.74x faster** | **1.83x faster** |+| pricing-page | 37.17s | 41.45s | 39.65s | 19.92s | **1.87x faster** | **2.08x faster** |+| settings-panel | 17.95s | 20.73s | 20.08s | 9.00s | **1.99x faster** | **2.30x faster** |+| e-commerce-product | 35.75s | 40.82s | 39.68s | 19.43s | **1.84x faster** | **2.10x faster** |The latency advantage compounds with UI complexity. A contact form renders **up to 3.0× faster**, and even complex dashboards and pricing pages — the kinds of UIs where Generative UI delivers the most value — render **2–3× faster** with OpenUI Lang.@@ -110,8 +139,10 @@ The latency advantage compounds with UI complexity. A contact form renders **up<div className="font-semibold mb-2">Conversion</div><p className="text-sm text-slate-600 dark:text-slate-400">The LLM generates OpenUI Lang. Thesys C1 JSON is a normalized AST projection (`component` +- `props`) that drops parser metadata (`type`, `typeName`, `partial`, `__typename`). Vercel- JSONL is produced by an RFC 6902-compliant converter that walks the same AST.+ `props`) that drops parser metadata (`type`, `typeName`, `partial`, `__typename`). The YAML+ payload and Vercel JSON-Render output are two serializations of the same json-render spec+ projection (`root`, `elements`, optional `state`): JSONL emits RFC 6902 patches, while YAML is+ serialized with <code>yaml.stringify(..., { indent: 2 })</code>.</p></div><div className="p-5 border border-slate-200 dark:border-slate-800 rounded-xl bg-slate-50 dark:bg-slate-900/40">@@ -119,7 +150,8 @@ The latency advantage compounds with UI complexity. A contact form renders **up<p className="text-sm text-slate-600 dark:text-slate-400">All formats measured with <code>tiktoken</code> using the <code>gpt-5</code> model encoder —the same tokenizer family as GPT-5.2. Whitespace and formatting is included as-is in the- count.+ count. For YAML, the benchmark counts the document payload only and excludes the outer+ <code>yaml-spec</code> fence.</p></div><div className="p-5 border border-slate-200 dark:border-slate-800 rounded-xl bg-slate-50 dark:bg-slate-900/40">@@ -153,9 +185,11 @@ pnpm benchSource files:-- `generate-samples.ts` — calls OpenAI, converts output to all three formats, saves to `samples/`+- `generate-samples.ts` — calls OpenAI, converts output to all four formats, saves to `samples/`- `run-benchmark.ts` — reads saved samples, counts tokens, prints the tables- `thesys-c1-converter.ts` — AST → normalized Thesys C1 JSON converter-- `vercel-jsonl-converter.ts` — RFC 6902-compliant AST → JSONL converter+- `vercel-spec-converter.ts` — AST → shared json-render spec projection (`root` / `elements`)+- `vercel-jsonl-converter.ts` — shared spec → RFC 6902 JSONL converter+- `yaml-converter.ts` — shared spec → YAML document converter- `schema.json` — full JSON Schema for the default component library (auto-generated by `library.toJSONSchema()`)- `system-prompt.txt` — system prompt for the default component library (auto-generated by `library.prompt()`)