venuekit 0.10.0 → 0.10.1
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/README.md +286 -280
- package/dist/{chunk-5H5QKXPV.js → chunk-4FCSKCFJ.js} +1 -1
- package/dist/{chunk-47ILVPKZ.cjs → chunk-LFRA3GBP.cjs} +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/react.cjs +97 -97
- package/dist/react.d.cts +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/react.js +2 -2
- package/package.json +1 -1
package/dist/react.cjs
CHANGED
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
|
|
46
46
|
|
|
47
47
|
|
|
48
|
-
var
|
|
48
|
+
var _chunkLFRA3GBPcjs = require('./chunk-LFRA3GBP.cjs');
|
|
49
49
|
|
|
50
50
|
// ../canvas/src/camera.ts
|
|
51
51
|
var MIN_ZOOM = 0.05;
|
|
@@ -133,7 +133,7 @@ function reduceGesture(state, camera, viewport, input) {
|
|
|
133
133
|
const [a, b] = list2;
|
|
134
134
|
return {
|
|
135
135
|
// Con dos dedos ya no hay tap posible: `moved` queda en true a propósito.
|
|
136
|
-
state: { pointers, origin: null, moved: true, pinchDistance:
|
|
136
|
+
state: { pointers, origin: null, moved: true, pinchDistance: _chunkLFRA3GBPcjs.distance.call(void 0, a, b) },
|
|
137
137
|
camera
|
|
138
138
|
};
|
|
139
139
|
}
|
|
@@ -146,7 +146,7 @@ function reduceGesture(state, camera, viewport, input) {
|
|
|
146
146
|
const [a, b] = list2;
|
|
147
147
|
const previousA = state.pointers[a.id];
|
|
148
148
|
const previousB = state.pointers[b.id];
|
|
149
|
-
const nextDistance =
|
|
149
|
+
const nextDistance = _chunkLFRA3GBPcjs.distance.call(void 0, a, b);
|
|
150
150
|
const previousDistance = state.pinchDistance;
|
|
151
151
|
if (!previousA || !previousB || !previousDistance || previousDistance < 1e-6 || nextDistance < 1e-6) {
|
|
152
152
|
return { state: { ...state, pointers, pinchDistance: nextDistance }, camera };
|
|
@@ -159,7 +159,7 @@ function reduceGesture(state, camera, viewport, input) {
|
|
|
159
159
|
camera: panBy(zoomed, nextMid.x - previousMid.x, nextMid.y - previousMid.y)
|
|
160
160
|
};
|
|
161
161
|
}
|
|
162
|
-
const movedEnough = state.moved || state.origin !== null &&
|
|
162
|
+
const movedEnough = state.moved || state.origin !== null && _chunkLFRA3GBPcjs.distance.call(void 0, state.origin, pointer) > TAP_SLOP;
|
|
163
163
|
if (!movedEnough) return { state: { ...state, pointers }, camera };
|
|
164
164
|
return {
|
|
165
165
|
state: { ...state, pointers, moved: true },
|
|
@@ -262,7 +262,7 @@ function centredBox(at, width, height, rotation) {
|
|
|
262
262
|
return { minX: at.x - hw, minY: at.y - hh, maxX: at.x + hw, maxY: at.y + hh };
|
|
263
263
|
}
|
|
264
264
|
function tableBodyBox(table) {
|
|
265
|
-
const size =
|
|
265
|
+
const size = _chunkLFRA3GBPcjs.tableSize.call(void 0, table.shape, table.places);
|
|
266
266
|
const k = _nullishCoalesce(table.scale, () => ( 1));
|
|
267
267
|
const [w, h] = "radius" in size ? [size.radius * 2 * k, size.radius * 2 * k] : [size.width * k, size.height * k];
|
|
268
268
|
return centredBox(table.transform, w, h, table.transform.rotation);
|
|
@@ -271,12 +271,12 @@ function elementBounds(_layout, element) {
|
|
|
271
271
|
return pieceBounds(element);
|
|
272
272
|
}
|
|
273
273
|
function pieceBounds(element) {
|
|
274
|
-
if (element.type === "zone") return
|
|
274
|
+
if (element.type === "zone") return _chunkLFRA3GBPcjs.zoneBounds.call(void 0, element);
|
|
275
275
|
if (element.type === "landmark") {
|
|
276
276
|
return centredBox(element.transform, element.width, element.height, element.transform.rotation);
|
|
277
277
|
}
|
|
278
|
-
const units = element.type === "seatBlock" ?
|
|
279
|
-
const own = units.length > 0 ?
|
|
278
|
+
const units = element.type === "seatBlock" ? _chunkLFRA3GBPcjs.expandSeatBlock.call(void 0, element) : _chunkLFRA3GBPcjs.expandTable.call(void 0, element);
|
|
279
|
+
const own = units.length > 0 ? _chunkLFRA3GBPcjs.bbox.call(void 0, units.map((u) => ({ x: u.x, y: u.y }))) : null;
|
|
280
280
|
if (element.type === "table") {
|
|
281
281
|
const body = tableBodyBox(element);
|
|
282
282
|
return own ? {
|
|
@@ -294,7 +294,7 @@ function elementAt(layout, screen, camera, viewport) {
|
|
|
294
294
|
const element = layout.elements[i];
|
|
295
295
|
const box = elementBounds(layout, element);
|
|
296
296
|
if (box && world.x >= box.minX && world.x <= box.maxX && world.y >= box.minY && world.y <= box.maxY) {
|
|
297
|
-
if (element.type === "zone" && !
|
|
297
|
+
if (element.type === "zone" && !_chunkLFRA3GBPcjs.pointInZone.call(void 0, element, world)) continue;
|
|
298
298
|
return element;
|
|
299
299
|
}
|
|
300
300
|
}
|
|
@@ -328,7 +328,7 @@ function unitRadii(layout) {
|
|
|
328
328
|
out.set(el.id, DEFAULT_UNIT_RADIUS * k);
|
|
329
329
|
continue;
|
|
330
330
|
}
|
|
331
|
-
const size =
|
|
331
|
+
const size = _chunkLFRA3GBPcjs.tableSize.call(void 0, el.shape, el.places);
|
|
332
332
|
out.set(el.id, ("radius" in size ? size.radius : Math.max(size.width, size.height) / 2) * k);
|
|
333
333
|
}
|
|
334
334
|
}
|
|
@@ -428,10 +428,10 @@ function buildScene(input) {
|
|
|
428
428
|
strokeWidth: strong ? 2.5 : 1.5,
|
|
429
429
|
...dim(ref) ? { alpha: DIMMED_ALPHA } : {}
|
|
430
430
|
};
|
|
431
|
-
const outline =
|
|
431
|
+
const outline = _chunkLFRA3GBPcjs.zoneOutline.call(void 0, el, ZONE_CORNER);
|
|
432
432
|
if (outline.length > 0) shapes.push({ kind: "polygon", points: outline, ...paint2 });
|
|
433
433
|
else shapes.push({ kind: "rect", x: b.minX, y: b.minY, width: b.maxX - b.minX, height: b.maxY - b.minY, cornerRadius: ZONE_CORNER, ...paint2 });
|
|
434
|
-
const room =
|
|
434
|
+
const room = _chunkLFRA3GBPcjs.zoneLabelSize.call(void 0, el);
|
|
435
435
|
const swap = el.transform.rotation === 90 || el.transform.rotation === 270;
|
|
436
436
|
const roomW = (swap ? room.height : room.width) * camera.zoom;
|
|
437
437
|
const roomH = (swap ? room.width : room.height) * camera.zoom;
|
|
@@ -730,7 +730,7 @@ function hitUnit(input) {
|
|
|
730
730
|
const unit = unitById.get(id);
|
|
731
731
|
if (!unit) continue;
|
|
732
732
|
const radius = _nullishCoalesce(radii.get(unit.elementId), () => ( 0));
|
|
733
|
-
const d =
|
|
733
|
+
const d = _chunkLFRA3GBPcjs.distance.call(void 0, world, unit);
|
|
734
734
|
if (d > reach + radius) continue;
|
|
735
735
|
const score = d - radius;
|
|
736
736
|
if (score < bestScore) {
|
|
@@ -755,7 +755,7 @@ function cornerPoint(box, corner) {
|
|
|
755
755
|
var clamp = (v, min, max) => Math.min(max, Math.max(min, v));
|
|
756
756
|
function resizeElement(el, corner, from, to) {
|
|
757
757
|
if (el.type === "zone" || el.type === "landmark") {
|
|
758
|
-
const box2 = el.type === "zone" ?
|
|
758
|
+
const box2 = el.type === "zone" ? _chunkLFRA3GBPcjs.zoneBounds.call(void 0, el) : centredBox(el.transform, el.width, el.height, el.transform.rotation);
|
|
759
759
|
const east = corner === "ne" || corner === "se";
|
|
760
760
|
const south = corner === "se" || corner === "sw";
|
|
761
761
|
const start = cornerPoint(box2, corner);
|
|
@@ -766,11 +766,11 @@ function resizeElement(el, corner, from, to) {
|
|
|
766
766
|
const swap = el.transform.rotation === 90 || el.transform.rotation === 270;
|
|
767
767
|
const [w, h] = swap ? [worldH, worldW] : [worldW, worldH];
|
|
768
768
|
if (el.type === "zone" && (_nullishCoalesce(el.curve, () => ( 0))) > 0) {
|
|
769
|
-
const sized =
|
|
769
|
+
const sized = _chunkLFRA3GBPcjs.zoneWithLocalSize.call(void 0, el, w, h);
|
|
770
770
|
const width = Math.round(clamp(sized.width, RESIZE_MIN, RESIZE_MAX));
|
|
771
771
|
const height = Math.round(clamp(sized.height, RESIZE_MIN, RESIZE_MAX));
|
|
772
772
|
const next = { ...sized, width, height };
|
|
773
|
-
const b =
|
|
773
|
+
const b = _chunkLFRA3GBPcjs.zoneBounds.call(void 0, next);
|
|
774
774
|
const dx = east ? box2.minX - b.minX : box2.maxX - b.maxX;
|
|
775
775
|
const dy = south ? box2.minY - b.minY : box2.maxY - b.maxY;
|
|
776
776
|
return { ...next, transform: { ...el.transform, x: el.transform.x + dx, y: el.transform.y + dy } };
|
|
@@ -782,11 +782,11 @@ function resizeElement(el, corner, from, to) {
|
|
|
782
782
|
const box = pieceBounds(el);
|
|
783
783
|
if (!box) return el;
|
|
784
784
|
const centre = { x: (box.minX + box.maxX) / 2, y: (box.minY + box.maxY) / 2 };
|
|
785
|
-
const reach =
|
|
785
|
+
const reach = _chunkLFRA3GBPcjs.distance.call(void 0, from, centre);
|
|
786
786
|
if (reach < 1) return el;
|
|
787
|
-
const scale =
|
|
787
|
+
const scale = _chunkLFRA3GBPcjs.snapScale.call(void 0, (_nullishCoalesce(el.scale, () => ( 1))) * (_chunkLFRA3GBPcjs.distance.call(void 0, to, centre) / reach), RESIZE_SCALE_STEP);
|
|
788
788
|
if (scale === (_nullishCoalesce(el.scale, () => ( 1)))) return el;
|
|
789
|
-
return
|
|
789
|
+
return _chunkLFRA3GBPcjs.scalePiece.call(void 0, el, scale);
|
|
790
790
|
}
|
|
791
791
|
|
|
792
792
|
// ../canvas/src/a11y.ts
|
|
@@ -955,7 +955,7 @@ function reduceEditGesture(state, camera, viewport, input) {
|
|
|
955
955
|
if (input.kind === "move") {
|
|
956
956
|
if (_optionalChain([press, 'optionalAccess', _30 => _30.marquee]) && Object.keys(state.g.pointers).length === 1) {
|
|
957
957
|
const { origin } = press.marquee;
|
|
958
|
-
const active = press.marquee.active || press.armed ||
|
|
958
|
+
const active = press.marquee.active || press.armed || _chunkLFRA3GBPcjs.distance.call(void 0, origin, p) > TAP_SLOP;
|
|
959
959
|
if (!active) return { state, camera, effects: [] };
|
|
960
960
|
return {
|
|
961
961
|
state: { g: state.g, press: { ...press, last: { x: p.x, y: p.y }, marquee: { origin, active: true } } },
|
|
@@ -973,7 +973,7 @@ function reduceEditGesture(state, camera, viewport, input) {
|
|
|
973
973
|
};
|
|
974
974
|
}
|
|
975
975
|
if (press && press.movable && Object.keys(state.g.pointers).length === 1) {
|
|
976
|
-
const dragging = press.pointerType === "touch" ? press.armed : press.moving ||
|
|
976
|
+
const dragging = press.pointerType === "touch" ? press.armed : press.moving || _chunkLFRA3GBPcjs.distance.call(void 0,
|
|
977
977
|
_nullishCoalesce(state.g.origin, () => ( press.last)),
|
|
978
978
|
p
|
|
979
979
|
) > TAP_SLOP;
|
|
@@ -1803,13 +1803,13 @@ function a11yLabel(u, m) {
|
|
|
1803
1803
|
}
|
|
1804
1804
|
function SeatMap(props) {
|
|
1805
1805
|
const { layout, focusRef, selection, onSelectionChange } = props;
|
|
1806
|
-
const maxSelection = _nullishCoalesce(props.maxSelection, () => (
|
|
1806
|
+
const maxSelection = _nullishCoalesce(props.maxSelection, () => ( _chunkLFRA3GBPcjs.DEFAULT_MAX_SELECTION));
|
|
1807
1807
|
const messages = _react.useMemo.call(void 0,
|
|
1808
1808
|
() => mergeMessages({ ...props.messages, ...props.continueLabel ? { continueLabel: props.continueLabel } : {} }),
|
|
1809
1809
|
[props.messages, props.continueLabel]
|
|
1810
1810
|
);
|
|
1811
|
-
const units = _react.useMemo.call(void 0, () =>
|
|
1812
|
-
const index = _react.useMemo.call(void 0, () => new (0,
|
|
1811
|
+
const units = _react.useMemo.call(void 0, () => _chunkLFRA3GBPcjs.expand.call(void 0, layout), [layout]);
|
|
1812
|
+
const index = _react.useMemo.call(void 0, () => new (0, _chunkLFRA3GBPcjs.SpatialIndex)(units), [units]);
|
|
1813
1813
|
const radii = _react.useMemo.call(void 0, () => unitRadii(layout), [layout]);
|
|
1814
1814
|
const unitById = _react.useMemo.call(void 0, () => new Map(units.map((u) => [u.id, u])), [units]);
|
|
1815
1815
|
const placeTypeColors = _react.useMemo.call(void 0, () => new Map(props.placeTypes.map((p) => [p.ref, p.color])), [props.placeTypes]);
|
|
@@ -1847,7 +1847,7 @@ function SeatMap(props) {
|
|
|
1847
1847
|
[props.takenUnitIds, conflicted]
|
|
1848
1848
|
);
|
|
1849
1849
|
const held = _react.useMemo.call(void 0, () => new Set(_nullishCoalesce(props.heldUnitIds, () => ( NONE))), [props.heldUnitIds]);
|
|
1850
|
-
const states = _react.useMemo.call(void 0, () =>
|
|
1850
|
+
const states = _react.useMemo.call(void 0, () => _chunkLFRA3GBPcjs.unitStates.call(void 0, units, taken, selection, held), [units, taken, selection, held]);
|
|
1851
1851
|
const selectable = _react.useMemo.call(void 0, () => units.filter((u) => u.placeTypeRef === focusRef), [units, focusRef]);
|
|
1852
1852
|
const a11yNodes = _react.useMemo.call(void 0,
|
|
1853
1853
|
() => buildA11yNodes(
|
|
@@ -1901,7 +1901,7 @@ function SeatMap(props) {
|
|
|
1901
1901
|
announce(messages.heldSeat, true);
|
|
1902
1902
|
return;
|
|
1903
1903
|
}
|
|
1904
|
-
const result =
|
|
1904
|
+
const result = _chunkLFRA3GBPcjs.toggleUnit.call(void 0, selection, unitId, states, maxSelection);
|
|
1905
1905
|
if (result.rejected === "taken") {
|
|
1906
1906
|
announce(byKind(unit, messages.takenSeat, messages.takenTable, messages.takenPlace), true);
|
|
1907
1907
|
return;
|
|
@@ -2035,8 +2035,8 @@ var NO_NODES = [];
|
|
|
2035
2035
|
function VenueOverview(props) {
|
|
2036
2036
|
const { layout, placeTypes, onSelect } = props;
|
|
2037
2037
|
const messages = _react.useMemo.call(void 0, () => mergeMessages(props.messages), [props.messages]);
|
|
2038
|
-
const units = _react.useMemo.call(void 0, () =>
|
|
2039
|
-
const index = _react.useMemo.call(void 0, () => new (0,
|
|
2038
|
+
const units = _react.useMemo.call(void 0, () => _chunkLFRA3GBPcjs.expand.call(void 0, layout), [layout]);
|
|
2039
|
+
const index = _react.useMemo.call(void 0, () => new (0, _chunkLFRA3GBPcjs.SpatialIndex)(units), [units]);
|
|
2040
2040
|
const radii = _react.useMemo.call(void 0, () => unitRadii(layout), [layout]);
|
|
2041
2041
|
const unitById = _react.useMemo.call(void 0, () => new Map(units.map((u) => [u.id, u])), [units]);
|
|
2042
2042
|
const placeTypeColors = _react.useMemo.call(void 0, () => new Map(placeTypes.map((p) => [p.ref, p.color])), [placeTypes]);
|
|
@@ -2053,7 +2053,7 @@ function VenueOverview(props) {
|
|
|
2053
2053
|
const takenIds = _nullishCoalesce(props.takenUnitIds, () => ( NONE2));
|
|
2054
2054
|
const selectedIds = _nullishCoalesce(props.selectedUnitIds, () => ( NONE2));
|
|
2055
2055
|
const states = _react.useMemo.call(void 0,
|
|
2056
|
-
() =>
|
|
2056
|
+
() => _chunkLFRA3GBPcjs.unitStates.call(void 0, units, new Set(takenIds), selectedIds, NO_HELD),
|
|
2057
2057
|
[units, takenIds, selectedIds]
|
|
2058
2058
|
);
|
|
2059
2059
|
const hideList = props.hideList === true;
|
|
@@ -2217,9 +2217,9 @@ function withWorldSize(el, axis, size) {
|
|
|
2217
2217
|
const swap = el.transform.rotation === 90 || el.transform.rotation === 270;
|
|
2218
2218
|
const field = axis === "x" !== swap ? "width" : "height";
|
|
2219
2219
|
if (el.type === "zone" && (_nullishCoalesce(el.curve, () => ( 0))) > 0) {
|
|
2220
|
-
const now =
|
|
2220
|
+
const now = _chunkLFRA3GBPcjs.zoneLocalSize.call(void 0, el);
|
|
2221
2221
|
if (Math.abs(now[field] - size) < 1e-6) return el;
|
|
2222
|
-
const next =
|
|
2222
|
+
const next = _chunkLFRA3GBPcjs.zoneWithLocalSize.call(void 0, el, field === "width" ? size : now.width, field === "height" ? size : now.height);
|
|
2223
2223
|
return { ...next, width: Math.round(next.width), height: Math.round(next.height) };
|
|
2224
2224
|
}
|
|
2225
2225
|
return el[field] === size ? el : { ...el, [field]: size };
|
|
@@ -2245,7 +2245,7 @@ function arrangeCommands(layout, ids, action) {
|
|
|
2245
2245
|
const scale = _nullishCoalesce(model.el.scale, () => ( 1));
|
|
2246
2246
|
return scaled.slice(1).flatMap(({ el }) => {
|
|
2247
2247
|
const piece = el;
|
|
2248
|
-
return (_nullishCoalesce(piece.scale, () => ( 1))) === scale ? [] : [{ type: "replaceElement", element:
|
|
2248
|
+
return (_nullishCoalesce(piece.scale, () => ( 1))) === scale ? [] : [{ type: "replaceElement", element: _chunkLFRA3GBPcjs.scalePiece.call(void 0, piece, scale) }];
|
|
2249
2249
|
});
|
|
2250
2250
|
}
|
|
2251
2251
|
const shifts = action === "distributeX" ? distributeBoxes(boxes, "x") : action === "distributeY" ? distributeBoxes(boxes, "y") : alignBoxes(boxes, action);
|
|
@@ -2398,10 +2398,10 @@ function BackgroundControl(props) {
|
|
|
2398
2398
|
var SIZE_STEP = 0.1;
|
|
2399
2399
|
var KEY_RESIZE_STEP = 20;
|
|
2400
2400
|
function steppedScale(scale, direction) {
|
|
2401
|
-
return
|
|
2401
|
+
return _chunkLFRA3GBPcjs.snapScale.call(void 0, scale + direction * SIZE_STEP);
|
|
2402
2402
|
}
|
|
2403
2403
|
function keyboardResize(el, corner, direction) {
|
|
2404
|
-
if (el.type === "seatBlock" || el.type === "table") return
|
|
2404
|
+
if (el.type === "seatBlock" || el.type === "table") return _chunkLFRA3GBPcjs.scalePiece.call(void 0, el, steppedScale(_nullishCoalesce(el.scale, () => ( 1)), direction));
|
|
2405
2405
|
const box = pieceBounds(el);
|
|
2406
2406
|
if (!box) return el;
|
|
2407
2407
|
const from = cornerPoint(box, corner);
|
|
@@ -2442,7 +2442,7 @@ function pieceName(el, placeTypes, m) {
|
|
|
2442
2442
|
return _nullishCoalesce((ref2 ? _optionalChain([placeTypes, 'access', _80 => _80.find, 'call', _81 => _81((p) => p.ref === ref2), 'optionalAccess', _82 => _82.label]) : void 0), () => ( m.unassigned));
|
|
2443
2443
|
}
|
|
2444
2444
|
const own = el.type === "seatBlock" ? (() => {
|
|
2445
|
-
const rows =
|
|
2445
|
+
const rows = _chunkLFRA3GBPcjs.expandLabels.call(void 0, el.rowLabels, el.rows);
|
|
2446
2446
|
return format(m.pieceBlockName, { from: _nullishCoalesce(rows[0], () => ( "")), to: _nullishCoalesce(rows[rows.length - 1], () => ( "")) });
|
|
2447
2447
|
})() : format(m.pieceTableName, { label: el.label });
|
|
2448
2448
|
const ref = _optionalChain([el, 'access', _83 => _83.placeType, 'optionalAccess', _84 => _84.ref]) || null;
|
|
@@ -2451,7 +2451,7 @@ function pieceName(el, placeTypes, m) {
|
|
|
2451
2451
|
}
|
|
2452
2452
|
function fullBlock(layout, id) {
|
|
2453
2453
|
const el = id ? layout.elements.find((e) => e.id === id) : void 0;
|
|
2454
|
-
return _optionalChain([el, 'optionalAccess', _88 => _88.type]) === "seatBlock" ?
|
|
2454
|
+
return _optionalChain([el, 'optionalAccess', _88 => _88.type]) === "seatBlock" ? _chunkLFRA3GBPcjs.expandSeatBlock.call(void 0, { ...el, removed: [] }) : [];
|
|
2455
2455
|
}
|
|
2456
2456
|
var DesignerCanvas = _react.forwardRef.call(void 0, function DesignerCanvas2({ designer, placeTypes, lockedUnitIds, messages, frameKey, onPieceTap, backgroundImage = null, compact = false, overlay, theme }, ref) {
|
|
2457
2457
|
const { ui } = designer;
|
|
@@ -2480,8 +2480,8 @@ var DesignerCanvas = _react.forwardRef.call(void 0, function DesignerCanvas2({ d
|
|
|
2480
2480
|
const spaceHeld = _react.useRef.call(void 0, false);
|
|
2481
2481
|
const [panReady, setPanReady] = _react.useState.call(void 0, false);
|
|
2482
2482
|
const marqueeArmed = _react.useRef.call(void 0, false);
|
|
2483
|
-
const units = _react.useMemo.call(void 0, () =>
|
|
2484
|
-
const index = _react.useMemo.call(void 0, () => new (0,
|
|
2483
|
+
const units = _react.useMemo.call(void 0, () => _chunkLFRA3GBPcjs.expand.call(void 0, layout), [layout]);
|
|
2484
|
+
const index = _react.useMemo.call(void 0, () => new (0, _chunkLFRA3GBPcjs.SpatialIndex)(units), [units]);
|
|
2485
2485
|
const radii = _react.useMemo.call(void 0, () => unitRadii(layout), [layout]);
|
|
2486
2486
|
const bg = layout.meta.background;
|
|
2487
2487
|
const images = _react.useMemo.call(void 0,
|
|
@@ -2490,7 +2490,7 @@ var DesignerCanvas = _react.forwardRef.call(void 0, function DesignerCanvas2({ d
|
|
|
2490
2490
|
);
|
|
2491
2491
|
const placeTypeColors = _react.useMemo.call(void 0, () => new Map(placeTypes.map((p) => [p.ref, p.color])), [placeTypes]);
|
|
2492
2492
|
const seatEditUnits = _react.useMemo.call(void 0, () => fullBlock(layout, ui.seatEditId), [layout, ui.seatEditId]);
|
|
2493
|
-
const seatEditIndex = _react.useMemo.call(void 0, () => new (0,
|
|
2493
|
+
const seatEditIndex = _react.useMemo.call(void 0, () => new (0, _chunkLFRA3GBPcjs.SpatialIndex)(seatEditUnits), [seatEditUnits]);
|
|
2494
2494
|
const seatEditById = _react.useMemo.call(void 0, () => new Map(seatEditUnits.map((u) => [u.id, u])), [seatEditUnits]);
|
|
2495
2495
|
const elementBoxes = _react.useMemo.call(void 0,
|
|
2496
2496
|
() => layout.elements.flatMap((el) => {
|
|
@@ -2757,7 +2757,7 @@ var DesignerCanvas = _react.forwardRef.call(void 0, function DesignerCanvas2({ d
|
|
|
2757
2757
|
if (isScaled2(next) && isScaled2(start)) {
|
|
2758
2758
|
const same = d.layout.elements.filter((el) => el.id !== start.id && el.type === next.type);
|
|
2759
2759
|
const match = snapScaleTo(_nullishCoalesce(next.scale, () => ( 1)), same.map((el) => _nullishCoalesce(el.scale, () => ( 1))));
|
|
2760
|
-
const sized2 = match !== null && match !== (_nullishCoalesce(next.scale, () => ( 1))) ?
|
|
2760
|
+
const sized2 = match !== null && match !== (_nullishCoalesce(next.scale, () => ( 1))) ? _chunkLFRA3GBPcjs.scalePiece.call(void 0, start, match) : next;
|
|
2761
2761
|
const now = _nullishCoalesce(sized2.scale, () => ( 1));
|
|
2762
2762
|
const matches = same.filter((el) => (_nullishCoalesce(el.scale, () => ( 1))) === now).flatMap((el) => _nullishCoalesce(pieceBounds(el), () => ( [])));
|
|
2763
2763
|
setHints(matches.length > 0 ? { guides: [], gaps: [], matches } : null);
|
|
@@ -3071,7 +3071,7 @@ function armedLabel(kind, m) {
|
|
|
3071
3071
|
if (kind === "roundTable") return m.pieceRoundTable;
|
|
3072
3072
|
if (kind === "rectTable") return m.pieceRectTable;
|
|
3073
3073
|
if (kind === "zone") return m.pieceZone;
|
|
3074
|
-
return _nullishCoalesce(_optionalChain([
|
|
3074
|
+
return _nullishCoalesce(_optionalChain([_chunkLFRA3GBPcjs.landmarkById.call(void 0, kind.slice("landmark:".length)), 'optionalAccess', _111 => _111.name]), () => ( kind));
|
|
3075
3075
|
}
|
|
3076
3076
|
function drawHints(ctx, hints, camera, viewport, color) {
|
|
3077
3077
|
const at = (x, y) => worldToScreen(camera, viewport, { x, y });
|
|
@@ -3207,7 +3207,7 @@ function anchorPanel(piece, panel, viewport, margin = 12) {
|
|
|
3207
3207
|
return docked;
|
|
3208
3208
|
}
|
|
3209
3209
|
function range(rule, count) {
|
|
3210
|
-
const labels =
|
|
3210
|
+
const labels = _chunkLFRA3GBPcjs.labelSequence.call(void 0, rule, count);
|
|
3211
3211
|
return { from: _nullishCoalesce(labels[0], () => ( "")), to: _nullishCoalesce(labels[labels.length - 1], () => ( "")) };
|
|
3212
3212
|
}
|
|
3213
3213
|
function blockRangeText(block, templates) {
|
|
@@ -3218,24 +3218,24 @@ function blockRangeText(block, templates) {
|
|
|
3218
3218
|
function reshapeBlock(block, patch) {
|
|
3219
3219
|
const next = { ...block, ...patch };
|
|
3220
3220
|
if (block.removed.length === 0) return next;
|
|
3221
|
-
const oldRows =
|
|
3222
|
-
const oldSeats =
|
|
3223
|
-
const newRows =
|
|
3224
|
-
const newSeats =
|
|
3221
|
+
const oldRows = _chunkLFRA3GBPcjs.expandLabels.call(void 0, block.rowLabels, block.rows);
|
|
3222
|
+
const oldSeats = _chunkLFRA3GBPcjs.expandLabels.call(void 0, block.seatLabels, block.cols);
|
|
3223
|
+
const newRows = _chunkLFRA3GBPcjs.expandLabels.call(void 0, next.rowLabels, next.rows);
|
|
3224
|
+
const newSeats = _chunkLFRA3GBPcjs.expandLabels.call(void 0, next.seatLabels, next.cols);
|
|
3225
3225
|
const removed = [];
|
|
3226
3226
|
for (const id of block.removed) {
|
|
3227
|
-
const [, row, seat] =
|
|
3227
|
+
const [, row, seat] = _chunkLFRA3GBPcjs.parseUnitId.call(void 0, id);
|
|
3228
3228
|
const r = row === void 0 ? -1 : oldRows.indexOf(row);
|
|
3229
3229
|
const c = seat === void 0 ? -1 : oldSeats.indexOf(seat);
|
|
3230
3230
|
if (r < 0 || c < 0 || r >= next.rows || c >= next.cols) continue;
|
|
3231
|
-
removed.push(
|
|
3231
|
+
removed.push(_chunkLFRA3GBPcjs.seatUnitId.call(void 0, block.id, newRows[r], newSeats[c]));
|
|
3232
3232
|
}
|
|
3233
3233
|
return { ...next, removed };
|
|
3234
3234
|
}
|
|
3235
3235
|
function labelStart(kind, raw, alphabet) {
|
|
3236
3236
|
const start = kind === "letters" ? raw.trim().toUpperCase() : raw.trim();
|
|
3237
3237
|
const rule = kind === "letters" && alphabet ? { kind, start, direction: "ltr", alphabet } : { kind, start, direction: "ltr" };
|
|
3238
|
-
return
|
|
3238
|
+
return _chunkLFRA3GBPcjs.labelRuleSchema.safeParse(rule).success ? start : null;
|
|
3239
3239
|
}
|
|
3240
3240
|
function switchLabelKind(rule, kind) {
|
|
3241
3241
|
if (rule.kind === kind) return rule;
|
|
@@ -3350,9 +3350,9 @@ function FloatingPanel(props) {
|
|
|
3350
3350
|
|
|
3351
3351
|
// ../react/src/designer/capacity.ts
|
|
3352
3352
|
function capacityRejections(before, after, placeTypes) {
|
|
3353
|
-
const over =
|
|
3353
|
+
const over = _chunkLFRA3GBPcjs.capacityViolations.call(void 0, before, after, placeTypes);
|
|
3354
3354
|
if (over.length === 0) return [];
|
|
3355
|
-
const was =
|
|
3355
|
+
const was = _chunkLFRA3GBPcjs.summarize.call(void 0, before).byRef;
|
|
3356
3356
|
return over.map((v) => ({ ref: v.ref, label: v.label, capacity: v.capacity, placed: _nullishCoalesce(_optionalChain([was, 'access', _128 => _128[v.ref], 'optionalAccess', _129 => _129.units]), () => ( 0)) }));
|
|
3357
3357
|
}
|
|
3358
3358
|
function placedUnits(option, summary) {
|
|
@@ -3360,19 +3360,19 @@ function placedUnits(option, summary) {
|
|
|
3360
3360
|
}
|
|
3361
3361
|
function nextPiece(option, placed) {
|
|
3362
3362
|
if (option.accepts === "zone") return { units: 1 };
|
|
3363
|
-
if (option.accepts === "seats") return { units:
|
|
3364
|
-
const capacity =
|
|
3363
|
+
if (option.accepts === "seats") return { units: _chunkLFRA3GBPcjs.nextBlockUnits.call(void 0, option, placed) };
|
|
3364
|
+
const capacity = _chunkLFRA3GBPcjs.placeTypeCapacity.call(void 0, option);
|
|
3365
3365
|
const left = capacity === null ? Infinity : Math.max(0, capacity - placed);
|
|
3366
3366
|
if (option.accepts === "tableWhole") return { units: Math.min(1, left) };
|
|
3367
|
-
return { units: Math.min(
|
|
3367
|
+
return { units: Math.min(_chunkLFRA3GBPcjs.DEFAULT_TABLE_PLACES, left) };
|
|
3368
3368
|
}
|
|
3369
3369
|
function capacityText(option, summary, m) {
|
|
3370
|
-
const capacity =
|
|
3370
|
+
const capacity = _chunkLFRA3GBPcjs.placeTypeCapacity.call(void 0, option);
|
|
3371
3371
|
if (capacity === null || option.accepts === "zone") return null;
|
|
3372
3372
|
return format(m.capacityCount, { placed: placedUnits(option, summary), capacity });
|
|
3373
3373
|
}
|
|
3374
3374
|
function capacityFullText(option, summary, m) {
|
|
3375
|
-
const capacity =
|
|
3375
|
+
const capacity = _chunkLFRA3GBPcjs.placeTypeCapacity.call(void 0, option);
|
|
3376
3376
|
if (capacity === null || option.accepts === "zone") return null;
|
|
3377
3377
|
const placed = placedUnits(option, summary);
|
|
3378
3378
|
if (placed > capacity) return format(m.capacityOver, { over: placed - capacity, capacity, name: option.label });
|
|
@@ -3380,12 +3380,12 @@ function capacityFullText(option, summary, m) {
|
|
|
3380
3380
|
return format(m.capacityFull, { capacity, name: option.label });
|
|
3381
3381
|
}
|
|
3382
3382
|
function overCapacity(option, summary) {
|
|
3383
|
-
const capacity =
|
|
3383
|
+
const capacity = _chunkLFRA3GBPcjs.placeTypeCapacity.call(void 0, option);
|
|
3384
3384
|
if (capacity === null || option.accepts === "zone") return 0;
|
|
3385
3385
|
return Math.max(0, placedUnits(option, summary) - capacity);
|
|
3386
3386
|
}
|
|
3387
3387
|
function trimPlan(layout, option, locked) {
|
|
3388
|
-
let left = overCapacity(option,
|
|
3388
|
+
let left = overCapacity(option, _chunkLFRA3GBPcjs.summarize.call(void 0, layout));
|
|
3389
3389
|
if (left === 0) return null;
|
|
3390
3390
|
const commands = [];
|
|
3391
3391
|
let removed = 0;
|
|
@@ -3393,7 +3393,7 @@ function trimPlan(layout, option, locked) {
|
|
|
3393
3393
|
const el = layout.elements[i];
|
|
3394
3394
|
if (el.type === "landmark" || el.type === "zone" || (_optionalChain([el, 'access', _133 => _133.placeType, 'optionalAccess', _134 => _134.ref]) || null) !== option.ref) continue;
|
|
3395
3395
|
if (el.type === "seatBlock") {
|
|
3396
|
-
const units =
|
|
3396
|
+
const units = _chunkLFRA3GBPcjs.expandSeatBlock.call(void 0, el);
|
|
3397
3397
|
const take = units.filter((u) => !locked.has(u.id)).sort((a, b) => b.rowIndex - a.rowIndex || b.colIndex - a.colIndex).slice(0, left);
|
|
3398
3398
|
if (take.length === 0) continue;
|
|
3399
3399
|
commands.push(
|
|
@@ -3408,7 +3408,7 @@ function trimPlan(layout, option, locked) {
|
|
|
3408
3408
|
left--;
|
|
3409
3409
|
} else {
|
|
3410
3410
|
let lastLocked = 0;
|
|
3411
|
-
for (let n = 1; n <= el.places; n++) if (locked.has(
|
|
3411
|
+
for (let n = 1; n <= el.places; n++) if (locked.has(_chunkLFRA3GBPcjs.placeUnitId.call(void 0, el.id, n))) lastLocked = n;
|
|
3412
3412
|
if (lastLocked === 0 && left >= el.places) {
|
|
3413
3413
|
commands.push({ type: "removeElement", id: el.id });
|
|
3414
3414
|
removed += el.places;
|
|
@@ -3485,14 +3485,14 @@ function syncPlaceTypes(layout, previous, placeTypes) {
|
|
|
3485
3485
|
if (el.type === "landmark" || !_optionalChain([el, 'access', _143 => _143.placeType, 'optionalAccess', _144 => _144.ref])) return el;
|
|
3486
3486
|
const option = byRef.get(el.placeType.ref);
|
|
3487
3487
|
if (!option && !before.has(el.placeType.ref)) return el;
|
|
3488
|
-
if (!option || !
|
|
3488
|
+
if (!option || !_chunkLFRA3GBPcjs.canAssign.call(void 0, el, option)) {
|
|
3489
3489
|
changed = true;
|
|
3490
3490
|
return { ...el, placeType: { ref: "", name: el.placeType.name } };
|
|
3491
3491
|
}
|
|
3492
3492
|
const mode = option.accepts === "tablePerPlace" ? "perPlace" : "whole";
|
|
3493
3493
|
if (el.placeType.name === option.label && (el.type !== "table" || el.mode === mode)) return el;
|
|
3494
3494
|
changed = true;
|
|
3495
|
-
return
|
|
3495
|
+
return _chunkLFRA3GBPcjs.assignPlaceType.call(void 0, el, option);
|
|
3496
3496
|
});
|
|
3497
3497
|
return changed ? { ...layout, elements } : layout;
|
|
3498
3498
|
}
|
|
@@ -3646,7 +3646,7 @@ function LandmarkPicker({ messages: m, onPick }) {
|
|
|
3646
3646
|
const groups = LANDMARK_GROUPS.map(({ group, key }) => ({
|
|
3647
3647
|
group,
|
|
3648
3648
|
title: m[key],
|
|
3649
|
-
items:
|
|
3649
|
+
items: _chunkLFRA3GBPcjs.landmarks.filter((l) => l.group === group && (q === "" || fold(l.name).includes(q)))
|
|
3650
3650
|
})).filter((g) => g.items.length > 0);
|
|
3651
3651
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "vk-d-landmarks", children: [
|
|
3652
3652
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "label", { className: "vk-d-search", htmlFor: searchId, children: [
|
|
@@ -4171,13 +4171,13 @@ function SizeStepper(props) {
|
|
|
4171
4171
|
const { piece, messages: m } = props;
|
|
4172
4172
|
const scale = _nullishCoalesce(piece.scale, () => ( 1));
|
|
4173
4173
|
const id = _react.useId.call(void 0, );
|
|
4174
|
-
const set = (direction) => props.onRun({ type: "replaceElement", element:
|
|
4174
|
+
const set = (direction) => props.onRun({ type: "replaceElement", element: _chunkLFRA3GBPcjs.scalePiece.call(void 0, piece, steppedScale(scale, direction)) });
|
|
4175
4175
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "vk-d-field", role: "group", "aria-labelledby": id, children: [
|
|
4176
4176
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { id, children: m.pieceSize }),
|
|
4177
4177
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "vk-d-stepper", children: [
|
|
4178
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "button", { type: "button", "aria-label": m.sizeLess, disabled: scale <=
|
|
4178
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "button", { type: "button", "aria-label": m.sizeLess, disabled: scale <= _chunkLFRA3GBPcjs.MIN_SCALE, onClick: () => set(-1), children: "\u2212" }),
|
|
4179
4179
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "output", { className: "vk-d-stepper-value", "aria-live": "polite", children: format(m.pieceSizeValue, { n: Math.round(scale * 100) }) }),
|
|
4180
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "button", { type: "button", "aria-label": m.sizeMore, disabled: scale >=
|
|
4180
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "button", { type: "button", "aria-label": m.sizeMore, disabled: scale >= _chunkLFRA3GBPcjs.MAX_SCALE, onClick: () => set(1), children: "+" })
|
|
4181
4181
|
] })
|
|
4182
4182
|
] });
|
|
4183
4183
|
}
|
|
@@ -4226,7 +4226,7 @@ function pieceHeading(el, placeTypes, m) {
|
|
|
4226
4226
|
const option = ref ? placeTypes.find((p) => p.ref === ref) : void 0;
|
|
4227
4227
|
const name = _nullishCoalesce(_optionalChain([option, 'optionalAccess', _147 => _147.label]), () => ( m.unassigned));
|
|
4228
4228
|
if (el.type === "zone") return { color: _nullishCoalesce(_optionalChain([option, 'optionalAccess', _148 => _148.color]), () => ( null)), text: name };
|
|
4229
|
-
const count = el.type === "seatBlock" ? plural2(
|
|
4229
|
+
const count = el.type === "seatBlock" ? plural2(_chunkLFRA3GBPcjs.expandSeatBlock.call(void 0, el).length, m.countSeat, m.countSeats) : el.mode === "whole" ? plural2(1, m.countTable, m.countTables) : plural2(el.places, m.countPlace, m.countPlaces);
|
|
4230
4230
|
return { color: _nullishCoalesce(_optionalChain([option, 'optionalAccess', _149 => _149.color]), () => ( null)), text: `${name} \xB7 ${count}` };
|
|
4231
4231
|
}
|
|
4232
4232
|
function PieceInspector(props) {
|
|
@@ -4246,7 +4246,7 @@ function PieceInspector(props) {
|
|
|
4246
4246
|
patch("label", label, `label:${el.id}`);
|
|
4247
4247
|
};
|
|
4248
4248
|
const assigned = el.type !== "landmark" && !!_optionalChain([el, 'access', _150 => _150.placeType, 'optionalAccess', _151 => _151.ref]);
|
|
4249
|
-
const options = el.type === "landmark" ? [] : props.placeTypes.filter((o) =>
|
|
4249
|
+
const options = el.type === "landmark" ? [] : props.placeTypes.filter((o) => _chunkLFRA3GBPcjs.canAssign.call(void 0, el, o));
|
|
4250
4250
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "vk-d-inspector", children: [
|
|
4251
4251
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "vk-d-insp-head", children: [
|
|
4252
4252
|
el.type !== "landmark" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "vk-d-dot", "aria-hidden": "true", style: { ["--vk-type"]: _nullishCoalesce(heading.color, () => ( "var(--vk-unassigned, #9ca3af)")) } }),
|
|
@@ -4300,7 +4300,7 @@ function PieceInspector(props) {
|
|
|
4300
4300
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, SizeStepper, { piece: el, messages: m, onRun: props.onRun })
|
|
4301
4301
|
] }),
|
|
4302
4302
|
el.type === "table" && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
4303
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, TextField, { label: m.tableNumber, maxLength:
|
|
4303
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, TextField, { label: m.tableNumber, maxLength: _chunkLFRA3GBPcjs.MAX_TABLE_LABEL_LENGTH, value: el.label, onCommit: tableLabelCommit }),
|
|
4304
4304
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4305
4305
|
Stepper,
|
|
4306
4306
|
{
|
|
@@ -4432,12 +4432,12 @@ function NumberingDialog(props) {
|
|
|
4432
4432
|
const m = props.messages;
|
|
4433
4433
|
const [draft, setDraft] = _react.useState.call(void 0, props.block);
|
|
4434
4434
|
const [failed, setFailed] = _react.useState.call(void 0, false);
|
|
4435
|
-
const rowLabels =
|
|
4436
|
-
const seatLabels =
|
|
4435
|
+
const rowLabels = _chunkLFRA3GBPcjs.expandLabels.call(void 0, draft.rowLabels, draft.rows);
|
|
4436
|
+
const seatLabels = _chunkLFRA3GBPcjs.expandLabels.call(void 0, draft.seatLabels, draft.cols);
|
|
4437
4437
|
const removed = new Set(draft.removed);
|
|
4438
|
-
const origRows =
|
|
4439
|
-
const origSeats =
|
|
4440
|
-
const soldAt = (r, c) => r < origRows.length && c < origSeats.length && props.lockedUnitIds.has(
|
|
4438
|
+
const origRows = _chunkLFRA3GBPcjs.expandLabels.call(void 0, props.block.rowLabels, props.block.rows);
|
|
4439
|
+
const origSeats = _chunkLFRA3GBPcjs.expandLabels.call(void 0, props.block.seatLabels, props.block.cols);
|
|
4440
|
+
const soldAt = (r, c) => r < origRows.length && c < origSeats.length && props.lockedUnitIds.has(_chunkLFRA3GBPcjs.seatUnitId.call(void 0, props.block.id, origRows[r], origSeats[c]));
|
|
4441
4441
|
const tooBig = draft.rows * draft.cols > MAX_PREVIEW_SEATS;
|
|
4442
4442
|
const pattern = draft.seatLabels.kind === "numbers" ? _nullishCoalesce(draft.seatLabels.pattern, () => ( "sequential")) : "sequential";
|
|
4443
4443
|
const patternId = _react.useId.call(void 0, );
|
|
@@ -4459,7 +4459,7 @@ function NumberingDialog(props) {
|
|
|
4459
4459
|
tooBig ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "vk-d-hint", children: m.numberingTooBig }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "vk-d-num-grid", role: "group", "aria-label": m.numbering, children: rowLabels.map((row, r) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "vk-d-num-row", children: [
|
|
4460
4460
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "vk-d-num-label", "aria-hidden": "true", children: row }),
|
|
4461
4461
|
seatLabels.map((seat, c) => {
|
|
4462
|
-
const id =
|
|
4462
|
+
const id = _chunkLFRA3GBPcjs.seatUnitId.call(void 0, draft.id, row, seat);
|
|
4463
4463
|
const sold = soldAt(r, c) && !removed.has(id);
|
|
4464
4464
|
const out = removed.has(id);
|
|
4465
4465
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -4474,7 +4474,7 @@ function NumberingDialog(props) {
|
|
|
4474
4474
|
"aria-label": format(sold ? m.seatNameSold : out ? m.seatNameRemoved : m.seatName, { row, seat }),
|
|
4475
4475
|
onClick: () => {
|
|
4476
4476
|
setFailed(false);
|
|
4477
|
-
setDraft((d) =>
|
|
4477
|
+
setDraft((d) => _chunkLFRA3GBPcjs.toggleRemovedSeat.call(void 0, d, id));
|
|
4478
4478
|
},
|
|
4479
4479
|
children: seat
|
|
4480
4480
|
},
|
|
@@ -4665,7 +4665,7 @@ function PlaceTypePanel(props) {
|
|
|
4665
4665
|
const capped = capacityText(o, summary, m);
|
|
4666
4666
|
const fullText = capacityFullText(o, summary, m);
|
|
4667
4667
|
const done = fullText !== null;
|
|
4668
|
-
const cap =
|
|
4668
|
+
const cap = _chunkLFRA3GBPcjs.placeTypeCapacity.call(void 0, o);
|
|
4669
4669
|
const over = cap !== null && placedUnits(o, summary) > cap;
|
|
4670
4670
|
const excess = over ? overCapacity(o, summary) : 0;
|
|
4671
4671
|
const trimmable = excess > 0 && props.onTrim ? _nullishCoalesce(_optionalChain([trimPlan, 'call', _156 => _156(props.layout, o, _nullishCoalesce(props.lockedUnitIds, () => ( NOTHING))), 'optionalAccess', _157 => _157.removed]), () => ( 0)) : 0;
|
|
@@ -5245,12 +5245,12 @@ function TopBar(props) {
|
|
|
5245
5245
|
function guardedStep(history, step, locked) {
|
|
5246
5246
|
const candidate = step === "undo" ? history.peekUndo() : history.peekRedo();
|
|
5247
5247
|
if (!candidate) return null;
|
|
5248
|
-
const violations =
|
|
5248
|
+
const violations = _chunkLFRA3GBPcjs.findLockViolations.call(void 0, history.present, candidate, locked);
|
|
5249
5249
|
if (violations.length > 0) return { ok: false, rejection: { violations } };
|
|
5250
5250
|
return { ok: true, layout: step === "undo" ? history.undo() : history.redo() };
|
|
5251
5251
|
}
|
|
5252
5252
|
function guardedLoad(history, next, locked, placeTypes = []) {
|
|
5253
|
-
const violations =
|
|
5253
|
+
const violations = _chunkLFRA3GBPcjs.findLockViolations.call(void 0, history.present, next, locked);
|
|
5254
5254
|
if (violations.length > 0) return { ok: false, rejection: { violations } };
|
|
5255
5255
|
const capacity = capacityRejections(history.present, next, placeTypes);
|
|
5256
5256
|
if (capacity.length > 0) return { ok: false, rejection: { violations: [], capacity } };
|
|
@@ -5273,7 +5273,7 @@ function elementPrefix(el) {
|
|
|
5273
5273
|
return el.type === "seatBlock" ? "b" : el.type === "table" ? "m" : el.type === "zone" ? "z" : "r";
|
|
5274
5274
|
}
|
|
5275
5275
|
function useDesigner({ initial, lockedUnitIds, onChange, placeTypes }) {
|
|
5276
|
-
const historyRef = _react.useRef.call(void 0, new (0,
|
|
5276
|
+
const historyRef = _react.useRef.call(void 0, new (0, _chunkLFRA3GBPcjs.History)(initial));
|
|
5277
5277
|
const [layout, setLayout] = _react.useState.call(void 0, initial);
|
|
5278
5278
|
const [rejection, setRejectionState] = _react.useState.call(void 0, null);
|
|
5279
5279
|
const [rejectionSeq, setRejectionSeq] = _react.useState.call(void 0, 0);
|
|
@@ -5310,11 +5310,11 @@ function useDesigner({ initial, lockedUnitIds, onChange, placeTypes }) {
|
|
|
5310
5310
|
const before = historyRef.current.present;
|
|
5311
5311
|
let candidate;
|
|
5312
5312
|
try {
|
|
5313
|
-
candidate =
|
|
5313
|
+
candidate = _chunkLFRA3GBPcjs.applyCommand.call(void 0, before, command);
|
|
5314
5314
|
} catch (e6) {
|
|
5315
5315
|
return false;
|
|
5316
5316
|
}
|
|
5317
|
-
const violations =
|
|
5317
|
+
const violations = _chunkLFRA3GBPcjs.findLockViolations.call(void 0, before, candidate, locked);
|
|
5318
5318
|
if (violations.length > 0) {
|
|
5319
5319
|
setRejection({ violations });
|
|
5320
5320
|
return false;
|
|
@@ -5333,8 +5333,8 @@ function useDesigner({ initial, lockedUnitIds, onChange, placeTypes }) {
|
|
|
5333
5333
|
const place = _react.useCallback.call(void 0,
|
|
5334
5334
|
(kind, at) => {
|
|
5335
5335
|
const current = historyRef.current.present;
|
|
5336
|
-
const id =
|
|
5337
|
-
if (!run({ type: "addElement", element:
|
|
5336
|
+
const id = _chunkLFRA3GBPcjs.newElementId.call(void 0, current, idPrefix(kind));
|
|
5337
|
+
if (!run({ type: "addElement", element: _chunkLFRA3GBPcjs.createPiece.call(void 0, kind, id, at, current) })) return null;
|
|
5338
5338
|
dispatchUi({ type: "select", id });
|
|
5339
5339
|
return id;
|
|
5340
5340
|
},
|
|
@@ -5343,10 +5343,10 @@ function useDesigner({ initial, lockedUnitIds, onChange, placeTypes }) {
|
|
|
5343
5343
|
const addFor = _react.useCallback.call(void 0,
|
|
5344
5344
|
(kind, option, near, opts = {}) => {
|
|
5345
5345
|
const current = historyRef.current.present;
|
|
5346
|
-
const id =
|
|
5347
|
-
let piece =
|
|
5346
|
+
const id = _chunkLFRA3GBPcjs.newElementId.call(void 0, current, idPrefix(kind));
|
|
5347
|
+
let piece = _chunkLFRA3GBPcjs.createPiece.call(void 0, kind, id, near, current, opts.seats === void 0 ? {} : { seats: opts.seats });
|
|
5348
5348
|
if (piece.type === "table" && opts.places !== void 0) piece = { ...piece, places: opts.places };
|
|
5349
|
-
if (option && piece.type !== "landmark" &&
|
|
5349
|
+
if (option && piece.type !== "landmark" && _chunkLFRA3GBPcjs.canAssign.call(void 0, piece, option)) piece = _chunkLFRA3GBPcjs.assignPlaceType.call(void 0, piece, option);
|
|
5350
5350
|
const own = elementBounds({ ...current, elements: [...current.elements, piece] }, piece);
|
|
5351
5351
|
if (own) {
|
|
5352
5352
|
const occupied = current.elements.flatMap((e) => _nullishCoalesce(elementBounds(current, e), () => ( [])));
|
|
@@ -5364,8 +5364,8 @@ function useDesigner({ initial, lockedUnitIds, onChange, placeTypes }) {
|
|
|
5364
5364
|
const el = find(id);
|
|
5365
5365
|
if (!el) return;
|
|
5366
5366
|
const current = historyRef.current.present;
|
|
5367
|
-
const newId =
|
|
5368
|
-
if (run({ type: "addElement", element:
|
|
5367
|
+
const newId = _chunkLFRA3GBPcjs.newElementId.call(void 0, current, elementPrefix(el));
|
|
5368
|
+
if (run({ type: "addElement", element: _chunkLFRA3GBPcjs.duplicatePiece.call(void 0, el, newId, current) })) {
|
|
5369
5369
|
dispatchUi({ type: "select", id: newId });
|
|
5370
5370
|
}
|
|
5371
5371
|
},
|
|
@@ -5374,7 +5374,7 @@ function useDesigner({ initial, lockedUnitIds, onChange, placeTypes }) {
|
|
|
5374
5374
|
const rotate = _react.useCallback.call(void 0,
|
|
5375
5375
|
(id) => {
|
|
5376
5376
|
const el = find(id);
|
|
5377
|
-
if (el) run({ type: "replaceElement", element:
|
|
5377
|
+
if (el) run({ type: "replaceElement", element: _chunkLFRA3GBPcjs.rotatePiece.call(void 0, el) });
|
|
5378
5378
|
},
|
|
5379
5379
|
[run]
|
|
5380
5380
|
);
|
|
@@ -5409,7 +5409,7 @@ function useDesigner({ initial, lockedUnitIds, onChange, placeTypes }) {
|
|
|
5409
5409
|
for (const id of ids) {
|
|
5410
5410
|
const el = current.elements.find((e) => e.id === id);
|
|
5411
5411
|
if (!el) continue;
|
|
5412
|
-
const copy =
|
|
5412
|
+
const copy = _chunkLFRA3GBPcjs.duplicatePiece.call(void 0, el, _chunkLFRA3GBPcjs.newElementId.call(void 0, current, elementPrefix(el)), current);
|
|
5413
5413
|
current = { ...current, elements: [...current.elements, copy] };
|
|
5414
5414
|
commands.push({ type: "addElement", element: copy });
|
|
5415
5415
|
created.push(copy.id);
|
|
@@ -5435,7 +5435,7 @@ function useDesigner({ initial, lockedUnitIds, onChange, placeTypes }) {
|
|
|
5435
5435
|
const toggleSeat = _react.useCallback.call(void 0,
|
|
5436
5436
|
(blockId, unitId) => {
|
|
5437
5437
|
const el = find(blockId);
|
|
5438
|
-
if (_optionalChain([el, 'optionalAccess', _180 => _180.type]) === "seatBlock") run({ type: "replaceElement", element:
|
|
5438
|
+
if (_optionalChain([el, 'optionalAccess', _180 => _180.type]) === "seatBlock") run({ type: "replaceElement", element: _chunkLFRA3GBPcjs.toggleRemovedSeat.call(void 0, el, unitId) });
|
|
5439
5439
|
},
|
|
5440
5440
|
[run]
|
|
5441
5441
|
);
|
|
@@ -5443,8 +5443,8 @@ function useDesigner({ initial, lockedUnitIds, onChange, placeTypes }) {
|
|
|
5443
5443
|
(id, option) => {
|
|
5444
5444
|
const el = find(id);
|
|
5445
5445
|
if (!el || el.type === "landmark") return;
|
|
5446
|
-
if (option && !
|
|
5447
|
-
run({ type: "replaceElement", element:
|
|
5446
|
+
if (option && !_chunkLFRA3GBPcjs.canAssign.call(void 0, el, option)) return;
|
|
5447
|
+
run({ type: "replaceElement", element: _chunkLFRA3GBPcjs.assignPlaceType.call(void 0, el, option) });
|
|
5448
5448
|
},
|
|
5449
5449
|
[run]
|
|
5450
5450
|
);
|
|
@@ -5510,7 +5510,7 @@ function useDesigner({ initial, lockedUnitIds, onChange, placeTypes }) {
|
|
|
5510
5510
|
var NOTHING_LOCKED = /* @__PURE__ */ new Set();
|
|
5511
5511
|
function blankLayout(name) {
|
|
5512
5512
|
return {
|
|
5513
|
-
meta: { id: "plan", name, version:
|
|
5513
|
+
meta: { id: "plan", name, version: _chunkLFRA3GBPcjs.CURRENT_VERSION, width: 1200, height: 800, background: null },
|
|
5514
5514
|
elements: []
|
|
5515
5515
|
};
|
|
5516
5516
|
}
|
|
@@ -5540,7 +5540,7 @@ function VenueDesigner(props) {
|
|
|
5540
5540
|
const { layout, ui, dispatchUi } = designer;
|
|
5541
5541
|
const messages = _react.useMemo.call(void 0, () => mergeDesignerMessages(props.messages), [props.messages]);
|
|
5542
5542
|
const m = messages;
|
|
5543
|
-
const summary = _react.useMemo.call(void 0, () =>
|
|
5543
|
+
const summary = _react.useMemo.call(void 0, () => _chunkLFRA3GBPcjs.summarize.call(void 0, layout), [layout]);
|
|
5544
5544
|
const selected = ui.selectedId ? _nullishCoalesce(layout.elements.find((e) => e.id === ui.selectedId), () => ( null)) : null;
|
|
5545
5545
|
const canvasRef = _react.useRef.call(void 0, null);
|
|
5546
5546
|
const otherTableLabels = _react.useMemo.call(void 0,
|
|
@@ -5946,7 +5946,7 @@ function VenueDesigner(props) {
|
|
|
5946
5946
|
}
|
|
5947
5947
|
|
|
5948
5948
|
// ../react/src/index.ts
|
|
5949
|
-
var VERSION = "0.10.
|
|
5949
|
+
var VERSION = "0.10.1";
|
|
5950
5950
|
|
|
5951
5951
|
|
|
5952
5952
|
|