@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.
- package/dist/arc-fan-rebuild.d.ts +17 -0
- package/dist/arc-fan-rebuild.js +227 -0
- package/dist/arc-fan-section-layout.d.ts +11 -0
- package/dist/arc-fan-section-layout.js +54 -0
- package/dist/arc-fan.d.ts +27 -0
- package/dist/arc-fan.interface.d.ts +100 -0
- package/dist/arc-fan.interface.js +30 -0
- package/dist/arc-fan.js +182 -0
- package/dist/catalog.d.ts +6 -4
- package/dist/catalog.js +31 -17
- package/dist/categories.d.ts +14 -3
- package/dist/categories.js +146 -35
- package/dist/editor-state.d.ts +4 -1
- package/dist/editor-state.js +53 -30
- package/dist/floors.d.ts +22 -0
- package/dist/floors.js +72 -0
- package/dist/geometry/boundary.d.ts +1 -1
- package/dist/geometry/boundary.js +16 -12
- package/dist/geometry/curve-warnings.d.ts +1 -1
- package/dist/geometry/curve-warnings.js +3 -5
- package/dist/geometry/decoration-bounds.d.ts +4 -0
- package/dist/geometry/decoration-bounds.js +42 -0
- package/dist/geometry/ellipse.js +4 -12
- package/dist/geometry/geometry.d.ts +9 -3
- package/dist/geometry/geometry.js +58 -34
- package/dist/geometry/inventory-outline.d.ts +8 -0
- package/dist/geometry/inventory-outline.js +46 -0
- package/dist/geometry/layout-transform.d.ts +10 -0
- package/dist/geometry/layout-transform.interface.d.ts +6 -0
- package/dist/geometry/layout-transform.interface.js +1 -0
- package/dist/geometry/layout-transform.js +206 -0
- package/dist/geometry/polygon-curves.d.ts +17 -0
- package/dist/geometry/polygon-curves.interface.d.ts +21 -0
- package/dist/geometry/polygon-curves.interface.js +5 -0
- package/dist/geometry/polygon-curves.js +169 -0
- package/dist/geometry/primitives.d.ts +1 -1
- package/dist/geometry/primitives.js +2 -3
- package/dist/geometry/seat-shape.d.ts +1 -1
- package/dist/geometry/seat-shape.js +5 -5
- package/dist/geometry/seating-layout.d.ts +10 -1
- package/dist/geometry/seating-layout.js +73 -57
- package/dist/geometry/units.d.ts +8 -0
- package/dist/geometry/units.js +13 -0
- package/dist/geometry/venue-outline.d.ts +4 -18
- package/dist/geometry/venue-outline.interface.d.ts +23 -0
- package/dist/geometry/venue-outline.interface.js +7 -0
- package/dist/geometry/venue-outline.js +142 -49
- package/dist/identity.d.ts +3 -1
- package/dist/identity.js +32 -17
- package/dist/issues.d.ts +16 -2
- package/dist/issues.js +17 -6
- package/dist/labels.d.ts +6 -1
- package/dist/labels.js +20 -18
- package/dist/layers.d.ts +26 -0
- package/dist/layers.js +86 -0
- package/dist/media.d.ts +27 -0
- package/dist/media.js +89 -0
- package/dist/{types.d.ts → physical-document.interface.d.ts} +142 -10
- package/dist/{types.js → physical-document.interface.js} +23 -0
- package/dist/preview.d.ts +1 -1
- package/dist/preview.js +39 -29
- package/dist/reference.js +1 -1
- package/dist/row-segments.d.ts +5 -1
- package/dist/row-segments.js +10 -9
- package/dist/schema.d.ts +680 -18
- package/dist/schema.js +269 -111
- package/dist/seat-proximity.d.ts +4 -0
- package/dist/seat-proximity.js +119 -0
- package/dist/section-elevation.d.ts +5 -0
- package/dist/section-elevation.interface.d.ts +26 -0
- package/dist/section-elevation.interface.js +8 -0
- package/dist/section-elevation.js +53 -0
- package/dist/section-fill-rebuild.d.ts +10 -0
- package/dist/section-fill-rebuild.js +64 -0
- package/dist/section-fill.d.ts +84 -0
- package/dist/section-fill.interface.d.ts +94 -0
- package/dist/section-fill.interface.js +22 -0
- package/dist/section-fill.js +306 -0
- package/dist/section-growth.d.ts +11 -0
- package/dist/section-growth.interface.d.ts +20 -0
- package/dist/section-growth.interface.js +1 -0
- package/dist/section-growth.js +245 -0
- package/dist/section-layout.d.ts +101 -0
- package/dist/section-layout.interface.d.ts +8 -0
- package/dist/section-layout.interface.js +5 -0
- package/dist/section-layout.js +72 -0
- package/dist/section-outline-refit.d.ts +8 -0
- package/dist/section-outline-refit.js +246 -0
- package/dist/section-refit.d.ts +22 -0
- package/dist/section-refit.interface.d.ts +49 -0
- package/dist/section-refit.interface.js +6 -0
- package/dist/section-refit.js +179 -0
- package/dist/section-scale.d.ts +2 -0
- package/dist/section-scale.js +128 -0
- package/dist/sections.d.ts +23 -0
- package/dist/sections.js +144 -0
- package/dist/selling.d.ts +1 -1
- package/dist/selling.js +11 -26
- package/dist/spacing-repairs.d.ts +31 -0
- package/dist/spacing-repairs.js +168 -0
- package/dist/table-layout.d.ts +3 -3
- package/dist/table-layout.js +35 -35
- package/dist/validation.d.ts +7 -2
- package/dist/validation.interface.d.ts +20 -0
- package/dist/validation.interface.js +9 -0
- package/dist/validation.js +221 -85
- package/dist/wayfinding.d.ts +10 -0
- package/dist/wayfinding.interface.d.ts +52 -0
- package/dist/wayfinding.interface.js +28 -0
- package/dist/wayfinding.js +63 -0
- package/package.json +97 -4
package/dist/catalog.d.ts
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import type { PhysicalDocumentV1, SeatingGroup, InventoryArea, UUID } from "./
|
|
1
|
+
import type { PhysicalDocumentV1, SeatingGroup, InventoryArea, UUID } from "./physical-document.interface.js";
|
|
2
2
|
import { type SegmentedRowEntry } from "./row-segments.js";
|
|
3
3
|
import { type GeneratedSeat } from "./geometry/geometry.js";
|
|
4
|
-
export
|
|
4
|
+
export type DocumentSeat = GeneratedSeat & {
|
|
5
|
+
sectionId: UUID | null;
|
|
6
|
+
};
|
|
5
7
|
/** Geometry remains shared; logical addresses are projected from the current document. */
|
|
6
|
-
export declare function documentGroupSeats(document: PhysicalDocumentV1, group: SeatingGroup): readonly
|
|
8
|
+
export declare function documentGroupSeats(document: PhysicalDocumentV1, group: SeatingGroup): readonly DocumentSeat[];
|
|
7
9
|
export type DocumentCatalog = {
|
|
8
10
|
groups: ReadonlyMap<UUID, SeatingGroup>;
|
|
9
11
|
areas: ReadonlyMap<UUID, InventoryArea>;
|
|
10
12
|
seats: ReadonlyMap<UUID, {
|
|
11
13
|
group: SeatingGroup;
|
|
12
|
-
seat:
|
|
14
|
+
seat: DocumentSeat;
|
|
13
15
|
}>;
|
|
14
16
|
rows: ReadonlyMap<UUID, SeatingGroup>;
|
|
15
17
|
segmentedRows: ReadonlyMap<UUID, SegmentedRowEntry>;
|
package/dist/catalog.js
CHANGED
|
@@ -1,15 +1,7 @@
|
|
|
1
|
+
import { sectionCatalog } from "./sections.js";
|
|
1
2
|
import { rowSegments } from "./row-segments.js";
|
|
2
|
-
import { sequenceLabel } from "./labels.js";
|
|
3
|
-
import {
|
|
4
|
-
const generated = new WeakMap();
|
|
5
|
-
export function generatedSeats(group) {
|
|
6
|
-
let cached = generated.get(group);
|
|
7
|
-
if (!cached) {
|
|
8
|
-
cached = Object.freeze([...generateGroup(group)]);
|
|
9
|
-
generated.set(group, cached);
|
|
10
|
-
}
|
|
11
|
-
return cached;
|
|
12
|
-
}
|
|
3
|
+
import { sequenceLabel, rowDisplayLabel } from "./labels.js";
|
|
4
|
+
import { generatedSeats } from "./geometry/geometry.js";
|
|
13
5
|
const documentSeats = new WeakMap();
|
|
14
6
|
/** Geometry remains shared; logical addresses are projected from the current document. */
|
|
15
7
|
export function documentGroupSeats(document, group) {
|
|
@@ -22,19 +14,39 @@ export function documentGroupSeats(document, group) {
|
|
|
22
14
|
if (cached)
|
|
23
15
|
return cached;
|
|
24
16
|
const segments = rowSegments(document);
|
|
25
|
-
const
|
|
26
|
-
const
|
|
17
|
+
const owners = sectionCatalog(document).owners;
|
|
18
|
+
const parts = new Map();
|
|
19
|
+
const result = generatedSeats(group).map((geometry) => {
|
|
20
|
+
const seat = { ...geometry, sectionId: owners.get(geometry.rowId ?? group.id) ?? null };
|
|
27
21
|
const segment = seat.rowId ? segments.get(seat.rowId) : undefined;
|
|
28
22
|
if (!segment)
|
|
29
23
|
return seat;
|
|
30
|
-
|
|
31
|
-
|
|
24
|
+
let part = parts.get(segment.part.id);
|
|
25
|
+
if (!part) {
|
|
26
|
+
part = {
|
|
27
|
+
ordinal: 0,
|
|
28
|
+
addressRowLabel: !segment.coherent || segment.row.qualifySeatLabels
|
|
29
|
+
? rowDisplayLabel(segment.group, segment.group.rows.indexOf(segment.part))
|
|
30
|
+
: undefined,
|
|
31
|
+
};
|
|
32
|
+
parts.set(segment.part.id, part);
|
|
33
|
+
}
|
|
34
|
+
if (!segment.coherent)
|
|
35
|
+
return {
|
|
36
|
+
...seat,
|
|
37
|
+
ownerLabel: segment.displayLabel,
|
|
38
|
+
addressRowLabel: part.addressRowLabel,
|
|
39
|
+
logicalPartIndex: segment.partIndex,
|
|
40
|
+
};
|
|
41
|
+
const ordinal = part.ordinal++;
|
|
32
42
|
return {
|
|
33
43
|
...seat,
|
|
34
44
|
label: seat.slot.labelOverride ??
|
|
35
45
|
sequenceLabel(segment.row.sequence, segment.firstIndex + ordinal, segment.totalSeats),
|
|
46
|
+
bookingLabel: sequenceLabel(segment.row.sequence, segment.firstIndex + ordinal, segment.totalSeats),
|
|
47
|
+
addressRowLabel: part.addressRowLabel,
|
|
36
48
|
logicalRowId: segment.row.id,
|
|
37
|
-
logicalRowLabel: segment.
|
|
49
|
+
logicalRowLabel: segment.displayLabel,
|
|
38
50
|
logicalPartIndex: segment.partIndex,
|
|
39
51
|
logicalSequence: segment.row.sequence,
|
|
40
52
|
};
|
|
@@ -64,6 +76,8 @@ export function documentCatalog(document) {
|
|
|
64
76
|
row.id,
|
|
65
77
|
{
|
|
66
78
|
row,
|
|
79
|
+
displayLabel: rowSegments(document).get(row.parts[0].rowId).displayLabel,
|
|
80
|
+
coherent: rowSegments(document).get(row.parts[0].rowId).coherent,
|
|
67
81
|
parts: row.parts.map((part) => rowSegments(document).get(part.rowId)),
|
|
68
82
|
},
|
|
69
83
|
])),
|
|
@@ -73,5 +87,5 @@ export function documentCatalog(document) {
|
|
|
73
87
|
return catalog;
|
|
74
88
|
}
|
|
75
89
|
export function inventoryAddress(document, seat) {
|
|
76
|
-
return `${documentCatalog(document).sections.get(seat.
|
|
90
|
+
return `${documentCatalog(document).sections.get(sectionCatalog(document).owners.get(seat.rowId ?? seat.groupId) ?? "") ?? "Unsectioned"}, ${seat.rowId ? "row" : "table"} ${seat.addressRowLabel ?? seat.logicalRowLabel ?? seat.ownerLabel}, seat ${seat.bookingLabel}`;
|
|
77
91
|
}
|
package/dist/categories.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { MapCategory, PhysicalDocumentV1, RowSlot, SeatingGroup, SeatSlot, UUID } from "./
|
|
2
|
-
import { SeatShape } from "./
|
|
1
|
+
import type { InventoryArea, MapCategory, PhysicalDocumentV1, RowSlot, SeatingGroup, SeatSlot, UUID } from "./physical-document.interface.js";
|
|
2
|
+
import { SeatShape, SeatingKind } from "./physical-document.interface.js";
|
|
3
3
|
import { type DomainIssue } from "./issues.js";
|
|
4
4
|
export declare function categoryCatalog(document: PhysicalDocumentV1): ReadonlyMap<UUID, MapCategory>;
|
|
5
5
|
/** Absence inherits; explicit null records an unassigned child. */
|
|
@@ -8,10 +8,21 @@ export declare function categoryReferences(groups: readonly SeatingGroup[]): Gen
|
|
|
8
8
|
id: UUID;
|
|
9
9
|
categoryId: UUID;
|
|
10
10
|
}>;
|
|
11
|
-
export declare function
|
|
11
|
+
export declare function missingCategoryLabel(places: number): string;
|
|
12
|
+
/** Unresolved catalogue references are repairable draft findings, not invalid physical structure. */
|
|
13
|
+
export declare function categoryIssues(document: PhysicalDocumentV1): readonly DomainIssue[];
|
|
12
14
|
/** Fragment paste reuses catalogue identity; whole-map copy remaps it with the map. */
|
|
13
15
|
export declare function remapGroupCategories(group: SeatingGroup, ids: ReadonlyMap<UUID, UUID>): SeatingGroup;
|
|
16
|
+
export declare enum InventoryKind {
|
|
17
|
+
Rows = "rows",
|
|
18
|
+
Tables = "tables",
|
|
19
|
+
Standing = "standing",
|
|
20
|
+
Booths = "booths"
|
|
21
|
+
}
|
|
22
|
+
export declare function groupInventoryKind(kind: SeatingKind): InventoryKind;
|
|
23
|
+
export declare function areaInventoryKind(kind: InventoryArea["kind"]): InventoryKind;
|
|
14
24
|
export declare function categoryUsage(document: PhysicalDocumentV1): ReadonlyMap<UUID, number>;
|
|
25
|
+
export declare function categoryInventoryKinds(document: PhysicalDocumentV1, categoryId: UUID): ReadonlySet<InventoryKind>;
|
|
15
26
|
export declare function ticketOptionNameKey(name: string): string;
|
|
16
27
|
export type CategoryPricing = {
|
|
17
28
|
onSale: boolean;
|
package/dist/categories.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { AreaKind, SeatShape, SeatingKind } from "./
|
|
2
|
-
import { issue, IssueCode } from "./issues.js";
|
|
1
|
+
import { AreaKind, SeatShape, SeatingKind } from "./physical-document.interface.js";
|
|
2
|
+
import { issue, IssueCode, IssueSeverity } from "./issues.js";
|
|
3
|
+
import { rowDisplayLabel } from "./labels.js";
|
|
3
4
|
const catalogs = new WeakMap();
|
|
4
5
|
export function categoryCatalog(document) {
|
|
5
6
|
let catalog = catalogs.get(document);
|
|
@@ -21,8 +22,7 @@ export function* categoryReferences(groups) {
|
|
|
21
22
|
for (const group of groups) {
|
|
22
23
|
if (group.categoryId)
|
|
23
24
|
yield { id: group.id, categoryId: group.categoryId };
|
|
24
|
-
if (group.kind === SeatingKind.Straight ||
|
|
25
|
-
group.kind === SeatingKind.Curved) {
|
|
25
|
+
if (group.kind === SeatingKind.Straight || group.kind === SeatingKind.Curved) {
|
|
26
26
|
for (const row of group.rows) {
|
|
27
27
|
if (row.categoryId)
|
|
28
28
|
yield { id: row.id, categoryId: row.categoryId };
|
|
@@ -32,35 +32,121 @@ export function* categoryReferences(groups) {
|
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
else {
|
|
35
|
-
const seats = group.kind === SeatingKind.Round
|
|
36
|
-
? group.chairs
|
|
37
|
-
: Object.values(group.chairsBySide).flat();
|
|
35
|
+
const seats = group.kind === SeatingKind.Round ? group.chairs : Object.values(group.chairsBySide).flat();
|
|
38
36
|
for (const slot of seats)
|
|
39
37
|
if (slot.categoryId)
|
|
40
38
|
yield { id: slot.id, categoryId: slot.categoryId };
|
|
41
39
|
}
|
|
42
40
|
}
|
|
43
41
|
}
|
|
42
|
+
const categoryFindings = new WeakMap();
|
|
43
|
+
export function missingCategoryLabel(places) {
|
|
44
|
+
return `${places} ${places === 1 ? "place has" : "places have"} no category`;
|
|
45
|
+
}
|
|
46
|
+
/** Unresolved catalogue references are repairable draft findings, not invalid physical structure. */
|
|
44
47
|
export function categoryIssues(document) {
|
|
48
|
+
const cached = categoryFindings.get(document);
|
|
49
|
+
if (cached)
|
|
50
|
+
return cached;
|
|
45
51
|
const categories = new Set((document.categories ?? []).map((category) => category.id));
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
]
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
52
|
+
const byOwner = new Map();
|
|
53
|
+
const check = (id, categoryId, ownerId) => {
|
|
54
|
+
if (categoryId && !categories.has(categoryId))
|
|
55
|
+
byOwner.set(id, issue(IssueCode.UnknownCategory, "Unknown category", [id], `${ownerId}.categoryId`));
|
|
56
|
+
};
|
|
57
|
+
const missingRows = [];
|
|
58
|
+
let missingPlaces = 0;
|
|
59
|
+
const seatWarnings = [];
|
|
60
|
+
for (const group of document.seatingGroups) {
|
|
61
|
+
if (group.kind === SeatingKind.Straight || group.kind === SeatingKind.Curved) {
|
|
62
|
+
group.rows.forEach((row, index) => {
|
|
63
|
+
let missing = 0;
|
|
64
|
+
let unknownSeats = 0;
|
|
65
|
+
let unknownRowCategory;
|
|
66
|
+
for (const slot of row.seats) {
|
|
67
|
+
if (slot.gap)
|
|
68
|
+
continue;
|
|
69
|
+
const categoryId = seatCategoryId(group, slot, row);
|
|
70
|
+
if (categoryId === null)
|
|
71
|
+
missing++;
|
|
72
|
+
else if (!categories.has(categoryId)) {
|
|
73
|
+
if (slot.categoryId === undefined)
|
|
74
|
+
unknownRowCategory = categoryId;
|
|
75
|
+
else
|
|
76
|
+
unknownSeats++;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
if (missing) {
|
|
80
|
+
missingRows.push(row.id);
|
|
81
|
+
missingPlaces += missing;
|
|
82
|
+
}
|
|
83
|
+
if (unknownRowCategory) {
|
|
84
|
+
const label = rowDisplayLabel(group, index);
|
|
85
|
+
const message = `"${label}" references unknown category "${unknownRowCategory}"`;
|
|
86
|
+
const referenceId = row.categoryId === undefined ? group.id : row.id;
|
|
87
|
+
byOwner.set(row.id, {
|
|
88
|
+
...issue(IssueCode.UnknownCategory, message, [row.id], `${referenceId}.categoryId`),
|
|
89
|
+
description: message,
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
if (unknownSeats) {
|
|
93
|
+
const rowName = `Row “${rowDisplayLabel(group, index)}”`;
|
|
94
|
+
const seats = unknownSeats === 1 ? "seat" : "seats";
|
|
95
|
+
seatWarnings.push({
|
|
96
|
+
...issue(IssueCode.UnknownSeatCategory, `${rowName} has ${unknownSeats} ${seats} with no category`, [
|
|
97
|
+
row.id,
|
|
98
|
+
]),
|
|
99
|
+
severity: IssueSeverity.Warning,
|
|
100
|
+
description: `${unknownSeats} ${seats} in ${rowName} have no category, so buyers see no price or colour for them.`,
|
|
101
|
+
blocks: [],
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
const slots = group.kind === SeatingKind.Round ? group.chairs : Object.values(group.chairsBySide).flat();
|
|
108
|
+
for (const slot of slots) {
|
|
109
|
+
if (slot.gap)
|
|
110
|
+
continue;
|
|
111
|
+
const ownerId = slot.categoryId !== undefined ? slot.id : group.id;
|
|
112
|
+
check(ownerId, seatCategoryId(group, slot), ownerId);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
for (const entity of [...document.areas, ...document.sections])
|
|
117
|
+
check(entity.id, entity.categoryId, entity.id);
|
|
118
|
+
const findings = [...byOwner.values(), ...seatWarnings];
|
|
119
|
+
if (missingPlaces) {
|
|
120
|
+
findings.unshift({
|
|
121
|
+
...issue(IssueCode.MissingCategory, missingCategoryLabel(missingPlaces), missingRows),
|
|
122
|
+
severity: IssueSeverity.Warning,
|
|
123
|
+
blocks: [],
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
const uses = categoryUsage(document);
|
|
127
|
+
for (const category of document.categories ?? []) {
|
|
128
|
+
if (categoryInventoryKinds(document, category.id).size > 1) {
|
|
129
|
+
const message = `Category “${category.name}” spans incompatible inventory types`;
|
|
130
|
+
findings.push(issue(IssueCode.MixedCategoryInventory, message, [category.id]));
|
|
131
|
+
}
|
|
132
|
+
if (!uses.get(category.id) || !categoryPricing(category).missing)
|
|
133
|
+
continue;
|
|
134
|
+
const message = `Category "${category.name}" has no default price. Each event sets its price before it goes on sale`;
|
|
135
|
+
findings.push({
|
|
136
|
+
...issue(IssueCode.MissingCategoryPrice, message, [category.id], `${category.id}.defaultPrice`),
|
|
137
|
+
severity: IssueSeverity.Warning,
|
|
138
|
+
description: message,
|
|
139
|
+
blocks: [],
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
categoryFindings.set(document, findings);
|
|
143
|
+
return findings;
|
|
56
144
|
}
|
|
57
145
|
/** Fragment paste reuses catalogue identity; whole-map copy remaps it with the map. */
|
|
58
146
|
export function remapGroupCategories(group, ids) {
|
|
59
147
|
const remap = (value) => {
|
|
60
148
|
const categoryId = value.categoryId ? ids.get(value.categoryId) : undefined;
|
|
61
|
-
return categoryId && categoryId !== value.categoryId
|
|
62
|
-
? { ...value, categoryId }
|
|
63
|
-
: value;
|
|
149
|
+
return categoryId && categoryId !== value.categoryId ? { ...value, categoryId } : value;
|
|
64
150
|
};
|
|
65
151
|
if (group.kind === SeatingKind.Straight || group.kind === SeatingKind.Curved)
|
|
66
152
|
return {
|
|
@@ -82,37 +168,62 @@ export function remapGroupCategories(group, ids) {
|
|
|
82
168
|
},
|
|
83
169
|
};
|
|
84
170
|
}
|
|
171
|
+
export var InventoryKind;
|
|
172
|
+
(function (InventoryKind) {
|
|
173
|
+
InventoryKind["Rows"] = "rows";
|
|
174
|
+
InventoryKind["Tables"] = "tables";
|
|
175
|
+
InventoryKind["Standing"] = "standing";
|
|
176
|
+
InventoryKind["Booths"] = "booths";
|
|
177
|
+
})(InventoryKind || (InventoryKind = {}));
|
|
178
|
+
export function groupInventoryKind(kind) {
|
|
179
|
+
return kind === SeatingKind.Straight || kind === SeatingKind.Curved ? InventoryKind.Rows : InventoryKind.Tables;
|
|
180
|
+
}
|
|
181
|
+
export function areaInventoryKind(kind) {
|
|
182
|
+
return kind === AreaKind.Booth ? InventoryKind.Booths : InventoryKind.Standing;
|
|
183
|
+
}
|
|
85
184
|
const usage = new WeakMap();
|
|
86
|
-
|
|
185
|
+
const noInventoryKinds = new Set();
|
|
186
|
+
function categoryInventory(document) {
|
|
87
187
|
const cached = usage.get(document);
|
|
88
188
|
if (cached)
|
|
89
189
|
return cached;
|
|
90
190
|
const counts = new Map();
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
|
|
191
|
+
const kinds = new Map();
|
|
192
|
+
const count = (id, kind, quantity) => {
|
|
193
|
+
if (!id)
|
|
194
|
+
return;
|
|
195
|
+
counts.set(id, (counts.get(id) ?? 0) + quantity);
|
|
196
|
+
const used = kinds.get(id) ?? new Set();
|
|
197
|
+
used.add(kind);
|
|
198
|
+
kinds.set(id, used);
|
|
94
199
|
};
|
|
95
200
|
for (const group of document.seatingGroups) {
|
|
96
|
-
|
|
97
|
-
|
|
201
|
+
const kind = groupInventoryKind(group.kind);
|
|
202
|
+
if (group.kind === SeatingKind.Straight || group.kind === SeatingKind.Curved) {
|
|
98
203
|
for (const row of group.rows)
|
|
99
204
|
for (const slot of row.seats)
|
|
100
205
|
if (!slot.gap)
|
|
101
|
-
count(seatCategoryId(group, slot, row));
|
|
206
|
+
count(seatCategoryId(group, slot, row), kind, 1);
|
|
102
207
|
}
|
|
103
208
|
else {
|
|
104
|
-
const slots = group.kind === SeatingKind.Round
|
|
105
|
-
? group.chairs
|
|
106
|
-
: Object.values(group.chairsBySide).flat();
|
|
209
|
+
const slots = group.kind === SeatingKind.Round ? group.chairs : Object.values(group.chairsBySide).flat();
|
|
107
210
|
for (const slot of slots)
|
|
108
211
|
if (!slot.gap)
|
|
109
|
-
count(seatCategoryId(group, slot));
|
|
212
|
+
count(seatCategoryId(group, slot), kind, 1);
|
|
110
213
|
}
|
|
111
214
|
}
|
|
112
|
-
for (const area of document.areas)
|
|
113
|
-
count(area.categoryId ?? null, area.kind === AreaKind.Booth ? 1 : area.capacity);
|
|
114
|
-
|
|
115
|
-
|
|
215
|
+
for (const area of document.areas) {
|
|
216
|
+
count(area.categoryId ?? null, areaInventoryKind(area.kind), area.kind === AreaKind.Booth ? 1 : area.capacity);
|
|
217
|
+
}
|
|
218
|
+
const result = { counts, kinds };
|
|
219
|
+
usage.set(document, result);
|
|
220
|
+
return result;
|
|
221
|
+
}
|
|
222
|
+
export function categoryUsage(document) {
|
|
223
|
+
return categoryInventory(document).counts;
|
|
224
|
+
}
|
|
225
|
+
export function categoryInventoryKinds(document, categoryId) {
|
|
226
|
+
return categoryInventory(document).kinds.get(categoryId) ?? noInventoryKinds;
|
|
116
227
|
}
|
|
117
228
|
export function ticketOptionNameKey(name) {
|
|
118
229
|
return name.trim().toLowerCase();
|
package/dist/editor-state.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import type
|
|
2
|
+
import { type PhysicalDocumentV1, type UUID } from "./physical-document.interface.js";
|
|
3
3
|
export declare const mapEditorStateSchema: z.ZodObject<{
|
|
4
4
|
version: z.ZodLiteral<1>;
|
|
5
5
|
lockedIds: z.ZodArray<z.ZodString>;
|
|
@@ -17,6 +17,7 @@ export declare class MapEditorPolicy {
|
|
|
17
17
|
readonly nodes: Map<string, EditorNode>;
|
|
18
18
|
readonly rows: Set<string>;
|
|
19
19
|
private readonly parents;
|
|
20
|
+
private readonly lockParents;
|
|
20
21
|
private readonly children;
|
|
21
22
|
private readonly locked;
|
|
22
23
|
private readonly hidden;
|
|
@@ -27,6 +28,8 @@ export declare class MapEditorPolicy {
|
|
|
27
28
|
canLock(id: UUID): boolean;
|
|
28
29
|
canHide(id: UUID): boolean;
|
|
29
30
|
childIds(id: UUID): readonly UUID[];
|
|
31
|
+
/** Inventory ownership controls visibility; only structural parents pass down position locks. */
|
|
32
|
+
layoutChildIds(id: UUID): readonly UUID[];
|
|
30
33
|
private parentIds;
|
|
31
34
|
private owner;
|
|
32
35
|
lockOwner(id: UUID): UUID | undefined;
|
package/dist/editor-state.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { sectionCatalog } from "./sections.js";
|
|
1
2
|
import { z } from "zod";
|
|
2
3
|
import { documentCatalog } from "./catalog.js";
|
|
3
4
|
import { worldMatrices } from "./geometry/geometry.js";
|
|
4
5
|
import { uuidSchema } from "./schema.js";
|
|
6
|
+
import { DecorationKind } from "./physical-document.interface.js";
|
|
5
7
|
export const mapEditorStateSchema = z.strictObject({
|
|
6
8
|
version: z.literal(1),
|
|
7
9
|
lockedIds: z.array(uuidSchema).max(100_000),
|
|
@@ -18,6 +20,7 @@ export class MapEditorPolicy {
|
|
|
18
20
|
nodes = new Map();
|
|
19
21
|
rows = new Set();
|
|
20
22
|
parents = new Map();
|
|
23
|
+
lockParents = new Map();
|
|
21
24
|
children = new Map();
|
|
22
25
|
locked;
|
|
23
26
|
hidden;
|
|
@@ -28,6 +31,7 @@ export class MapEditorPolicy {
|
|
|
28
31
|
this.document = document;
|
|
29
32
|
this.locked = new Set(state.lockedIds);
|
|
30
33
|
this.hidden = new Set(state.hiddenIds);
|
|
34
|
+
const owners = sectionCatalog(document).owners;
|
|
31
35
|
for (const node of [
|
|
32
36
|
...document.collections,
|
|
33
37
|
...document.sections,
|
|
@@ -36,11 +40,10 @@ export class MapEditorPolicy {
|
|
|
36
40
|
...document.decorations,
|
|
37
41
|
]) {
|
|
38
42
|
this.nodes.set(node.id, node);
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
this.parents.set(node.id, parents);
|
|
43
|
+
const structuralParents = "parentId" in node && node.parentId ? [node.parentId] : [];
|
|
44
|
+
this.lockParents.set(node.id, structuralParents);
|
|
45
|
+
const section = owners.get(node.id);
|
|
46
|
+
this.parents.set(node.id, section ? [...structuralParents, section] : structuralParents);
|
|
44
47
|
}
|
|
45
48
|
for (const group of document.seatingGroups) {
|
|
46
49
|
if (!("rows" in group))
|
|
@@ -48,7 +51,9 @@ export class MapEditorPolicy {
|
|
|
48
51
|
for (const row of group.rows) {
|
|
49
52
|
this.nodes.set(row.id, row);
|
|
50
53
|
this.rows.add(row.id);
|
|
51
|
-
this.
|
|
54
|
+
this.lockParents.set(row.id, [group.id]);
|
|
55
|
+
const section = owners.get(row.id);
|
|
56
|
+
this.parents.set(row.id, section ? [group.id, section] : [group.id]);
|
|
52
57
|
}
|
|
53
58
|
}
|
|
54
59
|
for (const [id, parents] of this.parents) {
|
|
@@ -79,40 +84,44 @@ export class MapEditorPolicy {
|
|
|
79
84
|
childIds(id) {
|
|
80
85
|
return this.children.get(id) ?? [];
|
|
81
86
|
}
|
|
82
|
-
|
|
83
|
-
|
|
87
|
+
/** Inventory ownership controls visibility; only structural parents pass down position locks. */
|
|
88
|
+
layoutChildIds(id) {
|
|
89
|
+
return this.childIds(id).filter((child) => this.lockParents.get(child)?.includes(id));
|
|
90
|
+
}
|
|
91
|
+
parentIds(id, graph) {
|
|
92
|
+
const parents = graph.get(id);
|
|
84
93
|
if (parents)
|
|
85
94
|
return parents;
|
|
86
95
|
const seat = documentCatalog(this.document).seats.get(id);
|
|
87
96
|
return seat ? [seat.seat.rowId ?? seat.group.id] : [];
|
|
88
97
|
}
|
|
89
|
-
owner(id, flags, cache, visiting = new Set()) {
|
|
98
|
+
owner(id, flags, cache, parents, visiting = new Set()) {
|
|
90
99
|
if (!flags.size || visiting.has(id))
|
|
91
100
|
return undefined;
|
|
92
101
|
if (cache.has(id))
|
|
93
102
|
return cache.get(id);
|
|
94
103
|
visiting.add(id);
|
|
95
104
|
let owner = flags.has(id) ? id : undefined;
|
|
96
|
-
for (const parent of this.parentIds(id)) {
|
|
97
|
-
owner ??= this.owner(parent, flags, cache, visiting);
|
|
105
|
+
for (const parent of this.parentIds(id, parents)) {
|
|
106
|
+
owner ??= this.owner(parent, flags, cache, parents, visiting);
|
|
98
107
|
}
|
|
99
108
|
visiting.delete(id);
|
|
100
109
|
cache.set(id, owner);
|
|
101
110
|
return owner;
|
|
102
111
|
}
|
|
103
112
|
lockOwner(id) {
|
|
104
|
-
return this.owner(id, this.locked, this.lockOwners);
|
|
113
|
+
return this.owner(id, this.locked, this.lockOwners, this.lockParents);
|
|
105
114
|
}
|
|
106
115
|
hiddenOwner(id) {
|
|
107
|
-
return this.owner(id, this.hidden, this.hiddenOwners);
|
|
116
|
+
return this.owner(id, this.hidden, this.hiddenOwners, this.parents);
|
|
108
117
|
}
|
|
109
118
|
inheritedLockOwner(id) {
|
|
110
|
-
return this.parentIds(id)
|
|
119
|
+
return this.parentIds(id, this.lockParents)
|
|
111
120
|
.map((parent) => this.lockOwner(parent))
|
|
112
121
|
.find((owner) => owner !== undefined);
|
|
113
122
|
}
|
|
114
123
|
inheritedHiddenOwner(id) {
|
|
115
|
-
return this.parentIds(id)
|
|
124
|
+
return this.parentIds(id, this.parents)
|
|
116
125
|
.map((parent) => this.hiddenOwner(parent))
|
|
117
126
|
.find((owner) => owner !== undefined);
|
|
118
127
|
}
|
|
@@ -176,9 +185,7 @@ export function pruneMapEditorState(document, state) {
|
|
|
176
185
|
return JSON.stringify(next) === JSON.stringify(state) ? state : next;
|
|
177
186
|
}
|
|
178
187
|
export function serializedEditorState(state) {
|
|
179
|
-
return state.lockedIds.length || state.hiddenIds.length
|
|
180
|
-
? JSON.stringify(canonicalEditorState(state))
|
|
181
|
-
: undefined;
|
|
188
|
+
return state.lockedIds.length || state.hiddenIds.length ? JSON.stringify(canonicalEditorState(state)) : undefined;
|
|
182
189
|
}
|
|
183
190
|
export function remapMapEditorState(state, identities) {
|
|
184
191
|
const remap = (ids) => ids.flatMap((id) => {
|
|
@@ -191,7 +198,7 @@ export function remapMapEditorState(state, identities) {
|
|
|
191
198
|
hiddenIds: remap(state.hiddenIds),
|
|
192
199
|
});
|
|
193
200
|
}
|
|
194
|
-
const
|
|
201
|
+
const nonLayoutFields = new Set([
|
|
195
202
|
"name",
|
|
196
203
|
"label",
|
|
197
204
|
"labels",
|
|
@@ -201,6 +208,7 @@ const appearanceFields = new Set([
|
|
|
201
208
|
"buyerNoun",
|
|
202
209
|
"selling",
|
|
203
210
|
"buyerNote",
|
|
211
|
+
"buyerPhoto",
|
|
204
212
|
"gap",
|
|
205
213
|
"seatShape",
|
|
206
214
|
"categoryId",
|
|
@@ -208,6 +216,7 @@ const appearanceFields = new Set([
|
|
|
208
216
|
"seatLabelStyle",
|
|
209
217
|
"labelStyle",
|
|
210
218
|
"rowStyle",
|
|
219
|
+
"rowRefitStrength",
|
|
211
220
|
"style",
|
|
212
221
|
"displayLabel",
|
|
213
222
|
"labelPlacement",
|
|
@@ -219,14 +228,26 @@ const appearanceFields = new Set([
|
|
|
219
228
|
"iconId",
|
|
220
229
|
"zIndex",
|
|
221
230
|
"capacity",
|
|
231
|
+
"gate",
|
|
232
|
+
"entrance",
|
|
233
|
+
"route",
|
|
234
|
+
"lineCap",
|
|
235
|
+
"lineJoin",
|
|
236
|
+
"startEnding",
|
|
237
|
+
"endEnding",
|
|
222
238
|
]);
|
|
239
|
+
const decorationKinds = new Set(Object.values(DecorationKind));
|
|
223
240
|
function layoutValue(value) {
|
|
224
241
|
if (Array.isArray(value))
|
|
225
242
|
return value.map(layoutValue);
|
|
226
|
-
if (value && typeof value === "object")
|
|
243
|
+
if (value && typeof value === "object") {
|
|
244
|
+
// Authored extrusion height is separate from a drawable's locked 2D footprint.
|
|
245
|
+
const decoration = "id" in value && "kind" in value && typeof value.kind === "string" && decorationKinds.has(value.kind);
|
|
227
246
|
return Object.fromEntries(Object.entries(value)
|
|
228
|
-
.filter(([key]) => !
|
|
247
|
+
.filter(([key]) => !nonLayoutFields.has(key) && !(decoration && key === "heightM"))
|
|
248
|
+
.sort(([left], [right]) => (left < right ? -1 : left > right ? 1 : 0))
|
|
229
249
|
.map(([key, child]) => [key, layoutValue(child)]));
|
|
250
|
+
}
|
|
230
251
|
return value;
|
|
231
252
|
}
|
|
232
253
|
/** Compare committed layout only; display names, numbering, paints and labels remain editable. */
|
|
@@ -241,21 +262,23 @@ export function protectedLayoutChanges(before, after, state) {
|
|
|
241
262
|
if (!owner)
|
|
242
263
|
continue;
|
|
243
264
|
const candidate = next.nodes.get(id);
|
|
244
|
-
const
|
|
245
|
-
|
|
246
|
-
|
|
265
|
+
const ownerId = previous.rows.has(id) ? (documentCatalog(before).rows.get(id)?.id ?? id) : id;
|
|
266
|
+
const nextOwnerId = next.rows.has(id) ? (documentCatalog(after).rows.get(id)?.id ?? id) : id;
|
|
267
|
+
if (!candidate || ownerId !== nextOwnerId) {
|
|
268
|
+
changed.add(owner);
|
|
269
|
+
continue;
|
|
270
|
+
}
|
|
247
271
|
const previousValue = {
|
|
248
272
|
layout: layoutValue(node),
|
|
249
|
-
matrix: beforeMatrices.get(
|
|
250
|
-
children: [...previous.
|
|
273
|
+
matrix: beforeMatrices.get(ownerId),
|
|
274
|
+
children: [...previous.layoutChildIds(id)].sort(),
|
|
251
275
|
};
|
|
252
276
|
const nextValue = {
|
|
253
277
|
layout: layoutValue(candidate),
|
|
254
|
-
matrix: afterMatrices.get(
|
|
255
|
-
children: [...next.
|
|
278
|
+
matrix: afterMatrices.get(nextOwnerId),
|
|
279
|
+
children: [...next.layoutChildIds(id)].sort(),
|
|
256
280
|
};
|
|
257
|
-
if (
|
|
258
|
-
JSON.stringify(previousValue) !== JSON.stringify(nextValue))
|
|
281
|
+
if (JSON.stringify(previousValue) !== JSON.stringify(nextValue))
|
|
259
282
|
changed.add(owner);
|
|
260
283
|
}
|
|
261
284
|
return [...changed];
|
package/dist/floors.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type PhysicalDocumentV1, type PointM, type UUID, type VenueFloor } from "./physical-document.interface.js";
|
|
2
|
+
export type FloorInventory = {
|
|
3
|
+
floor: VenueFloor | null;
|
|
4
|
+
members: readonly UUID[];
|
|
5
|
+
capacity: {
|
|
6
|
+
physicalSeats: number;
|
|
7
|
+
gaQuantity: number;
|
|
8
|
+
};
|
|
9
|
+
rowGapCount: number;
|
|
10
|
+
};
|
|
11
|
+
export type FloorCatalog = {
|
|
12
|
+
entries: ReadonlyMap<UUID | null, FloorInventory>;
|
|
13
|
+
owners: ReadonlyMap<UUID, UUID | null>;
|
|
14
|
+
};
|
|
15
|
+
/** Derive physical membership and counts once, without creating another editable document. */
|
|
16
|
+
export declare function floorCatalog(document: PhysicalDocumentV1): FloorCatalog;
|
|
17
|
+
/** Resolve seats through their physical owner; logical rows use their first physical part. */
|
|
18
|
+
export declare function objectFloorId(document: PhysicalDocumentV1, id: UUID): UUID | null;
|
|
19
|
+
export declare function floorLabel(floor: VenueFloor): string;
|
|
20
|
+
export declare const DefaultFloorFocalPoint: Readonly<PointM>;
|
|
21
|
+
export declare function authoredFloorFocalPoint(document: PhysicalDocumentV1, floorId: UUID | null): PointM | undefined;
|
|
22
|
+
export declare function sameFocalPoint(first: PointM | undefined, second: PointM | undefined): boolean;
|