Repository navigation
Releases
kerusiweb 4.2.0
Added
-
Fit to content (#63, D29). A new
fitinput/prop,'canvas'(the
default, unchanged) or'content', andcontentPadding(canvas units,
default the map'sseatSize), identical in both bindings. Under'content'
the map'sviewBoxis 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 switchingviewreframes the map. Core exports
contentBounds(layout, options),mapContentBounds(map, options)(so a
host can size its container to the content's proportions) and the
KerusiSeatmapFittype. -
KERUSI_SPECin core: the exact standard this library implements
(version: '1.0.0-draft',revision: 17,schemaVersion: '1.0.0-draft.17',
and alabel, "Kerusi v1.0.0-draft, rev 17"). A document'skerusimember 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
Added
- The rows view (§4.5.1, #38, D27, D28). A new
viewinput/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 skippedcols as gaps, puts seats with norowin a last line, and
draws no elements or group footprints. It is never switched on automatically.
Core exportscomputeRowsLayout(),computeViewLayout()and the
KerusiSeatmapViewtype;PlacedSectiongainsdrawsLabelandrowLabels
(PlacedRowLabel), and the map gets akerusi-seatmap--rowsclass 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.
renderWholeUnitHoverCardandrenderWholeUnitClickCard
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 newKerusiWholeUnitCardContext(unit,group,
selected,trigger,close), honourhoverCardOnFocus, and position,
dismiss and follow zoom and full screen as seat cards do. The control points
at its hover card witharia-describedby, and only one hover card shows at a
time across seats and controls.onSeatHover/seatHoverstill 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-largeormax-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 toreduceSeatHover(), andwholeUnitCardDataAttributes().
The card rules both bindings follow are core's too:wholeUnitControlGroups(),
isWholeUnitSelected(),wholeUnitCardGroup(),wholeUnitCardContext(),
seatCardKeyExists()andseatCardClickAction(). - Demos: with seat cards on, an
eithertable'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
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)
-
Seat.companionsis retired (§4.12.4). The member is reserved: the
validator rejects a seat that carries it, even an empty list, with the
reference rule idcompanions-retired(D23), and says that a group replaces
it.companion-referenceandcompanion-symmetryare gone with it. A set of
seats booked together is now a group withbooking: "whole", of kind
companionwhen no furniture is involved andloveseat,tableor the like
when it is. TheSeat.companionstype isnever. -
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 iswhole, or the seat alone. A tap, Enter or
Space on a seat toggles its whole unit, in place of the companion closure, and
changedinonSeatSelect/(seatSelect)lists all of it. -
companionModeisunitMode: 'auto' | 'seats'(D22), on both bindings
and as abuildRenderModeloption.'seats'is the old'independent': a
tap takes the seat alone, for an admin view that blocks single seats. -
New disallowed reasons.
companion-unavailableisunit-unavailable: a
seat of the unit is not available (§4.12.3).unit-too-largeis new: the unit
alone holds more seats thanmaxSelection, which still counts seats (D21).
SeatAriaStrings.disallowedneeds both keys, and no longer takes the old one. -
The render model.
RenderSeat.companionsis gone;RenderSeat.unitis
the seat's booking unit, andRenderSeat.unitBlockedsays another seat of it
cannot be picked. Core no longer exportscompanionClosure. The seat class
kerusi-seat--companioniskerusi-seat--unit, on a seat in a unit of more
than one. -
A seat booked only with a taken seat shows as unavailable (§4.12.3): the
other half of a sold love seat isaria-disabled, carries
kerusi-seat--unselectableand the newkerusi-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. -
Totals follow §4.9.1.
summarizeSelection, and thesummaryboth
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.unpricedcounts the seats no whole price covers. The live region's
total is the same.
Added
- Seat forms (§4.7.1).
SeatType.formsays what one place of a type looks
like, and the library now draws it:armchair,stool,recliner,
beanbag,cushion,wheelchair-space,sofaandbencheach get their own
outline, in the seat and in the legend swatch. Each faces up atrotation0
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, noformand a form the
library does not know draw the stock seat, so existing maps do not change
(D17). AshapefromseatStyleorseatTypeStylesstill wins over the
document's form. The outlines are drawn in-house (D24). Planned in #50, done in
#51. KerusiSeatShapegains the form names as presets, so an app can use
shape: 'armchair'too, and core exportsseatFormShape,SeatFormand
KerusiSeatFormShape.RenderLegendEntry.formcarries the form, and
legendSwatchPathtakes it as an optional third argument.- A "Lounge" scenario in both demos draws every form, untouched and turned.
- Groups (§4.11).
Section.groupsnames 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(arect, centred and turned as an element is, or acircle) is drawn
under its seats as<g class="kerusi-group kerusi-group--{kind}">, with a look
of its own fortable,sofa,loveseat,pew,benchandboothand a
plain shape for any other kind. Styled by the--kerusi-group-fill,
--kerusi-group-strokeand--kerusi-group-detailtokens, per kind with
--kerusi-group-{kind}-*, and by the newcolors.groupFill,groupStrokeand
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 alabelwraps its seats in arole="group"of that name, and a
seat in it is announced "Table 3, seat 4" (ariaStrings.groupSeat, optional).
The hover and click card context gainsgroup. 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-duplicateandgroup-shape-outside-canvas, a
group-shape-overlaps-seatwarning, andgroup-id,group-kind,
group-seats,group-shape-kindandgroup-shape-invalidfor what the
schemas own. Core exportsGroup,GroupKind,GroupShape,RenderGroup,
PlacedGroup,groupFootprintandresolveGroupGlyph. 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 aKerusiSession'sbookingModesoverriding 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.mjsand passes itsexamples/booking-units/corpus, vendored
here. Core also exportsbookingLevels,checkSelection(whether a selection
is a union of booking units, §4.12.3) andpriceSelection(§4.9.1). - A
sessioninput or prop drives booking. Both bindings already took a
KerusiSessionfor validation; itsbookingModesnow 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
eithergroup with a shape,
aneithertable or sofa, has its footprint drawn as a control: a
role="button"withtabindex="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-pressedsays
whether it is booked whole, and its outline takes the selected colour. While a
seat of it is taken it isaria-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;
onSelectionChangeand(selectionChange)do. - Whole units with no shape are the app's (D19): a room, the venue, a
shapeless group.RenderMap.wholeUnits, orbookingUnitswith a state, gives
them with their availability, and the app books one by settingselection
(core'stoggleWholeUnitdoes the arithmetic). The READMEs show a "Book the
whole room" button built this way. - The change reports whole units (D20).
selectionstays a list of seat ids.
React'sonSelectionChangegains a second argument,{ selection, wholeUnits };
Angular gains a(selectionDetail)output with the same object, emitted with
(selectionChange).wholeUnitslists the whole units fully selected, so an
app can say "Table 3 (whole table)".summarizeSelectionalso returns
wholeUnits, andwholes, 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,wholeUnitand
wholeUnitDisallowedare new optional strings too; leave them out and the
English defaults are used. - Whole prices (§4.9.1).
wholePriceandwholePriceTieron 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 everybookingis a known mode
(booking-mode-invalid), checks a session'sbookingModes
(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 againstbookingUnits,checkSelectionand
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
aneithervenue of...
kerusiweb 3.1.0
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
-
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). -
Events.
onSeatHover/seatHoverreports theRenderSeatunder the
pointer when it enters a seat andnullwhen 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
withinteractive={false}too.onSeatClick/seatClickreports
{ seat, selected, source }on every activation of any seat, booked,
held and blocked included, before the selection callbacks and withselected
as it was before the click. It is read-only (D13): it cannot cancel or change
what the click does. In AngularseatClickis anEventEmitterrather than an
output(), because only that can say whether it is bound. -
A read-only map can still take clicks (D14).
interactive={false}turns
selection off. WhileonSeatClick(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 noaria-pressed. There is no new prop: set
one and it turns on, remove them and the markup is a read-only map's again. -
Seat cards. A floating card anchored to a seat, with one card element and
two triggers:renderHoverCardandrenderClickCardin 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 arole="tooltip"wired to the seat with
aria-describedby. The click card opens on a click, a tap or Enter/Space, is a
non-modalrole="dialog"labelled by the seat, moves focus in when opened from
the keyboard and back to the seat on close, and closes onEscape, a press
outside, a second click on the same seat,close()or another seat's card.
Props and inputs:seatCardPlacement,seatCardClassName/seatCardClass,
seatCardAppearance,hoverCardDelayandhoverCardOnFocus. The hover card
shows on keyboard focus only withhoverCardOnFocus(D12).openSeatCard(),
closeSeatCard()andopenSeatCardIdopen and close a click card from code. -
The app owns the styling of a card (D11). Eleven
--kerusi-seat-card-*
tokens, the.kerusi-seat-cardclass hooks,data-placement,data-seat-id,
data-seat-status,data-seat-typeanddata-section-idattributes, your own
classes, andseatCardAppearance="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. -
Core (
@kerusiweb/core).reduceSeatHover()holds the hover rules once
for both bindings, asreduceGesture()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,
SeatCardAppearanceandHoverCardDelay. -
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. -
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,-borderand-hover-bg; see the
READMEs. The buttons no longer carry inline colours, so a rule on
.kerusi-controlno longer needs!importantto win. The default colours are
unchanged (elementBg,elementFg,elementMutedFg). The bar's border is a
40% tint ofelementMutedFg, lighter than before.
kerusiweb 3.0.0
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)
-
Documents follow rev 15.
KerusiMap.canvas({ width, height }, in
abstract units with one scale on both axes) andKerusiMap.seatSizeare
required.Seat.x/yandElement.x/yare required: an item's centre in
canvas units, no longer a percentage. A seat is aseatSizesquare centred
there; an element is awidth×heightrectangle, defaulting to the seat
size.Section.seatSizeoverrides the map's for one section.row/colon a
seat mean adjacency only (§4.3.5):colneeds arow, is a positive integer,
and is unique within its row. -
The map is one SVG (D1).
<svg class="kerusi-seatmap__svg">, whose
viewBoxis 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-svgare gone.KerusiSection(React) and
KerusiSectionComponent(Angular, now selectorg[kerusi-section]) render a
<g>and take the placed section aslayout, pluslabelandshowLabel.
Both bindings draw identical SVG, held to it by a shared parity test. -
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 fromrow,col, a row'sindex, or a row
shape. An empty row (§4.2.2) still reaches the render model with
empty: true, but reserves no space. -
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. -
A hidden section leaves its space empty (D4). Hiding it, or leaving it
out ofsectionIds, removes its group; the canvas keeps its size. -
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 declaresbounds(D5). Every section's label is
its group's accessible name; the drawn text isaria-hidden.
showSectionLabelskeeps its meaning. -
Keyboard navigation follows adjacency (D6). Left and right move along a
row incolorder and jump across an aisle (a skippedcol) 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 norowkeep the old heuristic, banded byyand ordered byx. -
Render model (
@kerusiweb/core).RenderMapgainscanvasand
seatSize.RenderSectionloseslayoutModeandaspectRatio, and gains
seatSize,bounds(declared, or the box around its content) and
boundsDeclared.RenderSeat.x/yare required canvas units, and it gains
sizeandbesideAisle.RenderElementlosesrow,rowIndexandcol,
and itswidth/heightare always set. Seats within a row are ordered by
col, thenx. -
computeSectionLayout()is replaced bycomputeMapLayout(renderMap, { rtl }),
returning{ width, height, sections: [{ section, seats, elements, bounds, labelAnchor }] }.
PlacedSeatandPlacedElementkeep their shape. An element's smallest font
is now a fifth of the seat size rather than a fixed 6 units. -
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-overrunandelement-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-duplicateandprice-tier-id-duplicate.
seat-positionandelement-positionare now errors for a missingxor
y. Two findings are warnings:seat-overlap(§4.3.1; footprints that only
touch don't overlap) andseat-outside-section-bounds. The rule ids match
the reference validator's (D7). -
SeatAriaStrings.besideAisleis 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,seatGapandfreeformBasis, and
aspectRatioandseatSizeinSectionRenderOptions(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,SectionLayoutand
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 nocanvasorseatSize. - No rev 14 → 15 upgrader ships (D8).
Added
-
Section.bounds,Section.seatSizeandRowMeta.shapein the document
model, withCanvas,Bounds,PointandRowShapetypes. -
Canvas geometry in core (
kerusi-geometry), with the reference
validator's semantics:seatSizeOf,areNeighbours,guidePointand
isOnGuide(for editors; renderers never read a row shape),footprintOf
andfootprintsOverlap. -
zoomToSection(sectionId)on the React handle and the Angular
component: zooms azoomablemap to a section'sbounds, or to the box
around its content. Core addsviewportForRect,canvasRectToContent,
contentRectToContainerandrevealContentRect. -
A maximized zoomable map fits the whole canvas to the screen at the
canvas's own proportions, through a--kerusi-canvas-aspectproperty. -
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. -
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
gridsection: choose a seat size and a pitch (the old defaults were 28
and 34), and put each seat atx = seatSize + (col − firstCol) × pitch,
y = top + seatSize + rowIndex × pitch, which is where 2.x drew it. Keeprow
andcolfor adjacency. An element spanning cells becomes one rectangle
centred over them. Space an empty row used to reserve is now simply space
the seats' ownyleave. - A
freeformsection: multiply each percentage by the section's width (or,
fory, its height) to get canvas units. 2.x drew a freeform section 1000
units wide and1000 / aspectRatiotall. - A
mixedsection: as freeform; itscols stay as they are. - Several sections: they now share one canvas, so give each its own region
of it, and declareboundswhere 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,seatGapandfreeformBasisfrom<kerusi-seatmap>/
<KerusiSeatmap>, andaspectRatioandseatSizefromsectionOverrides.
UseunitScaleto 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-svgand the section<h3>withsvg.kerusi-seatmap__svg
andg.kerusi-section[data-section-id]. - If you render sections yourself, use
computeMapLayout(renderMap, { rtl })
for one canvas instead ofcomputeSectionLayout()per section, and read
RenderSeat.x/y/sizeinstead ofcol,rowIndexor the layout mode. - If you pass your own
ariaStrings, addbesideAisle.
kerusiweb 2.3.0
Added
-
Custom seat content (#26). React takes a
renderSeatprop 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 withsvg:. -
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-visibleand coloured like the stock
ring. Custom content may have no.kerusi-seat__boxfor 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. -
resolveSeatGlyph()in@kerusiweb/corereturns every path, paint and
position of the stock seat (SeatGlyph), plusseatClassName()and the
KerusiSeatContexttype 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. -
Both demos gain a "Custom seat template" toggle that draws round seats from
the glyph's paints, keeping the stock status marks. -
Per-seat CSS hooks (#26). Every seat's
<g>now carriesdata-seat-type,
data-seat-status,data-section-idand, when the document gives them,
data-seat-rowanddata-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 samedata-seat-typeand their swatches
read the same token, so one rule recolours the seats and the key together. -
seatStyleandseatTypeStyles(#26), on both bindings. A
KerusiSeatStylesets a seat'sfill,labelColorand extraclassName
from code: per type throughseatTypeStyles(which the legend shows too), per
seat through aseatStyle(seat, { selected })function laid over it field by
field. A style takes the same slot asSeatType.color, below a stylesheet's
--kerusi-seat-fill, and never reaches a selected or blocked seat. A hex
fillgets a readable black or white label unlesslabelColorsays
otherwise. Core addsresolveSeatStyle(),isHexColor(), and an optional
trailingstyleargument onseatFill,seatTextFill,resolveSeatGlyph
and the legend swatch helpers. Both demos gain "Aisle seats via CSS" and
"Gold premium seats" toggles. -
Seat shapes (#26).
KerusiSeatStyle.shapetakes'seat'(the default
tapered outline),'square','rounded','circle', or a function returning
a pathdfor 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 addsseatShapePath(),
seatMarkerAnchor(),legendSwatchPath()and theKerusiSeatShapeand
SeatBoxtypes. Both demos gain a "Circle seat shape" toggle.
Changed
SeatType.colorcan now be overridden per seat. It still has no theme
token, but--kerusi-seat-fillset 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 newdata-*
attributes. Nothing looks different, but a test that snapshots the SVG will
see the change.legendSwatchFill()andlegendSwatchText()in core now
compute the legend's type swatches for both bindings.
kerusiweb 2.2.0
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
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
widthandheightstill place and size it. - The text size follows the box height and shrinks so a long label fits the box width.
rotationturns the text about the centre of the box.- The text colour comes from the usual element colour tokens.
- An element with no
labeltext 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
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 # ReactBreaking
-
The Angular package is renamed
ngx-kerusi-seatmap→@kerusiweb/angular,
joining@kerusiweb/coreand@kerusiweb/reactunder one scope. Thengx-
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
-
The repository is renamed
ngx-kerusi-seatmap→kerusiweb, and the
demos move toshadahm.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. -
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 barestart/build/testscripts — all of which meant Angular
— are gone.@angular/*moved from the workspace root'sdependenciesto
itsdevDependencies, alongsidereact, and the roottsconfig.jsonis
framework-neutral:angularCompilerOptionsmoved into a new
tsconfig.angular.jsonthat only the Angular binding and demo extend, so
core and the React binding no longer inherit them. -
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. -
docs/kerusi.mdis 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
-
Every package now ships its licence text. All three declared
"license": "MIT"while the onlyLICENSEfile 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/angularand@kerusiweb/reacteach carry a copy now. -
@kerusiweb/angulardeclarespublishConfig.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 publicwas passed by hand.
Added
-
A React binding,
@kerusiweb/react. Same components, same props, same
SVG as the Angular package:<KerusiSeatmap>,<KerusiSection>,
<KerusiLegend>, plususeKerusiStatein place ofKerusiStateStore. 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, ordefaultSelection);validate="throw"
throws during render so an error boundary catches it; focus moves through a
ref map rather than aquerySelectorAllscan; 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.cssthe 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 → thecolorsprop → the library default)
behave identically.The package is built by
tscalone, with no bundler, and declaresreact
and@kerusiweb/coreas peers. -
projects/react-demo/— a Vite React demo showing the same five venues
as the Angular one. The venue documents moved toprojects/demo-scenarios/
so both demos render the same fixtures rather than two copies drifting apart.
The published GitHub Pages site remains the Angular demo. -
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 theHeldSeattype 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
-
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/angularis now the Angular binding alone —
three components and the signal-backedKerusiStateStore— and declares
@kerusiweb/coreas 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'skerusi-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
strictwith no framework, no DOM and noany, 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,KerusiStateStoreand 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.