Skip to content

Add layout arrangement evaluation engine - #10

Merged
einari merged 4 commits into
mainfrom
feature/layout-evaluation-engine
Aug 15, 2026
Merged

Add layout arrangement evaluation engine#10
einari merged 4 commits into
mainfrom
feature/layout-evaluation-engine

Conversation

@einari

@einari einari commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Added

  • SizeClassCalculator.Compute() (C#) / computeSizeClass() (TypeScript) - computes the current width x height size class from actual available dimensions, shared by every renderer so they all agree on when a class boundary is crossed. (Layout engine: flow and freeform arrangement rendering #4)
  • FlowArrangementEvaluator.Evaluate() / evaluateFlowArrangement() - selects the most specific matching when width/height <class> override's tree for the current size class (both dimensions targeted beats one; the last declared wins among equally specific matches), falling back to the base tree when nothing matches. (Layout engine: flow and freeform arrangement rendering #4)
  • FreeformArrangementEvaluator.Evaluate() / evaluateFreeformArrangement() - selects the placement variant with an exact size-class match, or nothing - deliberately no fallback, matching the language's own "warn, don't silently pick" design for a size class with no matching variant. (Layout engine: flow and freeform arrangement rendering #4)
  • FlowArrangement gained an Overrides list (C#) / overrides (TypeScript) - the model previously had no field at all for Screenplay's when width/height <class> override construct, unlike FreeformArrangement which was already keyed by size class.
  • A shared JSON fixture corpus (layout-evaluation-fixtures.json) asserted independently by both the C# and TypeScript specs, following the same pattern established for the package resolver in ui profile package resolution engine #3/Add ui profile package resolution engine #9.

Notes

Per Scene#8's original design (confirmed against its merged PR description), Slot.Arrangement is per-slot, not per-layout - this evaluation engine works against that shape as-is and does not assume every slot in a layout shares one arrangement mode.

einari added 4 commits August 15, 2026 10:16
FlowArrangement had only a single unconditional root tree - nowhere
to represent Screenplay's when width/height <class> overrides, unlike
FreeformArrangement which already keys its variants by size class.
FlowOverride replaces the root for a targeted width and/or height size
class; both dimensions are independently optional to match what
Screenplay's when clause actually allows (width-only, height-only, or
both).
SizeClassCalculator computes a SizeClass from actual available
dimensions, shared by every renderer. FlowArrangementEvaluator
selects the most specific matching override's tree (both dimensions
targeted beats one; last declared wins among equally specific
matches), falling back to the base root. FreeformArrangementEvaluator
selects the variant with an exact size-class match, or nothing -
deliberately no fallback, matching the language's own "warn, don't
silently pick" design for an unmatched size class.
computeSizeClass/evaluateFlowArrangement/evaluateFreeformArrangement
are the runtime twins of the C# evaluators, run whenever a screen
renders and its available size may have changed.
layout-evaluation-fixtures.json is asserted independently by both
Cratis.Scene.Engine.Specs (C#) and @cratis/scene.engine's own Vitest
suite, covering flow override specificity/tie-breaking and freeform
exact-match selection - the same pattern used for the package resolver
in #3.
@einari einari added screen Screen/UI work: Screenplay UI constructs, Scene runtime, Stage rendering, Studio designers minor labels Aug 15, 2026
@einari
einari merged commit 0198012 into main Aug 15, 2026
5 of 6 checks passed
@einari
einari deleted the feature/layout-evaluation-engine branch August 15, 2026 08:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

minor screen Screen/UI work: Screenplay UI constructs, Scene runtime, Stage rendering, Studio designers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant