Skip to content

Make layout and elements far less fixed - #5

Merged
mattsenicksigma merged 5 commits into
mainfrom
feat/flexible-layout-and-elements
Oct 13, 2026
Merged

mattsenicksigma merged 5 commits into
mainfrom
feat/flexible-layout-and-elements

Conversation

@mattsenicksigma

@mattsenicksigma mattsenicksigma commented Oct 13, 2026 •

Copy link
Copy Markdown
Collaborator

Merge order: #5 → #6 → #4. The three open PRs are stacked in that order (each later PR's base is the previous PR's branch) so every diff shows only its own change and they merge without conflicts. Merge #5 into main first, then #6 (retarget to main after #5 merges), then #4.

This PR carries more than its own commits. #2 (the title / table-height / white-page fix) was merged into the stacked initial-package branch after #1 had already gone to main, so main still has the clipped H1 title and #3's presets were built on it. This PR contains #2's commits, so merging it brings the fix in; the preset goldens move accordingly (title style, content-sized heights, white background).

Corrected here: the earlier text said "a Sigma table does not paginate". That is true of the table element (no pagination or row-limit property), but Sigma can expand a table to all its rows through a layout attribute (flow="paginated"), which #4 adds. The README, design notes and macro docs now say so.

Addresses critique #4: the layout and element ceiling is lower than real reports need (flow layout with estimated heights, no multi-page tables, most chart kinds unmodeled, raw() = hand-written unchecked JSON).

What changed

1. The layout is a tree. Elements, row, stack, at() and page_break() are blocks; rows and stacks nest to any depth. Width flows down; height is measured up (measure: natural height, text sized from its width, flex weight) and then shared out (place). The rewrite reproduced the previous engine's output on every existing report (the only golden that moved is the leaderboard, whose chart height now follows the unified default).

2. Flexible heights. flex(block, weight, min) and h='fill' take a weighted share of leftover height (flex-grow semantics); a block with a flexible child is flexible, so "fill the page" works through any nesting.

3. at() / page_break(). Pinning is an explicit, checked exception: it must lie inside the content area, overlap has to be declared (overlap=true) and that declaration reaches the geometry check through a _-prefixed key that never goes to Sigma.

4. Tables over several pages. Found by experiment: Sigma can't paginate a table, but a RowNumber() column plus a number-range filter shows an exact row window, and Sigma accepts a hidden column for the filter. table(window=[a, b]) and table_pages(rows_per_page=, total_rows=) stack windows with page breaks. simple_dashboard(table_page_count=) uses it.

5. Every constant is a project setting (sigma_report_settings): page size, margin, gap, element heights, type sizes, and the text/table calibration numbers (the ones most likely to be wrong for another theme or font). Unknown keys fail at parse; per-call arguments win.

6. Element registry + checked raw(). scripts/generate_kinds.py generates macros/elements/kinds.sql from Sigma's own schema (29 kinds; CI fails if it is stale). raw() / extend() now reject an unknown kind, a missing required property or a misspelt property at dbt parse, listing what Sigma allows.

7. Typed macros for the rest of the chart family: combo (with secondary axis), waterfall, box, funnel, gauge, treemap, sankey, point/region/geography maps, plus progress, button and embed, on one channel_element assembler. Number literals ('0') work as fields.

Verification

  • Rendered in Sigma (pushed a 6-page report to staging and exported it to PDF): nested rows/stacks, flexible 2:1 heights, at(), a 90-row table over three pages (30 per page, correct windows, hidden column not shown, true total in each summary bar), combo with secondary axis, treemap, funnel, waterfall, gauge and box. Sigma's dry run accepted the report. The combo chart's flat line (no secondary axis) was found this way and fixed.
  • dbt 1.12 and dbt 2.0.0rc8, --warn-error: goldens identical on both, 62 negative cases (was 41), new step for settings overrides, kinds-registry check
  • 39 Python tests (kinds registry, overlap bookkeeping, plus the existing 33)
  • Not rendered: sankey, the three maps, progress, button, embed are validated against Sigma's request schema in CI only. Text/table calibration is still two measurements on one theme (now settings).

🤖 Generated with Claude Code

mattsenicksigma and others added 4 commits October 12, 2026 17:25
…round

A render of a pushed report (exported to PDF through the Sigma API) showed a long title
clipped inside its fixed 64px box: a markdown H1 is ~40px in Sigma's default theme.

- Titles, headings and text are sized from their characters and the width of the cell
  they land in. Heights are resolved in the layout flow, where width is finally known.
- Titles are bold 28px spans and headings 20px, not markdown H1/H3.
- Sigma tables do not paginate: they show a window of the first rows. table() takes
  rows= (default 10) to size the window from a measured 20px row + ~130px chrome,
  and h='fill' takes the rest of the page. fill is rejected inside rows and stacks.
- The report page background is white (theme.page_background) instead of the app gray.
- Tests: long-form report (wrapping title, narrow cell, rows=5, fill), 5 new negative cases.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The layout was a flow of fixed-height blocks with a two-level row/stack limit, tables could
not run over several pages, most Sigma chart kinds were unmodeled, and raw() took unchecked
JSON. Each of those is addressed.

- Layout is a recursive tree: rows and stacks nest to any depth. Heights are measured up
  (natural height from children, text sized from its width) and then shared out. flex()
  and h='fill' take a weighted share of leftover height. at() pins an element outside the
  flow (overlap must be declared, and is excluded from the geometry check), page_break()
  forces a page. The rewrite reproduced the old output on every existing report.
- Tables over several pages: table(window=[a, b]) shows rows a..b through a hidden
  RowNumber() column and a range filter (verified in Sigma), and table_pages() stacks
  windows with page breaks. simple_dashboard takes table_page_count.
- Every size and calibration constant (page size, margins, element heights, type sizes,
  text and table metrics) is a project setting (sigma_report_settings); unknown keys fail.
- An element-kind registry (kinds.sql) is generated from Sigma's schema by
  scripts/generate_kinds.py (CI checks it is current). raw() and extend() reject unknown
  kinds, missing required properties and misspelt properties at dbt parse.
- Typed macros for combo (with secondary axis), waterfall, box, funnel, gauge, treemap,
  sankey, point/region/geography maps, progress, button and embed, built on one
  channel_element assembler. Number literals work as fields.
- Tests: new flexible-layout report, settings-override step, 62 negative cases, kinds tests.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Brings in report presets (#3). Both sides added independent test helpers and checks (kept).
The preset goldens move only because they now pick up the title fix, content-sized heights
and white page background from #2, which had been merged into the stacked branch rather
than main.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@mattsenicksigma
mattsenicksigma changed the base branch from feat/layout-heights-and-title to main October 13, 2026 01:11
mattsenicksigma added a commit that referenced this pull request Oct 13, 2026
…ports

Aligns the two. Resolved: report() keeps both settings-driven defaults and schedules; request_body() strips
schedules and any _-prefixed bookkeeping; schema.yml keeps #5's entries plus #6's actions/schedule entries
(and the report schedules argument). button() was defined in both: #5's thinner copy is dropped, #6's
action-aware button is the one macro, and its height is now the button_h project setting. Goldens regenerate
for the tree layout.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
A table element has no pagination or row-limit property, which is what the windows (table_pages) work
around. But Sigma can also expand a table to all its rows at render time via flow="paginated" on the
layout entry - a separate feature, verified live while aligning the open PRs. Reword README, design notes,
macro comments and schema descriptions so they say what is true.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
mattsenicksigma added a commit that referenced this pull request Oct 13, 2026
…numbers

Re-applies #4's features on the tree layout: paginate= on table / pivot_table (flow="paginated" on the layout
entry), the rule that a paginated element is the last block on its page (and not in a row, stack or panel),
row(lead=), page_number() and report(page_numbers=). report_from_args now forwards page_numbers and schedules.
check_layout keeps #4's paginated-flow checks and #5's overlap allowance. schema.yml gains the new arguments
(in signature order, which dbt validates). Goldens regenerate.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@mattsenicksigma
mattsenicksigma merged commit 976d27c into main Oct 13, 2026
2 checks passed
mattsenicksigma added a commit that referenced this pull request Oct 13, 2026
Main now has the tree layout, settings and element registry (#5). Conflicts were additive: the README component
table (filter_by_value added to the Report row), the column-reference walker in the test macros (kept both
the typed columnIds handling and the list-filter exclusion), and the assert_reports model list. Goldens
regenerate for the new layout.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant