PseudoScript
Module

layout

data

Activation #

private
layout::Activation

An execution-activation bar on a lifeline, spanning a participant's first-to- last involvement; `owner` marks the entry's focus lifeline.

Entities Entity diagram scroll to zoom · drag to pan
RECORDActivationparticipantstringxnumbertopnumberbottomnumberownerbool
component

Core #

public
layout::Core

The shared geometry/text core: measures label and title widths, wraps descriptions to a width, and accumulates bounding boxes. Every engine builds on it, so text sizing and bounds math live in exactly one place.

Parent

Scenarios

SharedGeometryCore

The geometry/text core is the single home for sizing and bounds.

  • given an engine that must size labels and accumulate a bounding box
  • when it measures text or grows its bounds
  • then it calls the shared core rather than re-implementing the math
  • and text sizing and bounds accumulation live in exactly one place
Flow Flow — SharedGeometryCore scroll to zoom · drag to pan
FEATURESharedGeometryCorefor CoreGIVENan engine that must size labels andaccumulate a bounding boxWHENit measures text or grows its boundsTHENit calls the shared core rather thanre-implementing the mathANDtext sizing and bounds accumulationlive in exactly one place
data

Diagram #

public
layout::Diagram

A structural sequence diagram: the participants (lifelines) and the ordered items — messages and nested fragments — traced down them. The sequence engine's input.

Entities Entity diagram scroll to zoom · drag to pan
RECORDDiagramparticipantslayout::Participant[]itemslayout::Item[]RECORDParticipantidstringlabelstringkindstringsummarystringparentPathstringUNIONItemMessageItemFragmentItem
data

Divider #

private
layout::Divider

A horizontal split between two fragment sections: its y and the following section's guard.

Entities Entity diagram scroll to zoom · drag to pan
RECORDDividerynumberguardstring
data

FragKind #

private
layout::FragKind

The kind of a fragment frame: an `alt` (if/else) or a `loop` (for/while).

Entities Entity diagram scroll to zoom · drag to pan
UNIONFragKindAltLoopRECORDAltcondLabelstringthenStepsmodel::Step[]elseStepsmodel::Step[]RECORDLoopcondLabelstringbodymodel::Step[]
data

Fragment #

private
layout::Fragment

A nestable fragment over a body of items, drawn as an enclosing frame: its kind and the labelled sections it splits into (an `alt` has several).

Entities Entity diagram scroll to zoom · drag to pan
RECORDFragmentkindlayout::FragKindsectionslayout::Section[]UNIONFragKindAltLoopRECORDSectionguardstringbodylayout::Item[]
data

FragmentItem #

private
layout::FragmentItem
Entities Entity diagram scroll to zoom · drag to pan
RECORDFragmentItemfragmentlayout::FragmentRECORDFragmentkindlayout::FragKindsectionslayout::Section[]
data

Item #

private
layout::Item

One ordered item down the lifelines: a message or a nested fragment.

Entities Entity diagram scroll to zoom · drag to pan
UNIONItemMessageItemFragmentItemRECORDMessageItemmessagelayout::MessageRECORDFragmentItemfragmentlayout::Fragment
container

Layout #

public
layout::Layout

`crates/pseudoscript-layout`. The geometry/text `Core` and the sequence engine, each built on the `Projection` contract — turn a structural input into a positioned output under tunable metrics. The sequence engine is the only one implemented here: C4 placement is delegated to `dot` (the layered engine), which `emit` drives directly; a flowchart engine is a planned extension point on the same core, not yet built.

Inbound

Outbound

Scenarios

OneContractPerEngine

Every engine implements one contract: structure in, coordinates out.

  • given a structural diagram description and its tunable metrics
  • when the matching engine lays it out
  • then the input is turned into absolute coordinates under the metrics
  • and the result is positioned geometry the consumer renders verbatim
Flow Flow — OneContractPerEngine scroll to zoom · drag to pan
FEATUREOneContractPerEnginefor LayoutGIVENa structural diagram description andits tunable metricsWHENthe matching engine lays it outTHENthe input is turned into absolutecoordinates under the metricsANDthe result is positioned geometry theconsumer renders verbatim
LayoutIsPureAndShared

Layout is pure and shared — one place, identical everywhere.

  • given the same structural input laid out twice
  • when the results are compared
  • then the coordinates are identical and deterministic
  • and the static SVG renderer and the web IDE share this one implementation
  • but the engine performs no rendering and no I/O
Flow Flow — LayoutIsPureAndShared scroll to zoom · drag to pan
FEATURELayoutIsPureAndSharedfor LayoutGIVENthe same structural input laid outtwiceWHENthe results are comparedTHENthe coordinates are identical anddeterministicANDthe static SVG renderer and the webIDE share this one implementationBUTthe engine performs no rendering andno I/O
Components Component diagram scroll to zoom · drag to pan
PseudoscriptLayoutCOMPONENTCoreThe shared geometry/text core: measureslabel and title widths, wraps descriptions…COMPONENTSequenceThe sequence engine: lays a structural`Diagram` out into a `SequenceLayout` —…CONTAINEREmit`crates/pseudoscript-emit`. Projects a viewinto a `Scene` and renders it to SVG; C4…
data

Message #

private
layout::Message

A message between two lifelines: its source and target ids (equal for a self-message), kind, primary label (method name or return marker), and the dimmed detail after it (a call signature or return type). `source` is the wire field `from`, renamed because `from` is a PseudoScript keyword.

Entities Entity diagram scroll to zoom · drag to pan
RECORDMessagesourcestringtostringkindlayout::MsgKindlabelstringdetailstringUNIONMsgKindCallReturnSelfMsg
data

MessageItem #

private
layout::MessageItem
Entities Entity diagram scroll to zoom · drag to pan
RECORDMessageItemmessagelayout::MessageRECORDMessagesourcestringtostringkindlayout::MsgKindlabelstringdetailstring
data

Metrics #

public
layout::Metrics

Tunable spacing and font metrics for the sequence engine — head-card sizing, row advance per message kind, fragment padding. Field detail is the engine's concern; the defaults are the one source of truth consumers start from.

Inbound

Entities Entity diagram scroll to zoom · drag to pan
BLACKBOXMetrics
data

MsgKind #

private
layout::MsgKind

The kind of a sequence message: a call to another lifeline, a return to the caller, or a self-message on the sender's own lifeline.

Entities Entity diagram scroll to zoom · drag to pan
UNIONMsgKindCallReturnSelfMsgRECORDCallmessagestringRECORDReturnmarkerstring
data

Participant #

private
layout::Participant

One lifeline: its id (FQN), display label, C4 kind for the head card, optional summary, and the ancestry path shown under the name for container/component lifelines.

Entities Entity diagram scroll to zoom · drag to pan
RECORDParticipantidstringlabelstringkindstringsummarystringparentPathstring
data

PlacedFragment #

private
layout::PlacedFragment

A placed fragment frame: its box, the operator-tab label (the first section's guard), and the dividers splitting later sections.

Entities Entity diagram scroll to zoom · drag to pan
RECORDPlacedFragmentkindlayout::FragKindrectlayout::Rectlabelstringdividerslayout::Divider[]UNIONFragKindAltLoopRECORDRectxnumberynumberwnumberhnumberRECORDDividerynumberguardstring
data

PlacedMessage #

private
layout::PlacedMessage

A placed message: its kind, source/target ids, endpoint x-positions, row y, direction (+1 left-to-right, -1 right-to-left), reading-order step, label, and detail.

Entities Entity diagram scroll to zoom · drag to pan
RECORDPlacedMessagekindlayout::MsgKindsourcestringtostringfromXnumbertoXnumberynumberdirnumberstepnumberlabelstringdetailstringUNIONMsgKindCallReturnSelfMsg
data

PlacedParticipant #

private
layout::PlacedParticipant

A placed lifeline: its id, label, kind, ancestry path, wrapped summary lines, head-card rectangle, the lifeline's centre x, and the y span of its dashed line.

Entities Entity diagram scroll to zoom · drag to pan
RECORDPlacedParticipantidstringlabelstringkindstringparentPathstringsummaryLinesstring[]cardlayout::RectlifelineXnumbertopnumberbottomnumberRECORDRectxnumberynumberwnumberhnumber
data

Point #

private
layout::Point

A point in renderer coordinates.

Entities Entity diagram scroll to zoom · drag to pan
RECORDPointxnumberynumber
data

Rect #

public
layout::Rect

An axis-aligned rectangle: its top-left corner and extent.

Entities Entity diagram scroll to zoom · drag to pan
RECORDRectxnumberynumberwnumberhnumber
data

Section #

private
layout::Section

One compartment of a fragment: its guard label (shown in the operator tab or beside a divider) over a body of items.

Entities Entity diagram scroll to zoom · drag to pan
RECORDSectionguardstringbodylayout::Item[]UNIONItemMessageItemFragmentItem
component

Sequence #

private
layout::Sequence

The sequence engine: lays a structural `Diagram` out into a `SequenceLayout` — lifeline x-positions in first-appearance order, message rows stacked by evaluation order, and fragment frames sized to their bodies. The only engine implemented in this crate; C4 placement is `dot`'s job (`emit` drives it), and a flowchart engine would follow the same `Projection` contract.

Parent

Inbound

data

SequenceLayout #

public
layout::SequenceLayout

A laid-out sequence diagram: the canvas size plus every participant, message, activation bar, and fragment placed at absolute coordinates the renderer draws verbatim. The sequence engine's output.

Inbound

Entities Entity diagram scroll to zoom · drag to pan
RECORDSequenceLayoutwidthnumberheightnumberparticipantslayout::PlacedParticipant[]messageslayout::PlacedMessage[]activationslayout::Activation[]fragmentslayout::PlacedFragment[]RECORDPlacedParticipantidstringlabelstringkindstringparentPathstringsummaryLinesstring[]cardlayout::RectlifelineXnumbertopnumberbottomnumberRECORDPlacedMessagekindlayout::MsgKindsourcestringtostringfromXnumbertoXnumberynumberdirnumberstepnumberlabelstringdetailstringRECORDActivationparticipantstringxnumbertopnumberbottomnumberownerboolRECORDPlacedFragmentkindlayout::FragKindrectlayout::Rectlabelstringdividerslayout::Divider[]
data

Size #

private
layout::Size

A width/height extent.

Entities Entity diagram scroll to zoom · drag to pan
RECORDSizewnumberhnumber
Generated by pds doc.