Commit History
18 days ago
-
perf(frontend): load Mermaid, Shiki grammars and language detection on demand
- Mermaid is imported when a diagram renders - the editor uses shiki/core with the JavaScript regex engine and fetches each grammar the first time a block needs it; only SHIKI_LANGS ship - highlight.js language detection loads with the first language-less block - the chat panel and Embed Studio are lazy components - shiki-langs.ts holds the shared language/theme constants without a runtime Shiki import; the publisher keeps the eager highlighter Entry chunk: 2.79 MB -> 1.60 MB (813 KB -> 492 KB gzip). Co-authored-by: Cursor <cursoragent@cursor.com>d840d7c -
feat(frontend): browser-only live demo mode
VITE_DEMO=1 builds (or ?demo in dev) run the editor with no backend: - a local Y.Doc behind a LocalProvider, no IndexedDB, fresh on every load - scripted co-authors (Alice, Bob and Alice's agent) editing the sample article through Yjs awareness, pausing while the visitor types, replaying in a loop, and toned down for prefers-reduced-motion - AI chat, embed chat, publish, history, preview, DOI lookups and the embed check switched off with clear UI states; uploads stay inline - a network guard that fails any request to backend routes locally - Download .mdx built in the browser with the shared Markdown renderer - build:demo script and y-protocols as a direct dependency Co-authored-by: Cursor <cursoragent@cursor.com>6e392fe
20 days ago
-
feat(embed-studio): tweak panel, inspect, automatic check, launcher, inline edit
- Tweak panel: embeds declare 2 to 6 settings in a data-embed-config JSON block (contract + agent prompt updated, runtime 1.2.0 exposes them as ctx.config and applies embedConfig messages live). Sliders, colors, selects, toggles and text update the preview instantly with no model call and are saved back as "manual tweak" versions. - Inspect: a point-and-click inspector in the studio preview; the picked element becomes an @this pointer for the next message, and a label held by a text setting can be edited without the AI. - Automatic check after each iteration: POST /api/embed-check renders the chart in headless Chromium (light/dark, 360/680 px, CDN-only network, one at a time) with the embed checker, now in src/embed-check, and the studio shows "N checks passed, 1 warning [Fix]". - Launcher for new figures (description, CSV drop, 4 gallery starters from GET /api/embed-starters, existing charts) from the top bar and the slash menu, instead of opening a random chart.…4953bfd -
feat(embed-studio): drafts with Apply to article, compare, data drawer
- The studio edits a shared draft (Y.Map("embed-drafts")); the article keeps the applied chart until "Apply to article". New charts from the slash menu or the top bar get their node only on Apply, at the cursor position kept as a Yjs relative position: no more empty nodes. - Closing with unapplied changes offers apply, keep draft or discard; the node shows "X is editing this chart" (awareness) or "Unapplied draft by X". Charts already in the article are not renamed. - Before/after compare reuses the two preview iframes side by side, with a line diff in the Code tab. - Docked data drawer with typed columns and a "used by this chart" flag; files dropped on the chat and tables pasted into it become data files attached to the next message. - "Writing chart... N lines" while the tool input streams. - The conversation of each chart is shared in Y.Map("embed-chats") (readable text only) instead of localStorage. Co-authored-by: Cursor <cursoragent@cursor.com>f7733a1 -
feat(embed-studio): error loop, versions, chips and preview controls
- Preview errors reach the agent: a studio-only reporter in the srcdoc relays uncaught errors, rejections, failed loads and embed:error to the parent; the studio shows "The chart threw ... [Fix it]" and sends one automatic fix per user message. - Versions per agent turn in Y.Map("embed-versions") (shared, capped at 20): vN / Restore / Compare under each reply, Undo last change; restore appends a copy so history stays linear. - Starter and follow-up prompt chips, preview width presets (Article, Wide, 360) and a local light/dark toggle pushed with setTheme. - The agent's title and source land on the node; Shiki code view with Copy and Download. - Provider errors keep their HTTP status; 401/402/429 become actionable messages with Retry; model name in the header; Done replaces Save & Close; no more fake "Generating chart..." banner. - Minimal mobile layout: files drawer and Chat / Preview tabs under 900px. Co-authored-by: Cursor <cursoragent@cursor.com>461e15a