Commit Graph
11 Commits
Author SHA1 Message Date
David Stadelmann 6595387c5d feat: support cross-element port alignment via align-with
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.
2026-10-22 00:30:22 +02:00
David Stadelmann 94268c0a22 feat: add shell parameter and outside port names to block
Add `port-names-outside` to draw port name labels outside the block
border. It defaults to `auto`, which follows the new `shell` setting.

Add `shell` to `block` so it can act as a container, as an alternative
to `group`. Placing elements into such a block lets them be aligned to
the ports of the outer block. A shell block draws its port names outside
and, through the existing `wire-inside` behaviour, attaches wires to the
inner tip of pentagon ports. Child elements can be passed as a
positional body argument.

Add the `port-names-outside` and `shell` examples.
2026-10-22 00:30:16 +02:00
David Stadelmann d9abaf4a53 feat: add pentagon-shaped ports
Add an optional pentagon shape for block and group ports, configured via
the element-level `port-shape`, `port-kind` and `port-size` parameters.
Individual ports can override them with `shape`, `kind`, `size`,
`stroke` and `fill`. Clock ports with a pentagon shape drop the clock
triangle and default to a gray fill.

Wires attach to the outer end of the pentagon by default. With the new
`shell` parameter on `element.elmt` they attach to the inner tip
instead.

Each port is exposed as a CeTZ group with a `default` anchor plus the
cardinal sub-anchors `.east`, `.west`, `.north` and `.south` on the
pentagon's bounding box, so wires can attach to any face. For
non-pentagon ports the sub-anchors collapse to the default attach point,
and the bare `<elmt-id>-port-<port-id>` anchor resolves as before.

Add the `port-shape` and `port-shape-attach` examples and the
`gallery/test_port_shape` gallery entry.
2026-10-22 00:30:10 +02:00
David Stadelmann c14e2ceab9 feat: add port-name-padding parameter
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.
2026-10-22 00:29:52 +02:00
David Stadelmann 13e3fee913 feat: add ports on group elements
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.
2026-10-22 00:28:18 +02:00
Shmerlard 87643983ec added guided wire 2025-08-17 22:05:36 +03:00
bono 94d5d6b854 add examples and add iec gates to manual 2025-06-28 13:56:22 -03:00
HEL a856b7f634 added doc for wire.intersection 2024-05-18 21:52:46 +02:00
HEL 86d9122740 added groups 2024-05-18 13:06:57 +02:00
HEL 64a6146f32 added doc for gates + minor changes 2024-05-17 22:24:38 +02:00
HEL 4d97062d30 improved doc + moved examples to separate file 2024-05-17 16:52:43 +02:00