Skip to content

Commit 776a3aa

Browse files
fix(comic,email): remaining dogfood bugs for 0.6.0 (#217)
* fix(comic,email): remaining dogfood bugs for 0.6.0 Keep balloon tails from collapsing, rounder clouds, ellipse words whole, and gradients from double-translating inside groups. Email overlap now tells the designer to put text in a frame; the status-bar preflight counts email compiler findings, not print bleed. The New text panel no longer auto-opens over the canvas. Leave wrap/fit (11, 20) to #85 and tail handles (18) to #155. Signed-off-by: Cursor Agent <cursoragent@cursor.com> * fix(comic,email): address #217 review nits Skip a too-narrow ellipse crown instead of dummy-wrapping or splitting a word that fits the equator. Honour tailLength in document units for area text. Clamp shallow, zero, and interior pointed tails without flipping x. Draw cloud balloons as round scallops; keep the jagged star for burst. Status-bar email preflight no longer compiles unprofiled documents. Regenerate linear-gradient-translated goldens after the double CTM offset and list that case on the reviewed baseline workflow so the visual lane runs on this PR. Signed-off-by: Cursor Agent <cursoragent@cursor.com> * fix(comic): keep balloon words whole and restore default tail length Ellipse wrap now uses the box as the hard cap, matching the painter: a word that fits the box stays whole instead of breaking at the crown, oversize words split at that box width, and closing punctuation stays with the word. The painter no longer measures a crown row against the next chord. A 30-160px shared-vs-painter sweep locks the contract. tailEndpoint is documented as balloon-local (x/y stay parent space). An omitted tail is again max(32, 35% of height); authored lengths under 24 still clamp to 24 so the tip cannot sit inside the body. Signed-off-by: Cursor Agent <cursoragent@cursor.com> * fix(e2e): open Text tool options after Email L closed auto-open The New text panel no longer opens on tool switch, so specs that need writing-mode defaults click Tool options first. The Enter rename case now asserts the Rename layer dialog instead of any dialog, which used to pass on the auto-opened options panel. Signed-off-by: Cursor Agent <cursoragent@cursor.com> * fix(comic): keep spaced punctuation on the previous balloon line layoutParagraph wrapped a punctuation-only token onto its own line when the crown was too narrow. The painter already appends that mark to the line that has text. The 30-160px parity sweep now includes Wait / mark / what, ellipses, spaced hyphens, and spaced commas. Signed-off-by: Cursor Agent <cursoragent@cursor.com> --------- Signed-off-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Cursor Agent <cursoragent@cursor.com>
1 parent 791d84f commit 776a3aa

34 files changed

Lines changed: 980 additions & 162 deletions

‎.github/workflows/visual-baselines.yml‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ on:
2828
type: choice
2929
options:
3030
- multilingual-text
31+
- linear-gradient-translated
3132
- canvas-empty-guidance-light
3233
- file-import-svg
3334
- file-import-svg-visibility
@@ -252,8 +253,11 @@ jobs:
252253
const target = process.env.VARVE_BASELINE_TARGET;
253254
const caseName = process.env.VARVE_BASELINE_APP_CASE;
254255
const projects = target === 'app-replay' ? ['chromium-visual-1x', 'chromium-visual-2x', 'chromium-visual-3x'] : ['chromium'];
255-
const replay = { spec: 'tests/e2e/visual/replay.spec.ts', title: 'replay visual: multilingual-text', snapshots: projects.map((project, index) => `tests/e2e/visual/replay.spec.ts-snapshots/multilingual-text-${index + 1}x-${project}-linux.png`) };
256-
const owner = target === 'app-replay' && caseName === 'multilingual-text' ? replay : target === 'app-ui' ? owners[caseName] : null;
256+
const replayCases = {
257+
"multilingual-text": { spec: 'tests/e2e/visual/replay.spec.ts', title: 'replay visual: multilingual-text', snapshots: projects.map((project, index) => `tests/e2e/visual/replay.spec.ts-snapshots/multilingual-text-${index + 1}x-${project}-linux.png`) },
258+
"linear-gradient-translated": { spec: 'tests/e2e/visual/replay.spec.ts', title: 'replay visual: linear-gradient-translated', snapshots: projects.map((project, index) => `tests/e2e/visual/replay.spec.ts-snapshots/linear-gradient-translated-${index + 1}x-${project}-linux.png`) },
259+
};
260+
const owner = target === 'app-replay' ? replayCases[caseName] : target === 'app-ui' ? owners[caseName] : null;
257261
if (!owner) throw new Error('Unknown application target/case; no broad or cross-namespace update is allowed');
258262
const grep = owner.title.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') + '$';
259263
const originalSnapshots = owner.snapshots.map((path) => ({ path, sha256: createHash('sha256').update(readFileSync(path)).digest('hex') }));

‎docs/architecture/browser-demo.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ seconds of page load.
1616
as demo when `location.pathname` starts with `/try` or the URL carries `?try=1`
1717
/ `?demo=1`. Desktop (Tauri) is excluded regardless of URL.
1818
- **Sample seeding**: `apps/desktop/src/demo/sampleDocument.ts` builds the sample
19-
document from the scene model API (current schema 2.33, `createDocument` + `addNode` +
19+
document from the scene model API (current schema 2.34, `createDocument` + `addNode` +
2020
`serializeDocument`). Seeded into IndexedDB on first visit; never overwrites user
2121
edits. Its fonts are preloaded before the document opens.
2222
- **Direct open**: `useDemoEntry` orchestrates seed → open → banner. The editor
@@ -168,9 +168,9 @@ an opaque loading overlay that never went away. Only the image showed it.
168168
## Known limitations
169169

170170
- Files stored in this browser only (IndexedDB); clearing site data deletes them.
171-
- The current sample is seeded with document schema 2.33. Opening it in an older
171+
- The current sample is seeded with document schema 2.34. Opening it in an older
172172
desktop build depends on that build's supported schema; keep a backup and use
173-
a release that understands schema 2.33 before continuing to edit it.
173+
a release that understands schema 2.34 before continuing to edit it.
174174
- WASM engine, not native desktop engine — slower rendering on large documents.
175175
- No autosave: edits must be saved explicitly (Ctrl+S), and anything after the
176176
last save is lost on close. An explicit save does now update the browser-local

‎packages/codegen/src/email-layout.test.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,7 @@ describe('email layout inference', () => {
312312
const overlap = diagnostics.find((item) => item.code === 'OVERLAP_SEMANTIC_CONTENT');
313313
expect(overlap?.severity).toBe('error');
314314
expect(overlap?.sourceNodeId).toBe('headline');
315+
expect(overlap?.suggestedFix).toMatch(/put each text block in its own frame/i);
315316
});
316317

317318
it('does not pin a width or height on live text', () => {

‎packages/codegen/src/email-layout.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ function reportOverlaps(parent: EmailIrNode, warnings: EmailIrWarning[]): void {
184184
sourceNodeId: first.sourceNodeId,
185185
category: 'layout',
186186
suggestedFix: semantic
187-
? 'Separate the overlapping objects, or move the artwork into a background colour.'
187+
? 'Put each text block in its own frame, separate the overlapping objects, or move the artwork into a background colour.'
188188
: 'Group the artwork and mark it decorative so it can be rasterised as one image.',
189189
});
190190
return; // one report per container is enough to point the designer at it

‎packages/editor/src/components/FloatingToolbar/ToolOptionsPopover.tsx‎

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,21 @@ const DEFAULT_TEXT_CREATION_SETTINGS = {
6060
textOrientation: 'mixed' as const,
6161
};
6262

63+
/**
64+
* Tools whose options panel opens on selection. Text is omitted: the New text
65+
* panel sits over the canvas and the first drag-create gesture hits the panel
66+
* instead of the canvas.
67+
*/
68+
export function shouldAutoOpenToolOptions(tool: ToolId): boolean {
69+
return (
70+
BRUSH_TOOLS.has(tool) ||
71+
MARQUEE_TOOLS.has(tool) ||
72+
MAGIC_WAND_TOOLS.has(tool) ||
73+
RETOUCH_TOOLS.has(tool) ||
74+
tool === 'liquify'
75+
);
76+
}
77+
6378
/**
6479
* One segmented-control grammar for every mutually exclusive tool-option row.
6580
* Roving tabindex with arrow keys (APG radiogroup): the marquee's Operation
@@ -399,14 +414,7 @@ export function ToolOptionsPopover() {
399414

400415
useEffect(() => {
401416
openSourceRef.current = 'tool-change';
402-
setOpen(
403-
BRUSH_TOOLS.has(state.tool) ||
404-
MARQUEE_TOOLS.has(state.tool) ||
405-
MAGIC_WAND_TOOLS.has(state.tool) ||
406-
RETOUCH_TOOLS.has(state.tool) ||
407-
state.tool === 'liquify' ||
408-
state.tool === 'text',
409-
);
417+
setOpen(shouldAutoOpenToolOptions(state.tool));
410418
}, [state.tool]);
411419

412420
useEffect(() => {
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { describe, expect, it } from 'vitest';
2+
import { shouldAutoOpenToolOptions } from './ToolOptionsPopover';
3+
4+
describe('shouldAutoOpenToolOptions', () => {
5+
it('opens brush and marquee options on tool change', () => {
6+
expect(shouldAutoOpenToolOptions('paint')).toBe(true);
7+
expect(shouldAutoOpenToolOptions('marquee')).toBe(true);
8+
expect(shouldAutoOpenToolOptions('liquify')).toBe(true);
9+
});
10+
11+
it('does not auto-open the New text panel so the first canvas drag creates a box', () => {
12+
expect(shouldAutoOpenToolOptions('text')).toBe(false);
13+
expect(shouldAutoOpenToolOptions('select')).toBe(false);
14+
});
15+
});

‎packages/editor/src/components/PreflightWarnings.test.tsx‎

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,31 @@
33
import '@testing-library/jest-dom/vitest';
44
import { fireEvent, render, screen } from '@testing-library/react';
55
import {
6+
addChild,
7+
addNode,
68
createDocument,
79
DEFAULT_BLEED,
10+
DEFAULT_EMAIL_PROFILE,
11+
DEFAULT_EMAIL_SEMANTIC_MAP,
812
type Document,
913
defaultCmykColorConfig,
14+
makeFrameNode,
15+
makeTextNode,
1016
type ShapeNode,
1117
} from '@varve/scene';
18+
import { useEffect } from 'react';
1219
import { describe, expect, it } from 'vitest';
13-
import { EditorProvider } from '../context';
20+
import { EditorProvider, useEditor } from '../context';
1421
import { PreflightWarnings } from './PreflightWarnings';
1522

23+
function SwitchToEmail() {
24+
const { requestWorkspaceSwitch } = useEditor();
25+
useEffect(() => {
26+
void requestWorkspaceSwitch('email');
27+
}, [requestWorkspaceSwitch]);
28+
return null;
29+
}
30+
1631
// The component uses useEditor() which throws if not within EditorProvider.
1732
describe('PreflightWarnings', () => {
1833
it('renders null when no editor context (throws without provider)', () => {
@@ -116,4 +131,47 @@ describe('PreflightWarnings', () => {
116131
screen.queryByRole('dialog', { name: /preflight issues/i, hidden: true }),
117132
).not.toBeInTheDocument();
118133
});
134+
135+
it('counts email preflight findings in email workspace, not print bleed', async () => {
136+
let doc = createDocument('email-status', true);
137+
const root = makeFrameNode('email-root', { name: 'Email', w: 600, h: 200 });
138+
const headline = makeTextNode('headline', 'Headline', {
139+
transform: [1, 0, 0, 1, 0, 0],
140+
w: 400,
141+
h: 120,
142+
});
143+
const caption = makeTextNode('caption', 'Caption', {
144+
transform: [1, 0, 0, 1, 200, 40],
145+
w: 300,
146+
h: 120,
147+
});
148+
doc = addNode(doc, root);
149+
doc = addChild(doc, root.id, headline);
150+
doc = addChild(doc, root.id, caption);
151+
doc = {
152+
...doc,
153+
emailProfile: DEFAULT_EMAIL_PROFILE,
154+
emailSemantics: {
155+
...DEFAULT_EMAIL_SEMANTIC_MAP,
156+
nodeLinks: {
157+
headline: { kind: 'web' as const, url: '' },
158+
},
159+
},
160+
};
161+
162+
render(
163+
<EditorProvider initialDocumentJson={JSON.stringify(doc)}>
164+
<SwitchToEmail />
165+
<PreflightWarnings />
166+
</EditorProvider>,
167+
);
168+
169+
const badge = await screen.findByRole('button', {
170+
name: /preflight: \d+ errors, \d+ warnings/i,
171+
});
172+
expect(badge).toHaveAccessibleName(/errors/i);
173+
expect(badge).not.toHaveAccessibleName(/bleed/i);
174+
fireEvent.click(badge);
175+
expect(screen.getByText(/url is empty/i)).toBeInTheDocument();
176+
});
119177
});

‎packages/editor/src/components/PreflightWarnings.tsx‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import { Icon, Popover } from '@varve/ui';
1616
import { useCallback, useEffect, useMemo, useState } from 'react';
1717
import { useEditor } from '../context';
1818
import { measureTextOverset, resetTextOversetCache } from '../render/textOverset';
19+
import { emailPreflightResult } from './emailPreflight';
1920
import './PreflightWarnings.css';
2021

2122
const SEVERITY_ORDER: CombinedPreflightSeverity[] = ['error', 'warning', 'info'];
@@ -82,14 +83,15 @@ export function PreflightWarnings() {
8283

8384
const result = useMemo(() => {
8485
if (!state.document) return null;
86+
if (state.workspaceMode === 'email') return emailPreflightResult(state.document);
8587
const measure = preflightMeasureContext();
8688
const overset = measure ? measureTextOverset(state.document, measure) : null;
8789
return runCombinedPreflight(state.document, {
8890
availableFonts: getFontRegistry().availableFamilies(),
8991
oversetMap: overset?.map,
9092
oversetUnmeasured: overset?.unmeasured.length ?? 0,
9193
});
92-
}, [state.document, fontEpoch]);
94+
}, [state.document, state.workspaceMode, fontEpoch]);
9395

9496
const hasIssues = result && result.errorCount + result.warningCount + result.infoCount > 0;
9597

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
import {
2+
addChild,
3+
addNode,
4+
createDocument,
5+
DEFAULT_EMAIL_PROFILE,
6+
DEFAULT_EMAIL_SEMANTIC_MAP,
7+
makeFrameNode,
8+
makeTextNode,
9+
} from '@varve/scene';
10+
import { describe, expect, it } from 'vitest';
11+
import { emailPreflightResult } from './emailPreflight';
12+
import { getEmailCompilation } from './Inspector/panels/emailCompilation';
13+
14+
function overlappingEmailDocument() {
15+
let doc = createDocument('email-status', true);
16+
const root = makeFrameNode('email-root', { name: 'Email', w: 600, h: 200 });
17+
const headline = makeTextNode('headline', 'Headline', {
18+
transform: [1, 0, 0, 1, 0, 0],
19+
w: 400,
20+
h: 120,
21+
});
22+
const caption = makeTextNode('caption', 'Caption', {
23+
transform: [1, 0, 0, 1, 200, 40],
24+
w: 300,
25+
h: 120,
26+
});
27+
doc = addNode(doc, root);
28+
doc = addChild(doc, root.id, headline);
29+
doc = addChild(doc, root.id, caption);
30+
return {
31+
...doc,
32+
emailProfile: DEFAULT_EMAIL_PROFILE,
33+
emailSemantics: {
34+
...DEFAULT_EMAIL_SEMANTIC_MAP,
35+
nodeLinks: {
36+
headline: { kind: 'web' as const, url: '' },
37+
},
38+
},
39+
};
40+
}
41+
42+
describe('emailPreflightResult', () => {
43+
it('counts compiler diagnostics, not print bleed', () => {
44+
const doc = overlappingEmailDocument();
45+
const compilation = getEmailCompilation(doc);
46+
const result = emailPreflightResult(doc);
47+
const diagnosticErrors =
48+
compilation?.ir.diagnostics.filter((item) => item.severity === 'error').length ?? 0;
49+
const outputErrors =
50+
compilation?.output.warnings.filter((item) => item.severity === 'error').length ?? 0;
51+
52+
expect(result.errorCount).toBe(diagnosticErrors + outputErrors);
53+
expect(result.errorCount).toBeGreaterThan(0);
54+
expect(result.issues.some((issue) => /url is empty/i.test(issue.message))).toBe(true);
55+
expect(result.issues.every((issue) => issue.source === 'email')).toBe(true);
56+
expect(result.issues.some((issue) => /bleed/i.test(issue.message))).toBe(false);
57+
});
58+
59+
it('does not compile an unprofiled document for the status-bar count', () => {
60+
const doc = createDocument('no-email-profile', true);
61+
expect(getEmailCompilation(doc)).toBeNull();
62+
const result = emailPreflightResult(doc);
63+
expect(result.errorCount).toBe(0);
64+
expect(result.warningCount).toBe(0);
65+
expect(result.issues).toEqual([]);
66+
});
67+
});
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import type { CombinedPreflightIssue, CombinedPreflightResult, Document } from '@varve/scene';
2+
import { getEmailCompilation } from './Inspector/panels/emailCompilation';
3+
4+
/**
5+
* Status-bar counts for Email workspace. Print preflight (bleed, fonts,
6+
* overset) is the wrong checklist here; the compiler diagnostics are what
7+
* the designer is actually looking at.
8+
*/
9+
export function emailPreflightResult(document: Document): CombinedPreflightResult {
10+
const compilation = getEmailCompilation(document);
11+
const warnings = compilation?.output.warnings ?? [];
12+
const issues: CombinedPreflightIssue[] = [
13+
...(compilation?.ir.diagnostics ?? []).map((diagnostic) => ({
14+
source: 'email' as const,
15+
severity: diagnostic.severity,
16+
category: diagnostic.category,
17+
message: diagnostic.message,
18+
nodeId: diagnostic.sourceNodeId,
19+
})),
20+
...warnings.map((warning) => ({
21+
source: 'email' as const,
22+
severity: warning.severity,
23+
category: warning.category,
24+
message: warning.message,
25+
nodeId: warning.sourceNodeId,
26+
})),
27+
];
28+
const errorCount = issues.filter((issue) => issue.severity === 'error').length;
29+
const warningCount = issues.filter((issue) => issue.severity === 'warning').length;
30+
const infoCount = issues.filter((issue) => issue.severity === 'info').length;
31+
return {
32+
issues,
33+
errorCount,
34+
warningCount,
35+
infoCount,
36+
ready: errorCount === 0,
37+
checks: [],
38+
};
39+
}

0 commit comments

Comments
 (0)