@seatmap-fyi/map-domain 0.1.0-alpha.4 → 0.1.0-alpha.50

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 (111) hide show
  1. package/dist/arc-fan-rebuild.d.ts +17 -0
  2. package/dist/arc-fan-rebuild.js +227 -0
  3. package/dist/arc-fan-section-layout.d.ts +11 -0
  4. package/dist/arc-fan-section-layout.js +54 -0
  5. package/dist/arc-fan.d.ts +27 -0
  6. package/dist/arc-fan.interface.d.ts +100 -0
  7. package/dist/arc-fan.interface.js +30 -0
  8. package/dist/arc-fan.js +182 -0
  9. package/dist/catalog.d.ts +6 -4
  10. package/dist/catalog.js +31 -17
  11. package/dist/categories.d.ts +14 -3
  12. package/dist/categories.js +146 -35
  13. package/dist/editor-state.d.ts +4 -1
  14. package/dist/editor-state.js +53 -30
  15. package/dist/floors.d.ts +22 -0
  16. package/dist/floors.js +72 -0
  17. package/dist/geometry/boundary.d.ts +1 -1
  18. package/dist/geometry/boundary.js +16 -12
  19. package/dist/geometry/curve-warnings.d.ts +1 -1
  20. package/dist/geometry/curve-warnings.js +3 -5
  21. package/dist/geometry/decoration-bounds.d.ts +4 -0
  22. package/dist/geometry/decoration-bounds.js +42 -0
  23. package/dist/geometry/ellipse.js +4 -12
  24. package/dist/geometry/geometry.d.ts +9 -3
  25. package/dist/geometry/geometry.js +58 -34
  26. package/dist/geometry/inventory-outline.d.ts +8 -0
  27. package/dist/geometry/inventory-outline.js +46 -0
  28. package/dist/geometry/layout-transform.d.ts +10 -0
  29. package/dist/geometry/layout-transform.interface.d.ts +6 -0
  30. package/dist/geometry/layout-transform.interface.js +1 -0
  31. package/dist/geometry/layout-transform.js +206 -0
  32. package/dist/geometry/polygon-curves.d.ts +17 -0
  33. package/dist/geometry/polygon-curves.interface.d.ts +21 -0
  34. package/dist/geometry/polygon-curves.interface.js +5 -0
  35. package/dist/geometry/polygon-curves.js +169 -0
  36. package/dist/geometry/primitives.d.ts +1 -1
  37. package/dist/geometry/primitives.js +2 -3
  38. package/dist/geometry/seat-shape.d.ts +1 -1
  39. package/dist/geometry/seat-shape.js +5 -5
  40. package/dist/geometry/seating-layout.d.ts +10 -1
  41. package/dist/geometry/seating-layout.js +73 -57
  42. package/dist/geometry/units.d.ts +8 -0
  43. package/dist/geometry/units.js +13 -0
  44. package/dist/geometry/venue-outline.d.ts +4 -18
  45. package/dist/geometry/venue-outline.interface.d.ts +23 -0
  46. package/dist/geometry/venue-outline.interface.js +7 -0
  47. package/dist/geometry/venue-outline.js +142 -49
  48. package/dist/identity.d.ts +3 -1
  49. package/dist/identity.js +32 -17
  50. package/dist/issues.d.ts +16 -2
  51. package/dist/issues.js +17 -6
  52. package/dist/labels.d.ts +6 -1
  53. package/dist/labels.js +20 -18
  54. package/dist/layers.d.ts +26 -0
  55. package/dist/layers.js +86 -0
  56. package/dist/media.d.ts +27 -0
  57. package/dist/media.js +89 -0
  58. package/dist/{types.d.ts → physical-document.interface.d.ts} +142 -10
  59. package/dist/{types.js → physical-document.interface.js} +23 -0
  60. package/dist/preview.d.ts +1 -1
  61. package/dist/preview.js +39 -29
  62. package/dist/reference.js +1 -1
  63. package/dist/row-segments.d.ts +5 -1
  64. package/dist/row-segments.js +10 -9
  65. package/dist/schema.d.ts +680 -18
  66. package/dist/schema.js +269 -111
  67. package/dist/seat-proximity.d.ts +4 -0
  68. package/dist/seat-proximity.js +119 -0
  69. package/dist/section-elevation.d.ts +5 -0
  70. package/dist/section-elevation.interface.d.ts +26 -0
  71. package/dist/section-elevation.interface.js +8 -0
  72. package/dist/section-elevation.js +53 -0
  73. package/dist/section-fill-rebuild.d.ts +10 -0
  74. package/dist/section-fill-rebuild.js +64 -0
  75. package/dist/section-fill.d.ts +84 -0
  76. package/dist/section-fill.interface.d.ts +94 -0
  77. package/dist/section-fill.interface.js +22 -0
  78. package/dist/section-fill.js +306 -0
  79. package/dist/section-growth.d.ts +11 -0
  80. package/dist/section-growth.interface.d.ts +20 -0
  81. package/dist/section-growth.interface.js +1 -0
  82. package/dist/section-growth.js +245 -0
  83. package/dist/section-layout.d.ts +101 -0
  84. package/dist/section-layout.interface.d.ts +8 -0
  85. package/dist/section-layout.interface.js +5 -0
  86. package/dist/section-layout.js +72 -0
  87. package/dist/section-outline-refit.d.ts +8 -0
  88. package/dist/section-outline-refit.js +246 -0
  89. package/dist/section-refit.d.ts +22 -0
  90. package/dist/section-refit.interface.d.ts +49 -0
  91. package/dist/section-refit.interface.js +6 -0
  92. package/dist/section-refit.js +179 -0
  93. package/dist/section-scale.d.ts +2 -0
  94. package/dist/section-scale.js +128 -0
  95. package/dist/sections.d.ts +23 -0
  96. package/dist/sections.js +144 -0
  97. package/dist/selling.d.ts +1 -1
  98. package/dist/selling.js +11 -26
  99. package/dist/spacing-repairs.d.ts +31 -0
  100. package/dist/spacing-repairs.js +168 -0
  101. package/dist/table-layout.d.ts +3 -3
  102. package/dist/table-layout.js +35 -35
  103. package/dist/validation.d.ts +7 -2
  104. package/dist/validation.interface.d.ts +20 -0
  105. package/dist/validation.interface.js +9 -0
  106. package/dist/validation.js +221 -85
  107. package/dist/wayfinding.d.ts +10 -0
  108. package/dist/wayfinding.interface.d.ts +52 -0
  109. package/dist/wayfinding.interface.js +28 -0
  110. package/dist/wayfinding.js +63 -0
  111. package/package.json +97 -4
@@ -1,3 +1,5 @@
1
+ import type { ArcFanGeneration } from "./arc-fan.interface.js";
2
+ import type { EntranceAssignment, GateDetails, RouteDetails, LineCap, LineJoin, LineEnding } from "./wayfinding.interface.js";
1
3
  export declare const DocumentLimits: {
2
4
  readonly PhysicalSeats: 100000;
3
5
  readonly JsonBytes: number;
@@ -20,6 +22,12 @@ export type Transform = {
20
22
  export type PolygonM = {
21
23
  outer: PointM[];
22
24
  holes: PointM[][];
25
+ /** Signed quadratic bow per authored outer side; absence means straight sides. */
26
+ edgeCurvature?: number[];
27
+ /** Percentage of the rectangular outline’s maximum corner radius; absent means sharp corners. */
28
+ cornerRounding?: number;
29
+ /** Absolute circular fillet radius in metres. */
30
+ cornerRadiusM?: number;
23
31
  };
24
32
  export type Paint = {
25
33
  color: string;
@@ -124,7 +132,11 @@ export type MapCategory = {
124
132
  ticketOptions?: CategoryTicketOption[];
125
133
  seatShape?: SeatShape;
126
134
  };
135
+ export type BuyerPhoto = {
136
+ assetId: UUID;
137
+ };
127
138
  export type SeatSlot = {
139
+ buyerPhoto?: BuyerPhoto;
128
140
  gap?: boolean;
129
141
  buyerNote?: string;
130
142
  labelStyle?: LabelStyle;
@@ -153,13 +165,26 @@ export type RowLayout = {
153
165
  rotationDeg: number;
154
166
  seatRotationOffsetDeg?: number;
155
167
  };
168
+ /** Identifies a generated part independently of printed labels and position. */
169
+ export type SectionFillRowOrigin = {
170
+ sectionId: UUID;
171
+ rowIndex: number;
172
+ partIndex: number;
173
+ };
156
174
  export type RowSlot = {
175
+ entrance?: EntranceAssignment;
176
+ fillOrigin?: SectionFillRowOrigin;
177
+ /** Sibling stacking override; absent inherits the bank stacking position. */
178
+ zIndex?: number;
179
+ buyerPhoto?: BuyerPhoto;
157
180
  buyerNoun?: string;
158
181
  buyerNote?: string;
159
182
  labelStyle?: RowLabelStyle;
160
183
  categoryId?: UUID | null;
161
184
  id: UUID;
185
+ /** Displayed name; absent inherits the physical booking label. */
162
186
  labelOverride?: string;
187
+ /** Physical row identifier; absent inherits its group row sequence. */
163
188
  bookingLabel?: string;
164
189
  offsetM?: PointM;
165
190
  seatSequenceOverride?: LabelSequence;
@@ -169,13 +194,16 @@ export type RowSlot = {
169
194
  };
170
195
  export type DrawableBase = {
171
196
  id: UUID;
197
+ floorId?: UUID;
172
198
  parentId: UUID | null;
173
199
  transform: Transform;
174
200
  zIndex: number;
175
201
  };
176
202
  export type GroupBase = DrawableBase & {
203
+ entrance?: EntranceAssignment;
177
204
  categoryId?: UUID | null;
178
205
  name: string;
206
+ /** Explicit grouping for outline-free sections and overview shapes; inventory boundaries use geometry. */
179
207
  sectionId: UUID | null;
180
208
  seatSizeM: SizeM;
181
209
  boundary?: PolygonM;
@@ -186,6 +214,10 @@ export type RowsLabels = {
186
214
  seats: LabelSequence;
187
215
  rowStyle: RowLabelStyle;
188
216
  };
217
+ export declare enum RowStagger {
218
+ First = "first",
219
+ Second = "second"
220
+ }
189
221
  export declare enum RowAlignment {
190
222
  Start = "start",
191
223
  Center = "center",
@@ -205,13 +237,17 @@ export type SegmentedRow = {
205
237
  id: UUID;
206
238
  label: string;
207
239
  sequence: LabelSequence;
240
+ /** Use each physical part's row name for seat addresses without changing authored affixes. */
241
+ qualifySeatLabels?: boolean;
208
242
  smoothCorners?: boolean;
209
243
  parts: {
210
244
  rowId: UUID;
211
245
  joinBefore: RowJoin | null;
246
+ labelOverride?: string;
212
247
  }[];
213
248
  };
214
249
  type RowsBase = GroupBase & {
250
+ arcFan?: ArcFanGeneration;
215
251
  labels: RowsLabels;
216
252
  rows: RowSlot[];
217
253
  };
@@ -221,6 +257,7 @@ export type StraightRows = RowsBase & {
221
257
  seatPitchM: number;
222
258
  rowPitchM: number;
223
259
  rowAlignment?: RowAlignment;
260
+ stagger?: RowStagger;
224
261
  };
225
262
  };
226
263
  export type CurvedRows = RowsBase & {
@@ -241,9 +278,25 @@ export type CurvedRows = RowsBase & {
241
278
  };
242
279
  };
243
280
  export type RowInventory = StraightRows | CurvedRows;
244
- export type TableLabels = {
245
- table: string;
281
+ export type InventoryNaming = {
282
+ code: string;
283
+ name?: string;
284
+ };
285
+ export declare enum TableChairNumberFormat {
286
+ Prefixed = "prefixed",
287
+ Number = "number",
288
+ Letter = "letter"
289
+ }
290
+ export type TableChairNumbering = {
291
+ startAt: number;
292
+ direction: LabelDirection.Forward | LabelDirection.Reverse;
293
+ format: TableChairNumberFormat;
294
+ };
295
+ export type TableLabels = InventoryNaming & {
296
+ /** The physical booking sequence is independent of buyer-facing numbering. */
246
297
  chairs: LabelSequence;
298
+ chairNumbering?: TableChairNumbering;
299
+ buyerNoun?: string;
247
300
  tableStyle: LabelStyle;
248
301
  };
249
302
  export declare enum TableBookingMode {
@@ -290,18 +343,22 @@ export type RoundTableRecipe = {
290
343
  automaticSize?: boolean;
291
344
  seatArcDeg?: number;
292
345
  };
346
+ export type TableChairSideSelection = {
347
+ top: boolean;
348
+ bottom: boolean;
349
+ left: boolean;
350
+ right: boolean;
351
+ };
293
352
  export type LongTableLayout = {
294
353
  recipe: RectangularTableRecipe;
295
- sides: {
296
- top: boolean;
297
- bottom: boolean;
298
- left: boolean;
299
- right: boolean;
300
- };
354
+ sides?: TableChairSideSelection;
301
355
  };
302
356
  export type RectangularTable = GroupBase & {
357
+ surfaceColor?: string;
303
358
  selling?: TableSelling;
304
359
  roundLayout?: RoundTableRecipe;
360
+ /** Side preference set by editing the saved table, independent of the placed chair counts. */
361
+ conversionSides?: TableChairSideSelection;
305
362
  kind: SeatingKind.Rectangular;
306
363
  recipe: RectangularTableRecipe;
307
364
  labels: TableLabels;
@@ -313,6 +370,7 @@ export type RectangularTable = GroupBase & {
313
370
  };
314
371
  };
315
372
  export type RoundTable = GroupBase & {
373
+ surfaceColor?: string;
316
374
  selling?: TableSelling;
317
375
  longLayout?: LongTableLayout;
318
376
  kind: SeatingKind.Round;
@@ -321,10 +379,11 @@ export type RoundTable = GroupBase & {
321
379
  chairs: SeatSlot[];
322
380
  };
323
381
  export type SeatingGroup = StraightRows | CurvedRows | RectangularTable | RoundTable;
324
- type InventoryAreaBase = DrawableBase & {
382
+ type InventoryAreaBase = DrawableBase & InventoryNaming & {
383
+ entrance?: EntranceAssignment;
325
384
  categoryId?: UUID | null;
385
+ /** Explicit grouping for outline-free sections and overview shapes; inventory boundaries use geometry. */
326
386
  sectionId: UUID | null;
327
- label: string;
328
387
  labelStyle: LabelStyle;
329
388
  capacity: number;
330
389
  shape: {
@@ -357,15 +416,22 @@ export type Decoration = DrawableBase & ({
357
416
  kind: DecorationKind.Rectangle;
358
417
  sizeM: SizeM;
359
418
  cornerRadiusM: number;
419
+ gate?: GateDetails;
360
420
  } | {
361
421
  kind: DecorationKind.Circle;
362
422
  radiusM: number;
363
423
  } | {
364
424
  kind: DecorationKind.Line;
365
425
  pointsM: PointM[];
426
+ route?: RouteDetails;
427
+ lineCap?: LineCap;
428
+ lineJoin?: LineJoin;
429
+ startEnding?: LineEnding;
430
+ endEnding?: LineEnding;
366
431
  } | {
367
432
  kind: DecorationKind.Polygon;
368
433
  boundary: PolygonM;
434
+ gate?: GateDetails;
369
435
  } | {
370
436
  kind: DecorationKind.Icon;
371
437
  iconId: VenueGlyph;
@@ -376,6 +442,8 @@ export type Decoration = DrawableBase & ({
376
442
  sizeM: SizeM;
377
443
  opacity: number;
378
444
  }) & {
445
+ label?: string;
446
+ heightM?: number;
379
447
  style?: DecorationStyle;
380
448
  };
381
449
  export type SectionLabelPlacement = {
@@ -387,7 +455,48 @@ export declare enum SectionOutlineRole {
387
455
  Boundary = "boundary",
388
456
  Overview = "overview"
389
457
  }
458
+ export declare const RowRefitStrength: {
459
+ readonly min: 0;
460
+ readonly max: 100;
461
+ };
462
+ export declare const SectionRotation: {
463
+ readonly min: -180;
464
+ readonly max: 180;
465
+ readonly initial: 0;
466
+ };
467
+ export declare const SectionScale: {
468
+ readonly min: 50;
469
+ readonly max: 160;
470
+ readonly initial: 100;
471
+ };
472
+ export declare enum SectionTier {
473
+ Floor = "floor",
474
+ RaisedOne = "raised-one",
475
+ RaisedTwo = "raised-two",
476
+ RaisedThree = "raised-three"
477
+ }
478
+ export declare const SectionRake: {
479
+ readonly min: 0;
480
+ readonly max: 45;
481
+ readonly step: 1;
482
+ };
483
+ export declare const SectionFrontRowHeight: {
484
+ readonly min: 0;
485
+ readonly max: 120;
486
+ readonly step: 0.5;
487
+ };
488
+ export type SectionElevation = {
489
+ tier?: SectionTier;
490
+ rakeDeg?: number;
491
+ /** Authored height above the owning floor. Omission uses the chosen tier. */
492
+ frontRowHeightM?: number;
493
+ };
390
494
  export type Section = {
495
+ entrance?: EntranceAssignment;
496
+ buyerPhoto?: BuyerPhoto;
497
+ floorId?: UUID;
498
+ zoneId?: UUID;
499
+ elevation?: SectionElevation;
391
500
  /** Default for inventory subsequently drawn inside this section. */
392
501
  categoryId?: UUID | null;
393
502
  id: UUID;
@@ -395,6 +504,13 @@ export type Section = {
395
504
  displayLabel?: string;
396
505
  outline?: PolygonM;
397
506
  outlineRole?: SectionOutlineRole;
507
+ /** Last numeric rotation control value. Canvas rotation is independent. */
508
+ rotationDeg?: number;
509
+ scalePercent?: number;
510
+ /** Uniform Grow factor that preserves the authored outline subdivision. */
511
+ outlineGrowthFactor?: number;
512
+ /** Percentage used by the last accepted section row refit. */
513
+ rowRefitStrength?: number;
398
514
  style?: DecorationStyle;
399
515
  labelPlacement?: SectionLabelPlacement;
400
516
  labelStyle: LabelStyle;
@@ -406,10 +522,24 @@ export type AssetRef = {
406
522
  id: UUID;
407
523
  mimeType: "image/png" | "image/jpeg" | "image/webp" | "image/svg+xml";
408
524
  };
525
+ export type VenueFloor = {
526
+ id: UUID;
527
+ name: string;
528
+ baseHeightM: number;
529
+ focalPoint?: PointM;
530
+ };
531
+ export type VenueZone = {
532
+ id: UUID;
533
+ name: string;
534
+ color: string;
535
+ focalPoint?: PointM;
536
+ };
409
537
  export type PhysicalDocumentV1 = {
538
+ buyerPhoto?: BuyerPhoto;
410
539
  schemaVersion: 1;
411
540
  mapId: UUID;
412
541
  name: string;
542
+ venueName?: string;
413
543
  coordinateSystem: {
414
544
  unit: "metre";
415
545
  xAxis: "right";
@@ -418,6 +548,8 @@ export type PhysicalDocumentV1 = {
418
548
  };
419
549
  background: Paint;
420
550
  categories?: MapCategory[];
551
+ floors?: VenueFloor[];
552
+ zones?: VenueZone[];
421
553
  sections: Section[];
422
554
  collections: Collection[];
423
555
  seatingGroups: SeatingGroup[];
@@ -69,6 +69,11 @@ export var RowEnds;
69
69
  RowEnds["Both"] = "both";
70
70
  RowEnds["None"] = "none";
71
71
  })(RowEnds || (RowEnds = {}));
72
+ export var RowStagger;
73
+ (function (RowStagger) {
74
+ RowStagger["First"] = "first";
75
+ RowStagger["Second"] = "second";
76
+ })(RowStagger || (RowStagger = {}));
72
77
  export var RowAlignment;
73
78
  (function (RowAlignment) {
74
79
  RowAlignment["Start"] = "start";
@@ -86,6 +91,12 @@ export var RowJoin;
86
91
  RowJoin["Aisle"] = "aisle";
87
92
  RowJoin["Continuous"] = "continuous";
88
93
  })(RowJoin || (RowJoin = {}));
94
+ export var TableChairNumberFormat;
95
+ (function (TableChairNumberFormat) {
96
+ TableChairNumberFormat["Prefixed"] = "prefixed";
97
+ TableChairNumberFormat["Number"] = "number";
98
+ TableChairNumberFormat["Letter"] = "letter";
99
+ })(TableChairNumberFormat || (TableChairNumberFormat = {}));
89
100
  export var TableBookingMode;
90
101
  (function (TableBookingMode) {
91
102
  TableBookingMode["Individual"] = "individual";
@@ -108,6 +119,18 @@ export var SectionOutlineRole;
108
119
  SectionOutlineRole["Boundary"] = "boundary";
109
120
  SectionOutlineRole["Overview"] = "overview";
110
121
  })(SectionOutlineRole || (SectionOutlineRole = {}));
122
+ export const RowRefitStrength = { min: 0, max: 100 };
123
+ export const SectionRotation = { min: -180, max: 180, initial: 0 };
124
+ export const SectionScale = { min: 50, max: 160, initial: 100 };
125
+ export var SectionTier;
126
+ (function (SectionTier) {
127
+ SectionTier["Floor"] = "floor";
128
+ SectionTier["RaisedOne"] = "raised-one";
129
+ SectionTier["RaisedTwo"] = "raised-two";
130
+ SectionTier["RaisedThree"] = "raised-three";
131
+ })(SectionTier || (SectionTier = {}));
132
+ export const SectionRake = { min: 0, max: 45, step: 1 };
133
+ export const SectionFrontRowHeight = { min: 0, max: 120, step: 0.5 };
111
134
  export var EntityFamily;
112
135
  (function (EntityFamily) {
113
136
  EntityFamily["Group"] = "group";
package/dist/preview.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { PhysicalDocumentV1 } from "./types.js";
1
+ import type { PhysicalDocumentV1 } from "./physical-document.interface.js";
2
2
  export declare const ThumbnailPolicy: {
3
3
  readonly MaximumSvgLength: 128000;
4
4
  readonly MaximumContentLength: 120000;
package/dist/preview.js CHANGED
@@ -1,9 +1,13 @@
1
+ import { LineCap, LineJoin } from "./wayfinding.interface.js";
2
+ import { polygonContour } from "./geometry/polygon-curves.js";
3
+ import { layerCatalog } from "./layers.js";
4
+ import { sectionCatalog } from "./sections.js";
1
5
  import { documentGroupSeats } from "./catalog.js";
2
- import { footprint, project, worldMatrices, multiply, transformMatrix, } from "./geometry/geometry.js";
6
+ import { footprint, project, worldMatrices, multiply, transformMatrix } from "./geometry/geometry.js";
3
7
  import { emptyBounds, extend } from "./geometry/primitives.js";
4
8
  import { categoryCatalog, categorySeatShape } from "./categories.js";
5
9
  import { seatShapeParts, SeatShapePartKind } from "./geometry/seat-shape.js";
6
- import { DecorationKind, SeatingKind, ShapeKind, SeatShape } from "./types.js";
10
+ import { DecorationKind, SeatingKind, ShapeKind, SeatShape } from "./physical-document.interface.js";
7
11
  export const ThumbnailPolicy = {
8
12
  MaximumSvgLength: 128000,
9
13
  MaximumContentLength: 120000,
@@ -17,6 +21,7 @@ export function projectMapPreview(document) {
17
21
  const bounds = emptyBounds();
18
22
  const matrices = worldMatrices(document);
19
23
  const categories = categoryCatalog(document);
24
+ const owners = sectionCatalog(document).owners;
20
25
  const sections = new Map(document.sections.map((section) => [section.id, section]));
21
26
  const foreground = parseInt(document.background.color.slice(1, 3), 16) +
22
27
  parseInt(document.background.color.slice(3, 5), 16) +
@@ -26,19 +31,24 @@ export function projectMapPreview(document) {
26
31
  : "#ffffff";
27
32
  const paint = (value, fallback = foreground) => `fill="${value?.color ?? fallback}" fill-opacity="${value?.opacity ?? 0.45}"`;
28
33
  const number = (value) => value.toFixed(3);
34
+ const layers = layerCatalog(document);
35
+ const fragments = [];
36
+ let layer = -Infinity;
29
37
  let content = "";
30
38
  let glyphs = 0;
31
39
  let empty = true;
32
40
  const append = (markup) => {
33
- if (content.length + markup.length <= ThumbnailPolicy.MaximumContentLength)
41
+ if (content.length + markup.length <= ThumbnailPolicy.MaximumContentLength) {
34
42
  content += markup;
43
+ fragments.push({ order: layer, markup });
44
+ }
35
45
  };
36
46
  const point = (value, matrix) => {
37
47
  const result = matrix ? project(matrix, value) : value;
38
48
  extend(bounds, result);
39
49
  return `${number(result.x)},${number(result.y)}`;
40
50
  };
41
- const polygon = (value, matrix) => [value.outer, ...value.holes]
51
+ const polygon = (value, matrix) => [polygonContour(value).outer, ...value.holes]
42
52
  .map((ring) => {
43
53
  for (const entry of ring)
44
54
  point(entry, matrix);
@@ -62,9 +72,10 @@ export function projectMapPreview(document) {
62
72
  append(`<path d="${polygon(section.outline)}" ${paint(section.style?.fill)} fill-rule="evenodd"/>`);
63
73
  }
64
74
  for (const group of document.seatingGroups) {
75
+ layer = layers.order.get(group.id);
65
76
  empty = false;
66
77
  const matrix = matrices.get(group.id);
67
- const colour = sections.get(group.sectionId ?? "")?.style?.fill?.color ?? foreground;
78
+ const colour = sections.get(owners.get(group.id) ?? "")?.style?.fill?.color ?? foreground;
68
79
  if (group.boundary)
69
80
  append(`<path d="${polygon(group.boundary, matrix)}" fill="${colour}" fill-opacity=".3" fill-rule="evenodd"/>`);
70
81
  if (group.kind === SeatingKind.Rectangular)
@@ -77,12 +88,11 @@ export function projectMapPreview(document) {
77
88
  append(`<path d="${polygon({ outer: ring, holes: [] }, matrix)}" fill="${colour}" fill-opacity=".55"/>`);
78
89
  }
79
90
  const rows = new Map();
80
- const rowCounts = new Map("rows" in group
81
- ? group.rows.map((row) => [row.id, row.seats.length])
82
- : []);
91
+ const rowCounts = new Map("rows" in group ? group.rows.map((row) => [row.id, row.seats.length]) : []);
83
92
  let index = 0;
84
93
  const rowIndices = new Map();
85
94
  for (const seat of documentGroupSeats(document, group)) {
95
+ layer = layers.order.get(seat.rowId ?? group.id);
86
96
  if (seat.slot.gap) {
87
97
  index++;
88
98
  continue;
@@ -96,15 +106,12 @@ export function projectMapPreview(document) {
96
106
  const count = rowCounts.get(seat.rowId) ?? 1;
97
107
  const slot = rowIndices.get(seat.rowId) ?? 0;
98
108
  rowIndices.set(seat.rowId, slot + 1);
99
- if (slot % Math.max(1, Math.ceil(count / 24)) === 0 ||
100
- slot === count - 1)
109
+ if (slot % Math.max(1, Math.ceil(count / 24)) === 0 || slot === count - 1)
101
110
  row.push(`${number(position.x)},${number(position.y)}`);
102
111
  rows.set(seat.rowId, row);
103
112
  }
104
113
  if (glyphs < ThumbnailPolicy.MaximumSeatGlyphs && index % 8 === 0) {
105
- const category = seat.categoryId
106
- ? categories.get(seat.categoryId)
107
- : undefined;
114
+ const category = seat.categoryId ? categories.get(seat.categoryId) : undefined;
108
115
  const shape = categorySeatShape(category, seat.slot);
109
116
  const seatColour = category?.color ?? colour;
110
117
  if (shape === SeatShape.Circle) {
@@ -132,22 +139,24 @@ export function projectMapPreview(document) {
132
139
  index++;
133
140
  }
134
141
  if (!group.boundary) {
135
- for (const points of rows.values())
142
+ for (const [id, points] of rows) {
143
+ layer = layers.order.get(id);
136
144
  append(`<polyline points="${points.join(" ")}" fill="none" stroke="${colour}" stroke-width="${number(group.seatSizeM.height)}" stroke-opacity=".6" stroke-linecap="round"/>`);
145
+ }
137
146
  }
138
147
  }
139
148
  for (const area of document.areas) {
149
+ layer = layers.order.get(area.id);
140
150
  empty = false;
141
151
  const matrix = matrices.get(area.id);
142
152
  const path = area.shape.kind === ShapeKind.Polygon
143
153
  ? polygon(area.shape.boundary, matrix)
144
154
  : rectangle(area.shape.widthM, area.shape.heightM, matrix);
145
- const category = area.categoryId
146
- ? categories.get(area.categoryId)
147
- : undefined;
148
- append(`<path d="${path}" ${paint(category ? { color: category.color, opacity: 1 } : sections.get(area.sectionId ?? "")?.style?.fill)} fill-rule="evenodd"/>`);
155
+ const category = area.categoryId ? categories.get(area.categoryId) : undefined;
156
+ append(`<path d="${path}" ${paint(category ? { color: category.color, opacity: 1 } : sections.get(owners.get(area.id) ?? "")?.style?.fill)} fill-rule="evenodd"/>`);
149
157
  }
150
- for (const art of [...document.decorations].sort((left, right) => left.zIndex - right.zIndex)) {
158
+ for (const art of document.decorations) {
159
+ layer = layers.order.get(art.id);
151
160
  empty = false;
152
161
  const matrix = matrices.get(art.id);
153
162
  let path;
@@ -167,17 +176,18 @@ export function projectMapPreview(document) {
167
176
  path = rectangle(Math.max(art.fontSizeM, Array.from(art.text).length * art.fontSizeM * 0.65), art.fontSizeM, matrix);
168
177
  else
169
178
  path = rectangle(art.sizeM.width, art.sizeM.height, matrix);
170
- const outline = art.kind === DecorationKind.Image ||
171
- art.kind === DecorationKind.Line ||
172
- art.kind === DecorationKind.Text;
173
- append(`<path d="${path}" ${outline ? 'fill="none"' : paint(art.style?.fill)} stroke="${art.style?.stroke?.color ?? foreground}" stroke-opacity="${art.style?.stroke?.opacity ?? 0.5}" stroke-width="${art.style?.strokeWidthM ?? 0.08}" fill-rule="evenodd"/>`);
179
+ const outline = art.kind === DecorationKind.Image || art.kind === DecorationKind.Line || art.kind === DecorationKind.Text;
180
+ const lineStyle = art.kind === DecorationKind.Line
181
+ ? `stroke-linecap="${art.lineCap ?? LineCap.Flat}" stroke-linejoin="${art.lineJoin ?? LineJoin.Sharp}"`
182
+ : "";
183
+ append(`<path d="${path}" ${lineStyle} ${outline ? 'fill="none"' : paint(art.style?.fill)} stroke="${art.style?.stroke?.color ?? foreground}" stroke-opacity="${art.style?.stroke?.opacity ?? 0.5}" stroke-width="${art.style?.strokeWidthM ?? 0.08}" fill-rule="evenodd"/>`);
174
184
  }
175
- const width = Number.isFinite(bounds.minX)
176
- ? Math.max(1, bounds.maxX - bounds.minX)
177
- : 1;
178
- const height = Number.isFinite(bounds.minY)
179
- ? Math.max(1, bounds.maxY - bounds.minY)
180
- : 1;
185
+ content = fragments
186
+ .sort((a, b) => a.order - b.order)
187
+ .map((fragment) => fragment.markup)
188
+ .join("");
189
+ const width = Number.isFinite(bounds.minX) ? Math.max(1, bounds.maxX - bounds.minX) : 1;
190
+ const height = Number.isFinite(bounds.minY) ? Math.max(1, bounds.maxY - bounds.minY) : 1;
181
191
  const padding = Math.max(width, height) * 0.08;
182
192
  const x = Number.isFinite(bounds.minX) ? bounds.minX - padding : -padding;
183
193
  const y = Number.isFinite(bounds.minY) ? bounds.minY - padding : -padding;
package/dist/reference.js CHANGED
@@ -1,4 +1,4 @@
1
- import { DocumentLimits } from "./types.js";
1
+ import { DocumentLimits } from "./physical-document.interface.js";
2
2
  import { z } from "zod";
3
3
  import { uuidSchema } from "./schema.js";
4
4
  // Reference presentation is a dated observation, never authoritative inventory.
@@ -1,6 +1,8 @@
1
- import { RowEnds, type PhysicalDocumentV1, type SeatingGroup, type RowInventory, type RowSlot, type SegmentedRow, type UUID, type PointM } from "./types.js";
1
+ import { RowEnds, type PhysicalDocumentV1, type SeatingGroup, type RowInventory, type RowSlot, type SegmentedRow, type UUID, type PointM } from "./physical-document.interface.js";
2
2
  export type RowSegment = {
3
3
  row: SegmentedRow;
4
+ displayLabel: string;
5
+ coherent: boolean;
4
6
  group: RowInventory;
5
7
  part: RowSlot;
6
8
  partIndex: number;
@@ -9,6 +11,8 @@ export type RowSegment = {
9
11
  };
10
12
  export type SegmentedRowEntry = {
11
13
  row: SegmentedRow;
14
+ displayLabel: string;
15
+ coherent: boolean;
12
16
  parts: readonly RowSegment[];
13
17
  };
14
18
  export declare function isRowInventory(group: SeatingGroup): group is RowInventory;
@@ -1,25 +1,28 @@
1
1
  import { generateGroup, project, worldMatrices } from "./geometry/geometry.js";
2
- import { SeatingKind, RowEnds, RowJoin, } from "./types.js";
2
+ import { labelKey } from "./labels.js";
3
+ import { SeatingKind, RowEnds, RowJoin, } from "./physical-document.interface.js";
3
4
  const segments = new WeakMap();
4
5
  export function isRowInventory(group) {
5
- return (group.kind === SeatingKind.Straight || group.kind === SeatingKind.Curved);
6
+ return group.kind === SeatingKind.Straight || group.kind === SeatingKind.Curved;
6
7
  }
7
8
  /** Logical rows associate independent physical parts without moving them between rendering banks. */
8
9
  export function rowSegments(document) {
9
10
  const cached = segments.get(document);
10
11
  if (cached)
11
12
  return cached;
12
- const owners = new Map(document.seatingGroups.flatMap((group) => isRowInventory(group)
13
- ? group.rows.map((part) => [part.id, { group, part }])
14
- : []));
13
+ const owners = new Map(document.seatingGroups.flatMap((group) => isRowInventory(group) ? group.rows.map((part) => [part.id, { group, part }]) : []));
15
14
  const result = new Map();
16
15
  for (const row of document.segmentedRows ?? []) {
17
16
  const parts = row.parts.map((part) => owners.get(part.rowId));
17
+ const names = row.parts.map((part) => part.labelOverride ?? row.label);
18
+ const coherent = Boolean(labelKey(names[0])) && names.every((name) => name === names[0]);
18
19
  const totalSeats = parts.reduce((sum, item) => sum + item.part.seats.length, 0);
19
20
  let firstIndex = 0;
20
21
  parts.forEach((item, partIndex) => {
21
22
  result.set(item.part.id, {
22
23
  row,
24
+ displayLabel: names[partIndex],
25
+ coherent,
23
26
  ...item,
24
27
  partIndex,
25
28
  firstIndex,
@@ -33,8 +36,7 @@ export function rowSegments(document) {
33
36
  }
34
37
  export function changedSegmentGroups(before, after) {
35
38
  const groups = new Set();
36
- if (before.segmentedRows === after.segmentedRows &&
37
- before.seatingGroups === after.seatingGroups)
39
+ if (before.segmentedRows === after.segmentedRows && before.seatingGroups === after.seatingGroups)
38
40
  return groups;
39
41
  const previous = new Map((before.segmentedRows ?? []).map((row) => [row.id, row]));
40
42
  const next = new Map((after.segmentedRows ?? []).map((row) => [row.id, row]));
@@ -55,8 +57,7 @@ export function suggestedRowEnds(document, rowId) {
55
57
  const segment = rowSegments(document).get(rowId);
56
58
  if (!segment)
57
59
  return RowEnds.Both;
58
- const first = segment.partIndex === 0 ||
59
- segment.row.parts[segment.partIndex].joinBefore === RowJoin.Aisle;
60
+ const first = segment.partIndex === 0 || segment.row.parts[segment.partIndex].joinBefore === RowJoin.Aisle;
60
61
  const last = segment.partIndex === segment.row.parts.length - 1 ||
61
62
  segment.row.parts[segment.partIndex + 1].joinBefore === RowJoin.Aisle;
62
63
  if (first && last)