emit
emit::BoundaryFrame An enclosing frame of a boundary view: the boundary node's FQN (so the canvas can drill into it), title, C4 kind (frame accent), and the cluster rectangle.
emit::C4EdgeKind The relationship a routed edge expresses: a body `call`, a synthesised `trigger` from an initiator, or a `from` `provenance` link. Maps from `model::EdgeKind`, dropping the structural `for`-parent link.
emit::C4Layout A dot-placed C4 view for the interactive canvas and the static SVG: canvas size, placed node cards, routed edges, the enclosing boundary frames (outermost first; empty for a context view), and — only under experimental grid placement — the grid geometry for drag-to-pin.
emit::C4Scene emit::C4Tweaks Per-diagram C4 layout tweaks (the UI's "Layout" toggles): run the long-edge optimiser, lay out left-to-right instead of top-to-bottom, scale the spacing, and — experimentally — place by brute-force grid search instead of the layered engine, with its own cost dials and search mode.
emit::C4View Which C4 view a `C4Scene` is — drives the golden header keyword.
emit::Component emit::Container emit::Data emit::DataEntity One entity in a `data` ER view: its FQN, label, disclosed form, rows, whether it is the focal type, and its laid-out card rectangle.
emit::DataLink A field-type reference link between two entities in a data view: the referencing and referenced FQNs and the field driving the reference.
emit::DataScene emit::Edges Builds the routed-edge set for a C4 scene from the graph's edges: maps each `model::EdgeKind` to a `C4EdgeKind` (dropping `for`-parent links), lifts each endpoint to the in-view node it belongs to, drops self-loops and out-of-view edges, then sorts and de-duplicates.
Parent
- for emit::Emit
Inbound
- call emit::Projector · collect
- call emit::Projector · collect
Outbound
- from → emit::RoutedEdge
- from → emit::RoutedEdge
- from → emit::RoutedEdge
emit::Emit `crates/pseudoscript-emit`. Projects a view into a `Scene` and renders it to SVG; C4 views are placed by the `dot` layered engine, the sequence/data/feature views by the matching `layout` engine.
Parent
Inbound
- call doc::Diagrams · project
- call universe::FlowTracer · project
Outbound
- from → doc::Result
- call → emit::Projector · project
- call → emit::SvgRenderer · render
- call → emit::SvgRenderer · adaptiveStyleBlock
- from → universe::Result
Scenarios
A view projects to a notation-neutral scene, then to SVG.
- given a resolved graph and a chosen view
- when the view is projected
- then the relevant nodes and edges are selected and laid out into a Scene
- and the Scene renders to standalone SVG
- but a missing or wrong-kind target fails with an EmitError
The Scene IR is the conformance surface: notation-neutral and deterministic.
- given the same resolved graph and view projected twice
- when the scenes are compared
- then node order is source-declaration order
- and parallel edges merge into one multi-label edge, sorted by from, to, then kind
- but renderer coordinates never appear in the golden
emit::EmitError Why projecting a view failed: the target FQN names no node, or names a node of the wrong kind for the requested view.
emit::EntityForm The disclosed form of a data entity, driving the card's eyebrow and rows: a record of typed fields, a discriminated union of variants, or a black box.
emit::EntityRow One row of a data entity: the field or variant name, its rendered type (empty for a union variant), and the FQN of the data type this row targets when it references one.
emit::Feature emit::FeatureScene emit::FeatureStepNode One step box in a `feature` flow view: the step keyword, its prose, and the laid-out box rectangle.
emit::Frame A nestable frame over a body of sequence items, drawn as an enclosing box with its condition label.
emit::FrameItem emit::FrameKind The kind of a sequence frame: `if`/`else` becomes an `alt` frame, `for`/ `while` becomes a `loop` frame.
emit::GridInfo The grid the experimental placement used, in absolute canvas coordinates: cell `(r, c)` is centred at `origin + (c·cellW, r·cellH)`; `pad` is the drag-room frame, so a pixel maps to its pin cell by recovering the raw cell then subtracting `pad`.
emit::GridPin A node the user has pinned to a grid cell (drag-to-pin), identified by FQN; the emit layer resolves it to a `dot` node index for the current view. Honoured only under experimental grid placement.
emit::GridSearch Which grid search the experimental grid placer runs — the UI's heuristic-vs-brute-force toggle. Mirrors `dot::SearchMode` so the IDE need not depend on `dot`.
emit::LaidOutEdge A routed edge for the canvas/SVG: its endpoints (`source` stands for the wire `from`), kind, stacked labels, the engine's polyline (at least two points), the label position at the polyline midpoint when labels exist, and whether it draws dashed (a `from`-provenance edge).
emit::LaidOutNode A node card placed by the `dot` engine for the canvas/SVG: its FQN, C4 kind (accent and eyebrow), display label, optional `///` summary, and rectangle.
emit::Layout Assigns geometry. Projection stamps each C4 scene with simple row-flow coordinates (`solveC4`) — the panic-proof fallback geometry every scene carries. The real placement runs at render/canvas time: `layoutC4` drives the `dot` layered engine (rank/order/position/splines), framing boundary children as a cluster, tuned by per-diagram `C4Tweaks` and drag-to-pin cells. The sequence/data/feature scenes are placed by the matching `layout` engine.
Parent
- for emit::Emit
Inbound
- call emit::Projector · solveC4
- call emit::Projector · solveC4
Outbound
- from → dot::Graph
- call → dot::Dot · gridLayout
- call → dot::Dot · runPipeline
- from → layout::Metrics
- call → layout::Layout · layout
Scenarios
C4 layout is delegated to the `dot` layered engine.
- given a projected C4 scene
- when the scene is laid out
- then it is translated into a dot input graph and placed by the dot layered engine
- and a boundary view's children are framed as a dot cluster
- but the engine tolerates cycles and never panics, so the placement stays deterministic
Per-diagram tweaks and pins tune the C4 placement.
- given a C4 scene and the UI's layout tweaks
- when the scene is laid out with those tweaks
- then the long-edge optimiser, reading direction, and spacing follow the tweaks
- and under experimental grid placement, drag-to-pin cells fix their nodes
emit::Lifeline A sequence lifeline (a participant): its FQN, C4 kind for the head card, the node's `///` summary shown dimmed under the name, and the structural ancestry path under a container/component name. No coordinate — the sequence layout assigns the lifeline x.
Inbound
- from emit::Trace
- from emit::Trace
- from emit::Trace
emit::Message A message between two lifelines (or a self-message). `label` is the method name, or `Ok`/`Err`/empty for a return; `detail` is the type detail shown after it — a call's `(params): ret` signature or a return's concrete type.
emit::MessageItem emit::MessageKind The kind of a sequence message: a `call` to another lifeline, a `return` to the caller, or a `self`-message on the owner's own lifeline.
emit::PlacedNode A node placed in a C4 view: its FQN, C4 kind, display label, optional `///` summary (the card's dimmed description), the boundary it sits inside, and the layout rectangle assigned by the placer.
Inbound
- from emit::Projector
- from emit::Projector
- from emit::Projector
- from emit::Projector
- from emit::Projector
emit::PointI An integer point on the canvas (a rounded layout coordinate).
emit::Projector Projects a `View` out of the graph (LANG.md §9): dispatches on the view variant, collecting nodes and edges for a C4 scene or tracing a callable body for a sequence scene, then hands off to the placer. Fails with `EmitError` when the view's target is missing or the wrong kind.
Parent
- for emit::Emit
Inbound
- call emit::Emit · project
Outbound
- from → emit::PlacedNode
- call → emit::Edges · collect
- call → emit::Layout · solveC4
- from → emit::Result
- from → emit::Option
- from → emit::PlacedNode
- from → emit::PlacedNode
- from → emit::PlacedNode
- from → emit::PlacedNode
- call → emit::Edges · collect
- call → emit::Layout · solveC4
- from → emit::Result
- from → emit::Option
- call → emit::Trace · blackBox
- call → emit::Trace · walk
- from → emit::Result
Scenarios
Each view kind dispatches to its projection.
- given a graph and a View variant
- when project runs
- then Context and the boundary views build a C4Scene
- and Sequence traces the entry callable's body into a SequenceScene
- and Data builds an entity (ER) scene and Feature builds a flow scene
Project-symbol picks the view that best explains one symbol.
- given a single symbol FQN — a callable, system, container, component, or data type
- when the symbol is projected
- then a callable traces as a sequence, a system or container with children shows them, a data type shows its entity view
- and a childless boundary falls back to the view that frames it as a peer
- and an FQN naming no graph node projects its feature flow view
- but an FQN naming neither a node nor a feature fails with EmitError::UnknownNode
The data and feature views project their own scene families.
- given a Data view of a data type, or a Feature view of a scenario
- when the view is projected
- then the Data view collects the focal entity, its referenced types, and the links between them
- and the Feature view lays the scenario's given/when/then steps out as a flow
A missing node fails the projection.
- given a boundary or sequence view whose target FQN names no node
- when the view is projected
- then projection fails with EmitError::UnknownNode
A target of the wrong kind fails the projection.
- given a container view whose of node is not a system
- when the view is projected
- then projection fails with EmitError::WrongKind carrying expected and found
A black-box sequence entry still traces — its signature is the trace.
- given a sequence view whose entry callable is black-boxed (no disclosed body)
- when the view is projected
- then the trace is the single inbound call and its return the signature describes
- but a non-callable entry still fails with EmitError::WrongKind
emit::Rect An axis-aligned layout rectangle in renderer coordinates.
emit::RoutedEdge An edge routed between two C4 nodes: its endpoints, kind, and the merged call labels (sorted and de-duplicated; empty for a trigger or provenance edge). Parallel calls between the same pair collapse into one multi-label edge. `source` is the wire field `from`, renamed because `from` is a PseudoScript keyword.
Inbound
- from emit::Edges
- from emit::Edges
- from emit::Edges
emit::Scene A laid-out diagram: the notation-neutral IR the SVG renderer consumes. A C4 scene carries placed nodes and routed edges; a sequence scene carries lifelines and ordered messages with nested frames. This IR is the generation conformance surface (ADR-017): coordinates are carried for the renderer only, never serialised to the golden.
emit::SeqItem One ordered item in a sequence trace: a message or a nested frame.
Inbound
- from emit::Trace
- from emit::Trace
- from emit::Trace
- from emit::Trace
- from emit::Trace
- from emit::Trace
- from emit::Trace
- from emit::Trace
- from emit::Trace
emit::Sequence emit::SequenceScene emit::SvgRenderer Renders a laid-out `Scene` to standalone SVG markup — string-building, no template engine and no headless browser (LANG.md §9.3, ADR-017). Dispatches on the scene variant; the layout engine is wrapped so no input panics the render, falling back to the scene's own simple coordinates.
Parent
- for emit::Emit
Inbound
- call emit::Emit · render
- call emit::Emit · adaptiveStyleBlock
Scenarios
SVG is built as a string — no headless browser.
- given a laid-out Scene
- when render runs
- then a self-contained SVG document is built by string concatenation
- but no template engine or headless browser is invoked
The adaptive theme defers colour choice to the host stylesheet.
- given a scene rendered under the adaptive theme
- when the SVG is emitted
- then every palette role paints as a --pds-* CSS variable with the light value as fallback
- and the light and dark outputs stay byte-identical to their literal palettes
A failed layout degrades to simple coordinates rather than crashing.
- given a scene the layout engine cannot place, or an empty view
- when the C4 scene is rendered
- then rendering falls back to the scene's own simple coordinates
- but the render never panics
emit::Trace Walks a callable's body trace into ordered sequence items, registering each participant on first appearance (LANG.md §9.2, §7). A real trigger's initiator leads as the first lifeline with a synthesised inbound call; absent a trigger the owner leads. A `call` is a message to the target; a disclosed callee expands inline; a `self.` call is a self-message; a return marks `Ok`/`Err`; `if`/`else` nests an `alt` frame, `for`/`while` a `loop` frame.
Parent
- for emit::Emit
Inbound
- call emit::Projector · blackBox
- call emit::Projector · walk
Outbound
- from → emit::string
- from → emit::Option
- from → emit::string
- from → emit::SeqItem
- from → emit::SeqItem
- from → emit::SeqItem
- from → emit::Lifeline
- from → emit::SeqItem
- from → emit::Lifeline
- from → emit::SeqItem
- from → emit::Option
- from → emit::SeqItem
- from → emit::SeqItem
- from → emit::string
- from → emit::string
- from → emit::SeqItem
- from → emit::SeqItem
- from → emit::Lifeline
Scenarios
Control flow becomes nested frames in the trace.
- given a callable body with if/else and for/while
- when the body is traced
- then an if/else becomes an alt frame over its branches
- and a for/while becomes a loop frame over its body
Body calls become left-to-right messages; self-calls loop on the owner.
- given a callable body with calls to other nodes and self-calls
- when the body is traced
- then each call to another node is a left-to-right message to that lifeline
- and each self. call is a self-message on the owner's own lifeline
- and every target is registered as a participant on first appearance
Disclosed callees expand inline; black boxes and recursion stay single calls.
- given a traced body whose calls reach disclosed, black-box, and recursive callees
- when each call is traced
- then a disclosed callee's body expands inline, the active lifeline switching to it
- and its own returns flow back to its caller
- but a black-box callee, or one already in flight on the call stack, is one message closed by a synthesised return of its declared type
A triggerless entry suppresses its own returns.
- given a sequence entry that bears no trigger macro
- when its body is traced
- then the owner leads with no inbound call and the entry's returns are suppressed
- but inner expanded callees still return to their callers
emit::UnknownNode emit::View Which view to project from the graph (LANG.md §9). Context is the C1 whole; Container/Component zoom into one boundary; Sequence traces one entry point; Data draws a `data` type's entity (ER) view (§9.4); Feature draws a `feature` scenario's flow (§9.5).
emit::WrongKind