Document the per-port `shape`, `kind`, `size`, `stroke`, and `fill`
overrides in the ports dictionary of `element.elmt`, simplify the
`port-shape` parameter description, and update `port-shape-vertices`
return signature. Also reformat source and examples for consistency
and rebuild manual.pdf.
Wire up each port as a CeTZ group carrying, in addition to the
default attach anchor, four world-cardinal sub-anchors
`.east`, `.west`, `.north`, `.south` sitting on the pentagon's
bounding-box midpoints. This lets wires attach to any face of a
pentagon port instead of only the default outer/inner point:
wire.wire("w", ("src", "blk-port-a.east"), ...)
Sub-anchor semantics are world-oriented (not rotated with the shape),
so the tip's cardinal name follows its actual world direction:
- west side, kind "in" → tip = .east (kind "out" → .west)
- east side, kind "in" → tip = .west (kind "out" → .east)
- north side, kind "in" → tip = .south (kind "out" → .north)
- south side, kind "in" → tip = .north (kind "out" → .south)
Bounding-box extents depend only on side orientation (horizontal for
east/west, vertical for north/south); `kind` mirrors the shape but
preserves the bbox, so cardinal names stay stable.
Non-pentagon ports degenerate all four sub-anchors to the default
attach point, so user code can address `.east`/`.west`/etc.
uniformly regardless of port shape. The bare port anchor name
(`<elmt-id>-port-<port-id>`) resolves to the same coordinate as
before via a custom "default" anchor, preserving backward
compatibility. Debug mode still marks only the default attach point.
Add `examples.port-shape-attach` demonstrating attaching wires to
the `.west`, `.east` and `.north` faces of a single pentagon port.
Introduce a new `zigzag-at` parameter on `wire.wire` as an alternative
to `zigzag-ratio` for positioning the middle bend segment of a
`style: "zigzag"` wire. Instead of a fraction of the endpoint span,
the bend is placed on the axis of a referenced anchor via CeTZ's
perpendicular operator (`|-`):
- zigzag-dir "vertical": segment sits at anchor.x
- zigzag-dir "horizontal": segment sits at anchor.y
Accepted forms:
- str — raw CeTZ anchor name (e.g. port anchor
"elmt-port-id" or "elmt.center")
- array / native CeTZ dict — used as-is
- (rel: <length>, to: <coord>) with scalar rel — ergonomic axial
offset, rewritten to (rel: (dx, 0), to: ...) for vertical dir or
(rel: (0, dy), to: ...) for horizontal dir
`zigzag-ratio` default flipped from `50%` to `auto` (still resolves
to 50%) to allow detecting an explicit user override. Panics on
misuse:
- `zigzag-at` set together with an explicit `zigzag-ratio`
- `zigzag-at` set with a non-zigzag `style`
Add `examples.zigzag-at` demonstrating both the string-anchor and the
ergonomic offset forms.
Extend the port `align-with` field to accept references to ports of
other elements, in addition to the existing local-port form:
- "<local-id>" → same-element port (unchanged)
- (element: "<id>", port: "<id>") → cross-element reference
- "<raw-anchor>" → arbitrary CeTZ anchor name
Cross-element alignment is implemented via CeTZ perpendicular
projection (`|-`) so the port sits on this element's side line while
sharing the remote port's y (east/west) or x (north/south) coordinate.
Local resolution still validates matching axis and detects cycles;
external refs skip axis validation (remote side unknown at eval time)
and require the target element to be drawn first.
Also enrich port-related panic messages with the element id and port
context to make offending figures easier to locate, and add a manual
example (`examples.align-with-ports`) demonstrating both local and
cross-element alignment.
Defining a block and placing elements into that block has the benefit
that you can use the ports to align the elements within the block to the
ports of that outer ("shell") block
Introduces wire.breakout: a 45° diagonal line of configurable length
(default 1em) that starts at a given (x, y) and exposes a port anchor
<id>-port-<id> at its end point so wires can attach to it as if it were
a block port. A synthesized <id>.center anchor is placed opposite the
configured port-side so wire.wire with style "u-shape" can auto-detect
the port's cardinal side.
- x/y accept number, (rel:, to:) and (from:) forms; (from:) sets the
start point to the referenced anchor's coordinate.
- direction: one of north-east/north-west/south-east/south-west.
- Optional label positioned via name-pos (NE/NW/SE/SW); when name-pos is
opposite to direction, the label falls back to the start point so it
never covers the diagonal line. Label padding matches wire.wire (3pt).
Also adds three examples (breakout, breakout-label, breakout-wire) in
doc/examples.typ referenced from the docstring so tidy auto-renders
them in the manual, and a gallery entry (gallery/test_breakout.typ)
demonstrating orthogonal bus fan-out with breakouts in all four
directions.
Replaces the hard-coded 2pt padding used when placing port name labels.
Configurable per element via port-name-padding on elmt (forwarded by
block and group), defaulting to 2pt to preserve existing layout.
Groups now accept ports/ports-margins like blocks. Port name labels
default to outside the group border (outside-port-names: true) so they
don't overlap child elements; set to false for block-style inside
labels.