Skip to content

Releases

kerusiweb 4.2.0

Choose a tag to compare

@github-actions github-actions released this 03 Nov 20:54
81969de

Added

  • Fit to content (#63, D29). A new fit input/prop, 'canvas' (the
    default, unchanged) or 'content', and contentPadding (canvas units,
    default the map's seatSize), identical in both bindings. Under 'content'
    the map's viewBox is the box around what is drawn (seat footprints turned
    as they are, elements, group footprints, shown section labels, the rows
    view's row labels) plus the padding, kept on the canvas. Fit, reset (0)
    and full screen all frame that box, and it is the zoom's floor. Hiding a
    section or switching view reframes the map. Core exports
    contentBounds(layout, options), mapContentBounds(map, options) (so a
    host can size its container to the content's proportions) and the
    KerusiSeatmapFit type.

  • KERUSI_SPEC in core: the exact standard this library implements
    (version: '1.0.0-draft', revision: 17, schemaVersion: '1.0.0-draft.17',
    and a label, "Kerusi v1.0.0-draft, rev 17"). A document's kerusi member is
    "1.0" through every 1.0 draft revision, so use this, not that member, when
    telling people which standard a map follows. A test keeps it in step with the
    vendored conformance corpus.

Changed

  • Both demos label the KerusiMap they show with the full version, "Kerusi
    v1.0.0-draft, rev 17", and explain that "kerusi": "1.0" is the format
    version the standard requires for every 1.0 draft. The documents themselves
    are unchanged and still declare "1.0".

kerusiweb 4.1.0

Choose a tag to compare

@github-actions github-actions released this 25 Oct 18:40
ee5355d

Added

  • The rows view (§4.5.1, #38, D27, D28). A new view input/prop, 'canonical' (the
    default, unchanged) or 'rows', identical in both bindings. The rows view
    draws every row as a straight line in §4.2.1 order with its label beside it,
    keeps skipped cols as gaps, puts seats with no row in a last line, and
    draws no elements or group footprints. It is never switched on automatically.
    Core exports computeRowsLayout(), computeViewLayout() and the
    KerusiSeatmapView type; PlacedSection gains drawsLabel and rowLabels
    (PlacedRowLabel), and the map gets a kerusi-seatmap--rows class in that
    view.

The control that books an either group whole (D19), such as a tabletop, gets
the three things a seat already has (#56, D25). All three are additive: with
none of them set, seats and controls behave and render exactly as in 4.0.0, and
KerusiSeatCardContext is unchanged.

  • Whole-unit cards. renderWholeUnitHoverCard and renderWholeUnitClickCard
    in React, <ng-template kerusiWholeUnitHoverCard> and <ng-template kerusiWholeUnitClickCard> in Angular, open on the control, so an app can say
    "Table 3: the whole table, 8 seats, EUR 800.00" where the customer is looking.
    They are handed a new KerusiWholeUnitCardContext (unit, group,
    selected, trigger, close), honour hoverCardOnFocus, and position,
    dismiss and follow zoom and full screen as seat cards do. The control points
    at its hover card with aria-describedby, and only one hover card shows at a
    time across seats and controls. onSeatHover / seatHover still reports
    seats only.
  • A refusal callback. onWholeUnitDisallowed / (wholeUnitDisallowed)
    fires with { unit, group, reason } when the control is refused by a click,
    Enter or Space (unit-unavailable, unit-too-large or max-selection), so an
    app can show a visible message of its own. The live-region announcement is
    made as before.
  • The price from the app. wholeUnitPrice?: (unit) => string | undefined
    supplies the formatted price said in the control's name, in place of the map's
    wholePrice, for apps that price per event on their own server.
    wholeUnitAriaLabel() in core takes it as a fourth argument.
  • Core: KerusiWholeUnitCardContext, WholeUnitDisallowed,
    WholeUnitPriceFn, wholeUnitHoverKey() / wholeUnitOfHoverKey(), which
    feed a control to reduceSeatHover(), and wholeUnitCardDataAttributes().
    The card rules both bindings follow are core's too: wholeUnitControlGroups(),
    isWholeUnitSelected(), wholeUnitCardGroup(), wholeUnitCardContext(),
    seatCardKeyExists() and seatCardClickAction().
  • Demos: with seat cards on, an either table's top shows a card, and a
    refused tabletop shows a visible message, in both demos.

A visible cue on the control itself is left for a separate issue (D26).

kerusiweb 4.0.0

Choose a tag to compare

@github-actions github-actions released this 21 Oct 05:44
c77fa19

4.0.0, a breaking release of @kerusiweb/core, @kerusiweb/angular and
@kerusiweb/react, for Kerusi
rev 17
(ShadAhm/kerusi#17, ShadAhm/kerusi#18): seat forms, groups, booking units
and whole prices. Rev 17 retires Seat.companions for groups booked whole, and
selection moves from the companion closure to booking units, so companions
and companionMode go. Documents and code both change; see
Migrating from 3.x. Planned in #50; done in #51, #52 and
#53.

Changed (breaking)

  1. Seat.companions is retired (§4.12.4). The member is reserved: the
    validator rejects a seat that carries it, even an empty list, with the
    reference rule id companions-retired (D23), and says that a group replaces
    it. companion-reference and companion-symmetry are gone with it. A set of
    seats booked together is now a group with booking: "whole", of kind
    companion when no furniture is involved and loveseat, table or the like
    when it is. The Seat.companions type is never.

  2. A tap selects a booking unit (§4.12.2, D19). A seat's booking unit is
    every seat of the outermost level containing it (the map, its section, its
    group) whose effective mode is whole, or the seat alone. A tap, Enter or
    Space on a seat toggles its whole unit, in place of the companion closure, and
    changed in onSeatSelect / (seatSelect) lists all of it.

  3. companionMode is unitMode: 'auto' | 'seats' (D22), on both bindings
    and as a buildRenderModel option. 'seats' is the old 'independent': a
    tap takes the seat alone, for an admin view that blocks single seats.

  4. New disallowed reasons. companion-unavailable is unit-unavailable: a
    seat of the unit is not available (§4.12.3). unit-too-large is new: the unit
    alone holds more seats than maxSelection, which still counts seats (D21).
    SeatAriaStrings.disallowed needs both keys, and no longer takes the old one.

  5. The render model. RenderSeat.companions is gone; RenderSeat.unit is
    the seat's booking unit, and RenderSeat.unitBlocked says another seat of it
    cannot be picked. Core no longer exports companionClosure. The seat class
    kerusi-seat--companion is kerusi-seat--unit, on a seat in a unit of more
    than one.

  6. A seat booked only with a taken seat shows as unavailable (§4.12.3): the
    other half of a sold love seat is aria-disabled, carries
    kerusi-seat--unselectable and the new kerusi-seat--unit-blocked, which
    dims it, and is announced "unavailable, booked together with a seat that is
    taken". It was shown as available before, and refused only when tapped.

  7. Totals follow §4.9.1. summarizeSelection, and the summary both
    bindings expose, charge a table, room or venue its whole price when every one
    of its seats is selected, however they were picked, in place of its seats'
    prices. unpriced counts the seats no whole price covers. The live region's
    total is the same.

Added

  • Seat forms (§4.7.1). SeatType.form says what one place of a type looks
    like, and the library now draws it: armchair, stool, recliner,
    beanbag, cushion, wheelchair-space, sofa and bench each get their own
    outline, in the seat and in the legend swatch. Each faces up at rotation 0
    and turns with its seat, and every status cue (the held and booked wash and
    figure, the selected frame and core, blocked, the focus outline and the
    wheelchair marker) works on every form. chair, no form and a form the
    library does not know draw the stock seat, so existing maps do not change
    (D17). A shape from seatStyle or seatTypeStyles still wins over the
    document's form. The outlines are drawn in-house (D24). Planned in #50, done in
    #51.
  • KerusiSeatShape gains the form names as presets, so an app can use
    shape: 'armchair' too, and core exports seatFormShape, SeatForm and
    KerusiSeatFormShape. RenderLegendEntry.form carries the form, and
    legendSwatchPath takes it as an optional third argument.
  • A "Lounge" scenario in both demos draws every form, untouched and turned.
  • Groups (§4.11). Section.groups names a table, sofa, love seat, pew, bench
    or booth and the seats at it, and the map now draws the piece. A group's
    shape (a rect, centred and turned as an element is, or a circle) is drawn
    under its seats as <g class="kerusi-group kerusi-group--{kind}">, with a look
    of its own for table, sofa, loveseat, pew, bench and booth and a
    plain shape for any other kind. Styled by the --kerusi-group-fill,
    --kerusi-group-stroke and --kerusi-group-detail tokens, per kind with
    --kerusi-group-{kind}-*, and by the new colors.groupFill, groupStroke and
    groupDetail (D18). A footprint is decoration: hidden from assistive
    technology and not a pointer target, so a press on a tabletop selects nothing.
    A group with a label wraps its seats in a role="group" of that name, and a
    seat in it is announced "Table 3, seat 4" (ariaStrings.groupSeat, optional).
    The hover and click card context gains group. Mirrored in right-to-left (D3),
    hidden with its section (D4). The validator gains the group rules with the
    reference ids (D7, D23): group-seat-unresolved, group-seat-shared,
    group-id-duplicate and group-shape-outside-canvas, a
    group-shape-overlaps-seat warning, and group-id, group-kind,
    group-seats, group-shape-kind and group-shape-invalid for what the
    schemas own. Core exports Group, GroupKind, GroupShape, RenderGroup,
    PlacedGroup, groupFootprint and resolveGroupGlyph. Done in #52, planned
    in #50.
  • A "Banquet" scenario in both demos has round tables, and the Lounge's sofa and
    pews are groups.
  • Booking modes (§4.12). booking: "seats" | "whole" | "either" on the map, a
    section and a group, and a KerusiSession's bookingModes overriding them for
    one event (§4.12.1, §5.3), are modelled and honoured. Core exports
    bookingUnits(map, session?, state?): every booking unit, every whole unit
    (with level, id, label, seat ids, whole price and, given a state, whether it
    can be booked), and each seat's unit. It follows the standard's reference
    schema/booking.mjs and passes its examples/booking-units/ corpus, vendored
    here. Core also exports bookingLevels, checkSelection (whether a selection
    is a union of booking units, §4.12.3) and priceSelection (§4.9.1).
  • A session input or prop drives booking. Both bindings already took a
    KerusiSession for validation; its bookingModes now apply, so one map can
    sell every table whole at a wedding and by the seat at a quiz night. Without a
    session, the map's own modes apply.
  • Book a table whole from its shape (D19). An either group with a shape,
    an either table or sofa, has its footprint drawn as a control: a
    role="button" with tabindex="0", first in its group's wrapper so it comes
    before its seats in keyboard order, announced "Table 3, book the whole table,
    8 seats, MYR 180.00" (ariaStrings.wholeUnit, optional). A click, Enter or
    Space selects every seat of it, and again deselects them; aria-pressed says
    whether it is booked whole, and its outline takes the selected colour. While a
    seat of it is taken it is aria-disabled, with the reason as its
    aria-description. An arrow key moves into its first seat, and Escape clears
    the selection as from a seat. It shows a heavier outline on hover and the
    focus ring on :focus-visible (kerusi-group--whole, kerusi-group--selected,
    kerusi-group--unavailable, kerusi-group__focus). A read-only map draws the
    footprint as decoration, as before. Seat events do not fire for it;
    onSelectionChange and (selectionChange) do.
  • Whole units with no shape are the app's (D19): a room, the venue, a
    shapeless group. RenderMap.wholeUnits, or bookingUnits with a state, gives
    them with their availability, and the app books one by setting selection
    (core's toggleWholeUnit does the arithmetic). The READMEs show a "Book the
    whole room" button built this way.
  • The change reports whole units (D20). selection stays a list of seat ids.
    React's onSelectionChange gains a second argument, { selection, wholeUnits };
    Angular gains a (selectionDetail) output with the same object, emitted with
    (selectionChange). wholeUnits lists the whole units fully selected, so an
    app can say "Table 3 (whole table)". summarizeSelection also returns
    wholeUnits, and wholes, the levels charged a whole price.
  • What a screen reader says. A seat in a unit of more than one is announced
    with it: "booked with 7 other seats at Table 3" (ariaStrings.bookedWith), and
    at the unit's whole price when the level has one: "MYR 1,200.00 for all 8
    seats" (ariaStrings.unitPrice). unitUnavailable, wholeUnit and
    wholeUnitDisallowed are new optional strings too; leave them out and the
    English defaults are used.
  • Whole prices (§4.9.1). wholePrice and wholePriceTier on the map, a
    section and a group. The validator checks a whole price tier resolves
    (whole-price-tier-unresolved, D23) and counts whole prices toward the map's
    one currency (single-currency), checks every booking is a known mode
    (booking-mode-invalid), checks a session's bookingModes
    (session-booking-mode-invalid), and, given the map, that every section and
    group a session overrides exists (session-booking-mode-unresolved, D23).
  • The vendored conformance corpus is now rev 17 throughout, with the
    booking-units corpus run against bookingUnits, checkSelection and
    priceSelection.
  • A "Wedding" scenario in both demos sells the Banquet's map with every table
    booked whole through a session, at a table price; a "Venue hire" scenario has
    an either venue of...
Read more

kerusiweb 3.1.0

Choose a tag to compare

@ShadAhm ShadAhm released this 18 Oct 10:01
3df0ea3

A minor release (3.1.0) of @kerusiweb/core, @kerusiweb/angular and
@kerusiweb/react: customizable seat hover and click behaviour. All of it is
additive. Planned in #42.

Added

  1. Hover and click are independent and optional (D10). Two layers, each
    useful without the other, and nothing is on by default: a map using none of
    what follows renders the same markup and behaves the same as 3.0.0 (the
    parity signature does not move).

  2. Events. onSeatHover / seatHover reports the RenderSeat under the
    pointer when it enters a seat and null when it leaves the seat or the map,
    once each. Mouse and pen only, never during a pan or zoom (it is cleared once
    when one starts and resumes on the next pointer move), and it fires on a map
    with interactive={false} too. onSeatClick / seatClick reports
    { seat, selected, source } on every activation of any seat, booked,
    held and blocked included, before the selection callbacks and with selected
    as it was before the click. It is read-only (D13): it cannot cancel or change
    what the click does. In Angular seatClick is an EventEmitter rather than an
    output(), because only that can say whether it is bound.

  3. A read-only map can still take clicks (D14). interactive={false} turns
    selection off. While onSeatClick (or (seatClick)) or a click card is set,
    seats stay clickable and keyboard-reachable (Tab, arrows, Enter and Space, per
    WCAG 2.1.1), with no toggle and no aria-pressed. There is no new prop: set
    one and it turns on, remove them and the markup is a read-only map's again.

  4. Seat cards. A floating card anchored to a seat, with one card element and
    two triggers: renderHoverCard and renderClickCard in React,
    <ng-template kerusiSeatHoverCard> and <ng-template kerusiSeatClickCard> in
    Angular. The consumer supplies the content, and the library handles
    positioning, dismissal, zoom, full screen, touch and accessibility. The hover
    card follows a mouse or pen (never touch), is hoverable and dismissible with
    Escape (WCAG 1.4.13), and is a role="tooltip" wired to the seat with
    aria-describedby. The click card opens on a click, a tap or Enter/Space, is a
    non-modal role="dialog" labelled by the seat, moves focus in when opened from
    the keyboard and back to the seat on close, and closes on Escape, a press
    outside, a second click on the same seat, close() or another seat's card.
    Props and inputs: seatCardPlacement, seatCardClassName / seatCardClass,
    seatCardAppearance, hoverCardDelay and hoverCardOnFocus. The hover card
    shows on keyboard focus only with hoverCardOnFocus (D12). openSeatCard(),
    closeSeatCard() and openSeatCardId open and close a click card from code.

  5. The app owns the styling of a card (D11). Eleven --kerusi-seat-card-*
    tokens, the .kerusi-seat-card class hooks, data-placement, data-seat-id,
    data-seat-status, data-seat-type and data-section-id attributes, your own
    classes, and seatCardAppearance="none" to drop the chrome. Every library rule
    is wrapped in :where(), so a one-class rule of yours wins without
    !important. The card sits inside .kerusi-seatmap, so it inherits the
    map's --kerusi-* properties and shows in full screen.

  6. Core (@kerusiweb/core). reduceSeatHover() holds the hover rules once
    for both bindings, as reduceGesture() does for pan and pinch.
    placeSeatCard() is the placement arithmetic: side, position and arrow
    offset, with flip and clamp, pure and tested in Node. New types:
    SeatClick, KerusiSeatCardContext, SeatCardPlacement, SeatCardTrigger,
    SeatCardAppearance and HoverCardDelay.

  7. Docs and demos. "Hover and click", "Seat cards" and "Styling seat cards"
    in the root, React and Angular READMEs, with the tokens table. Both demos get
    a hover card toggle, a click card toggle and a "Restyled cards" toggle that
    restyles every card from the demo's stylesheet through the tokens alone.

  8. Slimmer zoom and full-screen buttons, and --kerusi-control-* tokens.
    The controls are now one grouped bar of 32px buttons with 16px icons, and
    hover and pressed states, in place of four loose 44px squares. Touch screens
    (pointer: coarse) keep the 44px target. Restyle them from your own
    stylesheet with --kerusi-control-size, -icon-size, -icon-stroke,
    -radius, -shadow, -bg, -fg, -border and -hover-bg; see the
    READMEs. The buttons no longer carry inline colours, so a rule on
    .kerusi-control no longer needs !important to win. The default colours are
    unchanged (elementBg, elementFg, elementMutedFg). The bar's border is a
    40% tint of elementMutedFg, lighter than before.

kerusiweb 3.0.0

Choose a tag to compare

@ShadAhm ShadAhm released this 18 Oct 10:01
f9db626

3.0.0, a breaking release of @kerusiweb/core, @kerusiweb/angular and
@kerusiweb/react, for Kerusi
rev 15
(ShadAhm/kerusi#10): one canvas per map in place of the grid, freeform
and mixed positioning modes. No rev 14 map is valid under rev 15, and 2.x
rejects every rev 15 map, so documents and code both change; see
Migrating from 2.x. Planned in #32.

Changed (breaking)

  1. Documents follow rev 15. KerusiMap.canvas ({ width, height }, in
    abstract units with one scale on both axes) and KerusiMap.seatSize are
    required. Seat.x/y and Element.x/y are required: an item's centre in
    canvas units, no longer a percentage. A seat is a seatSize square centred
    there; an element is a width × height rectangle, defaulting to the seat
    size. Section.seatSize overrides the map's for one section. row/col on a
    seat mean adjacency only (§4.3.5): col needs a row, is a positive integer,
    and is unique within its row.

  2. The map is one SVG (D1). <svg class="kerusi-seatmap__svg">, whose
    viewBox is the canvas, holds every section as a
    <g class="kerusi-section" data-section-id role="group"> named by its label.
    The per-section <section class="kerusi-seatmap__section"> wrapper, its
    <h3 class="kerusi-section-label"> heading and each section's own
    svg.kerusi-section-svg are gone. KerusiSection (React) and
    KerusiSectionComponent (Angular, now selector g[kerusi-section]) render a
    <g> and take the placed section as layout, plus label and showLabel.
    Both bindings draw identical SVG, held to it by a shared parity test.

  3. Nothing is laid out any more. Every seat is drawn at its x/y, at its
    seat size and rotation (§4.5): no cell sizes, no row pitch, no percentages,
    and no position ever derived from row, col, a row's index, or a row
    shape. An empty row (§4.2.2) still reaches the render model with
    empty: true, but reserves no space.

  4. Right-to-left mirrors the whole canvas (D3): x' = canvas.width − x,
    rotation negated, text kept readable. Sections and rows are no longer
    mirrored one by one.

  5. A hidden section leaves its space empty (D4). Hiding it, or leaving it
    out of sectionIds, removes its group; the canvas keeps its size.

  6. Section labels are drawn inside the map, just above a section's
    bounds (or inside their top-left corner when the canvas has no room above),
    and only for a section that declares bounds (D5). Every section's label is
    its group's accessible name; the drawn text is aria-hidden.
    showSectionLabels keeps its meaning.

  7. Keyboard navigation follows adjacency (D6). Left and right move along a
    row in col order and jump across an aisle (a skipped col) rather than
    stopping at it. Up and down move to the next row in §4.2.1 order and pick the
    seat nearest on the canvas. The arrows follow the screen: a row whose cols run
    right to left, a mirrored map, or rows ordered up the screen swap them. Seats
    with no row keep the old heuristic, banded by y and ordered by x.

  8. Render model (@kerusiweb/core). RenderMap gains canvas and
    seatSize. RenderSection loses layoutMode and aspectRatio, and gains
    seatSize, bounds (declared, or the box around its content) and
    boundsDeclared. RenderSeat.x/y are required canvas units, and it gains
    size and besideAisle. RenderElement loses row, rowIndex and col,
    and its width/height are always set. Seats within a row are ordered by
    col, then x.

  9. computeSectionLayout() is replaced by computeMapLayout(renderMap, { rtl }),
    returning { width, height, sections: [{ section, seats, elements, bounds, labelAnchor }] }.
    PlacedSeat and PlacedElement keep their shape. An element's smallest font
    is now a fifth of the seat size rather than a fixed 6 units.

  10. Validator rules. Removed with the positioning modes:
    section-layout-inconsistent, section-layout-grid,
    section-layout-freeform, section-layout-mixed,
    element-layout-mismatch, element-span-invalid,
    element-row-span-overrun and element-row-unresolved. Added: map-canvas,
    map-canvas-size, map-seat-size, section-seat-size,
    seat-outside-canvas, element-outside-canvas, element-size-invalid,
    seat-col-without-row, seat-col-invalid, seat-row-col-duplicate,
    row-shape-kind, row-shape-invalid, row-shape-cols-reversed,
    row-id-duplicate, seat-type-id-duplicate and price-tier-id-duplicate.
    seat-position and element-position are now errors for a missing x or
    y. Two findings are warnings: seat-overlap (§4.3.1; footprints that only
    touch don't overlap) and seat-outside-section-bounds. The rule ids match
    the reference validator's (D7).

  11. SeatAriaStrings.besideAisle is required: a seat next to an aisle says
    so ("next to an aisle"), worked out from adjacency. Add it if you supply
    your own strings.

Removed

  • Inputs and props: seatSize, seatGap and freeformBasis, and
    aspectRatio and seatSize in SectionRenderOptions (D2). The document fixes
    seat size and position now; unitScale (CSS pixels per canvas unit, at most)
    is the one sizing control left.
  • Core exports: SectionLayoutMode, checkSectionLayout,
    resolveSectionLayoutMode, inferSectionLayoutMode, hasXY, hasCol,
    hasAnyCoordinate, Positioned, computeSectionLayout, SectionLayout and
    SectionLayoutOptions.
  • Document members: Section.layout, Section.aspectRatio, and
    Element.row/col. Following §7, a consumer ignores them as unknown members
    rather than rejecting a map that still carries them; a rev 14 map is rejected
    anyway, because it has no canvas or seatSize.
  • No rev 14 → 15 upgrader ships (D8).

Added

  1. Section.bounds, Section.seatSize and RowMeta.shape in the document
    model, with Canvas, Bounds, Point and RowShape types.

  2. Canvas geometry in core (kerusi-geometry), with the reference
    validator's semantics: seatSizeOf, areNeighbours, guidePoint and
    isOnGuide (for editors; renderers never read a row shape), footprintOf
    and footprintsOverlap.

  3. zoomToSection(sectionId) on the React handle and the Angular
    component: zooms a zoomable map to a section's bounds, or to the box
    around its content. Core adds viewportForRect, canvasRectToContent,
    contentRectToContainer and revealContentRect.

  4. A maximized zoomable map fits the whole canvas to the screen at the
    canvas's own proportions, through a --kerusi-canvas-aspect property.

  5. A Town Hall demo, the standard's §6.7: two sections side by side, a
    curved balcony and a round table. Both demos' sections tables show each
    section's seat size and bounds, with a zoom-to-section button.

  6. The conformance corpus is re-vendored at rev 15 (spec-1.0.0-draft.15,
    d16fd99). Every valid example renders with no error and no warning, and
    every seat is asserted to be drawn at its document position, size and
    rotation.

Migrating from 2.x

Documents. Give each map a canvas and a seatSize, and every seat and
element an x/y: its centre, in canvas units. Then drop Section.layout,
Section.aspectRatio and any element's row/col. The rev 15 changelog in the
standard (§11) has the migration notes for each mode; in short:

  • A grid section: choose a seat size and a pitch (the old defaults were 28
    and 34), and put each seat at x = seatSize + (col − firstCol) × pitch,
    y = top + seatSize + rowIndex × pitch, which is where 2.x drew it. Keep row
    and col for adjacency. An element spanning cells becomes one rectangle
    centred over them. Space an empty row used to reserve is now simply space
    the seats' own y leave.
  • A freeform section: multiply each percentage by the section's width (or,
    for y, its height) to get canvas units. 2.x drew a freeform section 1000
    units wide and 1000 / aspectRatio tall.
  • A mixed section: as freeform; its cols stay as they are.
  • Several sections: they now share one canvas, so give each its own region
    of it, and declare bounds where you want a drawn label or zoom to section.

The demo fixtures were migrated this way, with a throwaway script that ran
2.x's layout code and checked every seat and element lands where 2.x drew it.

Code.

  • Remove seatSize, seatGap and freeformBasis from <kerusi-seatmap> /
    <KerusiSeatmap>, and aspectRatio and seatSize from sectionOverrides.
    Use unitScale to set how large the map draws.
  • If you style or query the markup, replace .kerusi-seatmap__section,
    .kerusi-seatmap__section--grid (and --freeform, --mixed),
    .kerusi-section-svg and the section <h3> with svg.kerusi-seatmap__svg
    and g.kerusi-section[data-section-id].
  • If you render sections yourself, use computeMapLayout(renderMap, { rtl })
    for one canvas instead of computeSectionLayout() per section, and read
    RenderSeat.x/y/size instead of col, rowIndex or the layout mode.
  • If you pass your own ariaStrings, add besideAisle.

kerusiweb 2.3.0

Choose a tag to compare

@ShadAhm ShadAhm released this 18 Oct 10:01
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.

kerusiweb 2.2.0

Choose a tag to compare

@ShadAhm ShadAhm released this 11 Oct 07:54

Added

  • Opt-in zoom and pan for Angular and React maps, including touch gestures, mouse/trackpad controls, keyboard navigation, accessible zoom controls, and viewport-change APIs.
  • An opt-in maximize/full-screen overlay for both bindings.
  • Shared viewport and pointer-gesture utilities in @kerusiweb/core, with matching framework APIs.

Zoom and maximize remain disabled by default.

v2.1.0

Choose a tag to compare

@ShadAhm ShadAhm released this 05 Oct 14:19
1655442

Free text labels on a seat map

A map can now carry plain text, such as section names like "Balcony" or "Table 3". Add an element with kind: "label":

{ "id": "heading", "kind": "label", "label": "Balcony", "x": 50, "y": 8, "width": 20, "height": 5 }

It draws only its text, with no box or outline. Before, a label element was drawn as a filled rectangle with the text inside.

  • The text is centred in the element's box, and width and height still place and size it.
  • The text size follows the box height and shrinks so a long label fits the box width.
  • rotation turns the text about the centre of the box.
  • The text colour comes from the usual element colour tokens.
  • An element with no label text draws nothing.
  • Other element kinds draw as before.

Both @kerusiweb/react and @kerusiweb/angular draw it. @kerusiweb/core adds a text shape to elementStyle, so apps that draw the map themselves, such as an editor preview, can match the renderer.

Upgrading

This release is backwards compatible. Update all three packages to 2.1.0 together:

npm install @kerusiweb/core@2.1.0 @kerusiweb/react@2.1.0

(Use @kerusiweb/angular@2.1.0 instead of the React package for Angular.) The React and Angular packages now need @kerusiweb/core 2.1.0 or later, since they rely on the new shape.

Full details are in the changelog.

Closes #21

v2.0.0

Choose a tag to compare

@ShadAhm ShadAhm released this 12 Sep 11:27
2ff3f96

First release published to npm — all three packages are live under the @kerusiweb scope:

npm install @kerusiweb/core @kerusiweb/angular   # Angular
npm install @kerusiweb/core @kerusiweb/react     # React

Breaking

  1. The Angular package is renamed ngx-kerusi-seatmap → @kerusiweb/angular,
    joining @kerusiweb/core and @kerusiweb/react under one scope. The ngx-
    prefix is Angular's convention for unscoped packages, where it exists to
    signal the framework in npm's flat namespace; a scope plus a framework
    segment already says the same thing, which is why every current
    multi-framework family names its bindings this way. No version of either
    name was ever published to npm, so there is no migration path to document —
    nothing depends on the old name.

    The import changes accordingly:

    -import { KerusiSeatmapComponent } from 'ngx-kerusi-seatmap';
    +import { KerusiSeatmapComponent } from '@kerusiweb/angular';

Changed

  1. The repository is renamed ngx-kerusi-seatmap → kerusiweb, and the
    demos move to shadahm.github.io/kerusiweb/. GitHub redirects the old URLs.
    The repo is no longer an Angular library that grew a React port; it is a
    seat-map renderer with framework bindings, and the name, the docs and the
    scripts now say so.

  2. Nothing in the workspace privileges one framework. projects/ now reads
    core/, angular/, react/, angular-demo/, react-demo/. Every npm
    script names its framework (start:angular, build:react, test:angular),
    and the bare start / build / test scripts — all of which meant Angular
    — are gone. @angular/* moved from the workspace root's dependencies to
    its devDependencies, alongside react, and the root tsconfig.json is
    framework-neutral: angularCompilerOptions moved into a new
    tsconfig.angular.json that only the Angular binding and demo extend, so
    core and the React binding no longer inherit them.

  3. Both demos deploy. GitHub Pages now serves a landing page linking to the
    Angular demo at /angular/ and the React demo at /react/, rather than
    giving the root to Angular alone.

  4. docs/kerusi.md is framework-neutral, and the conformance report is
    attributed to @kerusiweb/core, where the validator actually lives. Added
    CONTRIBUTING.md, issue templates and a PR template, each asking which
    package a report concerns.

Fixed

  1. Every package now ships its licence text. All three declared
    "license": "MIT" while the only LICENSE file sat at the repository root,
    which npm does not include in a workspace package's tarball — so each one
    would have published an MIT claim with nothing behind it. @kerusiweb/core,
    @kerusiweb/angular and @kerusiweb/react each carry a copy now.

  2. @kerusiweb/angular declares publishConfig.access: "public", as the
    other two packages already did. Scoped packages default to restricted
    access, which a free npm organisation cannot host, so publishing it would
    have failed until --access public was passed by hand.

Added

  1. A React binding, @kerusiweb/react. Same components, same props, same
    SVG as the Angular package: <KerusiSeatmap>, <KerusiSection>,
    <KerusiLegend>, plus useKerusiState in place of KerusiStateStore. Its
    test suite is the Angular component spec's assertions run against
    React-rendered DOM, and for the same documents the two bindings emit
    byte-identical markup.

    React translations of the Angular surface, where they could not be
    mechanical: [(selection)] becomes the controlled/uncontrolled pair
    (selection + onSelectionChange, or defaultSelection); validate="throw"
    throws during render so an error boundary catches it; focus moves through a
    ref map rather than a querySelectorAll scan; and a repeated live-region
    message is made distinct with a zero-width space in a single commit, rather
    than the clear-then-microtask React would batch away.

    Styles ship as one @kerusiweb/react/styles.css the consumer imports, since
    React has no equivalent of Angular's view-encapsulated component CSS. Colours
    stay bound inline in both bindings, so the three theming tiers
    (--kerusi-* stylesheet property → the colors prop → the library default)
    behave identically.

    The package is built by tsc alone, with no bundler, and declares react
    and @kerusiweb/core as peers.

  2. projects/react-demo/ — a Vite React demo showing the same five venues
    as the Angular one. The venue documents moved to projects/demo-scenarios/
    so both demos render the same fixtures rather than two copies drifting apart.
    The published GitHub Pages site remains the Angular demo.

  3. Three functions promoted into @kerusiweb/core, each of which the React
    binding would otherwise have retyped verbatim from the Angular one:
    isRtlLocale (view/rtl.ts), heldSeats (kerusi/kerusi-state.ts — core
    already exported the HeldSeat type with nothing producing it), and
    resolveColors (view/kerusi-seatmap-colors.ts). All three are additive;
    the Angular binding now calls them instead of its own copies.

Changed

  1. The framework-agnostic core is now its own package, @kerusiweb/core.
    The Kerusi document types, the conformance validator, the price/locale/row
    resolution, the render model and its geometry, and the colour, ARIA and
    selection helpers all moved out of the Angular library into
    projects/core/. @kerusiweb/angular is now the Angular binding alone —
    three components and the signal-backed KerusiStateStore — and declares
    @kerusiweb/core as a peer dependency.

    The split was mostly already there: only four files imported @angular/core
    and none imported RxJS. The one genuinely mixed file was
    kerusi-state-store.ts, whose pure delta-ordering and hold-expiry functions
    are now @kerusiweb/core's kerusi-state, with the signal wrapper left
    behind in the Angular package. No logic changed. See
    docs/architecture.md for what belongs where.

    Core compiles under strict with no framework, no DOM and no any, tests
    under plain Vitest, and — because it is "type": "module" with explicit
    import extensions — loads in Node ESM without a bundler, so validation can
    run server-side or in a build step.

Breaking

  • Install both packages: npm install @kerusiweb/core @kerusiweb/angular.

  • Imports move. Everything except KerusiSeatmapComponent,
    KerusiSectionComponent, KerusiLegendComponent, KerusiStateStore and the
    component I/O types (SeatDisallowed, SeatInteraction,
    SectionRenderOptions, ValidationMode) now comes from @kerusiweb/core:

    import { KerusiSeatmapComponent } from '@kerusiweb/angular';
    import type { KerusiMap, KerusiState } from '@kerusiweb/core';

    No symbol was renamed, removed or changed in behaviour — only its package.