@kerusiweb/core 2.2.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/LICENSE +22 -22
  2. package/README.md +70 -68
  3. package/dist/kerusi/index.d.ts +4 -3
  4. package/dist/kerusi/index.d.ts.map +1 -1
  5. package/dist/kerusi/index.js +4 -3
  6. package/dist/kerusi/index.js.map +1 -1
  7. package/dist/kerusi/kerusi-geometry.d.ts +47 -0
  8. package/dist/kerusi/kerusi-geometry.d.ts.map +1 -0
  9. package/dist/kerusi/kerusi-geometry.js +111 -0
  10. package/dist/kerusi/kerusi-geometry.js.map +1 -0
  11. package/dist/kerusi/kerusi-map.model.d.ts +121 -68
  12. package/dist/kerusi/kerusi-map.model.d.ts.map +1 -1
  13. package/dist/kerusi/kerusi-map.model.js +6 -2
  14. package/dist/kerusi/kerusi-map.model.js.map +1 -1
  15. package/dist/kerusi/kerusi-rows.d.ts +2 -2
  16. package/dist/kerusi/kerusi-rows.js +2 -2
  17. package/dist/kerusi/kerusi-validator.d.ts +18 -9
  18. package/dist/kerusi/kerusi-validator.d.ts.map +1 -1
  19. package/dist/kerusi/kerusi-validator.js +301 -122
  20. package/dist/kerusi/kerusi-validator.js.map +1 -1
  21. package/dist/render/build-render-model.d.ts +8 -4
  22. package/dist/render/build-render-model.d.ts.map +1 -1
  23. package/dist/render/build-render-model.js +147 -45
  24. package/dist/render/build-render-model.js.map +1 -1
  25. package/dist/render/index.d.ts +1 -1
  26. package/dist/render/index.d.ts.map +1 -1
  27. package/dist/render/index.js +1 -1
  28. package/dist/render/index.js.map +1 -1
  29. package/dist/render/map-layout.d.ts +92 -0
  30. package/dist/render/map-layout.d.ts.map +1 -0
  31. package/dist/render/map-layout.js +93 -0
  32. package/dist/render/map-layout.js.map +1 -0
  33. package/dist/render/navigation-order.d.ts +20 -10
  34. package/dist/render/navigation-order.d.ts.map +1 -1
  35. package/dist/render/navigation-order.js +72 -57
  36. package/dist/render/navigation-order.js.map +1 -1
  37. package/dist/render/render-model.d.ts +48 -26
  38. package/dist/render/render-model.d.ts.map +1 -1
  39. package/dist/render/seat-shapes.d.ts +36 -3
  40. package/dist/render/seat-shapes.d.ts.map +1 -1
  41. package/dist/render/seat-shapes.js +50 -3
  42. package/dist/render/seat-shapes.js.map +1 -1
  43. package/dist/view/index.d.ts +2 -0
  44. package/dist/view/index.d.ts.map +1 -1
  45. package/dist/view/index.js +2 -0
  46. package/dist/view/index.js.map +1 -1
  47. package/dist/view/kerusi-seat-style.d.ts +58 -0
  48. package/dist/view/kerusi-seat-style.d.ts.map +1 -0
  49. package/dist/view/kerusi-seat-style.js +32 -0
  50. package/dist/view/kerusi-seat-style.js.map +1 -0
  51. package/dist/view/kerusi-seatmap-colors.d.ts +41 -5
  52. package/dist/view/kerusi-seatmap-colors.d.ts.map +1 -1
  53. package/dist/view/kerusi-seatmap-colors.js +67 -8
  54. package/dist/view/kerusi-seatmap-colors.js.map +1 -1
  55. package/dist/view/rtl.d.ts +1 -1
  56. package/dist/view/rtl.js +1 -1
  57. package/dist/view/seat-aria.d.ts +6 -0
  58. package/dist/view/seat-aria.d.ts.map +1 -1
  59. package/dist/view/seat-aria.js +8 -0
  60. package/dist/view/seat-aria.js.map +1 -1
  61. package/dist/view/seat-glyph.d.ts +137 -0
  62. package/dist/view/seat-glyph.d.ts.map +1 -0
  63. package/dist/view/seat-glyph.js +130 -0
  64. package/dist/view/seat-glyph.js.map +1 -0
  65. package/dist/view/viewport.d.ts +35 -7
  66. package/dist/view/viewport.d.ts.map +1 -1
  67. package/dist/view/viewport.js +56 -7
  68. package/dist/view/viewport.js.map +1 -1
  69. package/package.json +42 -42
  70. package/dist/kerusi/kerusi-layout-mode.d.ts +0 -58
  71. package/dist/kerusi/kerusi-layout-mode.d.ts.map +0 -1
  72. package/dist/kerusi/kerusi-layout-mode.js +0 -117
  73. package/dist/kerusi/kerusi-layout-mode.js.map +0 -1
  74. package/dist/render/section-layout.d.ts +0 -66
  75. package/dist/render/section-layout.d.ts.map +0 -1
  76. package/dist/render/section-layout.js +0 -186
  77. package/dist/render/section-layout.js.map +0 -1
@@ -0,0 +1,137 @@
1
+ import { RenderSeat } from '../render/render-model.js';
2
+ import { SeatBox } from '../render/seat-shapes.js';
3
+ import { PlacedSeat } from '../render/map-layout.js';
4
+ import { KerusiSeatStyle } from './kerusi-seat-style.js';
5
+ import { KerusiSeatmapColors, SeatOccupantVariant } from './kerusi-seatmap-colors.js';
6
+ /**
7
+ * The seat glyph, resolved: every path, paint and position a binding draws
8
+ * inside one seat's `<g>`.
9
+ *
10
+ * Both bindings used to call the paint and shape functions one by one, and each
11
+ * kept its own copy of the "mark box" rule below. That is exactly the code the
12
+ * architecture says belongs in core, so it lives here now and a binding only
13
+ * binds the result. It is also what a custom seat template receives, so a
14
+ * consumer drawing their own seat can reuse the library's paths and colours
15
+ * rather than re-derive them.
16
+ */
17
+ /** A filled path. */
18
+ export interface SeatGlyphShape {
19
+ /** The path's `d` attribute. */
20
+ d: string;
21
+ /** A CSS paint, usually a `var(--kerusi-*, …)` with the resolved fallback. */
22
+ fill: string;
23
+ }
24
+ export interface SeatGlyph {
25
+ /** `null` for an available or blocked seat: nothing to mark. */
26
+ variant: SeatOccupantVariant | null;
27
+ /** The classes for the seat's `<g>`: `kerusi-seat`, its status, and the modifiers. */
28
+ className: string;
29
+ /**
30
+ * The `data-*` attributes for the seat's `<g>`, so CSS can pick seats out by
31
+ * what the document says about them. An absent field is not rendered.
32
+ */
33
+ data: SeatDataAttributes;
34
+ /** The seat's own placed box. */
35
+ box: SeatBox;
36
+ /**
37
+ * The box the decorative marks sit on: the seat's own, or the selected core's
38
+ * when it is selected. See {@link resolveSeatGlyph}.
39
+ */
40
+ markBox: SeatBox;
41
+ /**
42
+ * The outline: by default square-ish at the front and tapered at the back, so
43
+ * facing reads from the shape; otherwise the seat style's `shape`.
44
+ */
45
+ body: SeatGlyphShape;
46
+ /** The dimming wash over a held or booked seat; absent otherwise. */
47
+ wash?: SeatGlyphShape;
48
+ /** The bright plate inside a selected seat's frame; absent otherwise. */
49
+ core?: SeatGlyphShape;
50
+ /** The occupant figure for a selected, held or booked seat; absent otherwise. */
51
+ occupant?: SeatGlyphShape & {
52
+ variant: SeatOccupantVariant;
53
+ /** `none` except for the hollow held figure. */
54
+ stroke: string;
55
+ strokeWidth: number;
56
+ };
57
+ /** The seat number, centred on the seat and kept upright. */
58
+ label: {
59
+ text: string;
60
+ x: number;
61
+ y: number;
62
+ fontSize: number;
63
+ fill: string;
64
+ /** A core-coloured halo behind a selected seat's number; `none` otherwise. */
65
+ halo: string;
66
+ haloWidth: number;
67
+ /** Cancels the seat's rotation; `null` when the seat does not rotate. */
68
+ transform: string | null;
69
+ };
70
+ /** The corner marker for `accessibility.wheelchairAccessible`; absent otherwise. */
71
+ wheelchair?: {
72
+ cx: number;
73
+ cy: number;
74
+ r: number;
75
+ fill: string;
76
+ };
77
+ }
78
+ /** See {@link SeatGlyph.data}. Each field is bound as the attribute named beside it. */
79
+ export interface SeatDataAttributes {
80
+ /** `data-seat-type`: `Seat.type`. */
81
+ type: string;
82
+ /** `data-seat-status`: the merged availability, same as the status class. */
83
+ status: string;
84
+ /** `data-section-id`: the section the seat belongs to. */
85
+ section: string;
86
+ /** `data-seat-row`: `Seat.row`, when the seat names one. */
87
+ row?: string;
88
+ /**
89
+ * `data-seat-attributes`: `Seat.attributes`, space-separated, when there are
90
+ * any, so `[data-seat-attributes~="aisle"]` matches one tag among several.
91
+ */
92
+ attributes?: string;
93
+ }
94
+ /**
95
+ * What a custom seat template is handed: the seat, whether it is selected, and
96
+ * the stock glyph already resolved for it. Each binding extends this with a
97
+ * framework-native way to draw the stock glyph (`defaultContent`).
98
+ */
99
+ export interface KerusiSeatContext {
100
+ /** The seat as placed in its section, in viewBox units. */
101
+ placed: PlacedSeat;
102
+ /** The resolved seat: status, type, price, accessibility, `source.metadata`. */
103
+ seat: RenderSeat;
104
+ /** Whether the seat is in the current selection. */
105
+ selected: boolean;
106
+ /** The stock glyph's paths and paints, for reuse. */
107
+ glyph: SeatGlyph;
108
+ }
109
+ /**
110
+ * Resolves the stock glyph for one placed seat.
111
+ *
112
+ * Everything over a selected seat sits on its core, so every mark is measured
113
+ * from the core's box rather than the seat's. Drawing to the seat's box leaves
114
+ * the occupant's hips crossing the frame, where a figure tinted `selectedBg`
115
+ * lands on a frame filled `selectedBg` and reads as a hard nub. Because the core
116
+ * is an exact scaled copy of the body (see `seatSelectedFrame`), measuring from
117
+ * it keeps every clearance a mark had against the body, so the frame width stays
118
+ * free to change. *
119
+ * `style` is the seat's resolved `seatStyle` / `seatTypeStyles` entry (see
120
+ * `resolveSeatStyle`). It changes the seat's own colour, label colour and
121
+ * classes; it never changes a selected or blocked seat's fill.
122
+ */
123
+ export declare function resolveSeatGlyph(placed: PlacedSeat, selected: boolean, colors: Required<KerusiSeatmapColors>, typeColors: boolean, style?: KerusiSeatStyle): SeatGlyph;
124
+ /**
125
+ * The outline for a legend type swatch drawn in its type's `shape`, on a
126
+ * `size`-square box, or `undefined` to keep the flat square swatch: a type with
127
+ * no shape, or the default `'seat'`, has nothing a square does not already say.
128
+ */
129
+ export declare function legendSwatchPath(typeStyle: KerusiSeatStyle | undefined, size: number): string | undefined;
130
+ /** The `data-*` attributes for a seat's `<g>`; see {@link SeatDataAttributes}. */
131
+ export declare function seatDataAttributes(seat: RenderSeat): SeatDataAttributes;
132
+ /**
133
+ * The class list for a seat's `<g>`: the hooks the READMEs document, then any
134
+ * `extra` classes from the seat's style.
135
+ */
136
+ export declare function seatClassName(seat: RenderSeat, selected: boolean, extra?: string | readonly string[]): string;
137
+ //# sourceMappingURL=seat-glyph.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"seat-glyph.d.ts","sourceRoot":"","sources":["../../src/view/seat-glyph.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EACL,OAAO,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E,MAAM,GAAG,SAAS,MAAM,EAAE,GACjC,MAAM,CAYR"}
@@ -0,0 +1,130 @@
1
+ import { seatMarkerAnchor, seatOccupantPath, seatOccupantStroke, seatSelectedFrame, seatShapePath, } from '../render/seat-shapes.js';
2
+ import { classList } from './kerusi-seat-style.js';
3
+ import { occupantFillFor, occupantStrokeFor, seatCoreFill, seatFill, seatOccupantVariant, seatTextFill, seatWashFill, } from './kerusi-seatmap-colors.js';
4
+ /**
5
+ * Resolves the stock glyph for one placed seat.
6
+ *
7
+ * Everything over a selected seat sits on its core, so every mark is measured
8
+ * from the core's box rather than the seat's. Drawing to the seat's box leaves
9
+ * the occupant's hips crossing the frame, where a figure tinted `selectedBg`
10
+ * lands on a frame filled `selectedBg` and reads as a hard nub. Because the core
11
+ * is an exact scaled copy of the body (see `seatSelectedFrame`), measuring from
12
+ * it keeps every clearance a mark had against the body, so the frame width stays
13
+ * free to change. *
14
+ * `style` is the seat's resolved `seatStyle` / `seatTypeStyles` entry (see
15
+ * `resolveSeatStyle`). It changes the seat's own colour, label colour and
16
+ * classes; it never changes a selected or blocked seat's fill.
17
+ */
18
+ export function resolveSeatGlyph(placed, selected, colors, typeColors, style) {
19
+ const seat = placed.seat;
20
+ const variant = seatOccupantVariant(seat, selected);
21
+ const box = {
22
+ x: placed.x,
23
+ y: placed.y,
24
+ width: placed.width,
25
+ height: placed.height,
26
+ };
27
+ const markBox = selected ? coreBox(box) : box;
28
+ const shape = style?.shape;
29
+ const bodyD = seatShapePath(shape, box.x, box.y, box.width, box.height);
30
+ const anchor = seatMarkerAnchor(shape);
31
+ const textFill = seatTextFill(seat, selected, colors, typeColors, style);
32
+ return {
33
+ variant,
34
+ className: seatClassName(seat, selected, style?.className),
35
+ data: seatDataAttributes(seat),
36
+ box,
37
+ markBox,
38
+ body: { d: bodyD, fill: seatFill(seat, selected, colors, typeColors, style) },
39
+ wash: variant === 'held' || variant === 'booked'
40
+ ? { d: bodyD, fill: seatWashFill(variant, colors) }
41
+ : undefined,
42
+ core: selected
43
+ ? {
44
+ d: seatShapePath(shape, markBox.x, markBox.y, markBox.width, markBox.height),
45
+ fill: seatCoreFill(colors),
46
+ }
47
+ : undefined,
48
+ occupant: variant
49
+ ? {
50
+ variant,
51
+ d: seatOccupantPath(markBox.x, markBox.y, markBox.width, markBox.height),
52
+ fill: occupantFillFor(variant, colors),
53
+ stroke: occupantStrokeFor(variant, colors),
54
+ strokeWidth: seatOccupantStroke(markBox.width, markBox.height),
55
+ }
56
+ : undefined,
57
+ label: {
58
+ text: seat.label,
59
+ x: placed.centerX,
60
+ y: placed.centerY,
61
+ fontSize: placed.fontSize,
62
+ fill: textFill,
63
+ // The label is centred on the occupant's shoulder line, so without the
64
+ // halo a selected seat's number is `selectedBg` over a `selectedBg`
65
+ // silhouette. It also rescues a label too long for the core.
66
+ halo: selected ? seatCoreFill(colors) : 'none',
67
+ haloWidth: selected ? placed.fontSize * 0.22 : 0,
68
+ transform: placed.rotation
69
+ ? `rotate(${-placed.rotation} ${placed.centerX} ${placed.centerY})`
70
+ : null,
71
+ },
72
+ // The marker keeps the same relative corner on whichever box it sits on, so
73
+ // a selected seat's dot stays whole instead of being bitten off by the frame.
74
+ wheelchair: seat.accessibility?.wheelchairAccessible
75
+ ? {
76
+ cx: markBox.x + markBox.width * anchor.x,
77
+ cy: markBox.y + markBox.height * anchor.y,
78
+ r: markBox.width * 0.13,
79
+ fill: textFill,
80
+ }
81
+ : undefined,
82
+ };
83
+ }
84
+ /**
85
+ * The outline for a legend type swatch drawn in its type's `shape`, on a
86
+ * `size`-square box, or `undefined` to keep the flat square swatch: a type with
87
+ * no shape, or the default `'seat'`, has nothing a square does not already say.
88
+ */
89
+ export function legendSwatchPath(typeStyle, size) {
90
+ const shape = typeStyle?.shape;
91
+ return shape && shape !== 'seat' ? seatShapePath(shape, 0, 0, size, size) : undefined;
92
+ }
93
+ /** The selected core's box: the seat's, inset by the frame width on every side. */
94
+ function coreBox(box) {
95
+ const frame = seatSelectedFrame(box.width, box.height);
96
+ return {
97
+ x: box.x + frame,
98
+ y: box.y + frame,
99
+ width: box.width - frame * 2,
100
+ height: box.height - frame * 2,
101
+ };
102
+ }
103
+ /** The `data-*` attributes for a seat's `<g>`; see {@link SeatDataAttributes}. */
104
+ export function seatDataAttributes(seat) {
105
+ return {
106
+ type: seat.type.id,
107
+ status: seat.status,
108
+ section: seat.sectionId,
109
+ row: seat.row || undefined,
110
+ attributes: seat.attributes.length ? seat.attributes.join(' ') : undefined,
111
+ };
112
+ }
113
+ /**
114
+ * The class list for a seat's `<g>`: the hooks the READMEs document, then any
115
+ * `extra` classes from the seat's style.
116
+ */
117
+ export function seatClassName(seat, selected, extra) {
118
+ return [
119
+ 'kerusi-seat',
120
+ `kerusi-seat--${seat.status}`,
121
+ selected ? 'kerusi-seat--selected' : '',
122
+ seat.selectable ? '' : 'kerusi-seat--unselectable',
123
+ seat.accessibility?.wheelchairAccessible ? 'kerusi-seat--wheelchair' : '',
124
+ seat.companions.length > 0 ? 'kerusi-seat--companion' : '',
125
+ ...classList(extra),
126
+ ]
127
+ .filter(Boolean)
128
+ .join(' ');
129
+ }
130
+ //# sourceMappingURL=seat-glyph.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"seat-glyph.js","sourceRoot":"","sources":["../../src/view/seat-glyph.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,aAAa,GACd,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,SAAS,EAAmB,MAAM,wBAAwB,CAAC;AACpE,OAAO,EAEL,eAAe,EACf,iBAAiB,EAEjB,YAAY,EACZ,QAAQ,EACR,mBAAmB,EACnB,YAAY,EACZ,YAAY,GACb,MAAM,4BAA4B,CAAC;AAyGpC;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,gBAAgB,CAC9B,MAAkB,EAClB,QAAiB,EACjB,MAAqC,EACrC,UAAmB,EACnB,KAAuB;IA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C,EAAE;QAClB,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,OAAO,EAAE,IAAI,CAAC,SAAS;QACvB,GAAG,EAAE,IAAI,CAAC,GAAG,IAAI,SAAS;QAC1B,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS;KAC3E,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,aAAa,CAC3B,IAAgB,EAChB,QAAiB,EACjB,KAAkC;IAElC,OAAO;QACL,aAAa;QACb,gBAAgB,IAAI,CAAC,MAAM,EAAE;QAC7B,QAAQ,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAAC,CAAC,EAAE;QACvC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,2BAA2B;QAClD,IAAI,CAAC,aAAa,EAAE,oBAAoB,CAAC,CAAC,CAAC,yBAAyB,CAAC,CAAC,CAAC,EAAE;QACzE,IAAI,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,wBAAwB,CAAC,CAAC,CAAC,EAAE;QAC1D,GAAG,SAAS,CAAC,KAAK,CAAC;KACpB;SACE,MAAM,CAAC,OAAO,CAAC;SACf,IAAI,CAAC,GAAG,CAAC,CAAC;AACf,CAAC"}
@@ -7,8 +7,15 @@
7
7
  * The bindings own the measuring and the event listeners; this owns what a
8
8
  * wheel tick, a key press or a pinch *means*.
9
9
  *
10
- * Zoom 1 is "fit": the map exactly as it lays out without zooming. It is also
11
- * the minimum, so the map can never be shrunk below the container.
10
+ * Zoom 1 is "fit": the whole canvas (§4.5) exactly as it lays out without
11
+ * zooming. It is also the minimum, so the map can never be shrunk below the
12
+ * container.
13
+ *
14
+ * Positions come in two frames. *Content* coordinates are CSS pixels on the
15
+ * unzoomed map, with the canvas's top-left at the origin; convert a canvas
16
+ * rect, such as a section's bounds or a placed seat, with
17
+ * {@link canvasRectToContent}. *Container* coordinates are where something is
18
+ * on screen now, relative to the container.
12
19
  */
13
20
  /** Zoom and pan of the map, as a CSS transform about its top-left corner. */
14
21
  export interface KerusiViewport {
@@ -32,7 +39,7 @@ export interface ViewportLimits {
32
39
  minZoom: number;
33
40
  maxZoom: number;
34
41
  }
35
- /** The map exactly as laid out: no zoom, no pan. */
42
+ /** The whole canvas exactly as laid out: no zoom, no pan. */
36
43
  export declare const FIT_VIEWPORT: KerusiViewport;
37
44
  /** Zoom is relative to fit, so the floor is always 1. */
38
45
  export declare const MIN_ZOOM = 1;
@@ -72,16 +79,37 @@ export declare function zoomViewportBy(viewport: KerusiViewport, factor: number,
72
79
  export declare function stepViewport(viewport: KerusiViewport, direction: 1 | -1, content: ViewportSize, container: ViewportSize, limits?: ViewportLimits): KerusiViewport;
73
80
  /** Pans by a delta in CSS pixels, held inside the map's bounds. */
74
81
  export declare function panViewportBy(viewport: KerusiViewport, dx: number, dy: number, content: ViewportSize, container: ViewportSize, limits?: ViewportLimits): KerusiViewport;
82
+ /**
83
+ * A rect in canvas units — a section's bounds, a placed seat — in content
84
+ * coordinates, given the canvas and the size the map lays out at when unzoomed.
85
+ * The canvas has the same scale on both axes (§4.5), and so does a map laid
86
+ * out at its aspect ratio; each axis is scaled on its own regardless, so a
87
+ * stretched layout still lands where it is drawn.
88
+ */
89
+ export declare function canvasRectToContent(rect: ViewportRect, canvas: ViewportSize, content: ViewportSize): ViewportRect;
90
+ /** Where a rect in content coordinates is on screen under `viewport`, in container coordinates. */
91
+ export declare function contentRectToContainer(viewport: KerusiViewport, rect: ViewportRect): ViewportRect;
92
+ /**
93
+ * The viewport that shows `rect` as large as the container allows, centred on
94
+ * it, with a margin: zoom to a section's bounds. `rect` is in content
95
+ * coordinates. The zoom stays within the limits, so a rect bigger than the
96
+ * container at fit gives fit, and the pan stays within the map.
97
+ */
98
+ export declare function viewportForRect(rect: ViewportRect, content: ViewportSize, container: ViewportSize, margin?: number, limits?: ViewportLimits): KerusiViewport;
75
99
  /**
76
100
  * Pans just far enough to bring `rect` inside the container, with a margin.
77
101
  *
78
102
  * `rect` is where the thing is on screen *now*, in container coordinates — a
79
- * seat's bounding box minus the container's. Measuring the result of the
80
- * current transform, rather than computing a position from the layout, is what
81
- * keeps this correct whatever the section widths and unit scale are. A rect
82
- * bigger than the container is aligned by its leading edge.
103
+ * seat's bounding box minus the container's. A rect bigger than the container
104
+ * is aligned by its leading edge. To reveal something from where it is on the
105
+ * canvas instead, without measuring, use {@link revealContentRect}.
83
106
  */
84
107
  export declare function revealRect(viewport: KerusiViewport, rect: ViewportRect, content: ViewportSize, container: ViewportSize, margin?: number, limits?: ViewportLimits): KerusiViewport;
108
+ /**
109
+ * Pans just far enough to bring `rect`, in content coordinates, inside the
110
+ * container: reveal a focused seat from its placed position on the canvas.
111
+ */
112
+ export declare function revealContentRect(viewport: KerusiViewport, rect: ViewportRect, content: ViewportSize, container: ViewportSize, margin?: number, limits?: ViewportLimits): KerusiViewport;
85
113
  /**
86
114
  * The zoom factor a wheel event asks for, or `null` if it is not a zoom
87
115
  * gesture.
@@ -1 +1 @@
1
- {"version":3,"file":"viewport.d.ts","sourceRoot":"","sources":["../../src/view/viewport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,6EAA6E;AAC7E,MAAM,WAAW,cAAc;IAC7B,oDAAoD;IACpD,IAAI,EAAE,MAAM,CAAC;IACb,2DAA2D;IAC3D,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED,MAAM,WAAW,aAAa;IAC5B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,YAAa,SAAQ,aAAa,EAAE,YAAY;CAAG;AAEpE,MAAM,WAAW,cAA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AAC;CAClB,GAAG,MAAM,GAAG,IAAI,CAQhB;AAED,oFAAoF;AACpF,MAAM,WAAW,gBAAgB;IAC/B,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,cAAc,EACxB,KAAK,EAAE,gBAAgB,EACvB,OAAO,EAAE,YAAY,EACrB,SAAS,EAAE,YAAY,EACvB,MAAM,GAAE,cAA6B,GACpC,cAAc,GAAG,IAAI,CA8BvB;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,iBAAiB,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,IAAI,GAAG,SAAS,GAC3E,OAAO,CAQT;AAED,yEAAyE;AACzE,wBAAgB,cAAc,CAAC,CAAC,EAAE,cAAc,EAAE,CAAC,EAAE,cAAc,GAAG,OAAO,CAI5E;AAED,8EAA8E;AAC9E,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,cAAc,GAAG,MAAM,CAElE;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,cAAc,EAAE,SAAS,EAAE,OAAO,GAAG,MAAM,CAExF"}
@@ -7,10 +7,17 @@
7
7
  * The bindings own the measuring and the event listeners; this owns what a
8
8
  * wheel tick, a key press or a pinch *means*.
9
9
  *
10
- * Zoom 1 is "fit": the map exactly as it lays out without zooming. It is also
11
- * the minimum, so the map can never be shrunk below the container.
10
+ * Zoom 1 is "fit": the whole canvas (§4.5) exactly as it lays out without
11
+ * zooming. It is also the minimum, so the map can never be shrunk below the
12
+ * container.
13
+ *
14
+ * Positions come in two frames. *Content* coordinates are CSS pixels on the
15
+ * unzoomed map, with the canvas's top-left at the origin; convert a canvas
16
+ * rect, such as a section's bounds or a placed seat, with
17
+ * {@link canvasRectToContent}. *Container* coordinates are where something is
18
+ * on screen now, relative to the container.
12
19
  */
13
- /** The map exactly as laid out: no zoom, no pan. */
20
+ /** The whole canvas exactly as laid out: no zoom, no pan. */
14
21
  export const FIT_VIEWPORT = Object.freeze({ zoom: 1, x: 0, y: 0 });
15
22
  /** Zoom is relative to fit, so the floor is always 1. */
16
23
  export const MIN_ZOOM = 1;
@@ -78,20 +85,62 @@ export function stepViewport(viewport, direction, content, container, limits = z
78
85
  export function panViewportBy(viewport, dx, dy, content, container, limits = zoomLimits()) {
79
86
  return clampViewport({ zoom: viewport.zoom, x: viewport.x + dx, y: viewport.y + dy }, content, container, limits);
80
87
  }
88
+ /**
89
+ * A rect in canvas units — a section's bounds, a placed seat — in content
90
+ * coordinates, given the canvas and the size the map lays out at when unzoomed.
91
+ * The canvas has the same scale on both axes (§4.5), and so does a map laid
92
+ * out at its aspect ratio; each axis is scaled on its own regardless, so a
93
+ * stretched layout still lands where it is drawn.
94
+ */
95
+ export function canvasRectToContent(rect, canvas, content) {
96
+ const sx = canvas.width > 0 ? content.width / canvas.width : 0;
97
+ const sy = canvas.height > 0 ? content.height / canvas.height : 0;
98
+ return { x: rect.x * sx, y: rect.y * sy, width: rect.width * sx, height: rect.height * sy };
99
+ }
100
+ /** Where a rect in content coordinates is on screen under `viewport`, in container coordinates. */
101
+ export function contentRectToContainer(viewport, rect) {
102
+ return {
103
+ x: viewport.x + rect.x * viewport.zoom,
104
+ y: viewport.y + rect.y * viewport.zoom,
105
+ width: rect.width * viewport.zoom,
106
+ height: rect.height * viewport.zoom,
107
+ };
108
+ }
109
+ /**
110
+ * The viewport that shows `rect` as large as the container allows, centred on
111
+ * it, with a margin: zoom to a section's bounds. `rect` is in content
112
+ * coordinates. The zoom stays within the limits, so a rect bigger than the
113
+ * container at fit gives fit, and the pan stays within the map.
114
+ */
115
+ export function viewportForRect(rect, content, container, margin = REVEAL_MARGIN, limits = zoomLimits()) {
116
+ const fits = (available, size) => size > 0 ? Math.max(available - 2 * Math.max(0, margin), 0) / size : Number.POSITIVE_INFINITY;
117
+ const zoom = clamp(Math.min(fits(container.width, rect.width), fits(container.height, rect.height)), limits.minZoom, limits.maxZoom);
118
+ return clampViewport({
119
+ zoom,
120
+ x: container.width / 2 - (rect.x + rect.width / 2) * zoom,
121
+ y: container.height / 2 - (rect.y + rect.height / 2) * zoom,
122
+ }, content, container, limits);
123
+ }
81
124
  /**
82
125
  * Pans just far enough to bring `rect` inside the container, with a margin.
83
126
  *
84
127
  * `rect` is where the thing is on screen *now*, in container coordinates — a
85
- * seat's bounding box minus the container's. Measuring the result of the
86
- * current transform, rather than computing a position from the layout, is what
87
- * keeps this correct whatever the section widths and unit scale are. A rect
88
- * bigger than the container is aligned by its leading edge.
128
+ * seat's bounding box minus the container's. A rect bigger than the container
129
+ * is aligned by its leading edge. To reveal something from where it is on the
130
+ * canvas instead, without measuring, use {@link revealContentRect}.
89
131
  */
90
132
  export function revealRect(viewport, rect, content, container, margin = REVEAL_MARGIN, limits = zoomLimits()) {
91
133
  const dx = revealAxis(rect.x, rect.width, container.width, margin);
92
134
  const dy = revealAxis(rect.y, rect.height, container.height, margin);
93
135
  return panViewportBy(viewport, dx, dy, content, container, limits);
94
136
  }
137
+ /**
138
+ * Pans just far enough to bring `rect`, in content coordinates, inside the
139
+ * container: reveal a focused seat from its placed position on the canvas.
140
+ */
141
+ export function revealContentRect(viewport, rect, content, container, margin = REVEAL_MARGIN, limits = zoomLimits()) {
142
+ return revealRect(viewport, contentRectToContainer(viewport, rect), content, container, margin, limits);
143
+ }
95
144
  /**
96
145
  * The zoom factor a wheel event asks for, or `null` if it is not a zoom
97
146
  * gesture.
@@ -1 +1 @@
1
- {"version":3,"file":"viewport.js","sourceRoot":"","sources":["../../src/view/viewport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;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M,EAAE,CAAC,CAAC,CAAC;AAC9C,CAAC;AAED,iGAAiG;AACjG,SAAS,UAAU,CAAC,KAAa,EAAE,IAAY,EAAE,SAAiB,EAAE,MAAc;IAChF,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,SAAS,GAAG,CAAC,CAAC,CAAC;IAC1D,MAAM,GAAG,GAAG,IAAI,CAAC;IACjB,MAAM,IAAI,GAAG,SAAS,GAAG,IAAI,CAAC;IAC9B,IAAI,IAAI,IAAI,IAAI,GAAG,GAAG,EAAE,CAAC;QACvB,OAAO,GAAG,GAAG,KAAK,CAAC;IACrB,CAAC;IACD,IAAI,KAAK,GAAG,GAAG,EAAE,CAAC;QAChB,OAAO,GAAG,GAAG,KAAK,CAAC;IACrB,CAAC;IACD,IAAI,KAAK,GAAG,IAAI,GAAG,IAAI,EAAE,CAAC;QACxB,OAAO,IAAI,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC;IAC/B,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC;AAED,4EAA4E;AAC5E,SAAS,KAAK,CAAC,KAAa;IAC1B,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC;AAC7C,CAAC"}
package/package.json CHANGED
@@ -1,42 +1,42 @@
1
- {
2
- "name": "@kerusiweb/core",
3
- "version": "2.2.0",
4
- "description": "Framework-agnostic core for the Kerusi Seat Map & Availability Format: document types, a conformance validator, and the render model and geometry a seat-map renderer consumes.",
5
- "keywords": [
6
- "kerusi",
7
- "seat-map",
8
- "seatmap",
9
- "seat-picker",
10
- "seat-selection",
11
- "booking",
12
- "ticketing",
13
- "cinema",
14
- "airline",
15
- "venue"
16
- ],
17
- "license": "MIT",
18
- "author": "Arsyad \"Shad Ahm\" Ahmad",
19
- "repository": {
20
- "type": "git",
21
- "url": "https://github.com/ShadAhm/kerusiweb.git",
22
- "directory": "projects/core"
23
- },
24
- "homepage": "https://github.com/ShadAhm/kerusiweb",
25
- "type": "module",
26
- "sideEffects": false,
27
- "exports": {
28
- ".": {
29
- "types": "./dist/public-api.d.ts",
30
- "default": "./dist/public-api.js"
31
- },
32
- "./package.json": "./package.json"
33
- },
34
- "types": "./dist/public-api.d.ts",
35
- "main": "./dist/public-api.js",
36
- "files": [
37
- "dist"
38
- ],
39
- "publishConfig": {
40
- "access": "public"
41
- }
42
- }
1
+ {
2
+ "name": "@kerusiweb/core",
3
+ "version": "3.0.0",
4
+ "description": "Framework-agnostic core for the Kerusi Seat Map & Availability Format: document types, a conformance validator, and the render model and geometry a seat-map renderer consumes.",
5
+ "keywords": [
6
+ "kerusi",
7
+ "seat-map",
8
+ "seatmap",
9
+ "seat-picker",
10
+ "seat-selection",
11
+ "booking",
12
+ "ticketing",
13
+ "cinema",
14
+ "airline",
15
+ "venue"
16
+ ],
17
+ "license": "MIT",
18
+ "author": "Arsyad \"Shad Ahm\" Ahmad",
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "git+https://github.com/ShadAhm/kerusiweb.git",
22
+ "directory": "projects/core"
23
+ },
24
+ "homepage": "https://github.com/ShadAhm/kerusiweb",
25
+ "type": "module",
26
+ "sideEffects": false,
27
+ "exports": {
28
+ ".": {
29
+ "types": "./dist/public-api.d.ts",
30
+ "default": "./dist/public-api.js"
31
+ },
32
+ "./package.json": "./package.json"
33
+ },
34
+ "types": "./dist/public-api.d.ts",
35
+ "main": "./dist/public-api.js",
36
+ "files": [
37
+ "dist"
38
+ ],
39
+ "publishConfig": {
40
+ "access": "public"
41
+ }
42
+ }
@@ -1,58 +0,0 @@
1
- import { Section } from './kerusi-map.model.js';
2
- import { KerusiViolation } from './kerusi-violation.js';
3
- /** The three positioning modes a section may use (§4.5). */
4
- export type SectionLayoutMode = 'grid' | 'freeform' | 'mixed';
5
- /**
6
- * `Section.layout` is a strict, validated constraint — not a rendering hint.
7
- * This module is the single implementation of §4.5, shared by the validator and
8
- * the render-model builder so the two can never disagree about what mode a
9
- * section is in.
10
- *
11
- * Per §4.5:
12
- * - `grid` — every seat MUST have `col`; no seat may have `x` or `y`.
13
- * - `freeform` — every seat MUST have both `x` and `y`; no seat may have `col`.
14
- * - `mixed` — every seat MUST have `col` AND both `x` and `y`.
15
- *
16
- * A free-text `row` is permitted in every mode: it carries no positional
17
- * information, so it never participates in the constraint.
18
- */
19
- /**
20
- * The positional members a seat or element may carry. Elements are positioned
21
- * the same way seats are (§4.4), so these predicates take the shape rather than
22
- * the full `Seat`.
23
- */
24
- export interface Positioned {
25
- col?: number;
26
- x?: number;
27
- y?: number;
28
- }
29
- /** True when the item carries a usable grid column. */
30
- export declare function hasCol(item: Positioned): boolean;
31
- /** True when the item carries both freeform coordinates. Neither alone counts. */
32
- export declare function hasXY(item: Positioned): boolean;
33
- /** True when the item carries either coordinate — the `grid` prohibition. */
34
- export declare function hasAnyCoordinate(item: Positioned): boolean;
35
- /**
36
- * Infers a section's mode from its seats when `Section.layout` is omitted
37
- * (§4.5). Returns `undefined` when the seats are inconsistent — the caller MUST
38
- * reject such a section.
39
- *
40
- * An empty section infers `grid`: it satisfies "every seat has `col`" vacuously
41
- * and grid is the cheaper mode to render.
42
- */
43
- export declare function inferSectionLayoutMode(section: Section): SectionLayoutMode | undefined;
44
- /**
45
- * The mode a section renders in: its declared `layout`, or the inferred one.
46
- * Falls back to `grid` for an inconsistent section so a renderer can still draw
47
- * *something* after the validator has reported the fault. Callers that must not
48
- * render an invalid document should check {@link checkSectionLayout} first.
49
- */
50
- export declare function resolveSectionLayoutMode(section: Section): SectionLayoutMode;
51
- /**
52
- * Validates a section against §4.5. Returns every violation found, in seat
53
- * declaration order; an empty array means the section conforms.
54
- *
55
- * @param path Document path prefix for the violations, e.g. `sections[1]`.
56
- */
57
- export declare function checkSectionLayout(section: Section, path?: string): KerusiViolation[];
58
- //# sourceMappingURL=kerusi-layout-mode.d.ts.map