feat(cv-v2): migrate Monogram Sidebar preset + multi-rect pageBackgrounds engine API#65
Merged
Merged
Conversation
…kgrounds engine API New v2 preset port of the legacy MonogramSidebarCvTemplateComposer: pale teal sidebar with a Crimson Text monogram badge, centered icon contact stack, education + expertise modules; right column carries the spaced-caps name, professional summary, experience, projects, and additional info. Engine — new multi-rect page-background API (additive, backward-compat): - PageBackgroundFill record with factory helpers (fullPage, leftColumn, rightColumn, column) defined as ratios of the canvas page size so the same fill scales across page formats. - DocumentSession.pageBackgrounds(List<PageBackgroundFill>) + parallel GraphCompose.DocumentBuilder.pageBackgrounds(List) builder method. - DocumentPageBackgrounds.apply now emits one fragment per fill per page, painted at z=0 in list order. The legacy single-color pageBackground(color) keeps working unchanged via delegation to a one-fill list. Theme — additive CvPalette extension: - New 5th field mainFill (defaults to WHITE) carrying the right-column background. 4-arg legacy constructor preserved so all 12 existing palette factories compile and behave identically. Preset highlights: - Two-column chrome painted via pageBackgrounds, so overflow content on page 2+ inherits the same visual structure with no preset-side filler logic. - Options exposes sidebarFillColor + mainFillColor for runtime overrides without forking the theme. - Reuses shared ProjectRenderer, LabelValueRenderer, SectionLookup, MarkdownInline, TextOrnaments.spacedUpper — no preset-local helpers that duplicate existing components. Tests: - 5 new direct tests for the multi-rect API (PageBackgroundTest): multi-fill emission, fullPage parity, empty-list clear, ratio validation, factory helpers. - New MonogramSidebarSmokeTest assertion verifying the two-column page chrome is emitted on every rendered page. - Visual parity baseline at src/test/resources/visual-baselines/cv-v2-layered/monogram_sidebar-page-0.png. - Full canonical suite: 958/958 passing. Refs: ADR-aligned (additive engine extension via new public record PageBackgroundFill; no engine internals leak to the public API).
| // -- Main column --------------------------------------------------- | ||
|
|
||
| private void addMain(SectionBuilder section, CvIdentity identity, | ||
| List<CvSection> sections, double anchorWidth) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
pageBackgrounds(List<PageBackgroundFill>)API for multi-rect page chrome — both columns repeat automatically on every page without preset-side filler logic.CvPalettegains a 5thmainFillfield with a 4-arg legacy constructor that preserves all 12 existing palette factories.Engine extension (additive, backward-compatible)
New public record
com.demcha.compose.document.api.PageBackgroundFillwith factory helpers (fullPage,leftColumn,rightColumn,column) defined as ratios of the canvas, so a single API scales across page formats.The legacy
pageBackground(color)keeps working unchanged — internally it delegates to a one-fill list. All 18 legacy callers (PageBackgroundTest,InvoiceTemplateV2Test,ProposalTemplateV2Test,PdfBackendExtensibilityTest,BusinessTheme,GraphCompose.DocumentBuilder) pass without modification.Preset highlights
Options.sidebarFillColor+Options.mainFillColorfor runtime colour overrides without forking the theme.ProjectRenderer,LabelValueRenderer,SectionLookup,MarkdownInline,TextOrnaments.spacedUpper— no preset-local helpers that duplicate existing components.Architecture
PublicApiNoEngineLeakTest— green (FQN-only usage of engine internals).ShapeContainerInvariantsTest— green.PageBackgroundFillis a public-API-package record; its validation and factory helpers are unit-tested directly.Test plan
PageBackgroundTest— 10 tests (5 legacy + 5 new direct multi-rect API tests, including validation + factory helpers + empty-list clear semantics).MonogramSidebarSmokeTest— 4 tests including a new assertion that the two-column page chrome is emitted on every rendered page.CvV2VisualParityTest— 14 presets including newmonogram_sidebarbaseline.Limitations / follow-ups (not in scope for this PR)
PaginationPolicy.ATOMIC, so the preset itself can't yet span multiple pages. The new engine API is multi-page-aware (its primary motivation) and will start scaling correctly the moment row-pagination contracts land. That work is a separate engine task.addSidebarHeader/addNameBlock/addContactBlockstay preset-local because no existingSectionHeader/Headline/ContactLinewidget variant matches their exact visual (centered + multi-line + stacked-icon shapes). Extracting these as new widget variants is a future refactor opportunity once a second preset wants them.