@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.
- package/dist/arc-fan-rebuild.d.ts +13 -0
- package/dist/arc-fan-rebuild.js +163 -0
- package/dist/arc-fan.d.ts +27 -0
- package/dist/arc-fan.interface.d.ts +83 -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 +5 -3
- package/dist/categories.js +104 -25
- 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 +77 -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 +6 -3
- package/dist/geometry/geometry.js +28 -30
- 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 +1 -1
- package/dist/geometry/seating-layout.d.ts +9 -1
- package/dist/geometry/seating-layout.js +66 -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 +107 -49
- package/dist/identity.d.ts +3 -1
- package/dist/identity.js +32 -17
- package/dist/issues.d.ts +15 -2
- package/dist/issues.js +16 -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} +117 -4
- package/dist/{types.js → physical-document.interface.js} +17 -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 +591 -14
- package/dist/schema.js +238 -102
- 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 +12 -0
- package/dist/section-growth.interface.js +1 -0
- package/dist/section-growth.js +198 -0
- package/dist/section-layout.d.ts +95 -0
- package/dist/section-layout.interface.d.ts +8 -0
- package/dist/section-layout.interface.js +5 -0
- package/dist/section-layout.js +70 -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 +1 -2
- package/dist/table-layout.js +14 -22
- 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 +89 -4
package/dist/issues.d.ts
CHANGED
|
@@ -1,21 +1,32 @@
|
|
|
1
|
-
import type { UUID } from "./
|
|
1
|
+
import type { UUID } from "./physical-document.interface.js";
|
|
2
2
|
export declare enum IssueCode {
|
|
3
3
|
DuplicateId = "DUPLICATE_ID",
|
|
4
4
|
InvalidJson = "INVALID_JSON",
|
|
5
5
|
InvalidParent = "INVALID_PARENT",
|
|
6
6
|
InvalidStructure = "INVALID_STRUCTURE",
|
|
7
|
+
InvalidSegmentedRow = "INVALID_SEGMENTED_ROW",
|
|
7
8
|
Limit = "LIMIT_EXCEEDED",
|
|
8
9
|
UnknownSection = "UNKNOWN_SECTION",
|
|
10
|
+
UnknownFloor = "UNKNOWN_FLOOR",
|
|
11
|
+
UnknownZone = "UNKNOWN_ZONE",
|
|
12
|
+
UnknownGate = "UNKNOWN_GATE",
|
|
13
|
+
UnknownCategory = "UNKNOWN_CATEGORY",
|
|
14
|
+
UnknownSeatCategory = "UNKNOWN_SEAT_CATEGORY",
|
|
15
|
+
MissingCategory = "MISSING_CATEGORY",
|
|
16
|
+
MissingCategoryPrice = "MISSING_CATEGORY_PRICE",
|
|
9
17
|
UnsupportedVersion = "UNSUPPORTED_VERSION",
|
|
10
18
|
WorldBounds = "WORLD_BOUNDS",
|
|
11
19
|
DuplicateLabel = "DUPLICATE_LABEL",
|
|
12
20
|
EmptyInventory = "EMPTY_INVENTORY",
|
|
21
|
+
EmptySection = "EMPTY_SECTION",
|
|
13
22
|
InvalidBoundary = "INVALID_BOUNDARY",
|
|
14
23
|
InvalidCompanion = "INVALID_COMPANION",
|
|
15
24
|
InvalidLabel = "INVALID_LABEL",
|
|
25
|
+
MissingLabel = "MISSING_LABEL",
|
|
16
26
|
MissingAsset = "MISSING_ASSET",
|
|
17
27
|
CurveOverrun = "CURVE_OVERRUN",
|
|
18
|
-
|
|
28
|
+
SeatOverlap = "SEAT_OVERLAP",
|
|
29
|
+
SeatCramped = "SEAT_CRAMPED",
|
|
19
30
|
OutsideBoundary = "OUTSIDE_BOUNDARY",
|
|
20
31
|
InvalidCommand = "INVALID_COMMAND"
|
|
21
32
|
}
|
|
@@ -36,6 +47,7 @@ export type DomainIssue = {
|
|
|
36
47
|
code: IssueCode;
|
|
37
48
|
severity: IssueSeverity;
|
|
38
49
|
message: string;
|
|
50
|
+
description?: string;
|
|
39
51
|
entityIds: UUID[];
|
|
40
52
|
fieldPath?: string;
|
|
41
53
|
relatedEntityIds?: UUID[];
|
|
@@ -43,4 +55,5 @@ export type DomainIssue = {
|
|
|
43
55
|
blocks: BlockedAction[];
|
|
44
56
|
};
|
|
45
57
|
export declare function issue(code: IssueCode, message: string, entityIds: UUID[], fieldPath?: string): DomainIssue;
|
|
58
|
+
export declare function missingLabelMessage(count: number): string;
|
|
46
59
|
export declare function issueKey(value: DomainIssue): string;
|
package/dist/issues.js
CHANGED
|
@@ -4,18 +4,29 @@ export var IssueCode;
|
|
|
4
4
|
IssueCode["InvalidJson"] = "INVALID_JSON";
|
|
5
5
|
IssueCode["InvalidParent"] = "INVALID_PARENT";
|
|
6
6
|
IssueCode["InvalidStructure"] = "INVALID_STRUCTURE";
|
|
7
|
+
IssueCode["InvalidSegmentedRow"] = "INVALID_SEGMENTED_ROW";
|
|
7
8
|
IssueCode["Limit"] = "LIMIT_EXCEEDED";
|
|
8
9
|
IssueCode["UnknownSection"] = "UNKNOWN_SECTION";
|
|
10
|
+
IssueCode["UnknownFloor"] = "UNKNOWN_FLOOR";
|
|
11
|
+
IssueCode["UnknownZone"] = "UNKNOWN_ZONE";
|
|
12
|
+
IssueCode["UnknownGate"] = "UNKNOWN_GATE";
|
|
13
|
+
IssueCode["UnknownCategory"] = "UNKNOWN_CATEGORY";
|
|
14
|
+
IssueCode["UnknownSeatCategory"] = "UNKNOWN_SEAT_CATEGORY";
|
|
15
|
+
IssueCode["MissingCategory"] = "MISSING_CATEGORY";
|
|
16
|
+
IssueCode["MissingCategoryPrice"] = "MISSING_CATEGORY_PRICE";
|
|
9
17
|
IssueCode["UnsupportedVersion"] = "UNSUPPORTED_VERSION";
|
|
10
18
|
IssueCode["WorldBounds"] = "WORLD_BOUNDS";
|
|
11
19
|
IssueCode["DuplicateLabel"] = "DUPLICATE_LABEL";
|
|
12
20
|
IssueCode["EmptyInventory"] = "EMPTY_INVENTORY";
|
|
21
|
+
IssueCode["EmptySection"] = "EMPTY_SECTION";
|
|
13
22
|
IssueCode["InvalidBoundary"] = "INVALID_BOUNDARY";
|
|
14
23
|
IssueCode["InvalidCompanion"] = "INVALID_COMPANION";
|
|
15
24
|
IssueCode["InvalidLabel"] = "INVALID_LABEL";
|
|
25
|
+
IssueCode["MissingLabel"] = "MISSING_LABEL";
|
|
16
26
|
IssueCode["MissingAsset"] = "MISSING_ASSET";
|
|
17
27
|
IssueCode["CurveOverrun"] = "CURVE_OVERRUN";
|
|
18
|
-
IssueCode["
|
|
28
|
+
IssueCode["SeatOverlap"] = "SEAT_OVERLAP";
|
|
29
|
+
IssueCode["SeatCramped"] = "SEAT_CRAMPED";
|
|
19
30
|
IssueCode["OutsideBoundary"] = "OUTSIDE_BOUNDARY";
|
|
20
31
|
IssueCode["InvalidCommand"] = "INVALID_COMMAND";
|
|
21
32
|
})(IssueCode || (IssueCode = {}));
|
|
@@ -43,13 +54,12 @@ export function issue(code, message, entityIds, fieldPath) {
|
|
|
43
54
|
entityIds,
|
|
44
55
|
fieldPath,
|
|
45
56
|
remediation: [IssueRemediation.Edit, IssueRemediation.Remove],
|
|
46
|
-
blocks: [
|
|
47
|
-
BlockedAction.FinalizeAssignment,
|
|
48
|
-
BlockedAction.Publish,
|
|
49
|
-
BlockedAction.ReplaceBinding,
|
|
50
|
-
],
|
|
57
|
+
blocks: [BlockedAction.FinalizeAssignment, BlockedAction.Publish, BlockedAction.ReplaceBinding],
|
|
51
58
|
};
|
|
52
59
|
}
|
|
60
|
+
export function missingLabelMessage(count) {
|
|
61
|
+
return `${count} ${count === 1 ? "object has" : "objects have"} no label`;
|
|
62
|
+
}
|
|
53
63
|
export function issueKey(value) {
|
|
54
64
|
return `${value.code}:${[...value.entityIds].sort().join(",")}:${value.fieldPath ?? ""}`;
|
|
55
65
|
}
|
package/dist/labels.d.ts
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import { type LabelSequence } from "./
|
|
1
|
+
import { type LabelSequence, type InventoryNaming, type RowInventory } from "./physical-document.interface.js";
|
|
2
|
+
/** An explicit buyer-facing name overrides the generated inventory code. */
|
|
3
|
+
export declare function inventoryName(naming: InventoryNaming): string;
|
|
4
|
+
/** Physical row identifiers remain stable when their displayed names change. */
|
|
5
|
+
export declare function rowBookingLabel(group: RowInventory, index: number): string;
|
|
6
|
+
export declare function rowDisplayLabel(group: RowInventory, index: number): string;
|
|
2
7
|
export declare function labelKey(value: string): string;
|
|
3
8
|
/** Position in the buyer's sequence, independent of authored inventory identity. */
|
|
4
9
|
export declare function sequenceOrdinal(sequence: LabelSequence, index: number, count: number): number;
|
package/dist/labels.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NumberingScheme, LabelDirection, } from "./
|
|
1
|
+
import { NumberingScheme, LabelDirection, } from "./physical-document.interface.js";
|
|
2
2
|
import { caseFoldData } from "./case-fold-data.js";
|
|
3
3
|
const folds = new Map(caseFoldData.split(";").map((entry) => {
|
|
4
4
|
const [from, to] = entry.split(":");
|
|
@@ -9,9 +9,20 @@ const folds = new Map(caseFoldData.split(";").map((entry) => {
|
|
|
9
9
|
}));
|
|
10
10
|
// Unicode 17 White_Space, PropList.txt; same license as case-fold-data.
|
|
11
11
|
const whitespace = new Set([
|
|
12
|
-
9, 10, 11, 12, 13, 32, 133, 160, 5760, 8192, 8193, 8194, 8195, 8196, 8197,
|
|
13
|
-
|
|
12
|
+
9, 10, 11, 12, 13, 32, 133, 160, 5760, 8192, 8193, 8194, 8195, 8196, 8197, 8198, 8199, 8200, 8201, 8202, 8232, 8233,
|
|
13
|
+
8239, 8287, 12288,
|
|
14
14
|
]);
|
|
15
|
+
/** An explicit buyer-facing name overrides the generated inventory code. */
|
|
16
|
+
export function inventoryName(naming) {
|
|
17
|
+
return naming.name ?? naming.code;
|
|
18
|
+
}
|
|
19
|
+
/** Physical row identifiers remain stable when their displayed names change. */
|
|
20
|
+
export function rowBookingLabel(group, index) {
|
|
21
|
+
return group.rows[index].bookingLabel ?? sequenceLabel(group.labels.rows, index, group.rows.length);
|
|
22
|
+
}
|
|
23
|
+
export function rowDisplayLabel(group, index) {
|
|
24
|
+
return group.rows[index].labelOverride ?? rowBookingLabel(group, index);
|
|
25
|
+
}
|
|
15
26
|
export function labelKey(value) {
|
|
16
27
|
const points = Array.from(value);
|
|
17
28
|
let start = 0;
|
|
@@ -39,24 +50,17 @@ export function sequenceOrdinal(sequence, index, count) {
|
|
|
39
50
|
return (centre - index) * 2 - (count % 2);
|
|
40
51
|
return (index - centre) * 2 - (count % 2 === 0 ? 1 : 0);
|
|
41
52
|
}
|
|
42
|
-
return sequence.direction === LabelDirection.Reverse
|
|
43
|
-
? count - 1 - index
|
|
44
|
-
: index;
|
|
53
|
+
return sequence.direction === LabelDirection.Reverse ? count - 1 - index : index;
|
|
45
54
|
}
|
|
46
55
|
export function sequenceStep(sequence) {
|
|
47
|
-
return sequence.scheme === NumberingScheme.Odd ||
|
|
48
|
-
sequence.scheme === NumberingScheme.Even
|
|
49
|
-
? 2
|
|
50
|
-
: 1;
|
|
56
|
+
return sequence.scheme === NumberingScheme.Odd || sequence.scheme === NumberingScheme.Even ? 2 : 1;
|
|
51
57
|
}
|
|
52
58
|
/** Combined patterns own their order; the stored anchor remains available when switching back. */
|
|
53
59
|
export function sequenceOwnsOrder(scheme) {
|
|
54
|
-
return
|
|
60
|
+
return scheme === NumberingScheme.OutsideIn || scheme === NumberingScheme.InsideOut;
|
|
55
61
|
}
|
|
56
62
|
export function sequenceStart(sequence, count) {
|
|
57
|
-
let start = !sequenceOwnsOrder(sequence.scheme) &&
|
|
58
|
-
sequence.numberFrom === "last" &&
|
|
59
|
-
sequence.lastAt !== undefined
|
|
63
|
+
let start = !sequenceOwnsOrder(sequence.scheme) && sequence.numberFrom === "last" && sequence.lastAt !== undefined
|
|
60
64
|
? Math.max(0, sequence.lastAt - Math.max(0, count - 1) * sequenceStep(sequence))
|
|
61
65
|
: sequence.startAt;
|
|
62
66
|
if (sequence.scheme === NumberingScheme.Odd && start % 2 === 0)
|
|
@@ -81,11 +85,9 @@ const romanParts = [
|
|
|
81
85
|
[1, "I"],
|
|
82
86
|
];
|
|
83
87
|
export function sequenceLabel(sequence, index, count) {
|
|
84
|
-
let n = sequenceStart(sequence, count) +
|
|
85
|
-
sequenceOrdinal(sequence, index, count) * sequenceStep(sequence);
|
|
88
|
+
let n = sequenceStart(sequence, count) + sequenceOrdinal(sequence, index, count) * sequenceStep(sequence);
|
|
86
89
|
let label = String(n);
|
|
87
|
-
if (sequence.scheme === NumberingScheme.Alphabetic ||
|
|
88
|
-
sequence.scheme === NumberingScheme.LowerAlphabetic) {
|
|
90
|
+
if (sequence.scheme === NumberingScheme.Alphabetic || sequence.scheme === NumberingScheme.LowerAlphabetic) {
|
|
89
91
|
n = Math.max(1, n);
|
|
90
92
|
label = "";
|
|
91
93
|
while (n > 0) {
|
package/dist/layers.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type PhysicalDocumentV1, type UUID } from "./physical-document.interface.js";
|
|
2
|
+
export type LayerEntry = {
|
|
3
|
+
id: UUID;
|
|
4
|
+
parentId: UUID | null;
|
|
5
|
+
ownerId: UUID;
|
|
6
|
+
zIndex: number;
|
|
7
|
+
rowIndex: number;
|
|
8
|
+
};
|
|
9
|
+
export type LayerRun = {
|
|
10
|
+
ids: readonly UUID[];
|
|
11
|
+
order: number;
|
|
12
|
+
};
|
|
13
|
+
type LayerCatalog = {
|
|
14
|
+
runs: ReadonlyMap<UUID, readonly LayerRun[]>;
|
|
15
|
+
siblings: ReadonlyMap<UUID | null, readonly LayerEntry[]>;
|
|
16
|
+
targets: ReadonlyMap<UUID, readonly UUID[]>;
|
|
17
|
+
order: ReadonlyMap<UUID, number>;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* @method layerCatalog
|
|
21
|
+
* @description Projects rows and drawables onto their collection's stacking plane without changing bank ownership.
|
|
22
|
+
* @param document Physical document whose collection hierarchy and row defaults determine the stacking order.
|
|
23
|
+
* @returns Cached sibling lists, actionable targets and flattened painter order, including each bank's first row.
|
|
24
|
+
*/
|
|
25
|
+
export declare function layerCatalog(document: PhysicalDocumentV1): LayerCatalog;
|
|
26
|
+
export {};
|
package/dist/layers.js
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { SeatingKind } from "./physical-document.interface.js";
|
|
2
|
+
const catalogs = new WeakMap();
|
|
3
|
+
/**
|
|
4
|
+
* @method layerCatalog
|
|
5
|
+
* @description Projects rows and drawables onto their collection's stacking plane without changing bank ownership.
|
|
6
|
+
* @param document Physical document whose collection hierarchy and row defaults determine the stacking order.
|
|
7
|
+
* @returns Cached sibling lists, actionable targets and flattened painter order, including each bank's first row.
|
|
8
|
+
*/
|
|
9
|
+
export function layerCatalog(document) {
|
|
10
|
+
const cached = catalogs.get(document);
|
|
11
|
+
if (cached) {
|
|
12
|
+
return cached;
|
|
13
|
+
}
|
|
14
|
+
const siblings = new Map();
|
|
15
|
+
const targets = new Map();
|
|
16
|
+
const collections = new Set(document.collections.map((collection) => collection.id));
|
|
17
|
+
const banks = new Map();
|
|
18
|
+
const entities = [
|
|
19
|
+
...document.collections,
|
|
20
|
+
...document.seatingGroups,
|
|
21
|
+
...document.areas,
|
|
22
|
+
...document.decorations,
|
|
23
|
+
];
|
|
24
|
+
for (const entity of entities) {
|
|
25
|
+
const rows = "kind" in entity && (entity.kind === SeatingKind.Straight || entity.kind === SeatingKind.Curved)
|
|
26
|
+
? entity.rows
|
|
27
|
+
: null;
|
|
28
|
+
const entries = rows
|
|
29
|
+
? rows.map((row, rowIndex) => ({
|
|
30
|
+
id: row.id,
|
|
31
|
+
parentId: entity.parentId,
|
|
32
|
+
ownerId: entity.id,
|
|
33
|
+
zIndex: row.zIndex ?? entity.zIndex,
|
|
34
|
+
rowIndex,
|
|
35
|
+
}))
|
|
36
|
+
: [{ id: entity.id, parentId: entity.parentId, ownerId: entity.id, zIndex: entity.zIndex, rowIndex: 0 }];
|
|
37
|
+
const ids = entries.map((entry) => entry.id);
|
|
38
|
+
targets.set(entity.id, ids);
|
|
39
|
+
if (rows) {
|
|
40
|
+
banks.set(entity.id, ids);
|
|
41
|
+
for (const id of ids) {
|
|
42
|
+
targets.set(id, [id]);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
const list = siblings.get(entity.parentId) ?? [];
|
|
46
|
+
list.push(...entries);
|
|
47
|
+
siblings.set(entity.parentId, list);
|
|
48
|
+
}
|
|
49
|
+
for (const logical of document.segmentedRows ?? []) {
|
|
50
|
+
targets.set(logical.id, logical.parts.map((part) => part.rowId));
|
|
51
|
+
}
|
|
52
|
+
for (const list of siblings.values()) {
|
|
53
|
+
list.sort((a, b) => a.zIndex - b.zIndex || a.ownerId.localeCompare(b.ownerId) || a.rowIndex - b.rowIndex);
|
|
54
|
+
}
|
|
55
|
+
const order = new Map();
|
|
56
|
+
const runs = new Map();
|
|
57
|
+
let previousOwner = null;
|
|
58
|
+
let ordinal = 0;
|
|
59
|
+
const visit = (parent) => {
|
|
60
|
+
for (const entry of siblings.get(parent) ?? []) {
|
|
61
|
+
if (collections.has(entry.id)) {
|
|
62
|
+
visit(entry.id);
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
order.set(entry.id, ordinal);
|
|
66
|
+
const ownerRuns = runs.get(entry.ownerId) ?? [];
|
|
67
|
+
if (previousOwner === entry.ownerId) {
|
|
68
|
+
ownerRuns[ownerRuns.length - 1].ids.push(entry.id);
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
ownerRuns.push({ ids: [entry.id], order: ordinal });
|
|
72
|
+
}
|
|
73
|
+
runs.set(entry.ownerId, ownerRuns);
|
|
74
|
+
previousOwner = entry.ownerId;
|
|
75
|
+
ordinal++;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
visit(null);
|
|
80
|
+
for (const [id, rows] of banks) {
|
|
81
|
+
order.set(id, Math.min(...rows.map((row) => order.get(row))));
|
|
82
|
+
}
|
|
83
|
+
const catalog = { siblings, targets, order, runs };
|
|
84
|
+
catalogs.set(document, catalog);
|
|
85
|
+
return catalog;
|
|
86
|
+
}
|
package/dist/media.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { BuyerPhoto, PhysicalDocumentV1, UUID } from "./physical-document.interface.js";
|
|
2
|
+
import type { DocumentSeat } from "./catalog.js";
|
|
3
|
+
export declare enum MediaScope {
|
|
4
|
+
Artwork = "artwork",
|
|
5
|
+
Seat = "seat",
|
|
6
|
+
Row = "row",
|
|
7
|
+
Section = "section",
|
|
8
|
+
Venue = "venue",
|
|
9
|
+
Generated = "generated"
|
|
10
|
+
}
|
|
11
|
+
export type MediaReference = Readonly<{
|
|
12
|
+
scope: Exclude<MediaScope, MediaScope.Generated>;
|
|
13
|
+
ownerId: UUID;
|
|
14
|
+
assetId: UUID;
|
|
15
|
+
fieldPath: string;
|
|
16
|
+
}>;
|
|
17
|
+
/** All live consumers share resource identity, including photos on gap slots. */
|
|
18
|
+
export declare function mediaReferences(document: PhysicalDocumentV1): readonly MediaReference[];
|
|
19
|
+
export type ResolvedBuyerPhoto = {
|
|
20
|
+
scope: MediaScope.Generated;
|
|
21
|
+
} | {
|
|
22
|
+
scope: Exclude<MediaScope, MediaScope.Generated | MediaScope.Artwork>;
|
|
23
|
+
ownerId: UUID;
|
|
24
|
+
photo: BuyerPhoto;
|
|
25
|
+
};
|
|
26
|
+
/** Resolve the primary inventory address; overlapping editing scopes do not change inheritance. */
|
|
27
|
+
export declare function buyerPhotoForSeat(document: PhysicalDocumentV1, seat: DocumentSeat): ResolvedBuyerPhoto;
|
package/dist/media.js
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { DecorationKind, SeatingKind } from "./physical-document.interface.js";
|
|
2
|
+
export var MediaScope;
|
|
3
|
+
(function (MediaScope) {
|
|
4
|
+
MediaScope["Artwork"] = "artwork";
|
|
5
|
+
MediaScope["Seat"] = "seat";
|
|
6
|
+
MediaScope["Row"] = "row";
|
|
7
|
+
MediaScope["Section"] = "section";
|
|
8
|
+
MediaScope["Venue"] = "venue";
|
|
9
|
+
MediaScope["Generated"] = "generated";
|
|
10
|
+
})(MediaScope || (MediaScope = {}));
|
|
11
|
+
const groupReferences = new WeakMap();
|
|
12
|
+
const documentReferences = new WeakMap();
|
|
13
|
+
const photoInheritance = new WeakMap();
|
|
14
|
+
/** All live consumers share resource identity, including photos on gap slots. */
|
|
15
|
+
export function mediaReferences(document) {
|
|
16
|
+
const cached = documentReferences.get(document);
|
|
17
|
+
if (cached)
|
|
18
|
+
return cached;
|
|
19
|
+
const references = [];
|
|
20
|
+
const photo = (scope, ownerId, value, target = references) => {
|
|
21
|
+
if (value)
|
|
22
|
+
target.push({ scope, ownerId, assetId: value.assetId, fieldPath: `${ownerId}.buyerPhoto.assetId` });
|
|
23
|
+
};
|
|
24
|
+
photo(MediaScope.Venue, document.mapId, document.buyerPhoto);
|
|
25
|
+
for (const section of document.sections)
|
|
26
|
+
photo(MediaScope.Section, section.id, section.buyerPhoto);
|
|
27
|
+
for (const group of document.seatingGroups) {
|
|
28
|
+
let entries = groupReferences.get(group);
|
|
29
|
+
if (!entries) {
|
|
30
|
+
const next = [];
|
|
31
|
+
if (group.kind === SeatingKind.Straight || group.kind === SeatingKind.Curved) {
|
|
32
|
+
for (const row of group.rows) {
|
|
33
|
+
photo(MediaScope.Row, row.id, row.buyerPhoto, next);
|
|
34
|
+
for (const slot of row.seats)
|
|
35
|
+
photo(MediaScope.Seat, slot.id, slot.buyerPhoto, next);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
const sides = group.kind === SeatingKind.Round ? [group.chairs] : Object.values(group.chairsBySide);
|
|
40
|
+
for (const seats of sides)
|
|
41
|
+
for (const slot of seats)
|
|
42
|
+
photo(MediaScope.Seat, slot.id, slot.buyerPhoto, next);
|
|
43
|
+
}
|
|
44
|
+
entries = Object.freeze(next);
|
|
45
|
+
groupReferences.set(group, entries);
|
|
46
|
+
}
|
|
47
|
+
references.push(...entries);
|
|
48
|
+
}
|
|
49
|
+
for (const decoration of document.decorations)
|
|
50
|
+
if (decoration.kind === DecorationKind.Image)
|
|
51
|
+
references.push({
|
|
52
|
+
scope: MediaScope.Artwork,
|
|
53
|
+
ownerId: decoration.id,
|
|
54
|
+
assetId: decoration.assetId,
|
|
55
|
+
fieldPath: `${decoration.id}.assetId`,
|
|
56
|
+
});
|
|
57
|
+
const result = Object.freeze(references);
|
|
58
|
+
documentReferences.set(document, result);
|
|
59
|
+
return result;
|
|
60
|
+
}
|
|
61
|
+
/** Resolve the primary inventory address; overlapping editing scopes do not change inheritance. */
|
|
62
|
+
export function buyerPhotoForSeat(document, seat) {
|
|
63
|
+
if (seat.slot.buyerPhoto)
|
|
64
|
+
return { scope: MediaScope.Seat, ownerId: seat.id, photo: seat.slot.buyerPhoto };
|
|
65
|
+
let inherited = photoInheritance.get(document);
|
|
66
|
+
if (!inherited) {
|
|
67
|
+
const rows = new Map();
|
|
68
|
+
for (const group of document.seatingGroups)
|
|
69
|
+
if (group.kind === SeatingKind.Straight || group.kind === SeatingKind.Curved)
|
|
70
|
+
for (const row of group.rows)
|
|
71
|
+
if (row.buyerPhoto)
|
|
72
|
+
rows.set(row.id, row.buyerPhoto);
|
|
73
|
+
const sections = new Map();
|
|
74
|
+
for (const section of document.sections)
|
|
75
|
+
if (section.buyerPhoto)
|
|
76
|
+
sections.set(section.id, section.buyerPhoto);
|
|
77
|
+
inherited = { rows, sections };
|
|
78
|
+
photoInheritance.set(document, inherited);
|
|
79
|
+
}
|
|
80
|
+
const rowPhoto = seat.rowId ? inherited.rows.get(seat.rowId) : undefined;
|
|
81
|
+
if (rowPhoto)
|
|
82
|
+
return { scope: MediaScope.Row, ownerId: seat.rowId, photo: rowPhoto };
|
|
83
|
+
const sectionPhoto = seat.sectionId ? inherited.sections.get(seat.sectionId) : undefined;
|
|
84
|
+
if (sectionPhoto)
|
|
85
|
+
return { scope: MediaScope.Section, ownerId: seat.sectionId, photo: sectionPhoto };
|
|
86
|
+
if (document.buyerPhoto)
|
|
87
|
+
return { scope: MediaScope.Venue, ownerId: document.mapId, photo: document.buyerPhoto };
|
|
88
|
+
return { scope: MediaScope.Generated };
|
|
89
|
+
}
|
|
@@ -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,8 +278,11 @@ export type CurvedRows = RowsBase & {
|
|
|
241
278
|
};
|
|
242
279
|
};
|
|
243
280
|
export type RowInventory = StraightRows | CurvedRows;
|
|
244
|
-
export type
|
|
245
|
-
|
|
281
|
+
export type InventoryNaming = {
|
|
282
|
+
code: string;
|
|
283
|
+
name?: string;
|
|
284
|
+
};
|
|
285
|
+
export type TableLabels = InventoryNaming & {
|
|
246
286
|
chairs: LabelSequence;
|
|
247
287
|
tableStyle: LabelStyle;
|
|
248
288
|
};
|
|
@@ -321,10 +361,11 @@ export type RoundTable = GroupBase & {
|
|
|
321
361
|
chairs: SeatSlot[];
|
|
322
362
|
};
|
|
323
363
|
export type SeatingGroup = StraightRows | CurvedRows | RectangularTable | RoundTable;
|
|
324
|
-
type InventoryAreaBase = DrawableBase & {
|
|
364
|
+
type InventoryAreaBase = DrawableBase & InventoryNaming & {
|
|
365
|
+
entrance?: EntranceAssignment;
|
|
325
366
|
categoryId?: UUID | null;
|
|
367
|
+
/** Explicit grouping for outline-free sections and overview shapes; inventory boundaries use geometry. */
|
|
326
368
|
sectionId: UUID | null;
|
|
327
|
-
label: string;
|
|
328
369
|
labelStyle: LabelStyle;
|
|
329
370
|
capacity: number;
|
|
330
371
|
shape: {
|
|
@@ -357,15 +398,22 @@ export type Decoration = DrawableBase & ({
|
|
|
357
398
|
kind: DecorationKind.Rectangle;
|
|
358
399
|
sizeM: SizeM;
|
|
359
400
|
cornerRadiusM: number;
|
|
401
|
+
gate?: GateDetails;
|
|
360
402
|
} | {
|
|
361
403
|
kind: DecorationKind.Circle;
|
|
362
404
|
radiusM: number;
|
|
363
405
|
} | {
|
|
364
406
|
kind: DecorationKind.Line;
|
|
365
407
|
pointsM: PointM[];
|
|
408
|
+
route?: RouteDetails;
|
|
409
|
+
lineCap?: LineCap;
|
|
410
|
+
lineJoin?: LineJoin;
|
|
411
|
+
startEnding?: LineEnding;
|
|
412
|
+
endEnding?: LineEnding;
|
|
366
413
|
} | {
|
|
367
414
|
kind: DecorationKind.Polygon;
|
|
368
415
|
boundary: PolygonM;
|
|
416
|
+
gate?: GateDetails;
|
|
369
417
|
} | {
|
|
370
418
|
kind: DecorationKind.Icon;
|
|
371
419
|
iconId: VenueGlyph;
|
|
@@ -376,6 +424,8 @@ export type Decoration = DrawableBase & ({
|
|
|
376
424
|
sizeM: SizeM;
|
|
377
425
|
opacity: number;
|
|
378
426
|
}) & {
|
|
427
|
+
label?: string;
|
|
428
|
+
heightM?: number;
|
|
379
429
|
style?: DecorationStyle;
|
|
380
430
|
};
|
|
381
431
|
export type SectionLabelPlacement = {
|
|
@@ -387,7 +437,48 @@ export declare enum SectionOutlineRole {
|
|
|
387
437
|
Boundary = "boundary",
|
|
388
438
|
Overview = "overview"
|
|
389
439
|
}
|
|
440
|
+
export declare const RowRefitStrength: {
|
|
441
|
+
readonly min: 0;
|
|
442
|
+
readonly max: 100;
|
|
443
|
+
};
|
|
444
|
+
export declare const SectionRotation: {
|
|
445
|
+
readonly min: -180;
|
|
446
|
+
readonly max: 180;
|
|
447
|
+
readonly initial: 0;
|
|
448
|
+
};
|
|
449
|
+
export declare const SectionScale: {
|
|
450
|
+
readonly min: 50;
|
|
451
|
+
readonly max: 160;
|
|
452
|
+
readonly initial: 100;
|
|
453
|
+
};
|
|
454
|
+
export declare enum SectionTier {
|
|
455
|
+
Floor = "floor",
|
|
456
|
+
RaisedOne = "raised-one",
|
|
457
|
+
RaisedTwo = "raised-two",
|
|
458
|
+
RaisedThree = "raised-three"
|
|
459
|
+
}
|
|
460
|
+
export declare const SectionRake: {
|
|
461
|
+
readonly min: 0;
|
|
462
|
+
readonly max: 45;
|
|
463
|
+
readonly step: 1;
|
|
464
|
+
};
|
|
465
|
+
export declare const SectionFrontRowHeight: {
|
|
466
|
+
readonly min: 0;
|
|
467
|
+
readonly max: 120;
|
|
468
|
+
readonly step: 0.5;
|
|
469
|
+
};
|
|
470
|
+
export type SectionElevation = {
|
|
471
|
+
tier?: SectionTier;
|
|
472
|
+
rakeDeg?: number;
|
|
473
|
+
/** Authored height above the owning floor. Omission uses the chosen tier. */
|
|
474
|
+
frontRowHeightM?: number;
|
|
475
|
+
};
|
|
390
476
|
export type Section = {
|
|
477
|
+
entrance?: EntranceAssignment;
|
|
478
|
+
buyerPhoto?: BuyerPhoto;
|
|
479
|
+
floorId?: UUID;
|
|
480
|
+
zoneId?: UUID;
|
|
481
|
+
elevation?: SectionElevation;
|
|
391
482
|
/** Default for inventory subsequently drawn inside this section. */
|
|
392
483
|
categoryId?: UUID | null;
|
|
393
484
|
id: UUID;
|
|
@@ -395,6 +486,13 @@ export type Section = {
|
|
|
395
486
|
displayLabel?: string;
|
|
396
487
|
outline?: PolygonM;
|
|
397
488
|
outlineRole?: SectionOutlineRole;
|
|
489
|
+
/** Last numeric rotation control value. Canvas rotation is independent. */
|
|
490
|
+
rotationDeg?: number;
|
|
491
|
+
scalePercent?: number;
|
|
492
|
+
/** Uniform Grow factor that preserves the authored outline subdivision. */
|
|
493
|
+
outlineGrowthFactor?: number;
|
|
494
|
+
/** Percentage used by the last accepted section row refit. */
|
|
495
|
+
rowRefitStrength?: number;
|
|
398
496
|
style?: DecorationStyle;
|
|
399
497
|
labelPlacement?: SectionLabelPlacement;
|
|
400
498
|
labelStyle: LabelStyle;
|
|
@@ -406,7 +504,20 @@ export type AssetRef = {
|
|
|
406
504
|
id: UUID;
|
|
407
505
|
mimeType: "image/png" | "image/jpeg" | "image/webp" | "image/svg+xml";
|
|
408
506
|
};
|
|
507
|
+
export type VenueFloor = {
|
|
508
|
+
id: UUID;
|
|
509
|
+
name: string;
|
|
510
|
+
baseHeightM: number;
|
|
511
|
+
focalPoint?: PointM;
|
|
512
|
+
};
|
|
513
|
+
export type VenueZone = {
|
|
514
|
+
id: UUID;
|
|
515
|
+
name: string;
|
|
516
|
+
color: string;
|
|
517
|
+
focalPoint?: PointM;
|
|
518
|
+
};
|
|
409
519
|
export type PhysicalDocumentV1 = {
|
|
520
|
+
buyerPhoto?: BuyerPhoto;
|
|
410
521
|
schemaVersion: 1;
|
|
411
522
|
mapId: UUID;
|
|
412
523
|
name: string;
|
|
@@ -418,6 +529,8 @@ export type PhysicalDocumentV1 = {
|
|
|
418
529
|
};
|
|
419
530
|
background: Paint;
|
|
420
531
|
categories?: MapCategory[];
|
|
532
|
+
floors?: VenueFloor[];
|
|
533
|
+
zones?: VenueZone[];
|
|
421
534
|
sections: Section[];
|
|
422
535
|
collections: Collection[];
|
|
423
536
|
seatingGroups: SeatingGroup[];
|