Repository navigation
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 offered by the app's own "Hire the whole venue" button, an
eithertable booked from its top, and a private room bookedwhole. The
demos' companion pairs are groups booked whole.
Migrating from 3.x
Documents. Replace every companions list with a group in the seats'
section, booked whole. A wheelchair space and its companion seat:
seats: [
- { "id": "E1", "x": 40, "y": 200, "type": "wheelchair", "companions": ["E2"] },
- { "id": "E2", "x": 80, "y": 200, "type": "standard", "companions": ["E1"] }
+ { "id": "E1", "x": 40, "y": 200, "type": "wheelchair" },
+ { "id": "E2", "x": 80, "y": 200, "type": "standard" }
],
+ "groups": [
+ { "id": "E-bay", "kind": "companion", "seats": ["E1", "E2"], "booking": "whole" }
+ ]Use kind: "loveseat", "table" and so on when there is a piece of furniture,
and give it a shape to draw it. A family pod linked by a chain of companions is
one group of all its seats. Then set kerusi documents to rev 17 in whatever
pipeline produces them: a map that still carries companions is rejected with
companions-retired.
Code.
companionMode="independent"becomesunitMode="seats";
companionMode="auto"becomesunitMode="auto", the default, or nothing.- In a
SeatDisallowedhandler or a customariaStrings.disallowed, rename
companion-unavailabletounit-unavailable, and handleunit-too-large. RenderSeat.companionsisRenderSeat.unit.seatIds(with the seat itself),
andcompanionClosure(id, seatsById)isseatsById.get(id).unit.seatIds.- CSS on
.kerusi-seat--companionmoves to.kerusi-seat--unit. - A total from
summarizeSelectionnow applies whole prices (§4.9.1). A map with
nowholePriceorwholePriceTiertotals exactly as before. - To show whole bookings in a cart, read
wholeUnitsfrom the change event
(React's secondonSelectionChangeargument, Angular's(selectionDetail)) or
fromsummary.