Files
Samraaj BathandClaude Opus 4.8 27cccd8964 Don't lock content-derived button widths; nowrap icon+text chips
Two general fixes for single-line chips/pills whose labels wrapped onto
a second line in generated output:

1. fixedWidthButtonLike treated any constant-width button as authored
   fixed-width, but a content-sized chip whose label never changes paints
   the same width at every viewport. When the sizing probe proved
   width:auto reproduces the box at its own max-content at every painted
   sample (with genuinely wrappable text inside), the width is
   content-derived - don't lock it. Baking that px invited the emitters'
   quantization (snapLen 0.1px rounding, snapBase spacing-scale snap) to
   land fractionally below the intrinsic single-line width, wrapping the
   last word. Authored intent (sourceFixedWidth/sourceFixedSize) still
   locks.

2. nowrapWrapVulnerable bailed on any element child, so an icon svg
   beside the label disqualified the classic icon+text chip shape.
   Replaced children (svg/img/...) can't wrap and their constant width is
   already inside the probe's wMin/wMax, so they're now permitted; any
   non-replaced element child still bails.

525 tests (5 new), typecheck clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-06 13:36:09 -07:00
..
2026-06-29 15:11:48 -07:00
2026-06-29 16:14:44 -07:00
2026-06-29 16:14:44 -07:00
2026-06-29 15:11:48 -07:00
2026-06-29 15:11:48 -07:00
2026-06-29 15:11:48 -07:00
2026-06-29 16:14:44 -07:00
2026-06-29 15:11:48 -07:00

ditto.site Compiler

This workspace contains the deterministic compiler used by ditto.site. It captures a source URL, builds a render IR, infers assets/fonts/tokens/sections/recipes/SEO, generates a Next.js App Router app by default or a Vite React app on request, and validates the result with deterministic gates.

The full architecture overview lives in ../README.md. This file keeps only compiler-local commands and notes.

Commands

cd compiler
npm install
npx playwright install chromium

npm run clone -- https://example.com/
npm run clone -- https://example.com/ --serve   # then npm install + npm run dev
npm run clone -- https://example.com/ --open    # ...and open the browser too
npm run clone -- https://example.com/ --mode=multi --styling=tailwind
npm run clone -- https://example.com/ --mode=single --framework=vite
npm run clone-site -- https://example.com/
npm run validate-site -- ../runs/site-example.com/<timestamp>
npm run clone -- https://example.com/ --mode=multi --concurrency=5
npm run clone -- https://example.com/ --mode=multi --validate --validate-concurrency=3 --viewport-concurrency=2
npm run validate-site -- ../runs/site-example.com/<timestamp> --validate-concurrency=3 --viewport-concurrency=2
npm run bench -- --tier=easy
npm run bench-site
npm run quality -- ../runs/example.com/<timestamp>
npm run audit -- ../runs/example.com/<timestamp>
npm test
npm run typecheck

Root-level scripts forward to these commands, so npm run clone -- <url> works from the repository root too.

("Clone" here = generating a codebase from a live URL, not git clone; no source repo required.) On success the CLI prints a copy-paste-safe summary: a single quoted cd … && npm install && npm run dev line plus safe-to-edit pointers. Pass --serve to run install + dev automatically, or --open to also launch the browser. Without --out, a runs/<site>/latest symlink always points at the newest run so paths aren't timestamp-fragile.

Multi-page generation defaults to the fast no-validation path. Use --validate when the clone command itself should run the full build/render/gates QA pass, or run validate-site separately. --concurrency controls source route capture; --validate-concurrency controls how many routes validation grades at once; and --viewport-concurrency controls how many clone viewports each route renders at once.

Generated App Shape

Default Next generated apps use src/app/ditto.css and optional helpers under src/app/ditto/. Vite generated apps use src/ditto.css and optional helpers under src/ditto/, with multi-route pages under src/routes/. Validation builds keep data-cid attributes for source/clone alignment; delivered apps strip those validation ids and keep only required data-ditto-id anchors.