@seatmap-fyi/map-domain 0.1.0-alpha.2 → 0.1.0-alpha.29
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/catalog.d.ts +10 -3
- package/dist/catalog.js +66 -10
- package/dist/categories.d.ts +26 -0
- package/dist/categories.js +168 -0
- package/dist/editor-state.d.ts +49 -0
- package/dist/editor-state.js +266 -0
- package/dist/floors.d.ts +19 -0
- package/dist/floors.js +68 -0
- package/dist/geometry/boundary.d.ts +1 -1
- package/dist/geometry/boundary.js +10 -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 +12 -3
- package/dist/geometry/geometry.js +35 -26
- package/dist/geometry/polygon-curves.d.ts +12 -0
- package/dist/geometry/polygon-curves.js +132 -0
- package/dist/geometry/primitives.d.ts +1 -1
- package/dist/geometry/primitives.js +2 -3
- package/dist/geometry/seat-shape.d.ts +24 -0
- package/dist/geometry/seat-shape.js +101 -0
- package/dist/geometry/seating-layout.d.ts +14 -3
- package/dist/geometry/seating-layout.js +91 -19
- package/dist/geometry/units.d.ts +1 -0
- package/dist/geometry/units.js +2 -0
- package/dist/geometry/venue-outline.d.ts +2 -2
- package/dist/geometry/venue-outline.js +8 -21
- package/dist/identity.d.ts +4 -1
- package/dist/identity.js +36 -10
- package/dist/issues.d.ts +9 -2
- package/dist/issues.js +8 -6
- package/dist/labels.d.ts +12 -1
- package/dist/labels.js +76 -11
- 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/physical-document.interface.d.ts +518 -0
- package/dist/{types.js → physical-document.interface.js} +71 -0
- package/dist/preview.d.ts +1 -1
- package/dist/preview.js +65 -24
- package/dist/reference.js +1 -1
- package/dist/row-segments.d.ts +30 -0
- package/dist/row-segments.js +112 -0
- package/dist/schema.d.ts +1192 -68
- package/dist/schema.js +372 -96
- package/dist/seat-proximity.d.ts +4 -0
- package/dist/seat-proximity.js +119 -0
- package/dist/sections.d.ts +23 -0
- package/dist/sections.js +149 -0
- package/dist/selling.d.ts +34 -0
- package/dist/selling.js +148 -0
- package/dist/spacing-repairs.d.ts +31 -0
- package/dist/spacing-repairs.js +168 -0
- package/dist/table-layout.d.ts +29 -0
- package/dist/table-layout.js +134 -0
- package/dist/validation.d.ts +3 -1
- package/dist/validation.js +124 -74
- package/package.json +59 -3
- package/dist/types.d.ts +0 -313
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { SeatShape } from "../physical-document.interface.js";
|
|
2
|
+
export var SeatShapePartKind;
|
|
3
|
+
(function (SeatShapePartKind) {
|
|
4
|
+
SeatShapePartKind["Rectangle"] = "rectangle";
|
|
5
|
+
SeatShapePartKind["Polygon"] = "polygon";
|
|
6
|
+
})(SeatShapePartKind || (SeatShapePartKind = {}));
|
|
7
|
+
const rectangle = (x, y, width, height, radius = 0) => ({
|
|
8
|
+
kind: SeatShapePartKind.Rectangle,
|
|
9
|
+
x,
|
|
10
|
+
y,
|
|
11
|
+
width,
|
|
12
|
+
height,
|
|
13
|
+
radius,
|
|
14
|
+
});
|
|
15
|
+
const polygon = (...points) => ({
|
|
16
|
+
kind: SeatShapePartKind.Polygon,
|
|
17
|
+
points,
|
|
18
|
+
});
|
|
19
|
+
// Normalized to the existing physical seat footprint. Category appearance never
|
|
20
|
+
// changes positions, pitch, inventory identity or the personal geometry recipe.
|
|
21
|
+
const furniture = {
|
|
22
|
+
[SeatShape.Theatre]: [
|
|
23
|
+
rectangle(-0.3, -0.42, 0.6, 0.52, 0.06),
|
|
24
|
+
rectangle(-0.42, 0, 0.84, 0.22, 0.06),
|
|
25
|
+
rectangle(-0.42, 0.12, 0.12, 0.3, 0.04),
|
|
26
|
+
rectangle(0.3, 0.12, 0.12, 0.3, 0.04),
|
|
27
|
+
],
|
|
28
|
+
[SeatShape.Dining]: [
|
|
29
|
+
polygon(-0.23, -0.42, 0.23, -0.42, 0.19, -0.055, -0.19, -0.055),
|
|
30
|
+
rectangle(-0.315, -0.055, 0.63, 0.18, 0.025),
|
|
31
|
+
polygon(-0.19, 0.08, -0.08, 0.08, -0.19, 0.42, -0.3, 0.42),
|
|
32
|
+
polygon(0.08, 0.08, 0.19, 0.08, 0.3, 0.42, 0.19, 0.42),
|
|
33
|
+
],
|
|
34
|
+
[SeatShape.Folding]: [
|
|
35
|
+
polygon(-0.3, -0.42, 0.3, -0.42, 0.25, -0.2, -0.25, -0.2),
|
|
36
|
+
polygon(-0.315, -0.14, 0.315, -0.14, 0.26, 0.02, -0.26, 0.02),
|
|
37
|
+
polygon(-0.2, 0.0, -0.1, -0.02, 0.2, 0.42, 0.08, 0.42),
|
|
38
|
+
polygon(0.1, -0.02, 0.2, 0.0, -0.08, 0.42, -0.2, 0.42),
|
|
39
|
+
],
|
|
40
|
+
[SeatShape.Armchair]: [
|
|
41
|
+
rectangle(-0.34, -0.4, 0.68, 0.46, 0.08),
|
|
42
|
+
rectangle(-0.42, -0.08, 0.14, 0.42, 0.07),
|
|
43
|
+
rectangle(0.28, -0.08, 0.14, 0.42, 0.07),
|
|
44
|
+
rectangle(-0.42, 0.08, 0.84, 0.34, 0.07),
|
|
45
|
+
],
|
|
46
|
+
[SeatShape.Recliner]: [
|
|
47
|
+
polygon(-0.18, -0.42, 0.18, -0.42, 0.26, 0.1, -0.26, 0.1),
|
|
48
|
+
rectangle(-0.39, -0.12, 0.15, 0.36, 0.07),
|
|
49
|
+
rectangle(0.24, -0.12, 0.15, 0.36, 0.07),
|
|
50
|
+
rectangle(-0.26, 0.04, 0.52, 0.1, 0.02),
|
|
51
|
+
polygon(-0.21, 0.22, 0.21, 0.22, 0.3, 0.42, -0.3, 0.42),
|
|
52
|
+
],
|
|
53
|
+
[SeatShape.Stool]: [
|
|
54
|
+
rectangle(-0.42, -0.42, 0.84, 0.57, 0.1),
|
|
55
|
+
polygon(-0.18, 0.1, -0.04, 0.1, -0.2, 0.42, -0.36, 0.42),
|
|
56
|
+
polygon(0.04, 0.1, 0.18, 0.1, 0.36, 0.42, 0.2, 0.42),
|
|
57
|
+
],
|
|
58
|
+
[SeatShape.Bench]: [
|
|
59
|
+
rectangle(-0.42, -0.4, 0.84, 0.21, 0.035),
|
|
60
|
+
rectangle(-0.42, -0.12, 0.84, 0.35, 0.025),
|
|
61
|
+
rectangle(-0.23, 0.17, 0.09, 0.25, 0.015),
|
|
62
|
+
rectangle(0.14, 0.17, 0.09, 0.25, 0.015),
|
|
63
|
+
],
|
|
64
|
+
};
|
|
65
|
+
export function seatShapeParts(shape) {
|
|
66
|
+
return shape === SeatShape.Circle ? [] : furniture[shape];
|
|
67
|
+
}
|
|
68
|
+
const contours = new WeakMap();
|
|
69
|
+
/**
|
|
70
|
+
* @method seatShapeContour
|
|
71
|
+
* @description Reuses bounded normalized contours so small furniture corners stay smooth after scaling.
|
|
72
|
+
* @param {SeatShapePart} part Shared normalized furniture primitive.
|
|
73
|
+
* @returns {readonly number[]} Cached polygon coordinates for the primitive.
|
|
74
|
+
*/
|
|
75
|
+
export function seatShapeContour(part) {
|
|
76
|
+
if (part.kind === SeatShapePartKind.Polygon) {
|
|
77
|
+
return part.points;
|
|
78
|
+
}
|
|
79
|
+
const cached = contours.get(part);
|
|
80
|
+
if (cached) {
|
|
81
|
+
return cached;
|
|
82
|
+
}
|
|
83
|
+
const { x, y, width, height } = part;
|
|
84
|
+
const radius = Math.min(part.radius, width / 2, height / 2);
|
|
85
|
+
const points = [];
|
|
86
|
+
const centers = [
|
|
87
|
+
[x + width - radius, y + radius],
|
|
88
|
+
[x + width - radius, y + height - radius],
|
|
89
|
+
[x + radius, y + height - radius],
|
|
90
|
+
[x + radius, y + radius],
|
|
91
|
+
];
|
|
92
|
+
for (let corner = 0; corner < 4; corner++) {
|
|
93
|
+
const center = centers[corner];
|
|
94
|
+
for (let step = 0; step <= 8; step++) {
|
|
95
|
+
const angle = ((corner - 1) * Math.PI) / 2 + (step * Math.PI) / 16;
|
|
96
|
+
points.push(center[0] + radius * Math.cos(angle), center[1] + radius * Math.sin(angle));
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
contours.set(part, points);
|
|
100
|
+
return points;
|
|
101
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SeatingKind, type StraightRows, type CurvedRows, type RoundTable, type RectangularTable, type PointM } from "../
|
|
1
|
+
import { SeatingKind, type StraightRows, type CurvedRows, type RoundTable, type RectangularTable, type PointM, type RowLayout, type LabelSequence } from "../physical-document.interface.js";
|
|
2
2
|
export type RowsGeometry = Pick<StraightRows, "kind" | "recipe"> | Pick<CurvedRows, "kind" | "recipe">;
|
|
3
3
|
export declare enum TableSide {
|
|
4
4
|
Top = "top",
|
|
@@ -10,13 +10,18 @@ export type SeatGeometry = {
|
|
|
10
10
|
position: PointM;
|
|
11
11
|
rotationDeg: number;
|
|
12
12
|
};
|
|
13
|
-
export declare function rowSeatGeometry(group: RowsGeometry, row: number, seat: number, count: number, longestRow?: number): SeatGeometry;
|
|
13
|
+
export declare function rowSeatGeometry(group: RowsGeometry, row: number, seat: number, count: number, longestRow?: number, layout?: RowLayout): SeatGeometry;
|
|
14
|
+
/** Inspector curve changes preserve chair-facing rotation; negative curves reverse the path. */
|
|
15
|
+
export declare function setRowLayoutCurve(layout: RowLayout, curveDeg: number): RowLayout;
|
|
16
|
+
/** Resolves inherited geometry once when a row becomes independently editable. */
|
|
17
|
+
export declare function resolveRowLayout(group: StraightRows | CurvedRows, rowIndex: number): RowLayout | null;
|
|
14
18
|
export declare function roundChairGeometry(recipe: RoundTable["recipe"], chairHeightM: number, seat: number, count: number): SeatGeometry;
|
|
15
19
|
export declare function rectangularChairGeometry(recipe: RectangularTable["recipe"], chairHeightM: number, side: TableSide, seat: number, count: number): SeatGeometry;
|
|
16
20
|
export type SeatingPreview = (RowsGeometry & {
|
|
17
21
|
rows: number;
|
|
18
22
|
seatsPerRow: number;
|
|
19
23
|
rowCounts?: readonly number[];
|
|
24
|
+
rowLayouts?: readonly (RowLayout | undefined)[];
|
|
20
25
|
seatSizeM: number;
|
|
21
26
|
}) | {
|
|
22
27
|
kind: SeatingKind.Round;
|
|
@@ -30,7 +35,13 @@ export type SeatingPreview = (RowsGeometry & {
|
|
|
30
35
|
seatSizeM: number;
|
|
31
36
|
};
|
|
32
37
|
export type PreviewNumbering = {
|
|
33
|
-
|
|
38
|
+
rowSequence: LabelSequence;
|
|
39
|
+
logicalRow?: {
|
|
40
|
+
label: string;
|
|
41
|
+
sequence: LabelSequence;
|
|
42
|
+
offset: number;
|
|
43
|
+
total: number;
|
|
44
|
+
};
|
|
34
45
|
tableLabel: string;
|
|
35
46
|
seatFontSizeM: number;
|
|
36
47
|
rowFontSizeM: number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CurveMode, RowAlignment, SeatingKind, } from "../
|
|
1
|
+
import { CurveMode, TableChairDistribution, RowAlignment, SeatingKind, } from "../physical-document.interface.js";
|
|
2
2
|
import { ellipseAngleAtDistance } from "./ellipse.js";
|
|
3
3
|
export var TableSide;
|
|
4
4
|
(function (TableSide) {
|
|
@@ -7,7 +7,26 @@ export var TableSide;
|
|
|
7
7
|
TableSide["Bottom"] = "bottom";
|
|
8
8
|
TableSide["Left"] = "left";
|
|
9
9
|
})(TableSide || (TableSide = {}));
|
|
10
|
-
export function rowSeatGeometry(group, row, seat, count, longestRow = count) {
|
|
10
|
+
export function rowSeatGeometry(group, row, seat, count, longestRow = count, layout) {
|
|
11
|
+
if (layout) {
|
|
12
|
+
const sweep = (layout.curveDeg * Math.PI) / 180;
|
|
13
|
+
const fraction = count > 1 ? seat / (count - 1) : 0;
|
|
14
|
+
const angle = sweep * fraction;
|
|
15
|
+
const distance = seat * layout.seatPitchM;
|
|
16
|
+
// Stable straight-line limit avoids division by zero and cancellation near zero.
|
|
17
|
+
const sinc = Math.abs(angle) < 1e-6 ? 1 - (angle * angle) / 6 : Math.sin(angle) / angle;
|
|
18
|
+
const cosc = Math.abs(angle) < 1e-6 ? angle / 2 - (angle * angle * angle) / 24 : (1 - Math.cos(angle)) / angle;
|
|
19
|
+
const x = distance * sinc;
|
|
20
|
+
const y = -distance * cosc;
|
|
21
|
+
const rotation = (layout.rotationDeg * Math.PI) / 180;
|
|
22
|
+
return {
|
|
23
|
+
position: {
|
|
24
|
+
x: layout.originM.x + x * Math.cos(rotation) - y * Math.sin(rotation),
|
|
25
|
+
y: layout.originM.y + x * Math.sin(rotation) + y * Math.cos(rotation),
|
|
26
|
+
},
|
|
27
|
+
rotationDeg: layout.rotationDeg - (angle * 180) / Math.PI + (layout.seatRotationOffsetDeg ?? 0),
|
|
28
|
+
};
|
|
29
|
+
}
|
|
11
30
|
if (group.kind === SeatingKind.Straight)
|
|
12
31
|
return {
|
|
13
32
|
position: {
|
|
@@ -24,30 +43,75 @@ export function rowSeatGeometry(group, row, seat, count, longestRow = count) {
|
|
|
24
43
|
rotationDeg: 0,
|
|
25
44
|
};
|
|
26
45
|
const radius = group.recipe.innerRadiusM + row * group.recipe.rowPitchM;
|
|
27
|
-
const horizontal = group.recipe.innerRadiusM * (group.recipe.axisRatio ?? 1) +
|
|
28
|
-
row * group.recipe.rowPitchM;
|
|
46
|
+
const horizontal = group.recipe.innerRadiusM * (group.recipe.axisRatio ?? 1) + row * group.recipe.rowPitchM;
|
|
29
47
|
const p = group.recipe.placement;
|
|
30
48
|
const angle = p.kind === CurveMode.Pitch
|
|
31
49
|
? ellipseAngleAtDistance(horizontal, radius, (p.centerAngleDeg * Math.PI) / 180, (seat - (count - 1) / 2) * p.seatPitchM)
|
|
32
50
|
: ((p.startAngleDeg +
|
|
33
51
|
(count === 1
|
|
34
52
|
? p.sweepAngleDeg / 2
|
|
35
|
-
: (p.sweepAngleDeg * seat) /
|
|
36
|
-
(Math.abs(p.sweepAngleDeg) === 360 ? count : count - 1))) *
|
|
53
|
+
: (p.sweepAngleDeg * seat) / (Math.abs(p.sweepAngleDeg) === 360 ? count : count - 1))) *
|
|
37
54
|
Math.PI) /
|
|
38
55
|
180;
|
|
39
56
|
return {
|
|
40
57
|
position: { x: horizontal * Math.cos(angle), y: radius * Math.sin(angle) },
|
|
41
58
|
rotationDeg: horizontal === radius
|
|
42
59
|
? (angle * 180) / Math.PI + 90
|
|
43
|
-
: (Math.atan2(radius * Math.cos(angle), -horizontal * Math.sin(angle)) *
|
|
44
|
-
|
|
45
|
-
|
|
60
|
+
: (Math.atan2(radius * Math.cos(angle), -horizontal * Math.sin(angle)) * 180) / Math.PI,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
/** Inspector curve changes preserve chair-facing rotation; negative curves reverse the path. */
|
|
64
|
+
export function setRowLayoutCurve(layout, curveDeg) {
|
|
65
|
+
const rotation = layout.rotationDeg + (layout.seatRotationOffsetDeg ?? 0) + (curveDeg < 0 ? 180 : 0);
|
|
66
|
+
return {
|
|
67
|
+
...layout,
|
|
68
|
+
curveDeg,
|
|
69
|
+
rotationDeg: ((((rotation + 180) % 360) + 360) % 360) - 180,
|
|
70
|
+
seatRotationOffsetDeg: curveDeg < 0 ? -180 : 0,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
/** Resolves inherited geometry once when a row becomes independently editable. */
|
|
74
|
+
export function resolveRowLayout(group, rowIndex) {
|
|
75
|
+
const row = group.rows[rowIndex];
|
|
76
|
+
if (row.layout)
|
|
77
|
+
return row.layout;
|
|
78
|
+
if (group.kind === SeatingKind.Curved && (group.recipe.axisRatio ?? 1) !== 1)
|
|
79
|
+
return null;
|
|
80
|
+
const longest = group.rows.reduce((max, item) => Math.max(max, item.seats.length), 0);
|
|
81
|
+
const first = rowSeatGeometry(group, rowIndex, 0, row.seats.length, longest);
|
|
82
|
+
if (group.kind === SeatingKind.Straight)
|
|
83
|
+
return {
|
|
84
|
+
originM: first.position,
|
|
85
|
+
seatPitchM: group.recipe.seatPitchM,
|
|
86
|
+
curveDeg: 0,
|
|
87
|
+
rotationDeg: ((((first.rotationDeg + 180) % 360) + 360) % 360) - 180,
|
|
88
|
+
};
|
|
89
|
+
const radius = group.recipe.innerRadiusM + rowIndex * group.recipe.rowPitchM;
|
|
90
|
+
const placement = group.recipe.placement;
|
|
91
|
+
const intervals = Math.max(0, row.seats.length - 1);
|
|
92
|
+
let sweep;
|
|
93
|
+
let pitch;
|
|
94
|
+
if (placement.kind === CurveMode.Pitch) {
|
|
95
|
+
pitch = placement.seatPitchM;
|
|
96
|
+
sweep = (((intervals * pitch) / radius) * 180) / Math.PI;
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
sweep = placement.sweepAngleDeg * (Math.abs(placement.sweepAngleDeg) === 360 ? intervals / row.seats.length : 1);
|
|
100
|
+
pitch = intervals ? (((Math.abs(sweep) * Math.PI) / 180) * radius) / intervals : 0.55;
|
|
101
|
+
}
|
|
102
|
+
const tangent = first.rotationDeg + (sweep < 0 ? 180 : 0);
|
|
103
|
+
return {
|
|
104
|
+
originM: first.position,
|
|
105
|
+
seatPitchM: pitch,
|
|
106
|
+
curveDeg: -sweep,
|
|
107
|
+
rotationDeg: ((((tangent + 180) % 360) + 360) % 360) - 180,
|
|
108
|
+
...(sweep < 0 ? { seatRotationOffsetDeg: -180 } : {}),
|
|
46
109
|
};
|
|
47
110
|
}
|
|
48
111
|
export function roundChairGeometry(recipe, chairHeightM, seat, count) {
|
|
49
112
|
const radius = recipe.diameterM / 2 + recipe.chairGapM + chairHeightM / 2;
|
|
50
|
-
const
|
|
113
|
+
const arc = recipe.seatArcDeg ?? 360;
|
|
114
|
+
const angle = recipe.startAngleDeg + (count === 1 ? 0 : (360 - arc) / 2 + (arc * seat) / (arc === 360 ? count : count - 1));
|
|
51
115
|
return {
|
|
52
116
|
position: {
|
|
53
117
|
x: radius * Math.cos((angle * Math.PI) / 180),
|
|
@@ -59,9 +123,11 @@ export function roundChairGeometry(recipe, chairHeightM, seat, count) {
|
|
|
59
123
|
export function rectangularChairGeometry(recipe, chairHeightM, side, seat, count) {
|
|
60
124
|
const horizontal = side === TableSide.Top || side === TableSide.Bottom;
|
|
61
125
|
const length = horizontal ? recipe.widthM : recipe.depthM;
|
|
62
|
-
const along = recipe.
|
|
63
|
-
? -length / 2 + ((seat +
|
|
64
|
-
:
|
|
126
|
+
const along = recipe.chairDistribution === TableChairDistribution.EqualSegments
|
|
127
|
+
? -length / 2 + ((seat + 0.5) * length) / count
|
|
128
|
+
: recipe.chairPitchM === undefined
|
|
129
|
+
? -length / 2 + ((seat + 1) * length) / (count + 1)
|
|
130
|
+
: (seat - (count - 1) / 2) * recipe.chairPitchM;
|
|
65
131
|
const gap = recipe.chairGapM + chairHeightM / 2;
|
|
66
132
|
switch (side) {
|
|
67
133
|
case TableSide.Top:
|
|
@@ -76,12 +142,18 @@ export function rectangularChairGeometry(recipe, chairHeightM, side, seat, count
|
|
|
76
142
|
};
|
|
77
143
|
case TableSide.Bottom:
|
|
78
144
|
return {
|
|
79
|
-
position: {
|
|
145
|
+
position: {
|
|
146
|
+
x: recipe.chairDistribution === TableChairDistribution.EqualSegments ? along : -along,
|
|
147
|
+
y: recipe.depthM / 2 + gap,
|
|
148
|
+
},
|
|
80
149
|
rotationDeg: -90,
|
|
81
150
|
};
|
|
82
151
|
case TableSide.Left:
|
|
83
152
|
return {
|
|
84
|
-
position: {
|
|
153
|
+
position: {
|
|
154
|
+
x: -recipe.widthM / 2 - gap,
|
|
155
|
+
y: recipe.chairDistribution === TableChairDistribution.EqualSegments ? along : -along,
|
|
156
|
+
},
|
|
85
157
|
rotationDeg: 0,
|
|
86
158
|
};
|
|
87
159
|
default: {
|
|
@@ -94,12 +166,11 @@ export function* previewSeats(layout) {
|
|
|
94
166
|
switch (layout.kind) {
|
|
95
167
|
case SeatingKind.Straight:
|
|
96
168
|
case SeatingKind.Curved: {
|
|
97
|
-
const longestRow = layout.rowCounts?.reduce((max, count) => Math.max(max, count), 0) ??
|
|
98
|
-
layout.seatsPerRow;
|
|
169
|
+
const longestRow = layout.rowCounts?.reduce((max, count) => Math.max(max, count), 0) ?? layout.seatsPerRow;
|
|
99
170
|
for (let row = 0; row < layout.rows; row++)
|
|
100
171
|
for (let seat = 0; seat < (layout.rowCounts?.[row] ?? layout.seatsPerRow); seat++)
|
|
101
172
|
yield {
|
|
102
|
-
position: rowSeatGeometry(layout, row, seat, layout.rowCounts?.[row] ?? layout.seatsPerRow, longestRow).position,
|
|
173
|
+
position: rowSeatGeometry(layout, row, seat, layout.rowCounts?.[row] ?? layout.seatsPerRow, longestRow, layout.rowLayouts?.[row]).position,
|
|
103
174
|
row,
|
|
104
175
|
ordinal: seat + 1,
|
|
105
176
|
};
|
|
@@ -118,7 +189,8 @@ export function* previewSeats(layout) {
|
|
|
118
189
|
for (const side of Object.values(TableSide))
|
|
119
190
|
for (let seat = 0; seat < layout.sides[side]; seat++)
|
|
120
191
|
yield {
|
|
121
|
-
position: rectangularChairGeometry(layout.recipe, layout.seatSizeM, side, seat, layout.sides[side])
|
|
192
|
+
position: rectangularChairGeometry(layout.recipe, layout.seatSizeM, side, seat, layout.sides[side])
|
|
193
|
+
.position,
|
|
122
194
|
row: null,
|
|
123
195
|
ordinal: ++ordinal,
|
|
124
196
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const LayoutUnitM: number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PointM, PolygonM } from "../
|
|
1
|
+
import type { PointM, PolygonM } from "../physical-document.interface.js";
|
|
2
2
|
export declare enum OutlineKind {
|
|
3
3
|
Rectangle = "rectangle",
|
|
4
4
|
Ellipse = "ellipse",
|
|
@@ -18,4 +18,4 @@ export declare function sampledOutline(p: OutlineParameters): PolygonM;
|
|
|
18
18
|
/** Conservative convex envelope, with no invented architectural voids. */
|
|
19
19
|
export declare function memberEnvelope(points: readonly PointM[], paddingM?: number): PolygonM;
|
|
20
20
|
/** Deterministic widest interior scan interval; holes participate in every scan. */
|
|
21
|
-
export declare function interiorLabelPoint(
|
|
21
|
+
export declare function interiorLabelPoint(source: PolygonM): PointM;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { polygonContour } from "./polygon-curves.js";
|
|
1
2
|
import { pointsBounds, containsPoint } from "./primitives.js";
|
|
2
3
|
import { ellipseSegments } from "./ellipse.js";
|
|
3
4
|
export var OutlineKind;
|
|
@@ -8,15 +9,7 @@ export var OutlineKind;
|
|
|
8
9
|
OutlineKind["Envelope"] = "envelope";
|
|
9
10
|
})(OutlineKind || (OutlineKind = {}));
|
|
10
11
|
export function sampledOutline(p) {
|
|
11
|
-
if (![
|
|
12
|
-
p.center.x,
|
|
13
|
-
p.center.y,
|
|
14
|
-
p.radiusX,
|
|
15
|
-
p.radiusY,
|
|
16
|
-
p.innerRatio,
|
|
17
|
-
p.startDeg,
|
|
18
|
-
p.sweepDeg,
|
|
19
|
-
].every(Number.isFinite) ||
|
|
12
|
+
if (![p.center.x, p.center.y, p.radiusX, p.radiusY, p.innerRatio, p.startDeg, p.sweepDeg].every(Number.isFinite) ||
|
|
20
13
|
p.radiusX <= 0 ||
|
|
21
14
|
p.radiusY <= 0 ||
|
|
22
15
|
p.innerRatio < 0 ||
|
|
@@ -38,9 +31,7 @@ export function sampledOutline(p) {
|
|
|
38
31
|
],
|
|
39
32
|
holes: [],
|
|
40
33
|
};
|
|
41
|
-
const sweep = p.kind === OutlineKind.Ellipse
|
|
42
|
-
? Math.PI * 2
|
|
43
|
-
: (p.sweepDeg * Math.PI) / 180, start = (p.startDeg * Math.PI) / 180, full = Math.abs(sweep) === Math.PI * 2;
|
|
34
|
+
const sweep = p.kind === OutlineKind.Ellipse ? Math.PI * 2 : (p.sweepDeg * Math.PI) / 180, start = (p.startDeg * Math.PI) / 180, full = Math.abs(sweep) === Math.PI * 2;
|
|
44
35
|
const count = ellipseSegments(p.radiusX, p.radiusY, sweep);
|
|
45
36
|
const arc = (ratio) => Array.from({ length: count + (full ? 0 : 1) }, (_, i) => point(start + (sweep * i) / count, ratio));
|
|
46
37
|
const outer = arc(1);
|
|
@@ -49,10 +40,7 @@ export function sampledOutline(p) {
|
|
|
49
40
|
outer,
|
|
50
41
|
holes: p.innerRatio > 0 ? [arc(p.innerRatio).reverse()] : [],
|
|
51
42
|
};
|
|
52
|
-
const ring = [
|
|
53
|
-
...outer,
|
|
54
|
-
...(p.innerRatio > 0 ? arc(p.innerRatio).reverse() : [p.center]),
|
|
55
|
-
];
|
|
43
|
+
const ring = [...outer, ...(p.innerRatio > 0 ? arc(p.innerRatio).reverse() : [p.center])];
|
|
56
44
|
if (ring.length > 10000)
|
|
57
45
|
throw new Error("The sector exceeds the 10,000-vertex limit at 1mm accuracy.");
|
|
58
46
|
return { outer: ring, holes: [] };
|
|
@@ -73,8 +61,7 @@ export function memberEnvelope(points, paddingM = 0.15) {
|
|
|
73
61
|
const half = (input) => {
|
|
74
62
|
const result = [];
|
|
75
63
|
for (const p of input) {
|
|
76
|
-
while (result.length > 1 &&
|
|
77
|
-
cross(result[result.length - 2], result[result.length - 1], p) <= 0)
|
|
64
|
+
while (result.length > 1 && cross(result[result.length - 2], result[result.length - 1], p) <= 0)
|
|
78
65
|
result.pop();
|
|
79
66
|
result.push(p);
|
|
80
67
|
}
|
|
@@ -89,9 +76,9 @@ export function memberEnvelope(points, paddingM = 0.15) {
|
|
|
89
76
|
return { outer, holes: [] };
|
|
90
77
|
}
|
|
91
78
|
/** Deterministic widest interior scan interval; holes participate in every scan. */
|
|
92
|
-
export function interiorLabelPoint(
|
|
93
|
-
const
|
|
94
|
-
|
|
79
|
+
export function interiorLabelPoint(source) {
|
|
80
|
+
const polygon = polygonContour(source);
|
|
81
|
+
const bounds = pointsBounds(polygon.outer), inside = (p) => containsPoint(polygon.outer, p) && !polygon.holes.some((h) => containsPoint(h, p));
|
|
95
82
|
const center = {
|
|
96
83
|
x: (bounds.minX + bounds.maxX) / 2,
|
|
97
84
|
y: (bounds.minY + bounds.maxY) / 2,
|
package/dist/identity.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import type { PhysicalDocumentV1 } from "./
|
|
1
|
+
import type { PhysicalDocumentV1 } from "./physical-document.interface.js";
|
|
2
|
+
/** Work reported by allocation, remapping and final document validation. Assets keep their IDs. */
|
|
3
|
+
export declare function remapDocumentWork(source: PhysicalDocumentV1): number;
|
|
2
4
|
export declare function remapDocumentSteps(source: PhysicalDocumentV1, name: string): Generator<number, {
|
|
3
5
|
document: PhysicalDocumentV1;
|
|
4
6
|
warnings: string[];
|
|
7
|
+
identities: ReadonlyMap<string, string>;
|
|
5
8
|
}>;
|
package/dist/identity.js
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { DocumentParseStatus, parsePhysicalDocument } from "./schema.js";
|
|
2
|
+
import { DocumentParseStatus, groupSeatCount, parsePhysicalDocument } from "./schema.js";
|
|
3
|
+
const identityFields = new Set([
|
|
4
|
+
"id",
|
|
5
|
+
"parentId",
|
|
6
|
+
"sectionId",
|
|
7
|
+
"companionForSeatId",
|
|
8
|
+
"assetId",
|
|
9
|
+
"categoryId",
|
|
10
|
+
"rowId",
|
|
11
|
+
"floorId",
|
|
12
|
+
"zoneId",
|
|
13
|
+
]);
|
|
14
|
+
const identityRecordSchema = z.record(z.string(), z.unknown());
|
|
15
|
+
/** Work reported by allocation, remapping and final document validation. Assets keep their IDs. */
|
|
16
|
+
export function remapDocumentWork(source) {
|
|
17
|
+
const identities = source.sections.length +
|
|
18
|
+
source.collections.length +
|
|
19
|
+
source.areas.length +
|
|
20
|
+
source.decorations.length +
|
|
21
|
+
(source.floors?.length ?? 0) +
|
|
22
|
+
(source.zones?.length ?? 0) +
|
|
23
|
+
(source.segmentedRows?.length ?? 0) +
|
|
24
|
+
(source.categories?.reduce((total, category) => total + 1 + (category.ticketOptions?.length ?? 0), 0) ?? 0) +
|
|
25
|
+
source.seatingGroups.reduce((total, group) => total + 1 + groupSeatCount(group) + ("rows" in group ? group.rows.length : 0), 0);
|
|
26
|
+
return identities * 2 + source.assets.length + 1;
|
|
27
|
+
}
|
|
3
28
|
export function* remapDocumentSteps(source, name) {
|
|
4
29
|
const ids = new Map(), warnings = [];
|
|
5
30
|
function* allocate(value) {
|
|
@@ -11,7 +36,7 @@ export function* remapDocumentSteps(source, name) {
|
|
|
11
36
|
yield* allocate(child);
|
|
12
37
|
return;
|
|
13
38
|
}
|
|
14
|
-
const record =
|
|
39
|
+
const record = identityRecordSchema.parse(value);
|
|
15
40
|
if (typeof record.id === "string")
|
|
16
41
|
ids.set(record.id, crypto.randomUUID());
|
|
17
42
|
yield typeof record.id === "string" ? 1 : 0;
|
|
@@ -29,13 +54,11 @@ export function* remapDocumentSteps(source, name) {
|
|
|
29
54
|
return result;
|
|
30
55
|
}
|
|
31
56
|
if (value && typeof value === "object") {
|
|
32
|
-
const record =
|
|
57
|
+
const record = identityRecordSchema.parse(value);
|
|
33
58
|
yield typeof record.id === "string" ? 1 : 0;
|
|
34
59
|
const result = {};
|
|
35
60
|
for (const [field, child] of Object.entries(record)) {
|
|
36
|
-
if (field === "companionForSeatId" &&
|
|
37
|
-
typeof child === "string" &&
|
|
38
|
-
!ids.has(child)) {
|
|
61
|
+
if (field === "companionForSeatId" && typeof child === "string" && !ids.has(child)) {
|
|
39
62
|
warnings.push("An external companion relationship was cleared.");
|
|
40
63
|
continue;
|
|
41
64
|
}
|
|
@@ -43,19 +66,22 @@ export function* remapDocumentSteps(source, name) {
|
|
|
43
66
|
}
|
|
44
67
|
return result;
|
|
45
68
|
}
|
|
46
|
-
if (typeof value === "string" &&
|
|
47
|
-
["id", "parentId", "sectionId", "companionForSeatId", "assetId"].includes(key))
|
|
69
|
+
if (typeof value === "string" && identityFields.has(key))
|
|
48
70
|
return ids.get(value) ?? value;
|
|
49
71
|
return value;
|
|
50
72
|
}
|
|
51
73
|
const remapped = yield* remap(source);
|
|
52
74
|
const parsed = parsePhysicalDocument({
|
|
53
|
-
...
|
|
75
|
+
...identityRecordSchema.parse(remapped),
|
|
54
76
|
mapId: crypto.randomUUID(),
|
|
55
77
|
name,
|
|
56
78
|
});
|
|
57
79
|
if (parsed.status !== DocumentParseStatus.Accepted)
|
|
58
80
|
throw new Error("Identity remapping produced invalid physical structure.");
|
|
59
81
|
yield 1;
|
|
60
|
-
return {
|
|
82
|
+
return {
|
|
83
|
+
document: parsed.document,
|
|
84
|
+
warnings: [...new Set(warnings)],
|
|
85
|
+
identities: ids,
|
|
86
|
+
};
|
|
61
87
|
}
|
package/dist/issues.d.ts
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
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
|
+
UnknownCategory = "UNKNOWN_CATEGORY",
|
|
13
|
+
MissingCategoryPrice = "MISSING_CATEGORY_PRICE",
|
|
9
14
|
UnsupportedVersion = "UNSUPPORTED_VERSION",
|
|
10
15
|
WorldBounds = "WORLD_BOUNDS",
|
|
11
16
|
DuplicateLabel = "DUPLICATE_LABEL",
|
|
@@ -15,7 +20,8 @@ export declare enum IssueCode {
|
|
|
15
20
|
InvalidLabel = "INVALID_LABEL",
|
|
16
21
|
MissingAsset = "MISSING_ASSET",
|
|
17
22
|
CurveOverrun = "CURVE_OVERRUN",
|
|
18
|
-
|
|
23
|
+
SeatOverlap = "SEAT_OVERLAP",
|
|
24
|
+
SeatCramped = "SEAT_CRAMPED",
|
|
19
25
|
OutsideBoundary = "OUTSIDE_BOUNDARY",
|
|
20
26
|
InvalidCommand = "INVALID_COMMAND"
|
|
21
27
|
}
|
|
@@ -36,6 +42,7 @@ export type DomainIssue = {
|
|
|
36
42
|
code: IssueCode;
|
|
37
43
|
severity: IssueSeverity;
|
|
38
44
|
message: string;
|
|
45
|
+
description?: string;
|
|
39
46
|
entityIds: UUID[];
|
|
40
47
|
fieldPath?: string;
|
|
41
48
|
relatedEntityIds?: UUID[];
|
package/dist/issues.js
CHANGED
|
@@ -4,8 +4,13 @@ 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["UnknownCategory"] = "UNKNOWN_CATEGORY";
|
|
13
|
+
IssueCode["MissingCategoryPrice"] = "MISSING_CATEGORY_PRICE";
|
|
9
14
|
IssueCode["UnsupportedVersion"] = "UNSUPPORTED_VERSION";
|
|
10
15
|
IssueCode["WorldBounds"] = "WORLD_BOUNDS";
|
|
11
16
|
IssueCode["DuplicateLabel"] = "DUPLICATE_LABEL";
|
|
@@ -15,7 +20,8 @@ export var IssueCode;
|
|
|
15
20
|
IssueCode["InvalidLabel"] = "INVALID_LABEL";
|
|
16
21
|
IssueCode["MissingAsset"] = "MISSING_ASSET";
|
|
17
22
|
IssueCode["CurveOverrun"] = "CURVE_OVERRUN";
|
|
18
|
-
IssueCode["
|
|
23
|
+
IssueCode["SeatOverlap"] = "SEAT_OVERLAP";
|
|
24
|
+
IssueCode["SeatCramped"] = "SEAT_CRAMPED";
|
|
19
25
|
IssueCode["OutsideBoundary"] = "OUTSIDE_BOUNDARY";
|
|
20
26
|
IssueCode["InvalidCommand"] = "INVALID_COMMAND";
|
|
21
27
|
})(IssueCode || (IssueCode = {}));
|
|
@@ -43,11 +49,7 @@ export function issue(code, message, entityIds, fieldPath) {
|
|
|
43
49
|
entityIds,
|
|
44
50
|
fieldPath,
|
|
45
51
|
remediation: [IssueRemediation.Edit, IssueRemediation.Remove],
|
|
46
|
-
blocks: [
|
|
47
|
-
BlockedAction.FinalizeAssignment,
|
|
48
|
-
BlockedAction.Publish,
|
|
49
|
-
BlockedAction.ReplaceBinding,
|
|
50
|
-
],
|
|
52
|
+
blocks: [BlockedAction.FinalizeAssignment, BlockedAction.Publish, BlockedAction.ReplaceBinding],
|
|
51
53
|
};
|
|
52
54
|
}
|
|
53
55
|
export function issueKey(value) {
|
package/dist/labels.d.ts
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
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;
|
|
8
|
+
/** Position in the buyer's sequence, independent of authored inventory identity. */
|
|
9
|
+
export declare function sequenceOrdinal(sequence: LabelSequence, index: number, count: number): number;
|
|
10
|
+
export declare function sequenceStep(sequence: LabelSequence): number;
|
|
11
|
+
/** Combined patterns own their order; the stored anchor remains available when switching back. */
|
|
12
|
+
export declare function sequenceOwnsOrder(scheme: string): boolean;
|
|
13
|
+
export declare function sequenceStart(sequence: LabelSequence, count: number): number;
|
|
3
14
|
export declare function sequenceLabel(sequence: LabelSequence, index: number, count: number): string;
|