Add Layout's own macro slot arrangement - #14
Merged
Conversation
While researching Cratis/Stage#37, found that Layout had no way to represent Screenplay's `template`/`row`/`column`/`grid`/`variant` constructs, which position a layout's own named slots relative to each other. The existing Arrangement types on Slot only ever positioned that one slot's own filled content elements (FlowLeaf/ElementPlacement both embed a SceneElement) - there was nowhere to record which slot sits where within the layout itself, so a Stage translator would have had to silently drop that structure. Layout gets a new optional `Arrangement` (same FlowArrangement/ FreeformSlotArrangement types as a Slot's own arrangement), whose leaf content references a slot by name instead of an element: FlowSlotLeaf/SlotPlacement mirror FlowLeaf/ElementPlacement exactly, just swapping "which element" for "which slot". Fully additive - no existing type's shape changed, and FlowArrangementEvaluator is reused unmodified for the new macro case since it never inspects leaf content; only the freeform side needed a new evaluator (FreeformSlotArrangementEvaluator), which reuses the very same 'freeformCases' shared fixtures as FreeformArrangementEvaluator since the algorithm is identical and content-agnostic.
Evaluates a Layout's own FreeformSlotArrangement the same way FreeformArrangementEvaluator evaluates a Slot's - exact size-class match or nothing, no fallback. Both the C# and TypeScript specs reuse the existing 'freeformCases' shared fixtures verbatim: the algorithm only selects a variant by size class and never inspects what a placement's leaf content actually is, so the same corpus proves both evaluators.
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.
Added
Layout.Arrangement: an optionalFlowArrangement/FreeformSlotArrangementdescribing how a layout's own named slots position relative to each other, filling a gap where Screenplay'stemplate/row/column/grid/variantconstructs (which arrange slots) had nowhere to go in the object model - only a single slot's own filled content could be arranged before thisFlowSlotLeaf/SlotPlacement: the slot-referencing counterparts toFlowLeaf/ElementPlacement, used only within aLayout's own arrangement treeFreeformSlotArrangementEvaluator(+ TypeScriptevaluateFreeformSlotArrangement): selects aLayout's macro placement variant for a size class, mirroringFreeformArrangementEvaluatorContext
Found while implementing Cratis/Stage#37 (the Screenplay → Scene translation seam) - Screenplay's
layoutconstruct places named slots viatemplate/variantblocks, butLayouthad no field to receive that structure, onlySlot.Arrangementfor a slot's own content. Fully additive: no existing type's shape changed, andFlowArrangementEvaluatoris reused unmodified since it never inspects leaf content.