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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/dist/arc-fan-rebuild.d.ts +13 -0
  2. package/dist/arc-fan-rebuild.js +163 -0
  3. package/dist/arc-fan.d.ts +27 -0
  4. package/dist/arc-fan.interface.d.ts +83 -0
  5. package/dist/arc-fan.interface.js +30 -0
  6. package/dist/arc-fan.js +182 -0
  7. package/dist/catalog.d.ts +10 -3
  8. package/dist/catalog.js +66 -10
  9. package/dist/categories.d.ts +27 -0
  10. package/dist/categories.js +217 -0
  11. package/dist/editor-state.d.ts +4 -1
  12. package/dist/editor-state.js +61 -31
  13. package/dist/floors.d.ts +22 -0
  14. package/dist/floors.js +77 -0
  15. package/dist/geometry/boundary.d.ts +1 -1
  16. package/dist/geometry/boundary.js +16 -12
  17. package/dist/geometry/curve-warnings.d.ts +1 -1
  18. package/dist/geometry/curve-warnings.js +3 -5
  19. package/dist/geometry/decoration-bounds.d.ts +4 -0
  20. package/dist/geometry/decoration-bounds.js +42 -0
  21. package/dist/geometry/ellipse.js +4 -12
  22. package/dist/geometry/geometry.d.ts +12 -3
  23. package/dist/geometry/geometry.js +37 -28
  24. package/dist/geometry/layout-transform.d.ts +10 -0
  25. package/dist/geometry/layout-transform.interface.d.ts +6 -0
  26. package/dist/geometry/layout-transform.interface.js +1 -0
  27. package/dist/geometry/layout-transform.js +206 -0
  28. package/dist/geometry/polygon-curves.d.ts +17 -0
  29. package/dist/geometry/polygon-curves.interface.d.ts +21 -0
  30. package/dist/geometry/polygon-curves.interface.js +5 -0
  31. package/dist/geometry/polygon-curves.js +169 -0
  32. package/dist/geometry/primitives.d.ts +1 -1
  33. package/dist/geometry/primitives.js +2 -3
  34. package/dist/geometry/seat-shape.d.ts +24 -0
  35. package/dist/geometry/seat-shape.js +101 -0
  36. package/dist/geometry/seating-layout.d.ts +20 -3
  37. package/dist/geometry/seating-layout.js +113 -19
  38. package/dist/geometry/units.d.ts +8 -0
  39. package/dist/geometry/units.js +13 -0
  40. package/dist/geometry/venue-outline.d.ts +4 -18
  41. package/dist/geometry/venue-outline.interface.d.ts +23 -0
  42. package/dist/geometry/venue-outline.interface.js +7 -0
  43. package/dist/geometry/venue-outline.js +107 -49
  44. package/dist/identity.d.ts +3 -1
  45. package/dist/identity.js +32 -9
  46. package/dist/issues.d.ts +15 -2
  47. package/dist/issues.js +16 -6
  48. package/dist/labels.d.ts +12 -1
  49. package/dist/labels.js +76 -11
  50. package/dist/layers.d.ts +26 -0
  51. package/dist/layers.js +86 -0
  52. package/dist/media.d.ts +27 -0
  53. package/dist/media.js +89 -0
  54. package/dist/physical-document.interface.d.ts +592 -0
  55. package/dist/physical-document.interface.js +179 -0
  56. package/dist/preview.d.ts +1 -1
  57. package/dist/preview.js +70 -25
  58. package/dist/reference.js +1 -1
  59. package/dist/row-segments.d.ts +30 -0
  60. package/dist/row-segments.js +113 -0
  61. package/dist/schema.d.ts +1578 -68
  62. package/dist/schema.js +467 -98
  63. package/dist/seat-proximity.d.ts +4 -0
  64. package/dist/seat-proximity.js +119 -0
  65. package/dist/section-elevation.d.ts +5 -0
  66. package/dist/section-elevation.interface.d.ts +26 -0
  67. package/dist/section-elevation.interface.js +8 -0
  68. package/dist/section-elevation.js +53 -0
  69. package/dist/section-fill-rebuild.d.ts +10 -0
  70. package/dist/section-fill-rebuild.js +64 -0
  71. package/dist/section-fill.d.ts +84 -0
  72. package/dist/section-fill.interface.d.ts +94 -0
  73. package/dist/section-fill.interface.js +22 -0
  74. package/dist/section-fill.js +306 -0
  75. package/dist/section-growth.d.ts +11 -0
  76. package/dist/section-growth.interface.d.ts +12 -0
  77. package/dist/section-growth.interface.js +1 -0
  78. package/dist/section-growth.js +198 -0
  79. package/dist/section-layout.d.ts +95 -0
  80. package/dist/section-layout.interface.d.ts +8 -0
  81. package/dist/section-layout.interface.js +5 -0
  82. package/dist/section-layout.js +70 -0
  83. package/dist/section-outline-refit.d.ts +8 -0
  84. package/dist/section-outline-refit.js +246 -0
  85. package/dist/section-refit.d.ts +22 -0
  86. package/dist/section-refit.interface.d.ts +49 -0
  87. package/dist/section-refit.interface.js +6 -0
  88. package/dist/section-refit.js +179 -0
  89. package/dist/section-scale.d.ts +2 -0
  90. package/dist/section-scale.js +128 -0
  91. package/dist/sections.d.ts +23 -0
  92. package/dist/sections.js +144 -0
  93. package/dist/selling.d.ts +34 -0
  94. package/dist/selling.js +148 -0
  95. package/dist/spacing-repairs.d.ts +31 -0
  96. package/dist/spacing-repairs.js +168 -0
  97. package/dist/table-layout.d.ts +29 -0
  98. package/dist/table-layout.js +134 -0
  99. package/dist/validation.d.ts +7 -2
  100. package/dist/validation.interface.d.ts +20 -0
  101. package/dist/validation.interface.js +9 -0
  102. package/dist/validation.js +227 -78
  103. package/dist/wayfinding.d.ts +10 -0
  104. package/dist/wayfinding.interface.d.ts +52 -0
  105. package/dist/wayfinding.interface.js +28 -0
  106. package/dist/wayfinding.js +63 -0
  107. package/package.json +109 -4
  108. package/dist/types.d.ts +0 -313
  109. package/dist/types.js +0 -91
@@ -0,0 +1,29 @@
1
+ import { SeatingKind, type RoundTable, type RectangularTable, type LongTableLayout, type RoundTableRecipe } from "./physical-document.interface.js";
2
+ import type { TableInventory } from "./selling.js";
3
+ export declare const TableLayoutDefaults: {
4
+ readonly chairSizeM: number;
5
+ readonly chairGapM: number;
6
+ };
7
+ export declare const TableLayoutLimits: {
8
+ readonly chairs: 40;
9
+ readonly arcMin: 120;
10
+ readonly arcMax: 360;
11
+ readonly radiusMinM: 0.6;
12
+ readonly radiusMaxM: 3.7;
13
+ readonly widthMinM: 0.9;
14
+ readonly widthMaxM: 7.3;
15
+ readonly heightMinM: 0.7;
16
+ readonly heightMaxM: 5.5;
17
+ };
18
+ export declare const TableChairSides: readonly ["top", "bottom", "left", "right"];
19
+ export declare function defaultRoundTableRecipe(): RoundTableRecipe;
20
+ export declare function defaultLongTableLayout(): LongTableLayout;
21
+ /** Shared by committed count reconciliation and placement previews. */
22
+ export declare function automaticTableRadiusM(count: number, arcDeg: number): number;
23
+ export declare function resizeRoundTable(table: RoundTable): RoundTable;
24
+ export declare function setRoundTableAutomaticSize(table: RoundTable, automaticSize: boolean): RoundTable;
25
+ export declare function setRoundTableArc(table: RoundTable, requested: number): RoundTable;
26
+ export declare function setRoundTableRadius(table: RoundTable, requested: number): RoundTable;
27
+ export declare function setLongTableDimensions(table: RectangularTable, widthM: number, depthM: number): RectangularTable;
28
+ /** Shape changes retain inventory identity, personal overrides and the inactive shape settings. */
29
+ export declare function changeTableShape(table: TableInventory, kind: SeatingKind.Round | SeatingKind.Rectangular): TableInventory;
@@ -0,0 +1,134 @@
1
+ import { LayoutUnitM } from "./geometry/units.js";
2
+ import { SeatingKind, TableChairDistribution, } from "./physical-document.interface.js";
3
+ export const TableLayoutDefaults = {
4
+ chairSizeM: 18 * LayoutUnitM,
5
+ chairGapM: 7 * LayoutUnitM,
6
+ };
7
+ export const TableLayoutLimits = {
8
+ chairs: 40,
9
+ arcMin: 120,
10
+ arcMax: 360,
11
+ radiusMinM: 0.6,
12
+ radiusMaxM: 3.7,
13
+ widthMinM: 0.9,
14
+ widthMaxM: 7.3,
15
+ heightMinM: 0.7,
16
+ heightMaxM: 5.5,
17
+ };
18
+ export const TableChairSides = ["top", "bottom", "left", "right"];
19
+ export function defaultRoundTableRecipe() {
20
+ return {
21
+ diameterM: 72 * LayoutUnitM,
22
+ chairGapM: TableLayoutDefaults.chairGapM,
23
+ startAngleDeg: 0,
24
+ automaticSize: true,
25
+ seatArcDeg: 360,
26
+ };
27
+ }
28
+ export function defaultLongTableLayout() {
29
+ return {
30
+ recipe: {
31
+ widthM: 80 * LayoutUnitM,
32
+ depthM: 50 * LayoutUnitM,
33
+ chairGapM: TableLayoutDefaults.chairGapM,
34
+ chairDistribution: TableChairDistribution.EqualSegments,
35
+ },
36
+ sides: { top: true, bottom: true, left: false, right: false },
37
+ };
38
+ }
39
+ /** Shared by committed count reconciliation and placement previews. */
40
+ export function automaticTableRadiusM(count, arcDeg) {
41
+ return Math.min(160, Math.max(36, (count * 4 * 360) / arcDeg)) * LayoutUnitM;
42
+ }
43
+ export function resizeRoundTable(table) {
44
+ if (!table.recipe.automaticSize)
45
+ return table;
46
+ const diameterM = 2 * automaticTableRadiusM(table.chairs.length, table.recipe.seatArcDeg ?? 360);
47
+ if (diameterM === table.recipe.diameterM)
48
+ return table;
49
+ return { ...table, recipe: { ...table.recipe, diameterM } };
50
+ }
51
+ export function setRoundTableAutomaticSize(table, automaticSize) {
52
+ if (!!table.recipe.automaticSize === automaticSize)
53
+ return table;
54
+ return resizeRoundTable({
55
+ ...table,
56
+ recipe: { ...table.recipe, automaticSize },
57
+ });
58
+ }
59
+ export function setRoundTableArc(table, requested) {
60
+ const seatArcDeg = Math.min(360, Math.max(120, Math.round(requested)));
61
+ if (seatArcDeg === table.recipe.seatArcDeg)
62
+ return table;
63
+ return resizeRoundTable({
64
+ ...table,
65
+ recipe: { ...table.recipe, seatArcDeg },
66
+ });
67
+ }
68
+ function dimensionM(requested, minimum, maximum) {
69
+ const units = Math.min(maximum, Math.max(minimum, Math.round(requested / LayoutUnitM)));
70
+ return units * LayoutUnitM;
71
+ }
72
+ export function setRoundTableRadius(table, requested) {
73
+ if (table.recipe.automaticSize)
74
+ return table;
75
+ const diameterM = 2 * dimensionM(requested, 24, 160);
76
+ return diameterM === table.recipe.diameterM ? table : { ...table, recipe: { ...table.recipe, diameterM } };
77
+ }
78
+ export function setLongTableDimensions(table, widthM, depthM) {
79
+ const recipe = {
80
+ ...table.recipe,
81
+ widthM: dimensionM(widthM, 40, 320),
82
+ depthM: dimensionM(depthM, 30, 240),
83
+ };
84
+ return recipe.widthM === table.recipe.widthM && recipe.depthM === table.recipe.depthM ? table : { ...table, recipe };
85
+ }
86
+ /** Shape changes retain inventory identity, personal overrides and the inactive shape settings. */
87
+ export function changeTableShape(table, kind) {
88
+ if (table.kind === kind)
89
+ return table;
90
+ if (table.kind === SeatingKind.Rectangular) {
91
+ const { recipe, chairsBySide, roundLayout, ...base } = table;
92
+ const chairs = TableChairSides.flatMap((side) => chairsBySide[side]);
93
+ return resizeRoundTable({
94
+ ...base,
95
+ kind: SeatingKind.Round,
96
+ chairs,
97
+ recipe: {
98
+ ...(roundLayout ?? defaultRoundTableRecipe()),
99
+ automaticSize: true,
100
+ },
101
+ longLayout: {
102
+ recipe,
103
+ sides: {
104
+ top: !!chairsBySide.top.length,
105
+ bottom: !!chairsBySide.bottom.length,
106
+ left: !!chairsBySide.left.length,
107
+ right: !!chairsBySide.right.length,
108
+ },
109
+ },
110
+ });
111
+ }
112
+ const { recipe, chairs, longLayout, ...base } = table;
113
+ const layout = longLayout ?? defaultLongTableLayout();
114
+ const sides = TableChairSides.filter((side) => layout.sides[side]);
115
+ let offset = 0;
116
+ const chairsBySide = {
117
+ top: [],
118
+ bottom: [],
119
+ left: [],
120
+ right: [],
121
+ };
122
+ for (const [index, side] of sides.entries()) {
123
+ const count = Math.floor(chairs.length / sides.length) + (index < chairs.length % sides.length ? 1 : 0);
124
+ chairsBySide[side] = chairs.slice(offset, offset + count);
125
+ offset += count;
126
+ }
127
+ return {
128
+ ...base,
129
+ kind: SeatingKind.Rectangular,
130
+ recipe: layout.recipe,
131
+ chairsBySide,
132
+ roundLayout: recipe,
133
+ };
134
+ }
@@ -1,6 +1,7 @@
1
- import { type PhysicalDocumentV1, type UUID } from "./types.js";
1
+ import { type PhysicalDocumentV1, type UUID } from "./physical-document.interface.js";
2
2
  import { type DomainIssue } from "./issues.js";
3
- export type AssetReadiness = ReadonlySet<UUID>;
3
+ import { type AssetReadiness } from "./validation.interface.js";
4
+ export type { AssetReadiness } from "./validation.interface.js";
4
5
  /** Label equality and collision ownership live here; consumers only project issues. */
5
6
  export declare class ValidationIndex {
6
7
  private document;
@@ -8,6 +9,7 @@ export declare class ValidationIndex {
8
9
  private buckets;
9
10
  private owners;
10
11
  private collisions;
12
+ private dirtyLabels;
11
13
  private groupIssues;
12
14
  private seats;
13
15
  private companions;
@@ -15,7 +17,10 @@ export declare class ValidationIndex {
15
17
  constructor(document: PhysicalDocumentV1, assetReadiness?: AssetReadiness);
16
18
  private key;
17
19
  private refresh;
20
+ /** Booking collisions already explain the affected rows; do not also report their shared name. */
21
+ private collisionIssues;
18
22
  private put;
23
+ private refreshLabels;
19
24
  private remove;
20
25
  private indexGroup;
21
26
  rebuild(document: PhysicalDocumentV1): void;
@@ -0,0 +1,20 @@
1
+ import type { UUID } from "./physical-document.interface.js";
2
+ export type AssetReadiness = ReadonlySet<UUID>;
3
+ export declare enum LabelScope {
4
+ Row = "row",
5
+ Table = "table",
6
+ Seat = "seat",
7
+ Booking = "booking",
8
+ Section = "section",
9
+ Area = "area"
10
+ }
11
+ export type LabelEntry = {
12
+ kind: LabelScope;
13
+ id: UUID;
14
+ ownerId: UUID;
15
+ label: string;
16
+ bookingRowName?: string;
17
+ seatLabels?: ReadonlySet<string>;
18
+ field: string;
19
+ scope: string;
20
+ };
@@ -0,0 +1,9 @@
1
+ export var LabelScope;
2
+ (function (LabelScope) {
3
+ LabelScope["Row"] = "row";
4
+ LabelScope["Table"] = "table";
5
+ LabelScope["Seat"] = "seat";
6
+ LabelScope["Booking"] = "booking";
7
+ LabelScope["Section"] = "section";
8
+ LabelScope["Area"] = "area";
9
+ })(LabelScope || (LabelScope = {}));