venuekit 0.10.3 → 0.11.0
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/{chunk-TDC5G7L7.js → chunk-IRNVYNYV.js} +79 -14
- package/dist/{chunk-UWCMN6Q7.cjs → chunk-YLV7JK57.cjs} +83 -18
- package/dist/index.cjs +6 -2
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +5 -1
- package/dist/{place-types-Dc0eabAi.d.cts → place-types-DNfiQXGU.d.cts} +23 -2
- package/dist/{place-types-Dc0eabAi.d.ts → place-types-DNfiQXGU.d.ts} +23 -2
- package/dist/react.cjs +493 -238
- package/dist/react.d.cts +59 -5
- package/dist/react.d.ts +59 -5
- package/dist/react.js +298 -43
- package/package.json +1 -1
|
@@ -315,6 +315,12 @@ var seatBlockSchema = z.object({
|
|
|
315
315
|
curve: z.number().min(0).max(180).default(0),
|
|
316
316
|
scale: z.number().min(MIN_SCALE).max(MAX_SCALE).default(1),
|
|
317
317
|
removed: z.array(z.string().max(MAX_ID_LENGTH * 2)).max(MAX_UNITS).default([]),
|
|
318
|
+
/**
|
|
319
|
+
* Butacas «sólo con invitación»: se ven pero el público no las compra (quedan para
|
|
320
|
+
* cortesías y cupos apartados). Mismos ids que `removed`. Opcional y sin default:
|
|
321
|
+
* un plano viejo sigue saliendo igual que entró.
|
|
322
|
+
*/
|
|
323
|
+
reserved: z.array(z.string().max(MAX_ID_LENGTH * 2)).max(MAX_UNITS).optional(),
|
|
318
324
|
placeType: placeTypeLinkSchema.nullable().default(null)
|
|
319
325
|
});
|
|
320
326
|
var tableSchema = z.object({
|
|
@@ -326,6 +332,14 @@ var tableSchema = z.object({
|
|
|
326
332
|
label: z.string().min(1).max(MAX_TABLE_LABEL_LENGTH),
|
|
327
333
|
mode: z.enum(["whole", "perPlace"]),
|
|
328
334
|
scale: z.number().min(MIN_SCALE).max(MAX_SCALE).default(1),
|
|
335
|
+
/** Mesa entera «sólo con invitación» (vale con `mode: "whole"`). */
|
|
336
|
+
reserved: z.boolean().optional(),
|
|
337
|
+
/**
|
|
338
|
+
* Lugares «sólo con invitación» de una mesa compartida (`mode: "perPlace"`), por número.
|
|
339
|
+
* Por número y no por id: copiar la mesa o cambiarle el modo no los deja colgando.
|
|
340
|
+
* Los que pasan de `places` no cuentan (achicar la mesa no invalida el plano).
|
|
341
|
+
*/
|
|
342
|
+
reservedPlaces: z.array(z.number().int().min(1).max(64)).max(64).optional(),
|
|
329
343
|
placeType: placeTypeLinkSchema.nullable().default(null)
|
|
330
344
|
});
|
|
331
345
|
var landmarkSchema = z.object({
|
|
@@ -388,17 +402,21 @@ var layoutSchema = z.object({
|
|
|
388
402
|
ctx.addIssue({ code: "custom", path: ["elements", i, "id"], message: `Id de elemento duplicado: ${e.id}` });
|
|
389
403
|
}
|
|
390
404
|
elementIds.add(e.id);
|
|
391
|
-
if (e.type !== "seatBlock" ||
|
|
405
|
+
if (e.type !== "seatBlock" || overLimit) return;
|
|
406
|
+
const reserved = e.reserved ?? [];
|
|
407
|
+
if (e.removed.length === 0 && reserved.length === 0) return;
|
|
392
408
|
if (!labelRuleSchema.safeParse(e.rowLabels).success || !labelRuleSchema.safeParse(e.seatLabels).success) return;
|
|
393
409
|
const rows = new Set(expandLabels(e.rowLabels, e.rows));
|
|
394
410
|
const seats = new Set(expandLabels(e.seatLabels, e.cols));
|
|
395
|
-
|
|
411
|
+
const check = (field) => (id, j) => {
|
|
396
412
|
const [blockId, row, seat, ...extra] = parseUnitId(id);
|
|
397
413
|
const ok = blockId === e.id && extra.length === 0 && row !== void 0 && seat !== void 0 && rows.has(row) && seats.has(seat);
|
|
398
414
|
if (!ok) {
|
|
399
|
-
ctx.addIssue({ code: "custom", path: ["elements", i,
|
|
415
|
+
ctx.addIssue({ code: "custom", path: ["elements", i, field, j], message: `El bloque ${e.id} no genera la butaca ${id}` });
|
|
400
416
|
}
|
|
401
|
-
}
|
|
417
|
+
};
|
|
418
|
+
e.removed.forEach(check("removed"));
|
|
419
|
+
reserved.forEach(check("reserved"));
|
|
402
420
|
});
|
|
403
421
|
});
|
|
404
422
|
var spanishParseOptions = { error: z.locales.es().localeError };
|
|
@@ -571,6 +589,7 @@ function expandSeatBlock(block) {
|
|
|
571
589
|
const rowLabels = expandLabels(block.rowLabels, block.rows);
|
|
572
590
|
const seatLabels = expandLabels(block.seatLabels, block.cols);
|
|
573
591
|
const removed = new Set(block.removed);
|
|
592
|
+
const reserved = new Set(block.reserved ?? []);
|
|
574
593
|
const out = [];
|
|
575
594
|
for (let r = 0; r < block.rows; r++) {
|
|
576
595
|
const row = rowLabels[r];
|
|
@@ -590,7 +609,8 @@ function expandSeatBlock(block) {
|
|
|
590
609
|
row,
|
|
591
610
|
seat,
|
|
592
611
|
rowIndex: r,
|
|
593
|
-
colIndex: c
|
|
612
|
+
colIndex: c,
|
|
613
|
+
inviteOnly: reserved.has(id)
|
|
594
614
|
});
|
|
595
615
|
}
|
|
596
616
|
}
|
|
@@ -622,12 +642,34 @@ function expandTable(table) {
|
|
|
622
642
|
const placeTypeRef = table.placeType?.ref || null;
|
|
623
643
|
if (table.mode === "whole") {
|
|
624
644
|
const centre = applyTransform({ x: 0, y: 0 }, table.transform);
|
|
625
|
-
return [{
|
|
645
|
+
return [{
|
|
646
|
+
id: table.id,
|
|
647
|
+
label: table.label,
|
|
648
|
+
kind: "table",
|
|
649
|
+
x: centre.x,
|
|
650
|
+
y: centre.y,
|
|
651
|
+
elementId: table.id,
|
|
652
|
+
placeTypeRef,
|
|
653
|
+
table: table.label,
|
|
654
|
+
inviteOnly: table.reserved === true
|
|
655
|
+
}];
|
|
626
656
|
}
|
|
657
|
+
const reserved = new Set(table.reservedPlaces ?? []);
|
|
627
658
|
return localPlacePositions(table).map((local, i) => {
|
|
628
659
|
const p = applyTransform(local, table.transform);
|
|
629
660
|
const n = i + 1;
|
|
630
|
-
return {
|
|
661
|
+
return {
|
|
662
|
+
id: placeUnitId(table.id, n),
|
|
663
|
+
label: `${table.label} \xB7 ${n}`,
|
|
664
|
+
kind: "place",
|
|
665
|
+
x: p.x,
|
|
666
|
+
y: p.y,
|
|
667
|
+
elementId: table.id,
|
|
668
|
+
placeTypeRef,
|
|
669
|
+
table: table.label,
|
|
670
|
+
place: n,
|
|
671
|
+
inviteOnly: reserved.has(n)
|
|
672
|
+
};
|
|
631
673
|
});
|
|
632
674
|
}
|
|
633
675
|
function expand(layout) {
|
|
@@ -890,17 +932,19 @@ var History = class {
|
|
|
890
932
|
|
|
891
933
|
// ../core/src/lock.ts
|
|
892
934
|
function samePlace(before, after) {
|
|
893
|
-
return after.label === before.label && after.placeTypeRef === before.placeTypeRef && after.elementId === before.elementId && after.kind === before.kind && after.rowIndex === before.rowIndex && after.colIndex === before.colIndex && after.place === before.place;
|
|
935
|
+
return after.label === before.label && after.placeTypeRef === before.placeTypeRef && after.elementId === before.elementId && after.kind === before.kind && after.rowIndex === before.rowIndex && after.colIndex === before.colIndex && after.place === before.place && after.inviteOnly === before.inviteOnly;
|
|
894
936
|
}
|
|
895
937
|
function findLockViolations(before, after, locked) {
|
|
896
938
|
if (locked.size === 0) return [];
|
|
897
939
|
const afterUnits = new Map(expand(after).map((u) => [u.id, u]));
|
|
940
|
+
const placesBefore = wholeTablePlaces(before);
|
|
941
|
+
const placesAfter = wholeTablePlaces(after);
|
|
898
942
|
const out = [];
|
|
899
943
|
const seen = /* @__PURE__ */ new Set();
|
|
900
944
|
for (const u of expand(before)) {
|
|
901
945
|
if (!locked.has(u.id)) continue;
|
|
902
946
|
const now = afterUnits.get(u.id);
|
|
903
|
-
if (now && samePlace(u, now)) continue;
|
|
947
|
+
if (now && samePlace(u, now) && (u.kind !== "table" || placesBefore.get(u.elementId) === placesAfter.get(now.elementId))) continue;
|
|
904
948
|
const v = u.table !== void 0 ? { reason: "table", table: u.table } : { reason: "row", row: u.row ?? u.label, elementId: u.elementId };
|
|
905
949
|
const key = v.reason === "table" ? `t\0${v.table}` : `r\0${v.elementId}\0${v.row}`;
|
|
906
950
|
if (seen.has(key)) continue;
|
|
@@ -909,6 +953,11 @@ function findLockViolations(before, after, locked) {
|
|
|
909
953
|
}
|
|
910
954
|
return out;
|
|
911
955
|
}
|
|
956
|
+
function wholeTablePlaces(layout) {
|
|
957
|
+
const out = /* @__PURE__ */ new Map();
|
|
958
|
+
for (const el of layout.elements) if (el.type === "table" && el.mode === "whole") out.set(el.id, el.places);
|
|
959
|
+
return out;
|
|
960
|
+
}
|
|
912
961
|
|
|
913
962
|
// ../core/src/pieces.ts
|
|
914
963
|
var DEFAULT_BLOCK = { rows: 5, cols: 10 };
|
|
@@ -1033,12 +1082,13 @@ function duplicatePiece(el, id, layout) {
|
|
|
1033
1082
|
const rowLabels = followingRows(el.rowLabels, el.rows) ?? el.rowLabels;
|
|
1034
1083
|
const before = expandLabels(el.rowLabels, el.rows);
|
|
1035
1084
|
const after = expandLabels(rowLabels, el.rows);
|
|
1036
|
-
const
|
|
1085
|
+
const remap = (r) => {
|
|
1037
1086
|
const [, row, seat] = parseUnitId(r);
|
|
1038
1087
|
const i = row === void 0 ? -1 : before.indexOf(row);
|
|
1039
1088
|
return i < 0 || seat === void 0 ? r : seatUnitId(id, after[i], seat);
|
|
1040
|
-
}
|
|
1041
|
-
|
|
1089
|
+
};
|
|
1090
|
+
const removed = el.removed.map(remap);
|
|
1091
|
+
return { ...el, id, transform, rowLabels, removed, ...el.reserved ? { reserved: el.reserved.map(remap) } : {} };
|
|
1042
1092
|
}
|
|
1043
1093
|
return { ...el, id, transform };
|
|
1044
1094
|
}
|
|
@@ -1054,7 +1104,20 @@ function rotatePiece(el) {
|
|
|
1054
1104
|
}
|
|
1055
1105
|
function toggleRemovedSeat(block, unitId) {
|
|
1056
1106
|
const removed = block.removed.includes(unitId) ? block.removed.filter((r) => r !== unitId) : [...block.removed, unitId];
|
|
1057
|
-
return { ...block, removed };
|
|
1107
|
+
if (!block.reserved?.includes(unitId)) return { ...block, removed };
|
|
1108
|
+
return { ...block, removed, reserved: block.reserved.filter((r) => r !== unitId) };
|
|
1109
|
+
}
|
|
1110
|
+
function toggleReservedSeat(block, unitId) {
|
|
1111
|
+
if (block.removed.includes(unitId)) return block;
|
|
1112
|
+
const current = block.reserved ?? [];
|
|
1113
|
+
const reserved = current.includes(unitId) ? current.filter((r) => r !== unitId) : [...current, unitId];
|
|
1114
|
+
return { ...block, reserved };
|
|
1115
|
+
}
|
|
1116
|
+
function toggleReservedTable(table, place) {
|
|
1117
|
+
if (place === void 0) return { ...table, reserved: !table.reserved };
|
|
1118
|
+
const current = table.reservedPlaces ?? [];
|
|
1119
|
+
const reservedPlaces = current.includes(place) ? current.filter((n) => n !== place) : [...current, place].sort((a, b) => a - b);
|
|
1120
|
+
return { ...table, reservedPlaces };
|
|
1058
1121
|
}
|
|
1059
1122
|
function snapScale(scale, step = 0.05) {
|
|
1060
1123
|
const snapped = Math.round(scale / step) * step;
|
|
@@ -1242,7 +1305,7 @@ function migrate(input) {
|
|
|
1242
1305
|
}
|
|
1243
1306
|
|
|
1244
1307
|
// ../core/src/index.ts
|
|
1245
|
-
var VERSION = "0.
|
|
1308
|
+
var VERSION = "0.11.0";
|
|
1246
1309
|
|
|
1247
1310
|
export {
|
|
1248
1311
|
LATIN_ALPHABET,
|
|
@@ -1322,6 +1385,8 @@ export {
|
|
|
1322
1385
|
duplicatePiece,
|
|
1323
1386
|
rotatePiece,
|
|
1324
1387
|
toggleRemovedSeat,
|
|
1388
|
+
toggleReservedSeat,
|
|
1389
|
+
toggleReservedTable,
|
|
1325
1390
|
snapScale,
|
|
1326
1391
|
scalePiece,
|
|
1327
1392
|
canAssign,
|
|
@@ -315,6 +315,12 @@ var seatBlockSchema = _zod.z.object({
|
|
|
315
315
|
curve: _zod.z.number().min(0).max(180).default(0),
|
|
316
316
|
scale: _zod.z.number().min(MIN_SCALE).max(MAX_SCALE).default(1),
|
|
317
317
|
removed: _zod.z.array(_zod.z.string().max(MAX_ID_LENGTH * 2)).max(MAX_UNITS).default([]),
|
|
318
|
+
/**
|
|
319
|
+
* Butacas «sólo con invitación»: se ven pero el público no las compra (quedan para
|
|
320
|
+
* cortesías y cupos apartados). Mismos ids que `removed`. Opcional y sin default:
|
|
321
|
+
* un plano viejo sigue saliendo igual que entró.
|
|
322
|
+
*/
|
|
323
|
+
reserved: _zod.z.array(_zod.z.string().max(MAX_ID_LENGTH * 2)).max(MAX_UNITS).optional(),
|
|
318
324
|
placeType: placeTypeLinkSchema.nullable().default(null)
|
|
319
325
|
});
|
|
320
326
|
var tableSchema = _zod.z.object({
|
|
@@ -326,6 +332,14 @@ var tableSchema = _zod.z.object({
|
|
|
326
332
|
label: _zod.z.string().min(1).max(MAX_TABLE_LABEL_LENGTH),
|
|
327
333
|
mode: _zod.z.enum(["whole", "perPlace"]),
|
|
328
334
|
scale: _zod.z.number().min(MIN_SCALE).max(MAX_SCALE).default(1),
|
|
335
|
+
/** Mesa entera «sólo con invitación» (vale con `mode: "whole"`). */
|
|
336
|
+
reserved: _zod.z.boolean().optional(),
|
|
337
|
+
/**
|
|
338
|
+
* Lugares «sólo con invitación» de una mesa compartida (`mode: "perPlace"`), por número.
|
|
339
|
+
* Por número y no por id: copiar la mesa o cambiarle el modo no los deja colgando.
|
|
340
|
+
* Los que pasan de `places` no cuentan (achicar la mesa no invalida el plano).
|
|
341
|
+
*/
|
|
342
|
+
reservedPlaces: _zod.z.array(_zod.z.number().int().min(1).max(64)).max(64).optional(),
|
|
329
343
|
placeType: placeTypeLinkSchema.nullable().default(null)
|
|
330
344
|
});
|
|
331
345
|
var landmarkSchema = _zod.z.object({
|
|
@@ -388,17 +402,21 @@ var layoutSchema = _zod.z.object({
|
|
|
388
402
|
ctx.addIssue({ code: "custom", path: ["elements", i, "id"], message: `Id de elemento duplicado: ${e.id}` });
|
|
389
403
|
}
|
|
390
404
|
elementIds.add(e.id);
|
|
391
|
-
if (e.type !== "seatBlock" ||
|
|
405
|
+
if (e.type !== "seatBlock" || overLimit) return;
|
|
406
|
+
const reserved = _nullishCoalesce(e.reserved, () => ( []));
|
|
407
|
+
if (e.removed.length === 0 && reserved.length === 0) return;
|
|
392
408
|
if (!labelRuleSchema.safeParse(e.rowLabels).success || !labelRuleSchema.safeParse(e.seatLabels).success) return;
|
|
393
409
|
const rows = new Set(expandLabels(e.rowLabels, e.rows));
|
|
394
410
|
const seats = new Set(expandLabels(e.seatLabels, e.cols));
|
|
395
|
-
|
|
411
|
+
const check = (field) => (id, j) => {
|
|
396
412
|
const [blockId, row, seat, ...extra] = parseUnitId(id);
|
|
397
413
|
const ok = blockId === e.id && extra.length === 0 && row !== void 0 && seat !== void 0 && rows.has(row) && seats.has(seat);
|
|
398
414
|
if (!ok) {
|
|
399
|
-
ctx.addIssue({ code: "custom", path: ["elements", i,
|
|
415
|
+
ctx.addIssue({ code: "custom", path: ["elements", i, field, j], message: `El bloque ${e.id} no genera la butaca ${id}` });
|
|
400
416
|
}
|
|
401
|
-
}
|
|
417
|
+
};
|
|
418
|
+
e.removed.forEach(check("removed"));
|
|
419
|
+
reserved.forEach(check("reserved"));
|
|
402
420
|
});
|
|
403
421
|
});
|
|
404
422
|
var spanishParseOptions = { error: _zod.z.locales.es().localeError };
|
|
@@ -571,6 +589,7 @@ function expandSeatBlock(block) {
|
|
|
571
589
|
const rowLabels = expandLabels(block.rowLabels, block.rows);
|
|
572
590
|
const seatLabels = expandLabels(block.seatLabels, block.cols);
|
|
573
591
|
const removed = new Set(block.removed);
|
|
592
|
+
const reserved = new Set(_nullishCoalesce(block.reserved, () => ( [])));
|
|
574
593
|
const out = [];
|
|
575
594
|
for (let r = 0; r < block.rows; r++) {
|
|
576
595
|
const row = rowLabels[r];
|
|
@@ -590,7 +609,8 @@ function expandSeatBlock(block) {
|
|
|
590
609
|
row,
|
|
591
610
|
seat,
|
|
592
611
|
rowIndex: r,
|
|
593
|
-
colIndex: c
|
|
612
|
+
colIndex: c,
|
|
613
|
+
inviteOnly: reserved.has(id)
|
|
594
614
|
});
|
|
595
615
|
}
|
|
596
616
|
}
|
|
@@ -622,12 +642,34 @@ function expandTable(table) {
|
|
|
622
642
|
const placeTypeRef = _optionalChain([table, 'access', _7 => _7.placeType, 'optionalAccess', _8 => _8.ref]) || null;
|
|
623
643
|
if (table.mode === "whole") {
|
|
624
644
|
const centre = applyTransform({ x: 0, y: 0 }, table.transform);
|
|
625
|
-
return [{
|
|
645
|
+
return [{
|
|
646
|
+
id: table.id,
|
|
647
|
+
label: table.label,
|
|
648
|
+
kind: "table",
|
|
649
|
+
x: centre.x,
|
|
650
|
+
y: centre.y,
|
|
651
|
+
elementId: table.id,
|
|
652
|
+
placeTypeRef,
|
|
653
|
+
table: table.label,
|
|
654
|
+
inviteOnly: table.reserved === true
|
|
655
|
+
}];
|
|
626
656
|
}
|
|
657
|
+
const reserved = new Set(_nullishCoalesce(table.reservedPlaces, () => ( [])));
|
|
627
658
|
return localPlacePositions(table).map((local, i) => {
|
|
628
659
|
const p = applyTransform(local, table.transform);
|
|
629
660
|
const n = i + 1;
|
|
630
|
-
return {
|
|
661
|
+
return {
|
|
662
|
+
id: placeUnitId(table.id, n),
|
|
663
|
+
label: `${table.label} \xB7 ${n}`,
|
|
664
|
+
kind: "place",
|
|
665
|
+
x: p.x,
|
|
666
|
+
y: p.y,
|
|
667
|
+
elementId: table.id,
|
|
668
|
+
placeTypeRef,
|
|
669
|
+
table: table.label,
|
|
670
|
+
place: n,
|
|
671
|
+
inviteOnly: reserved.has(n)
|
|
672
|
+
};
|
|
631
673
|
});
|
|
632
674
|
}
|
|
633
675
|
function expand(layout) {
|
|
@@ -890,17 +932,19 @@ var History = (_class2 = class {
|
|
|
890
932
|
|
|
891
933
|
// ../core/src/lock.ts
|
|
892
934
|
function samePlace(before, after) {
|
|
893
|
-
return after.label === before.label && after.placeTypeRef === before.placeTypeRef && after.elementId === before.elementId && after.kind === before.kind && after.rowIndex === before.rowIndex && after.colIndex === before.colIndex && after.place === before.place;
|
|
935
|
+
return after.label === before.label && after.placeTypeRef === before.placeTypeRef && after.elementId === before.elementId && after.kind === before.kind && after.rowIndex === before.rowIndex && after.colIndex === before.colIndex && after.place === before.place && after.inviteOnly === before.inviteOnly;
|
|
894
936
|
}
|
|
895
937
|
function findLockViolations(before, after, locked) {
|
|
896
938
|
if (locked.size === 0) return [];
|
|
897
939
|
const afterUnits = new Map(expand(after).map((u) => [u.id, u]));
|
|
940
|
+
const placesBefore = wholeTablePlaces(before);
|
|
941
|
+
const placesAfter = wholeTablePlaces(after);
|
|
898
942
|
const out = [];
|
|
899
943
|
const seen = /* @__PURE__ */ new Set();
|
|
900
944
|
for (const u of expand(before)) {
|
|
901
945
|
if (!locked.has(u.id)) continue;
|
|
902
946
|
const now = afterUnits.get(u.id);
|
|
903
|
-
if (now && samePlace(u, now)) continue;
|
|
947
|
+
if (now && samePlace(u, now) && (u.kind !== "table" || placesBefore.get(u.elementId) === placesAfter.get(now.elementId))) continue;
|
|
904
948
|
const v = u.table !== void 0 ? { reason: "table", table: u.table } : { reason: "row", row: _nullishCoalesce(u.row, () => ( u.label)), elementId: u.elementId };
|
|
905
949
|
const key = v.reason === "table" ? `t\0${v.table}` : `r\0${v.elementId}\0${v.row}`;
|
|
906
950
|
if (seen.has(key)) continue;
|
|
@@ -909,6 +953,11 @@ function findLockViolations(before, after, locked) {
|
|
|
909
953
|
}
|
|
910
954
|
return out;
|
|
911
955
|
}
|
|
956
|
+
function wholeTablePlaces(layout) {
|
|
957
|
+
const out = /* @__PURE__ */ new Map();
|
|
958
|
+
for (const el of layout.elements) if (el.type === "table" && el.mode === "whole") out.set(el.id, el.places);
|
|
959
|
+
return out;
|
|
960
|
+
}
|
|
912
961
|
|
|
913
962
|
// ../core/src/pieces.ts
|
|
914
963
|
var DEFAULT_BLOCK = { rows: 5, cols: 10 };
|
|
@@ -1033,12 +1082,13 @@ function duplicatePiece(el, id, layout) {
|
|
|
1033
1082
|
const rowLabels = _nullishCoalesce(followingRows(el.rowLabels, el.rows), () => ( el.rowLabels));
|
|
1034
1083
|
const before = expandLabels(el.rowLabels, el.rows);
|
|
1035
1084
|
const after = expandLabels(rowLabels, el.rows);
|
|
1036
|
-
const
|
|
1085
|
+
const remap = (r) => {
|
|
1037
1086
|
const [, row, seat] = parseUnitId(r);
|
|
1038
1087
|
const i = row === void 0 ? -1 : before.indexOf(row);
|
|
1039
1088
|
return i < 0 || seat === void 0 ? r : seatUnitId(id, after[i], seat);
|
|
1040
|
-
}
|
|
1041
|
-
|
|
1089
|
+
};
|
|
1090
|
+
const removed = el.removed.map(remap);
|
|
1091
|
+
return { ...el, id, transform, rowLabels, removed, ...el.reserved ? { reserved: el.reserved.map(remap) } : {} };
|
|
1042
1092
|
}
|
|
1043
1093
|
return { ...el, id, transform };
|
|
1044
1094
|
}
|
|
@@ -1054,7 +1104,20 @@ function rotatePiece(el) {
|
|
|
1054
1104
|
}
|
|
1055
1105
|
function toggleRemovedSeat(block, unitId) {
|
|
1056
1106
|
const removed = block.removed.includes(unitId) ? block.removed.filter((r) => r !== unitId) : [...block.removed, unitId];
|
|
1057
|
-
return { ...block, removed };
|
|
1107
|
+
if (!_optionalChain([block, 'access', _17 => _17.reserved, 'optionalAccess', _18 => _18.includes, 'call', _19 => _19(unitId)])) return { ...block, removed };
|
|
1108
|
+
return { ...block, removed, reserved: block.reserved.filter((r) => r !== unitId) };
|
|
1109
|
+
}
|
|
1110
|
+
function toggleReservedSeat(block, unitId) {
|
|
1111
|
+
if (block.removed.includes(unitId)) return block;
|
|
1112
|
+
const current = _nullishCoalesce(block.reserved, () => ( []));
|
|
1113
|
+
const reserved = current.includes(unitId) ? current.filter((r) => r !== unitId) : [...current, unitId];
|
|
1114
|
+
return { ...block, reserved };
|
|
1115
|
+
}
|
|
1116
|
+
function toggleReservedTable(table, place) {
|
|
1117
|
+
if (place === void 0) return { ...table, reserved: !table.reserved };
|
|
1118
|
+
const current = _nullishCoalesce(table.reservedPlaces, () => ( []));
|
|
1119
|
+
const reservedPlaces = current.includes(place) ? current.filter((n) => n !== place) : [...current, place].sort((a, b) => a - b);
|
|
1120
|
+
return { ...table, reservedPlaces };
|
|
1058
1121
|
}
|
|
1059
1122
|
function snapScale(scale, step = 0.05) {
|
|
1060
1123
|
const snapped = Math.round(scale / step) * step;
|
|
@@ -1101,8 +1164,8 @@ function capacityViolations(before, after, options) {
|
|
|
1101
1164
|
const out = [];
|
|
1102
1165
|
for (const o of capped) {
|
|
1103
1166
|
const capacity = placeTypeCapacity(o);
|
|
1104
|
-
const units = _nullishCoalesce(_optionalChain([now, 'access',
|
|
1105
|
-
if (units > (_nullishCoalesce(_optionalChain([was, 'access',
|
|
1167
|
+
const units = _nullishCoalesce(_optionalChain([now, 'access', _20 => _20[o.ref], 'optionalAccess', _21 => _21.units]), () => ( 0));
|
|
1168
|
+
if (units > (_nullishCoalesce(_optionalChain([was, 'access', _22 => _22[o.ref], 'optionalAccess', _23 => _23.units]), () => ( 0))) && units > capacity) out.push({ ref: o.ref, label: o.label, capacity, units });
|
|
1106
1169
|
}
|
|
1107
1170
|
return out;
|
|
1108
1171
|
}
|
|
@@ -1164,7 +1227,7 @@ function summarize(layout) {
|
|
|
1164
1227
|
let unassignedPieces = 0;
|
|
1165
1228
|
for (const el of layout.elements) {
|
|
1166
1229
|
if (el.type === "landmark") continue;
|
|
1167
|
-
const ref = _optionalChain([el, 'access',
|
|
1230
|
+
const ref = _optionalChain([el, 'access', _24 => _24.placeType, 'optionalAccess', _25 => _25.ref]) || null;
|
|
1168
1231
|
if (el.type === "table") {
|
|
1169
1232
|
tables++;
|
|
1170
1233
|
if (ref) {
|
|
@@ -1242,7 +1305,9 @@ function migrate(input) {
|
|
|
1242
1305
|
}
|
|
1243
1306
|
|
|
1244
1307
|
// ../core/src/index.ts
|
|
1245
|
-
var VERSION = "0.
|
|
1308
|
+
var VERSION = "0.11.0";
|
|
1309
|
+
|
|
1310
|
+
|
|
1246
1311
|
|
|
1247
1312
|
|
|
1248
1313
|
|
|
@@ -1338,4 +1403,4 @@ var VERSION = "0.10.3";
|
|
|
1338
1403
|
|
|
1339
1404
|
|
|
1340
1405
|
|
|
1341
|
-
exports.LATIN_ALPHABET = LATIN_ALPHABET; exports.SPANISH_ALPHABET = SPANISH_ALPHABET; exports.letterLabel = letterLabel; exports.letterIndex = letterIndex; exports.labelSequence = labelSequence; exports.expandLabels = expandLabels; exports.ID_SEP = ID_SEP; exports.seatUnitId = seatUnitId; exports.placeUnitId = placeUnitId; exports.parseUnitId = parseUnitId; exports.landmarks = landmarks; exports.landmarkById = landmarkById; exports.MAX_UNITS = MAX_UNITS; exports.MAX_ID_LENGTH = MAX_ID_LENGTH; exports.MAX_NAME_LENGTH = MAX_NAME_LENGTH; exports.MAX_REF_LENGTH = MAX_REF_LENGTH; exports.MAX_TABLE_LABEL_LENGTH = MAX_TABLE_LABEL_LENGTH; exports.MAX_SRC_LENGTH = MAX_SRC_LENGTH; exports.MAX_ELEMENTS = MAX_ELEMENTS; exports.MAX_LETTERS_START = MAX_LETTERS_START; exports.MAX_SKIP = MAX_SKIP; exports.MIN_SCALE = MIN_SCALE; exports.MAX_SCALE = MAX_SCALE; exports.MAX_ROWS = MAX_ROWS; exports.MAX_COLS = MAX_COLS; exports.MAX_COORD = MAX_COORD; exports.MAX_SPACING = MAX_SPACING; exports.MAX_SIZE = MAX_SIZE; exports.idSchema = idSchema; exports.rotationSchema = rotationSchema; exports.transformSchema = transformSchema; exports.labelRuleSchema = labelRuleSchema; exports.placeTypeLinkSchema = placeTypeLinkSchema; exports.seatBlockSchema = seatBlockSchema; exports.tableSchema = tableSchema; exports.landmarkSchema = landmarkSchema; exports.zoneSchema = zoneSchema; exports.elementSchema = elementSchema; exports.backgroundSchema = backgroundSchema; exports.metaSchema = metaSchema; exports.layoutSchema = layoutSchema; exports.spanishParseOptions = spanishParseOptions; exports.applyTransform = applyTransform; exports.bbox = bbox; exports.pointInPolygon = pointInPolygon; exports.distance = distance; exports.placeTypeBounds = placeTypeBounds; exports.zoneArc = zoneArc; exports.zoneLocalSize = zoneLocalSize; exports.zoneBounds = zoneBounds; exports.pointInZone = pointInZone; exports.zoneOutline = zoneOutline; exports.zoneLabelSize = zoneLabelSize; exports.zoneWithLocalSize = zoneWithLocalSize; exports.expandSeatBlock = expandSeatBlock; exports.TABLE_RADIUS = TABLE_RADIUS; exports.TABLE_WIDTH = TABLE_WIDTH; exports.TABLE_HEIGHT = TABLE_HEIGHT; exports.PLACE_OFFSET = PLACE_OFFSET; exports.expandTable = expandTable; exports.expand = expand; exports.SpatialIndex = SpatialIndex; exports.CommandError = CommandError; exports.applyCommand = applyCommand; exports.HISTORY_LIMIT = HISTORY_LIMIT; exports.History = History; exports.findLockViolations = findLockViolations; exports.DEFAULT_BLOCK = DEFAULT_BLOCK; exports.DEFAULT_TABLE_PLACES = DEFAULT_TABLE_PLACES; exports.DEFAULT_ZONE = DEFAULT_ZONE; exports.newElementId = newElementId; exports.tableSize = tableSize; exports.blockShape = blockShape; exports.createPiece = createPiece; exports.duplicatePiece = duplicatePiece; exports.rotatePiece = rotatePiece; exports.toggleRemovedSeat = toggleRemovedSeat; exports.snapScale = snapScale; exports.scalePiece = scalePiece; exports.canAssign = canAssign; exports.placeTypeCapacity = placeTypeCapacity; exports.nextBlockUnits = nextBlockUnits; exports.capacityViolations = capacityViolations; exports.assignPlaceType = assignPlaceType; exports.rebindPlaceTypes = rebindPlaceTypes; exports.summarize = summarize; exports.DEFAULT_MAX_SELECTION = DEFAULT_MAX_SELECTION; exports.unitStates = unitStates; exports.toggleUnit = toggleUnit; exports.CURRENT_VERSION = CURRENT_VERSION; exports.LayoutError = LayoutError; exports.migrate = migrate; exports.VERSION = VERSION;
|
|
1406
|
+
exports.LATIN_ALPHABET = LATIN_ALPHABET; exports.SPANISH_ALPHABET = SPANISH_ALPHABET; exports.letterLabel = letterLabel; exports.letterIndex = letterIndex; exports.labelSequence = labelSequence; exports.expandLabels = expandLabels; exports.ID_SEP = ID_SEP; exports.seatUnitId = seatUnitId; exports.placeUnitId = placeUnitId; exports.parseUnitId = parseUnitId; exports.landmarks = landmarks; exports.landmarkById = landmarkById; exports.MAX_UNITS = MAX_UNITS; exports.MAX_ID_LENGTH = MAX_ID_LENGTH; exports.MAX_NAME_LENGTH = MAX_NAME_LENGTH; exports.MAX_REF_LENGTH = MAX_REF_LENGTH; exports.MAX_TABLE_LABEL_LENGTH = MAX_TABLE_LABEL_LENGTH; exports.MAX_SRC_LENGTH = MAX_SRC_LENGTH; exports.MAX_ELEMENTS = MAX_ELEMENTS; exports.MAX_LETTERS_START = MAX_LETTERS_START; exports.MAX_SKIP = MAX_SKIP; exports.MIN_SCALE = MIN_SCALE; exports.MAX_SCALE = MAX_SCALE; exports.MAX_ROWS = MAX_ROWS; exports.MAX_COLS = MAX_COLS; exports.MAX_COORD = MAX_COORD; exports.MAX_SPACING = MAX_SPACING; exports.MAX_SIZE = MAX_SIZE; exports.idSchema = idSchema; exports.rotationSchema = rotationSchema; exports.transformSchema = transformSchema; exports.labelRuleSchema = labelRuleSchema; exports.placeTypeLinkSchema = placeTypeLinkSchema; exports.seatBlockSchema = seatBlockSchema; exports.tableSchema = tableSchema; exports.landmarkSchema = landmarkSchema; exports.zoneSchema = zoneSchema; exports.elementSchema = elementSchema; exports.backgroundSchema = backgroundSchema; exports.metaSchema = metaSchema; exports.layoutSchema = layoutSchema; exports.spanishParseOptions = spanishParseOptions; exports.applyTransform = applyTransform; exports.bbox = bbox; exports.pointInPolygon = pointInPolygon; exports.distance = distance; exports.placeTypeBounds = placeTypeBounds; exports.zoneArc = zoneArc; exports.zoneLocalSize = zoneLocalSize; exports.zoneBounds = zoneBounds; exports.pointInZone = pointInZone; exports.zoneOutline = zoneOutline; exports.zoneLabelSize = zoneLabelSize; exports.zoneWithLocalSize = zoneWithLocalSize; exports.expandSeatBlock = expandSeatBlock; exports.TABLE_RADIUS = TABLE_RADIUS; exports.TABLE_WIDTH = TABLE_WIDTH; exports.TABLE_HEIGHT = TABLE_HEIGHT; exports.PLACE_OFFSET = PLACE_OFFSET; exports.expandTable = expandTable; exports.expand = expand; exports.SpatialIndex = SpatialIndex; exports.CommandError = CommandError; exports.applyCommand = applyCommand; exports.HISTORY_LIMIT = HISTORY_LIMIT; exports.History = History; exports.findLockViolations = findLockViolations; exports.DEFAULT_BLOCK = DEFAULT_BLOCK; exports.DEFAULT_TABLE_PLACES = DEFAULT_TABLE_PLACES; exports.DEFAULT_ZONE = DEFAULT_ZONE; exports.newElementId = newElementId; exports.tableSize = tableSize; exports.blockShape = blockShape; exports.createPiece = createPiece; exports.duplicatePiece = duplicatePiece; exports.rotatePiece = rotatePiece; exports.toggleRemovedSeat = toggleRemovedSeat; exports.toggleReservedSeat = toggleReservedSeat; exports.toggleReservedTable = toggleReservedTable; exports.snapScale = snapScale; exports.scalePiece = scalePiece; exports.canAssign = canAssign; exports.placeTypeCapacity = placeTypeCapacity; exports.nextBlockUnits = nextBlockUnits; exports.capacityViolations = capacityViolations; exports.assignPlaceType = assignPlaceType; exports.rebindPlaceTypes = rebindPlaceTypes; exports.summarize = summarize; exports.DEFAULT_MAX_SELECTION = DEFAULT_MAX_SELECTION; exports.unitStates = unitStates; exports.toggleUnit = toggleUnit; exports.CURRENT_VERSION = CURRENT_VERSION; exports.LayoutError = LayoutError; exports.migrate = migrate; exports.VERSION = VERSION;
|
package/dist/index.cjs
CHANGED
|
@@ -92,9 +92,9 @@
|
|
|
92
92
|
|
|
93
93
|
|
|
94
94
|
|
|
95
|
-
var _chunkUWCMN6Q7cjs = require('./chunk-UWCMN6Q7.cjs');
|
|
96
95
|
|
|
97
96
|
|
|
97
|
+
var _chunkYLV7JK57cjs = require('./chunk-YLV7JK57.cjs');
|
|
98
98
|
|
|
99
99
|
|
|
100
100
|
|
|
@@ -187,4 +187,8 @@ var _chunkUWCMN6Q7cjs = require('./chunk-UWCMN6Q7.cjs');
|
|
|
187
187
|
|
|
188
188
|
|
|
189
189
|
|
|
190
|
-
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
exports.CURRENT_VERSION = _chunkYLV7JK57cjs.CURRENT_VERSION; exports.CommandError = _chunkYLV7JK57cjs.CommandError; exports.DEFAULT_BLOCK = _chunkYLV7JK57cjs.DEFAULT_BLOCK; exports.DEFAULT_MAX_SELECTION = _chunkYLV7JK57cjs.DEFAULT_MAX_SELECTION; exports.DEFAULT_TABLE_PLACES = _chunkYLV7JK57cjs.DEFAULT_TABLE_PLACES; exports.DEFAULT_ZONE = _chunkYLV7JK57cjs.DEFAULT_ZONE; exports.HISTORY_LIMIT = _chunkYLV7JK57cjs.HISTORY_LIMIT; exports.History = _chunkYLV7JK57cjs.History; exports.ID_SEP = _chunkYLV7JK57cjs.ID_SEP; exports.LATIN_ALPHABET = _chunkYLV7JK57cjs.LATIN_ALPHABET; exports.LayoutError = _chunkYLV7JK57cjs.LayoutError; exports.MAX_COLS = _chunkYLV7JK57cjs.MAX_COLS; exports.MAX_COORD = _chunkYLV7JK57cjs.MAX_COORD; exports.MAX_ELEMENTS = _chunkYLV7JK57cjs.MAX_ELEMENTS; exports.MAX_ID_LENGTH = _chunkYLV7JK57cjs.MAX_ID_LENGTH; exports.MAX_LETTERS_START = _chunkYLV7JK57cjs.MAX_LETTERS_START; exports.MAX_NAME_LENGTH = _chunkYLV7JK57cjs.MAX_NAME_LENGTH; exports.MAX_REF_LENGTH = _chunkYLV7JK57cjs.MAX_REF_LENGTH; exports.MAX_ROWS = _chunkYLV7JK57cjs.MAX_ROWS; exports.MAX_SCALE = _chunkYLV7JK57cjs.MAX_SCALE; exports.MAX_SIZE = _chunkYLV7JK57cjs.MAX_SIZE; exports.MAX_SKIP = _chunkYLV7JK57cjs.MAX_SKIP; exports.MAX_SPACING = _chunkYLV7JK57cjs.MAX_SPACING; exports.MAX_SRC_LENGTH = _chunkYLV7JK57cjs.MAX_SRC_LENGTH; exports.MAX_TABLE_LABEL_LENGTH = _chunkYLV7JK57cjs.MAX_TABLE_LABEL_LENGTH; exports.MAX_UNITS = _chunkYLV7JK57cjs.MAX_UNITS; exports.MIN_SCALE = _chunkYLV7JK57cjs.MIN_SCALE; exports.PLACE_OFFSET = _chunkYLV7JK57cjs.PLACE_OFFSET; exports.SPANISH_ALPHABET = _chunkYLV7JK57cjs.SPANISH_ALPHABET; exports.SpatialIndex = _chunkYLV7JK57cjs.SpatialIndex; exports.TABLE_HEIGHT = _chunkYLV7JK57cjs.TABLE_HEIGHT; exports.TABLE_RADIUS = _chunkYLV7JK57cjs.TABLE_RADIUS; exports.TABLE_WIDTH = _chunkYLV7JK57cjs.TABLE_WIDTH; exports.VERSION = _chunkYLV7JK57cjs.VERSION; exports.applyCommand = _chunkYLV7JK57cjs.applyCommand; exports.applyTransform = _chunkYLV7JK57cjs.applyTransform; exports.assignPlaceType = _chunkYLV7JK57cjs.assignPlaceType; exports.backgroundSchema = _chunkYLV7JK57cjs.backgroundSchema; exports.bbox = _chunkYLV7JK57cjs.bbox; exports.blockShape = _chunkYLV7JK57cjs.blockShape; exports.canAssign = _chunkYLV7JK57cjs.canAssign; exports.capacityViolations = _chunkYLV7JK57cjs.capacityViolations; exports.createPiece = _chunkYLV7JK57cjs.createPiece; exports.distance = _chunkYLV7JK57cjs.distance; exports.duplicatePiece = _chunkYLV7JK57cjs.duplicatePiece; exports.elementSchema = _chunkYLV7JK57cjs.elementSchema; exports.expand = _chunkYLV7JK57cjs.expand; exports.expandLabels = _chunkYLV7JK57cjs.expandLabels; exports.expandSeatBlock = _chunkYLV7JK57cjs.expandSeatBlock; exports.expandTable = _chunkYLV7JK57cjs.expandTable; exports.findLockViolations = _chunkYLV7JK57cjs.findLockViolations; exports.idSchema = _chunkYLV7JK57cjs.idSchema; exports.labelRuleSchema = _chunkYLV7JK57cjs.labelRuleSchema; exports.labelSequence = _chunkYLV7JK57cjs.labelSequence; exports.landmarkById = _chunkYLV7JK57cjs.landmarkById; exports.landmarkSchema = _chunkYLV7JK57cjs.landmarkSchema; exports.landmarks = _chunkYLV7JK57cjs.landmarks; exports.layoutSchema = _chunkYLV7JK57cjs.layoutSchema; exports.letterIndex = _chunkYLV7JK57cjs.letterIndex; exports.letterLabel = _chunkYLV7JK57cjs.letterLabel; exports.metaSchema = _chunkYLV7JK57cjs.metaSchema; exports.migrate = _chunkYLV7JK57cjs.migrate; exports.newElementId = _chunkYLV7JK57cjs.newElementId; exports.nextBlockUnits = _chunkYLV7JK57cjs.nextBlockUnits; exports.parseUnitId = _chunkYLV7JK57cjs.parseUnitId; exports.placeTypeBounds = _chunkYLV7JK57cjs.placeTypeBounds; exports.placeTypeCapacity = _chunkYLV7JK57cjs.placeTypeCapacity; exports.placeTypeLinkSchema = _chunkYLV7JK57cjs.placeTypeLinkSchema; exports.placeUnitId = _chunkYLV7JK57cjs.placeUnitId; exports.pointInPolygon = _chunkYLV7JK57cjs.pointInPolygon; exports.pointInZone = _chunkYLV7JK57cjs.pointInZone; exports.rebindPlaceTypes = _chunkYLV7JK57cjs.rebindPlaceTypes; exports.rotatePiece = _chunkYLV7JK57cjs.rotatePiece; exports.rotationSchema = _chunkYLV7JK57cjs.rotationSchema; exports.scalePiece = _chunkYLV7JK57cjs.scalePiece; exports.seatBlockSchema = _chunkYLV7JK57cjs.seatBlockSchema; exports.seatUnitId = _chunkYLV7JK57cjs.seatUnitId; exports.snapScale = _chunkYLV7JK57cjs.snapScale; exports.spanishParseOptions = _chunkYLV7JK57cjs.spanishParseOptions; exports.summarize = _chunkYLV7JK57cjs.summarize; exports.tableSchema = _chunkYLV7JK57cjs.tableSchema; exports.tableSize = _chunkYLV7JK57cjs.tableSize; exports.toggleRemovedSeat = _chunkYLV7JK57cjs.toggleRemovedSeat; exports.toggleReservedSeat = _chunkYLV7JK57cjs.toggleReservedSeat; exports.toggleReservedTable = _chunkYLV7JK57cjs.toggleReservedTable; exports.toggleUnit = _chunkYLV7JK57cjs.toggleUnit; exports.transformSchema = _chunkYLV7JK57cjs.transformSchema; exports.unitStates = _chunkYLV7JK57cjs.unitStates; exports.zoneArc = _chunkYLV7JK57cjs.zoneArc; exports.zoneBounds = _chunkYLV7JK57cjs.zoneBounds; exports.zoneLabelSize = _chunkYLV7JK57cjs.zoneLabelSize; exports.zoneLocalSize = _chunkYLV7JK57cjs.zoneLocalSize; exports.zoneOutline = _chunkYLV7JK57cjs.zoneOutline; exports.zoneSchema = _chunkYLV7JK57cjs.zoneSchema; exports.zoneWithLocalSize = _chunkYLV7JK57cjs.zoneWithLocalSize;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { L as LabelRule, a as Layout, S as SellableUnit, B as Box, Z as Zone, P as Point, E as Element, b as Background } from './place-types-
|
|
2
|
-
export { C as CapacityViolation, D as DEFAULT_BLOCK, c as DEFAULT_TABLE_PLACES, d as DEFAULT_ZONE, e as Landmark, f as LockViolation, M as MAX_COLS, g as MAX_COORD, h as MAX_ELEMENTS, i as MAX_ID_LENGTH, j as MAX_LETTERS_START, k as MAX_NAME_LENGTH, l as MAX_REF_LENGTH, m as MAX_ROWS, n as MAX_SCALE, o as MAX_SIZE, p as MAX_SKIP, q as MAX_SPACING, r as MAX_SRC_LENGTH, s as MAX_TABLE_LABEL_LENGTH, t as MAX_UNITS, u as MIN_SCALE, v as PLACE_OFFSET, w as PieceKind, x as PieceOptions, y as PlaceTypeAccepts, z as PlaceTypeLink, A as PlaceTypeOption, F as PlanSummary, R as Rotation, G as SeatBlock, T as TABLE_HEIGHT, H as TABLE_RADIUS, I as TABLE_WIDTH, J as Table, K as Transform, N as applyTransform, O as assignPlaceType, Q as backgroundSchema, U as bbox, V as blockShape, W as canAssign, X as capacityViolations, Y as createPiece, _ as distance, $ as duplicatePiece, a0 as elementSchema, a1 as expand, a2 as expandSeatBlock, a3 as expandTable, a4 as findLockViolations, a5 as idSchema, a6 as labelRuleSchema, a7 as landmarkSchema, a8 as layoutSchema, a9 as metaSchema, aa as newElementId, ab as nextBlockUnits, ac as placeTypeCapacity, ad as placeTypeLinkSchema, ae as pointInPolygon, af as rebindPlaceTypes, ag as rotatePiece, ah as rotationSchema, ai as scalePiece, aj as seatBlockSchema, ak as snapScale, al as spanishParseOptions, am as summarize, an as tableSchema, ao as tableSize, ap as toggleRemovedSeat, aq as
|
|
1
|
+
import { L as LabelRule, a as Layout, S as SellableUnit, B as Box, Z as Zone, P as Point, E as Element, b as Background } from './place-types-DNfiQXGU.cjs';
|
|
2
|
+
export { C as CapacityViolation, D as DEFAULT_BLOCK, c as DEFAULT_TABLE_PLACES, d as DEFAULT_ZONE, e as Landmark, f as LockViolation, M as MAX_COLS, g as MAX_COORD, h as MAX_ELEMENTS, i as MAX_ID_LENGTH, j as MAX_LETTERS_START, k as MAX_NAME_LENGTH, l as MAX_REF_LENGTH, m as MAX_ROWS, n as MAX_SCALE, o as MAX_SIZE, p as MAX_SKIP, q as MAX_SPACING, r as MAX_SRC_LENGTH, s as MAX_TABLE_LABEL_LENGTH, t as MAX_UNITS, u as MIN_SCALE, v as PLACE_OFFSET, w as PieceKind, x as PieceOptions, y as PlaceTypeAccepts, z as PlaceTypeLink, A as PlaceTypeOption, F as PlanSummary, R as Rotation, G as SeatBlock, T as TABLE_HEIGHT, H as TABLE_RADIUS, I as TABLE_WIDTH, J as Table, K as Transform, N as applyTransform, O as assignPlaceType, Q as backgroundSchema, U as bbox, V as blockShape, W as canAssign, X as capacityViolations, Y as createPiece, _ as distance, $ as duplicatePiece, a0 as elementSchema, a1 as expand, a2 as expandSeatBlock, a3 as expandTable, a4 as findLockViolations, a5 as idSchema, a6 as labelRuleSchema, a7 as landmarkSchema, a8 as layoutSchema, a9 as metaSchema, aa as newElementId, ab as nextBlockUnits, ac as placeTypeCapacity, ad as placeTypeLinkSchema, ae as pointInPolygon, af as rebindPlaceTypes, ag as rotatePiece, ah as rotationSchema, ai as scalePiece, aj as seatBlockSchema, ak as snapScale, al as spanishParseOptions, am as summarize, an as tableSchema, ao as tableSize, ap as toggleRemovedSeat, aq as toggleReservedSeat, ar as toggleReservedTable, as as transformSchema, at as zoneSchema } from './place-types-DNfiQXGU.cjs';
|
|
3
3
|
import 'zod';
|
|
4
4
|
|
|
5
5
|
declare const LATIN_ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
|
@@ -256,6 +256,6 @@ interface LandmarkDef {
|
|
|
256
256
|
declare const landmarks: readonly LandmarkDef[];
|
|
257
257
|
declare function landmarkById(id: string): LandmarkDef | null;
|
|
258
258
|
|
|
259
|
-
declare const VERSION = "0.
|
|
259
|
+
declare const VERSION = "0.11.0";
|
|
260
260
|
|
|
261
261
|
export { Background, Box, CURRENT_VERSION, type Command, CommandError, DEFAULT_MAX_SELECTION, Element, HISTORY_LIMIT, History, ID_SEP, LATIN_ALPHABET, type LabelAlphabet, type LabelPattern, LabelRule, type LandmarkDef, type LandmarkGroup, Layout, LayoutError, Point, SPANISH_ALPHABET, SellableUnit, SpatialIndex, type ToggleResult, type UnitState, VERSION, Zone, type ZoneArc, applyCommand, expandLabels, labelSequence, landmarkById, landmarks, letterIndex, letterLabel, migrate, parseUnitId, placeTypeBounds, placeUnitId, pointInZone, seatUnitId, toggleUnit, unitStates, zoneArc, zoneBounds, zoneLabelSize, zoneLocalSize, zoneOutline, zoneWithLocalSize };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { L as LabelRule, a as Layout, S as SellableUnit, B as Box, Z as Zone, P as Point, E as Element, b as Background } from './place-types-
|
|
2
|
-
export { C as CapacityViolation, D as DEFAULT_BLOCK, c as DEFAULT_TABLE_PLACES, d as DEFAULT_ZONE, e as Landmark, f as LockViolation, M as MAX_COLS, g as MAX_COORD, h as MAX_ELEMENTS, i as MAX_ID_LENGTH, j as MAX_LETTERS_START, k as MAX_NAME_LENGTH, l as MAX_REF_LENGTH, m as MAX_ROWS, n as MAX_SCALE, o as MAX_SIZE, p as MAX_SKIP, q as MAX_SPACING, r as MAX_SRC_LENGTH, s as MAX_TABLE_LABEL_LENGTH, t as MAX_UNITS, u as MIN_SCALE, v as PLACE_OFFSET, w as PieceKind, x as PieceOptions, y as PlaceTypeAccepts, z as PlaceTypeLink, A as PlaceTypeOption, F as PlanSummary, R as Rotation, G as SeatBlock, T as TABLE_HEIGHT, H as TABLE_RADIUS, I as TABLE_WIDTH, J as Table, K as Transform, N as applyTransform, O as assignPlaceType, Q as backgroundSchema, U as bbox, V as blockShape, W as canAssign, X as capacityViolations, Y as createPiece, _ as distance, $ as duplicatePiece, a0 as elementSchema, a1 as expand, a2 as expandSeatBlock, a3 as expandTable, a4 as findLockViolations, a5 as idSchema, a6 as labelRuleSchema, a7 as landmarkSchema, a8 as layoutSchema, a9 as metaSchema, aa as newElementId, ab as nextBlockUnits, ac as placeTypeCapacity, ad as placeTypeLinkSchema, ae as pointInPolygon, af as rebindPlaceTypes, ag as rotatePiece, ah as rotationSchema, ai as scalePiece, aj as seatBlockSchema, ak as snapScale, al as spanishParseOptions, am as summarize, an as tableSchema, ao as tableSize, ap as toggleRemovedSeat, aq as
|
|
1
|
+
import { L as LabelRule, a as Layout, S as SellableUnit, B as Box, Z as Zone, P as Point, E as Element, b as Background } from './place-types-DNfiQXGU.js';
|
|
2
|
+
export { C as CapacityViolation, D as DEFAULT_BLOCK, c as DEFAULT_TABLE_PLACES, d as DEFAULT_ZONE, e as Landmark, f as LockViolation, M as MAX_COLS, g as MAX_COORD, h as MAX_ELEMENTS, i as MAX_ID_LENGTH, j as MAX_LETTERS_START, k as MAX_NAME_LENGTH, l as MAX_REF_LENGTH, m as MAX_ROWS, n as MAX_SCALE, o as MAX_SIZE, p as MAX_SKIP, q as MAX_SPACING, r as MAX_SRC_LENGTH, s as MAX_TABLE_LABEL_LENGTH, t as MAX_UNITS, u as MIN_SCALE, v as PLACE_OFFSET, w as PieceKind, x as PieceOptions, y as PlaceTypeAccepts, z as PlaceTypeLink, A as PlaceTypeOption, F as PlanSummary, R as Rotation, G as SeatBlock, T as TABLE_HEIGHT, H as TABLE_RADIUS, I as TABLE_WIDTH, J as Table, K as Transform, N as applyTransform, O as assignPlaceType, Q as backgroundSchema, U as bbox, V as blockShape, W as canAssign, X as capacityViolations, Y as createPiece, _ as distance, $ as duplicatePiece, a0 as elementSchema, a1 as expand, a2 as expandSeatBlock, a3 as expandTable, a4 as findLockViolations, a5 as idSchema, a6 as labelRuleSchema, a7 as landmarkSchema, a8 as layoutSchema, a9 as metaSchema, aa as newElementId, ab as nextBlockUnits, ac as placeTypeCapacity, ad as placeTypeLinkSchema, ae as pointInPolygon, af as rebindPlaceTypes, ag as rotatePiece, ah as rotationSchema, ai as scalePiece, aj as seatBlockSchema, ak as snapScale, al as spanishParseOptions, am as summarize, an as tableSchema, ao as tableSize, ap as toggleRemovedSeat, aq as toggleReservedSeat, ar as toggleReservedTable, as as transformSchema, at as zoneSchema } from './place-types-DNfiQXGU.js';
|
|
3
3
|
import 'zod';
|
|
4
4
|
|
|
5
5
|
declare const LATIN_ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
|
@@ -256,6 +256,6 @@ interface LandmarkDef {
|
|
|
256
256
|
declare const landmarks: readonly LandmarkDef[];
|
|
257
257
|
declare function landmarkById(id: string): LandmarkDef | null;
|
|
258
258
|
|
|
259
|
-
declare const VERSION = "0.
|
|
259
|
+
declare const VERSION = "0.11.0";
|
|
260
260
|
|
|
261
261
|
export { Background, Box, CURRENT_VERSION, type Command, CommandError, DEFAULT_MAX_SELECTION, Element, HISTORY_LIMIT, History, ID_SEP, LATIN_ALPHABET, type LabelAlphabet, type LabelPattern, LabelRule, type LandmarkDef, type LandmarkGroup, Layout, LayoutError, Point, SPANISH_ALPHABET, SellableUnit, SpatialIndex, type ToggleResult, type UnitState, VERSION, Zone, type ZoneArc, applyCommand, expandLabels, labelSequence, landmarkById, landmarks, letterIndex, letterLabel, migrate, parseUnitId, placeTypeBounds, placeUnitId, pointInZone, seatUnitId, toggleUnit, unitStates, zoneArc, zoneBounds, zoneLabelSize, zoneLocalSize, zoneOutline, zoneWithLocalSize };
|
package/dist/index.js
CHANGED
|
@@ -82,6 +82,8 @@ import {
|
|
|
82
82
|
tableSchema,
|
|
83
83
|
tableSize,
|
|
84
84
|
toggleRemovedSeat,
|
|
85
|
+
toggleReservedSeat,
|
|
86
|
+
toggleReservedTable,
|
|
85
87
|
toggleUnit,
|
|
86
88
|
transformSchema,
|
|
87
89
|
unitStates,
|
|
@@ -92,7 +94,7 @@ import {
|
|
|
92
94
|
zoneOutline,
|
|
93
95
|
zoneSchema,
|
|
94
96
|
zoneWithLocalSize
|
|
95
|
-
} from "./chunk-
|
|
97
|
+
} from "./chunk-IRNVYNYV.js";
|
|
96
98
|
export {
|
|
97
99
|
CURRENT_VERSION,
|
|
98
100
|
CommandError,
|
|
@@ -177,6 +179,8 @@ export {
|
|
|
177
179
|
tableSchema,
|
|
178
180
|
tableSize,
|
|
179
181
|
toggleRemovedSeat,
|
|
182
|
+
toggleReservedSeat,
|
|
183
|
+
toggleReservedTable,
|
|
180
184
|
toggleUnit,
|
|
181
185
|
transformSchema,
|
|
182
186
|
unitStates,
|
|
@@ -135,6 +135,7 @@ declare const seatBlockSchema: z.ZodObject<{
|
|
|
135
135
|
curve: z.ZodDefault<z.ZodNumber>;
|
|
136
136
|
scale: z.ZodDefault<z.ZodNumber>;
|
|
137
137
|
removed: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
138
|
+
reserved: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
138
139
|
placeType: z.ZodDefault<z.ZodNullable<z.ZodObject<{
|
|
139
140
|
ref: z.ZodString;
|
|
140
141
|
name: z.ZodString;
|
|
@@ -159,6 +160,8 @@ declare const tableSchema: z.ZodObject<{
|
|
|
159
160
|
perPlace: "perPlace";
|
|
160
161
|
}>;
|
|
161
162
|
scale: z.ZodDefault<z.ZodNumber>;
|
|
163
|
+
reserved: z.ZodOptional<z.ZodBoolean>;
|
|
164
|
+
reservedPlaces: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
162
165
|
placeType: z.ZodDefault<z.ZodNullable<z.ZodObject<{
|
|
163
166
|
ref: z.ZodString;
|
|
164
167
|
name: z.ZodString;
|
|
@@ -255,6 +258,7 @@ declare const elementSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
255
258
|
curve: z.ZodDefault<z.ZodNumber>;
|
|
256
259
|
scale: z.ZodDefault<z.ZodNumber>;
|
|
257
260
|
removed: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
261
|
+
reserved: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
258
262
|
placeType: z.ZodDefault<z.ZodNullable<z.ZodObject<{
|
|
259
263
|
ref: z.ZodString;
|
|
260
264
|
name: z.ZodString;
|
|
@@ -278,6 +282,8 @@ declare const elementSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
278
282
|
perPlace: "perPlace";
|
|
279
283
|
}>;
|
|
280
284
|
scale: z.ZodDefault<z.ZodNumber>;
|
|
285
|
+
reserved: z.ZodOptional<z.ZodBoolean>;
|
|
286
|
+
reservedPlaces: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
281
287
|
placeType: z.ZodDefault<z.ZodNullable<z.ZodObject<{
|
|
282
288
|
ref: z.ZodString;
|
|
283
289
|
name: z.ZodString;
|
|
@@ -413,6 +419,7 @@ declare const layoutSchema: z.ZodObject<{
|
|
|
413
419
|
curve: z.ZodDefault<z.ZodNumber>;
|
|
414
420
|
scale: z.ZodDefault<z.ZodNumber>;
|
|
415
421
|
removed: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
422
|
+
reserved: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
416
423
|
placeType: z.ZodDefault<z.ZodNullable<z.ZodObject<{
|
|
417
424
|
ref: z.ZodString;
|
|
418
425
|
name: z.ZodString;
|
|
@@ -436,6 +443,8 @@ declare const layoutSchema: z.ZodObject<{
|
|
|
436
443
|
perPlace: "perPlace";
|
|
437
444
|
}>;
|
|
438
445
|
scale: z.ZodDefault<z.ZodNumber>;
|
|
446
|
+
reserved: z.ZodOptional<z.ZodBoolean>;
|
|
447
|
+
reservedPlaces: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
439
448
|
placeType: z.ZodDefault<z.ZodNullable<z.ZodObject<{
|
|
440
449
|
ref: z.ZodString;
|
|
441
450
|
name: z.ZodString;
|
|
@@ -518,6 +527,8 @@ type SellableUnit = {
|
|
|
518
527
|
/** Etiqueta de la mesa ("4"), tanto en mesa entera como en sus lugares. */
|
|
519
528
|
table?: string;
|
|
520
529
|
place?: number;
|
|
530
|
+
/** «Sólo con invitación»: se ve en el mapa pero el público no la compra. */
|
|
531
|
+
inviteOnly: boolean;
|
|
521
532
|
};
|
|
522
533
|
declare function expandSeatBlock(block: SeatBlock): SellableUnit[];
|
|
523
534
|
declare const TABLE_RADIUS = 30;
|
|
@@ -544,7 +555,9 @@ type LockViolation = {
|
|
|
544
555
|
/**
|
|
545
556
|
* IDs bloqueados (vendidos) que `after` haría desaparecer, cambiar de etiqueta, pasar
|
|
546
557
|
* a otro tipo de lugar o cambiar de lugar físico adentro de la pieza (renumerar
|
|
547
|
-
* empezando en otra letra o número, saltear, invertir el sentido)
|
|
558
|
+
* empezando en otra letra o número, saltear, invertir el sentido) o pasar a «sólo con
|
|
559
|
+
* invitación» o dejar de serlo (ya se vendió). Una mesa entera vendida tampoco cambia
|
|
560
|
+
* de personas: quien la compró recibió una entrada por persona. Mover, girar,
|
|
548
561
|
* escalar o curvar la pieza entera no cambia nada de eso y no viola nada.
|
|
549
562
|
* Las zonas no cuentan: no tienen unidades vendidas por lugar.
|
|
550
563
|
* Orden estable: el del documento `before`.
|
|
@@ -598,7 +611,15 @@ declare function createPiece(kind: PieceKind, id: string, at: Point, layout: Lay
|
|
|
598
611
|
declare function duplicatePiece(el: Element, id: string, layout: Layout): Element;
|
|
599
612
|
/** Un cuarto de vuelta sobre su centro. El bloque se ancla en su primera butaca: hay que corregirle el ancla. */
|
|
600
613
|
declare function rotatePiece(el: Element): Element;
|
|
614
|
+
/** Una butaca sacada deja de ser «sólo con invitación»: si vuelve, vuelve a la venta. */
|
|
601
615
|
declare function toggleRemovedSeat(block: SeatBlock, unitId: string): SeatBlock;
|
|
616
|
+
/** Marca o desmarca una butaca «sólo con invitación». Una sacada no se marca: no existe. */
|
|
617
|
+
declare function toggleReservedSeat(block: SeatBlock, unitId: string): SeatBlock;
|
|
618
|
+
/**
|
|
619
|
+
* Mesa entera: `place` sin pasar alterna la mesa. Mesa compartida: alterna el lugar `place`
|
|
620
|
+
* (1 en adelante). Lo del otro modo queda guardado para cuando se vuelva a él.
|
|
621
|
+
*/
|
|
622
|
+
declare function toggleReservedTable(table: Table, place?: number): Table;
|
|
602
623
|
/** El tamaño al paso más cercano (0.05 = 5 %), dentro de lo que acepta el esquema. */
|
|
603
624
|
declare function snapScale(scale: number, step?: number): number;
|
|
604
625
|
/**
|
|
@@ -678,4 +699,4 @@ type PlanSummary = {
|
|
|
678
699
|
};
|
|
679
700
|
declare function summarize(layout: Layout): PlanSummary;
|
|
680
701
|
|
|
681
|
-
export { duplicatePiece as $, type PlaceTypeOption as A, type Box as B, type CapacityViolation as C, DEFAULT_BLOCK as D, type Element as E, type PlanSummary as F, type SeatBlock as G, TABLE_RADIUS as H, TABLE_WIDTH as I, type Table as J, type Transform as K, type LabelRule as L, MAX_COLS as M, applyTransform as N, assignPlaceType as O, type Point as P, backgroundSchema as Q, type Rotation as R, type SellableUnit as S, TABLE_HEIGHT as T, bbox as U, blockShape as V, canAssign as W, capacityViolations as X, createPiece as Y, type Zone as Z, distance as _, type Layout as a, elementSchema as a0, expand as a1, expandSeatBlock as a2, expandTable as a3, findLockViolations as a4, idSchema as a5, labelRuleSchema as a6, landmarkSchema as a7, layoutSchema as a8, metaSchema as a9, newElementId as aa, nextBlockUnits as ab, placeTypeCapacity as ac, placeTypeLinkSchema as ad, pointInPolygon as ae, rebindPlaceTypes as af, rotatePiece as ag, rotationSchema as ah, scalePiece as ai, seatBlockSchema as aj, snapScale as ak, spanishParseOptions as al, summarize as am, tableSchema as an, tableSize as ao, toggleRemovedSeat as ap,
|
|
702
|
+
export { duplicatePiece as $, type PlaceTypeOption as A, type Box as B, type CapacityViolation as C, DEFAULT_BLOCK as D, type Element as E, type PlanSummary as F, type SeatBlock as G, TABLE_RADIUS as H, TABLE_WIDTH as I, type Table as J, type Transform as K, type LabelRule as L, MAX_COLS as M, applyTransform as N, assignPlaceType as O, type Point as P, backgroundSchema as Q, type Rotation as R, type SellableUnit as S, TABLE_HEIGHT as T, bbox as U, blockShape as V, canAssign as W, capacityViolations as X, createPiece as Y, type Zone as Z, distance as _, type Layout as a, elementSchema as a0, expand as a1, expandSeatBlock as a2, expandTable as a3, findLockViolations as a4, idSchema as a5, labelRuleSchema as a6, landmarkSchema as a7, layoutSchema as a8, metaSchema as a9, newElementId as aa, nextBlockUnits as ab, placeTypeCapacity as ac, placeTypeLinkSchema as ad, pointInPolygon as ae, rebindPlaceTypes as af, rotatePiece as ag, rotationSchema as ah, scalePiece as ai, seatBlockSchema as aj, snapScale as ak, spanishParseOptions as al, summarize as am, tableSchema as an, tableSize as ao, toggleRemovedSeat as ap, toggleReservedSeat as aq, toggleReservedTable as ar, transformSchema as as, zoneSchema as at, type Background as b, DEFAULT_TABLE_PLACES as c, DEFAULT_ZONE as d, type Landmark as e, type LockViolation as f, MAX_COORD as g, MAX_ELEMENTS as h, MAX_ID_LENGTH as i, MAX_LETTERS_START as j, MAX_NAME_LENGTH as k, MAX_REF_LENGTH as l, MAX_ROWS as m, MAX_SCALE as n, MAX_SIZE as o, MAX_SKIP as p, MAX_SPACING as q, MAX_SRC_LENGTH as r, MAX_TABLE_LABEL_LENGTH as s, MAX_UNITS as t, MIN_SCALE as u, PLACE_OFFSET as v, type PieceKind as w, type PieceOptions as x, type PlaceTypeAccepts as y, type PlaceTypeLink as z };
|