Repository navigation
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.