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

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 (107) hide show
  1. package/dist/arc-fan-rebuild.d.ts +13 -0
  2. package/dist/arc-fan-rebuild.js +163 -0
  3. package/dist/arc-fan.d.ts +27 -0
  4. package/dist/arc-fan.interface.d.ts +83 -0
  5. package/dist/arc-fan.interface.js +30 -0
  6. package/dist/arc-fan.js +182 -0
  7. package/dist/catalog.d.ts +6 -4
  8. package/dist/catalog.js +31 -17
  9. package/dist/categories.d.ts +5 -3
  10. package/dist/categories.js +104 -25
  11. package/dist/editor-state.d.ts +4 -1
  12. package/dist/editor-state.js +53 -30
  13. package/dist/floors.d.ts +22 -0
  14. package/dist/floors.js +77 -0
  15. package/dist/geometry/boundary.d.ts +1 -1
  16. package/dist/geometry/boundary.js +16 -12
  17. package/dist/geometry/curve-warnings.d.ts +1 -1
  18. package/dist/geometry/curve-warnings.js +3 -5
  19. package/dist/geometry/decoration-bounds.d.ts +4 -0
  20. package/dist/geometry/decoration-bounds.js +42 -0
  21. package/dist/geometry/ellipse.js +4 -12
  22. package/dist/geometry/geometry.d.ts +6 -3
  23. package/dist/geometry/geometry.js +28 -30
  24. package/dist/geometry/layout-transform.d.ts +10 -0
  25. package/dist/geometry/layout-transform.interface.d.ts +6 -0
  26. package/dist/geometry/layout-transform.interface.js +1 -0
  27. package/dist/geometry/layout-transform.js +206 -0
  28. package/dist/geometry/polygon-curves.d.ts +17 -0
  29. package/dist/geometry/polygon-curves.interface.d.ts +21 -0
  30. package/dist/geometry/polygon-curves.interface.js +5 -0
  31. package/dist/geometry/polygon-curves.js +169 -0
  32. package/dist/geometry/primitives.d.ts +1 -1
  33. package/dist/geometry/primitives.js +2 -3
  34. package/dist/geometry/seat-shape.d.ts +1 -1
  35. package/dist/geometry/seat-shape.js +1 -1
  36. package/dist/geometry/seating-layout.d.ts +9 -1
  37. package/dist/geometry/seating-layout.js +66 -57
  38. package/dist/geometry/units.d.ts +8 -0
  39. package/dist/geometry/units.js +13 -0
  40. package/dist/geometry/venue-outline.d.ts +4 -18
  41. package/dist/geometry/venue-outline.interface.d.ts +23 -0
  42. package/dist/geometry/venue-outline.interface.js +7 -0
  43. package/dist/geometry/venue-outline.js +107 -49
  44. package/dist/identity.d.ts +3 -1
  45. package/dist/identity.js +32 -17
  46. package/dist/issues.d.ts +15 -2
  47. package/dist/issues.js +16 -6
  48. package/dist/labels.d.ts +6 -1
  49. package/dist/labels.js +20 -18
  50. package/dist/layers.d.ts +26 -0
  51. package/dist/layers.js +86 -0
  52. package/dist/media.d.ts +27 -0
  53. package/dist/media.js +89 -0
  54. package/dist/{types.d.ts → physical-document.interface.d.ts} +117 -4
  55. package/dist/{types.js → physical-document.interface.js} +17 -0
  56. package/dist/preview.d.ts +1 -1
  57. package/dist/preview.js +39 -29
  58. package/dist/reference.js +1 -1
  59. package/dist/row-segments.d.ts +5 -1
  60. package/dist/row-segments.js +10 -9
  61. package/dist/schema.d.ts +591 -14
  62. package/dist/schema.js +238 -102
  63. package/dist/seat-proximity.d.ts +4 -0
  64. package/dist/seat-proximity.js +119 -0
  65. package/dist/section-elevation.d.ts +5 -0
  66. package/dist/section-elevation.interface.d.ts +26 -0
  67. package/dist/section-elevation.interface.js +8 -0
  68. package/dist/section-elevation.js +53 -0
  69. package/dist/section-fill-rebuild.d.ts +10 -0
  70. package/dist/section-fill-rebuild.js +64 -0
  71. package/dist/section-fill.d.ts +84 -0
  72. package/dist/section-fill.interface.d.ts +94 -0
  73. package/dist/section-fill.interface.js +22 -0
  74. package/dist/section-fill.js +306 -0
  75. package/dist/section-growth.d.ts +11 -0
  76. package/dist/section-growth.interface.d.ts +12 -0
  77. package/dist/section-growth.interface.js +1 -0
  78. package/dist/section-growth.js +198 -0
  79. package/dist/section-layout.d.ts +95 -0
  80. package/dist/section-layout.interface.d.ts +8 -0
  81. package/dist/section-layout.interface.js +5 -0
  82. package/dist/section-layout.js +70 -0
  83. package/dist/section-outline-refit.d.ts +8 -0
  84. package/dist/section-outline-refit.js +246 -0
  85. package/dist/section-refit.d.ts +22 -0
  86. package/dist/section-refit.interface.d.ts +49 -0
  87. package/dist/section-refit.interface.js +6 -0
  88. package/dist/section-refit.js +179 -0
  89. package/dist/section-scale.d.ts +2 -0
  90. package/dist/section-scale.js +128 -0
  91. package/dist/sections.d.ts +23 -0
  92. package/dist/sections.js +144 -0
  93. package/dist/selling.d.ts +1 -1
  94. package/dist/selling.js +11 -26
  95. package/dist/spacing-repairs.d.ts +31 -0
  96. package/dist/spacing-repairs.js +168 -0
  97. package/dist/table-layout.d.ts +1 -2
  98. package/dist/table-layout.js +14 -22
  99. package/dist/validation.d.ts +7 -2
  100. package/dist/validation.interface.d.ts +20 -0
  101. package/dist/validation.interface.js +9 -0
  102. package/dist/validation.js +221 -85
  103. package/dist/wayfinding.d.ts +10 -0
  104. package/dist/wayfinding.interface.d.ts +52 -0
  105. package/dist/wayfinding.interface.js +28 -0
  106. package/dist/wayfinding.js +63 -0
  107. package/package.json +89 -4
@@ -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";
@@ -108,6 +113,18 @@ export var SectionOutlineRole;
108
113
  SectionOutlineRole["Boundary"] = "boundary";
109
114
  SectionOutlineRole["Overview"] = "overview";
110
115
  })(SectionOutlineRole || (SectionOutlineRole = {}));
116
+ export const RowRefitStrength = { min: 0, max: 100 };
117
+ export const SectionRotation = { min: -180, max: 180, initial: 0 };
118
+ export const SectionScale = { min: 50, max: 160, initial: 100 };
119
+ export var SectionTier;
120
+ (function (SectionTier) {
121
+ SectionTier["Floor"] = "floor";
122
+ SectionTier["RaisedOne"] = "raised-one";
123
+ SectionTier["RaisedTwo"] = "raised-two";
124
+ SectionTier["RaisedThree"] = "raised-three";
125
+ })(SectionTier || (SectionTier = {}));
126
+ export const SectionRake = { min: 0, max: 45, step: 1 };
127
+ export const SectionFrontRowHeight = { min: 0, max: 120, step: 0.5 };
111
128
  export var EntityFamily;
112
129
  (function (EntityFamily) {
113
130
  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)