Skip to content

Layout engine: flow and freeform arrangement rendering #4

Description

@einari

Context

Screenplay's layout arrangement construct (flow with when overrides;
freeform with per-width/height-class variants) needs a runtime
implementation in Scene.Engine/Scene.React that actually reflows or
re-places content based on the active width/height size class.

Proposal

  • flow: implement neutral primitives (row, column, grid,
    grow, gap, span) mapped to CSS flex/grid in Scene.React, with
    when width <class> / when height <class> producing layout overrides
    evaluated against the current runtime size class — not raw pixel
    breakpoints.
  • freeform: implement variant selection keyed by the current
    (width class, height class) pair, falling back predictably (and
    warning, per the language design) when a targeted size class has no
    matching variant.
  • Both arrangement modes should be able to coexist per slot within one
    layout (pending the language-side decision on this) — the engine should
    not assume a layout is uniformly one mode.
  • Size-class computation itself (mapping actual viewport/window/device
    dimensions to compact/regular) needs to live here, shared by every
    renderer, so Scene.React and any future native renderer agree on
    when a class boundary is crossed.

Open questions

  • Whether size-class computation should be reactive (recompute on resize,
    live in Studio's preview) vs. fixed per launch (mobile devices, where
    orientation change is the only runtime variable) — likely both, but
    worth confirming the API shape handles both cases uniformly.

Dependencies

Depends on

Blocks

Size-class computation lands here and is shared by every renderer, so Scene.React and any future native renderer agree on class boundaries.

Part of the screen work — build order and full dependency map: #7


Implementation notes

Lands in Scene.Engine (TypeScript) — size-class computation and variant selection are runtime concerns that both Scene.React and any future native renderer share, so they must sit in the engine and not in a renderer.

The layout shape (the template tree, variants, placements) is part of the C# Scene.Model and its TypeScript mirror; the evaluation of it is the engine. See #1.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    screenScreen/UI work: Screenplay UI constructs, Scene runtime, Stage rendering, Studio designers

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions