Skip to content

kerusiweb 2.3.0

Choose a tag to compare

@ShadAhm ShadAhm released this 18 Oct 10:01
· 53 commits to master since this release
d1c4ae6

Added

  1. Custom seat content (#26). React takes a renderSeat prop and Angular an
    <ng-template kerusiSeat let-seat> placed inside <kerusi-seatmap>; either
    draws the inside of every seat in place of the stock glyph. The library keeps
    each seat's <g> (role, ARIA state, tab stop, rotation, event handlers), so
    keyboard navigation, selection and announcements are unchanged whatever is
    drawn. The template receives the seat, whether it is selected, the stock
    glyph's resolved paths and paints, and the stock drawing itself
    (defaultContent) to keep or add to. Angular templates must prefix their
    elements with svg:.

  2. A focus outline for custom seats. While a seat template is in use, the
    library draws .kerusi-seat__focus, an outline of the seat's body, over the
    custom content, visible only on :focus-visible and coloured like the stock
    ring. Custom content may have no .kerusi-seat__box for the stock ring to
    stroke, so this keeps keyboard focus visible (WCAG 2.4.7). Without a seat
    template it is not rendered and the markup is unchanged.

  3. resolveSeatGlyph() in @kerusiweb/core returns every path, paint and
    position of the stock seat (SeatGlyph), plus seatClassName() and the
    KerusiSeatContext type both bindings' template contexts extend. Both
    section components now bind this one object instead of calling the paint and
    shape functions one by one, and each binding's copy of the selected seat's
    mark-box rule is gone. The rendered SVG is unchanged.

  4. Both demos gain a "Custom seat template" toggle that draws round seats from
    the glyph's paints, keeping the stock status marks.

  5. Per-seat CSS hooks (#26). Every seat's <g> now carries data-seat-type,
    data-seat-status, data-section-id and, when the document gives them,
    data-seat-row and data-seat-attributes (space-separated, for
    [data-seat-attributes~="aisle"]). Two per-seat tokens, --kerusi-seat-fill
    and --kerusi-seat-label, set on a seat selector, replace that seat's own
    colour without !important. They never reach a selected or blocked seat, and
    held and booked seats keep their wash and occupant figure, so status still
    reads. Legend type items carry the same data-seat-type and their swatches
    read the same token, so one rule recolours the seats and the key together.

  6. seatStyle and seatTypeStyles (#26), on both bindings. A
    KerusiSeatStyle sets a seat's fill, labelColor and extra className
    from code: per type through seatTypeStyles (which the legend shows too), per
    seat through a seatStyle(seat, { selected }) function laid over it field by
    field. A style takes the same slot as SeatType.color, below a stylesheet's
    --kerusi-seat-fill, and never reaches a selected or blocked seat. A hex
    fill gets a readable black or white label unless labelColor says
    otherwise. Core adds resolveSeatStyle(), isHexColor(), and an optional
    trailing style argument on seatFill, seatTextFill, resolveSeatGlyph
    and the legend swatch helpers. Both demos gain "Aisle seats via CSS" and
    "Gold premium seats" toggles.

  7. Seat shapes (#26). KerusiSeatStyle.shape takes 'seat' (the default
    tapered outline), 'square', 'rounded', 'circle', or a function returning
    a path d for a box. The wash, the selected frame and core, and a seat
    template's focus outline follow it; the occupant figure and wheelchair marker
    stay inside every preset (the marker moves in on a circle). A type styled with
    a shape is keyed with it in the legend. Core adds seatShapePath(),
    seatMarkerAnchor(), legendSwatchPath() and the KerusiSeatShape and
    SeatBox types. Both demos gain a "Circle seat shape" toggle.

Changed

  • SeatType.color can now be overridden per seat. It still has no theme
    token, but --kerusi-seat-fill set on a seat selector replaces it for the
    seats that selector matches.
  • Seat markup. An unselected, unblocked seat's fill is now emitted as
    var(--kerusi-seat-fill, <its colour>) and its label as
    var(--kerusi-seat-label, <its colour>), alongside the new data-*
    attributes. Nothing looks different, but a test that snapshots the SVG will
    see the change. legendSwatchFill() and legendSwatchText() in core now
    compute the legend's type swatches for both bindings.