feat: add predictable layout primitives#99
Merged
Conversation
|
To preview the documentation for this pull request, visit the following URL:
|
|
Visit the preview URL for this PR (updated for commit 4881c97): https://superdeck-dev--pr99-feat-predictable-lay-0iwgkttd.web.app (expires Wed, 12 Aug 2026 23:34:41 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: bd68fc230762285849207e7e120aaf87cd4ca2f9 |
Replace SlideStyle.blockContainer's BoxStyler with a constrained, modifier-free BlockStyler; add first-class block margin beside padding across authoring, models, contracts, serializer, rendering, docs, and demo; split inset authoring from the normalized compiled contract; canonicalize nested directive formatting; derive the Playground AI slide schema from the core contract; normalize image numeric args; and make the debug overflow indicator a non-obscuring frame outline.
The integration-test TestApp harness hardcodes its own deck styles map, which drifted from lib/main.dart when the boxed style was added. Loading the real demo deck in startup_test then threw "Unknown style boxed" inside the slides computed, surfacing as a SignalEffectException from DeckSessionState and failing the Integration Tests CI job. Register boxedStyle() in the harness so it resolves every style used in slides.md.
Extend the layout showcase deck from 11 to 13 slides with frame-size and treatment-matrix examples, document spacing controls, and add block margin to the panel style.
Adopt the generated Mix styling layer while retaining BlockStyler's constrained API, render-boundary sanitization, and the branch's layout showcase changes.
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
Adds a complete set of predictable layout primitives to
slides.md— section spacing, block margin and padding, alignment inheritance, image paint scaling, and debug overflow diagnostics — and constrains the framework-owned block container to a new modifier-freeBlockStyler. Authors get polished layouts in Markdown; the style API can no longer express competing geometry owners.Changes and impact
@section spacingadds finite, non-negative gaps only between sibling blocks and clamps oversized gaps to the available width. Spacing owns sibling gutters.marginandpadding. Margin is consumed inside a block's allocated frame, outside its decoration; padding sits between the decoration and content. Overrides replace only the matching resolved inset after style variants resolve, preserving decoration, foreground decoration, clipping, and animation. Absent means inherit; explicit zero removes the inset. Both keys are reserved block metadata and never reach widget args. Margin never changes section spacing or flex ratios.BlockStyler:SlideStyle.blockContainernow takesBlockStyler(resolving to MixBoxSpec) exposing only padding, margin, decoration, foreground decoration, clip behavior, context/BlockVariantvariants, and animation. Widget modifiers, constraints, transforms, and box alignment are unrepresentable —StyleSpec.widgetModifiersis always null for block containers.Block.parseAuthoring,BlockInsets.parseAuthoringwith exact field/edge errors); compiled contracts accept only closed four-edgetop/right/bottom/leftobjects and reject shorthand. The exported JSON schema reflects the normalized contract.aiSlideSchemaprojection (flattened for structured-output adapters); the copied block/section/alignment/flex schemas and their generated types are deleted. Sanitization preservesspacing,padding, andmarginand feeds normalized data through the canonical parser.block -> section -> centerLeft, reaching built-in and custom block rendering.@image scalepaints inside an aligned, clipped frame without changing flex geometry;width,height, andscaleaccept integers or doubles through one finite-positive rule (width: 300,scale: 1).Authoring example
The inner braces are YAML flow mappings, so multiline entries require commas. Scalar shorthand stays inline (
@block { padding: 16 }).Compatibility
This is an intentional hard break with no compatibility shims:
SlideStyle.blockContainerchanges fromBoxStyler?toBlockStyler?; block-container modifiers are no longer expressible.padding/marginare normalized four-edge objects only.marginjoins the reserved widget-arg keys.Validation
melos run build_runner:build,contracts:export,contracts:check— clean, no drift on second runmelos run analyze:dart(dart analyze --fatal-infos) — clean across all packagesmelos run test— all packages pass, including new contract, formatter,BlockStyler, margin rendering, image numeric, Playground parity, and overflow regression testsdemolayout matrix integration test passes on macOS