@seatlayer/core 0.17.0 → 0.18.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/index.cjs CHANGED
@@ -275,9 +275,12 @@ var init_fr = __esm({
275
275
  // src/index.ts
276
276
  var index_exports = {};
277
277
  __export(index_exports, {
278
+ ACCESSIBILITY_RING_COLOR: () => ACCESSIBILITY_RING_COLOR,
278
279
  ACCESSIBILITY_TYPES: () => ACCESSIBILITY_TYPES,
279
280
  CHART_STORAGE_KEY: () => CHART_STORAGE_KEY,
280
281
  DEFAULT_CURRENCY: () => DEFAULT_CURRENCY,
282
+ LABEL_STYLE_MAX_SIZE: () => LABEL_STYLE_MAX_SIZE,
283
+ LABEL_STYLE_MIN_SIZE: () => LABEL_STYLE_MIN_SIZE,
281
284
  MAX_EVENT_INVENTORY: () => MAX_EVENT_INVENTORY,
282
285
  MAX_GA_CAPACITY: () => MAX_GA_CAPACITY,
283
286
  PickerController: () => PickerController,
@@ -285,6 +288,7 @@ __export(index_exports, {
285
288
  SeatmapRenderer: () => SeatmapRenderer,
286
289
  UNGROUPED_ID: () => UNGROUPED_ID,
287
290
  accessibilityMeta: () => accessibilityMeta,
291
+ accessibilityRingColor: () => accessibilityRingColor,
288
292
  allObjects: () => allObjects,
289
293
  applyHidden: () => applyHidden,
290
294
  chartBounds: () => chartBounds,
@@ -339,6 +343,21 @@ var ACCESSIBILITY_LABEL = new Map(ACCESSIBILITY_TYPES.map((a) => [a.key, a]));
339
343
  function accessibilityMeta(key) {
340
344
  return ACCESSIBILITY_LABEL.get(key);
341
345
  }
346
+ var ACCESSIBILITY_RING_COLOR = {
347
+ wheelchair: "#3b82f6",
348
+ companion: "#8b5cf6",
349
+ "semi-ambulatory": "#0ea5e9",
350
+ hearing: "#14b8a6",
351
+ "sign-language": "#f59e0b",
352
+ "plus-size": "#ec4899",
353
+ "lift-armrest": "#22c55e"
354
+ };
355
+ function accessibilityRingColor(types) {
356
+ const primary = types?.[0];
357
+ return primary && ACCESSIBILITY_RING_COLOR[primary] || "#3b82f6";
358
+ }
359
+ var LABEL_STYLE_MIN_SIZE = 8;
360
+ var LABEL_STYLE_MAX_SIZE = 24;
342
361
  function layerOf(obj) {
343
362
  switch (obj.type) {
344
363
  case "row":
@@ -485,15 +504,21 @@ function expandRowSlots(row) {
485
504
  return rowSeatPositions(row).map((p, i) => {
486
505
  const o = ov.get(i);
487
506
  const accessibility = overrideAccessibility(o);
507
+ const inventoryLabel = o?.label ?? `${row.label}-${seatNumber(i)}`;
508
+ const displayPrefix = row.displayLabel ?? row.label;
509
+ const commercial = { ...row.commercial, ...o?.commercial };
488
510
  return {
489
511
  index: i,
490
512
  x: p.x + (o?.dx ?? 0),
491
513
  y: p.y + (o?.dy ?? 0),
492
- label: o?.label ?? `${row.label}-${seatNumber(i)}`,
514
+ label: inventoryLabel,
515
+ displayLabel: o?.displayLabel ?? `${displayPrefix}-${seatNumber(i)}`,
493
516
  categoryKey: o?.categoryKey ?? row.categoryKey,
494
517
  skipped: !!o?.skip,
495
518
  accessible: accessibility.length > 0,
496
- accessibility
519
+ accessibility,
520
+ commercial: Object.values(commercial).some((value) => value !== void 0 && value !== false && value !== "") ? commercial : void 0,
521
+ viewUrl: o?.viewFromSeatUrl ?? row.viewFromSeatUrl
497
522
  };
498
523
  });
499
524
  }
@@ -504,13 +529,15 @@ function expandRow(row) {
504
529
  seats.push({
505
530
  id: `${row.id}:${slot.index}`,
506
531
  label: slot.label,
532
+ displayLabel: slot.displayLabel === slot.label ? void 0 : slot.displayLabel,
507
533
  x: slot.x,
508
534
  y: slot.y,
509
535
  rowId: row.id,
510
536
  categoryKey: slot.categoryKey,
511
537
  accessible: slot.accessible || void 0,
512
538
  accessibility: slot.accessibility.length ? slot.accessibility : void 0,
513
- viewUrl: row.viewFromSeatUrl
539
+ commercial: slot.commercial,
540
+ viewUrl: slot.viewUrl
514
541
  });
515
542
  }
516
543
  return seats;
@@ -868,7 +895,7 @@ function computeSections(doc) {
868
895
  }
869
896
  nodes.set(logicalId, {
870
897
  id: logicalId,
871
- label: s.label || "Section",
898
+ label: s.displayLabel || s.label || "Section",
872
899
  zone: s.zone,
873
900
  seatCount: 0,
874
901
  objectIds: [],
@@ -1196,15 +1223,6 @@ var CLOSED_SEAT_OPACITY = 0.4;
1196
1223
  var FOCUS_DIM_OPACITY = 0.16;
1197
1224
  var FOCUS_BACKDROP_FILL = "rgba(244,246,248,0.06)";
1198
1225
  var CB_PALETTE = ["#E69F00", "#56B4E9", "#009E73", "#F0E442", "#0072B2", "#D55E00", "#CC79A7"];
1199
- var ACCESS_RING = {
1200
- wheelchair: "#3b82f6",
1201
- companion: "#8b5cf6",
1202
- "semi-ambulatory": "#0ea5e9",
1203
- hearing: "#14b8a6",
1204
- "sign-language": "#f59e0b",
1205
- "plus-size": "#ec4899",
1206
- "lift-armrest": "#22c55e"
1207
- };
1208
1226
  function seatMatchesAccess(seat, filter) {
1209
1227
  if (filter.length === 0) return !!seat.accessible;
1210
1228
  return !!seat.accessibility?.some((t2) => filter.includes(t2));
@@ -2654,13 +2672,12 @@ var _SeatmapRenderer = class _SeatmapRenderer {
2654
2672
  this.paintSeat(c, seat.id);
2655
2673
  target.add(c);
2656
2674
  if (seat.accessible) {
2657
- const primary = seat.accessibility?.[0];
2658
2675
  target.add(
2659
2676
  new import_Circle.Circle({
2660
2677
  x: seat.x,
2661
2678
  y: seat.y,
2662
2679
  radius: this.seatR + 1,
2663
- stroke: primary && ACCESS_RING[primary] || "#3b82f6",
2680
+ stroke: accessibilityRingColor(seat.accessibility),
2664
2681
  strokeWidth: 2,
2665
2682
  listening: false,
2666
2683
  perfectDrawEnabled: false,
@@ -2693,7 +2710,7 @@ var _SeatmapRenderer = class _SeatmapRenderer {
2693
2710
  const t2 = new import_Text.Text({
2694
2711
  x: seat.x,
2695
2712
  y: seat.y,
2696
- text: seat.label,
2713
+ text: seat.displayLabel ?? seat.label,
2697
2714
  fontSize: BOOTH_LABEL_FONT_SIZE,
2698
2715
  fontStyle: "600",
2699
2716
  fontFamily: this.labelFont(),
@@ -2716,12 +2733,12 @@ var _SeatmapRenderer = class _SeatmapRenderer {
2716
2733
  const idx = this.catOrder.indexOf(categoryKey);
2717
2734
  return CB_PALETTE[(idx >= 0 ? idx : 0) % CB_PALETTE.length];
2718
2735
  }
2719
- /** Authored free fills retain the chart's validated ink. Renderer-owned
2720
- * transient fills choose an ink against the paint that is actually visible. */
2721
- renderedBookableLabelInk(id, shape) {
2736
+ /** Resolve label ink against the paint that is actually visible. The theme
2737
+ * ink remains preferred, but mixed category palettes cannot always share one
2738
+ * accessible text colour, so every free and transient state gets the same
2739
+ * deterministic dark/light fallback used by Designer. */
2740
+ renderedBookableLabelInk(shape) {
2722
2741
  const preferred = this.theme.seatLabelColor ?? DEF_SEAT_LABEL;
2723
- const status = this.statusById.get(id) ?? "free";
2724
- if (status === "free" && !this.selection.has(id)) return preferred;
2725
2742
  const fill = shape.fill();
2726
2743
  return stateAwareBookableLabelInk(typeof fill === "string" ? fill : "", preferred);
2727
2744
  }
@@ -2807,7 +2824,7 @@ var _SeatmapRenderer = class _SeatmapRenderer {
2807
2824
  if (this.selectionFocusId && id !== this.selectionFocusId) c.opacity(Math.min(c.opacity(), 0.16));
2808
2825
  const bookableLabel = this.boothLabelById.get(id) ?? this.seatLabelById.get(id);
2809
2826
  if (bookableLabel) {
2810
- bookableLabel.fill(this.renderedBookableLabelInk(id, c));
2827
+ bookableLabel.fill(this.renderedBookableLabelInk(c));
2811
2828
  bookableLabel.visible(
2812
2829
  isBookableLabelLegibleAtScale(bookableLabel.fontSize(), this.effScale()) && c.opacity() >= 0.5
2813
2830
  );
@@ -3348,14 +3365,19 @@ var _SeatmapRenderer = class _SeatmapRenderer {
3348
3365
  listening: false
3349
3366
  }, obj.outlinePath);
3350
3367
  bgTarget.add(blockPoly);
3368
+ const labelStyle = obj.labelPresentation?.labelStyle;
3369
+ const preferredInk = labelStyle?.color ?? palette.sectionInk;
3370
+ const labelScale = (labelStyle?.size ?? 18) / 18;
3351
3371
  const nameLabel = new import_Text.Text({
3352
- x: centroid.x,
3353
- y: centroid.y,
3354
- text: obj.label,
3355
- fontSize: 22,
3372
+ x: obj.labelPresentation?.position?.x ?? centroid.x,
3373
+ y: obj.labelPresentation?.position?.y ?? centroid.y,
3374
+ text: obj.displayLabel ?? obj.label,
3375
+ rotation: obj.labelPresentation?.rotation ?? 0,
3376
+ visible: obj.labelPresentation?.visible !== false,
3377
+ fontSize: 22 * labelScale,
3356
3378
  fontStyle: "700",
3357
3379
  fontFamily: this.labelFont(),
3358
- fill: palette.sectionInk,
3380
+ fill: stateAwareBookableLabelInk(palette.sectionFill, preferredInk),
3359
3381
  listening: false,
3360
3382
  perfectDrawEnabled: false
3361
3383
  });
@@ -3379,7 +3401,7 @@ var _SeatmapRenderer = class _SeatmapRenderer {
3379
3401
  const sec = {
3380
3402
  id: obj.id,
3381
3403
  logicalId: obj.logicalSectionId ?? obj.id,
3382
- label: obj.label,
3404
+ label: obj.displayLabel ?? obj.label,
3383
3405
  outline: obj.outline,
3384
3406
  ...obj.outlinePath ? { outlinePath: obj.outlinePath } : {},
3385
3407
  holes: obj.holes ?? [],
@@ -3395,6 +3417,8 @@ var _SeatmapRenderer = class _SeatmapRenderer {
3395
3417
  blockPoly,
3396
3418
  nameLabel,
3397
3419
  subLabel,
3420
+ preferredInk,
3421
+ labelScale,
3398
3422
  nameLabelFits: true,
3399
3423
  subLabelFits: true,
3400
3424
  elevation,
@@ -3563,7 +3587,7 @@ var _SeatmapRenderer = class _SeatmapRenderer {
3563
3587
  const sectionFill = sec.blockPoly.fill();
3564
3588
  const sectionInk = stateAwareBookableLabelInk(
3565
3589
  typeof sectionFill === "string" ? sectionFill : sec.baseFill,
3566
- palette.sectionInk
3590
+ sec.preferredInk
3567
3591
  );
3568
3592
  sec.nameLabel.fill(sectionInk);
3569
3593
  sec.subLabel.fill(sectionInk);
@@ -3659,7 +3683,9 @@ var _SeatmapRenderer = class _SeatmapRenderer {
3659
3683
  fitSectionRungLabels(sec, sx) {
3660
3684
  const paddingPx = 8;
3661
3685
  sec.subLabelFits = false;
3662
- for (let fontPx = SECTION_LABEL_PX; fontPx >= MIN_SECTION_LABEL_PX; fontPx -= 1) {
3686
+ const maxPx = SECTION_LABEL_PX * sec.labelScale;
3687
+ const minPx = MIN_SECTION_LABEL_PX * sec.labelScale;
3688
+ for (let fontPx = maxPx; fontPx >= minPx; fontPx -= 1) {
3663
3689
  for (const rotation of [0, -90]) {
3664
3690
  sec.nameLabel.rotation(rotation);
3665
3691
  this.sizeLabel(sec.nameLabel, fontPx / sx, sec.nameLabel.y());
@@ -4496,7 +4522,7 @@ var _SeatmapRenderer = class _SeatmapRenderer {
4496
4522
  continue;
4497
4523
  }
4498
4524
  measure.fontSize(SEAT_LABEL_FONT_SIZE);
4499
- measure.text(bookableMarkerLabel(seat.label));
4525
+ measure.text(bookableMarkerLabel(seat.displayLabel ?? seat.label));
4500
4526
  const fitted = measure.width() > maxWidth ? Math.max(MIN_FITTED_SEAT_LABEL_FONT_SIZE, SEAT_LABEL_FONT_SIZE * maxWidth / measure.width()) : SEAT_LABEL_FONT_SIZE;
4501
4527
  minimumFont = Math.min(minimumFont, fitted);
4502
4528
  }
@@ -4650,11 +4676,11 @@ var _SeatmapRenderer = class _SeatmapRenderer {
4650
4676
  const t2 = new import_Text.Text({
4651
4677
  x: seat.x,
4652
4678
  y: seat.y,
4653
- text: bookableMarkerLabel(seat.label),
4679
+ text: bookableMarkerLabel(seat.displayLabel ?? seat.label),
4654
4680
  fontSize: SEAT_LABEL_FONT_SIZE,
4655
4681
  fontStyle: "600",
4656
4682
  fontFamily: this.labelFont(),
4657
- fill: shape ? this.renderedBookableLabelInk(seat.id, shape) : this.theme.seatLabelColor ?? DEF_SEAT_LABEL,
4683
+ fill: shape ? this.renderedBookableLabelInk(shape) : this.theme.seatLabelColor ?? DEF_SEAT_LABEL,
4658
4684
  listening: false,
4659
4685
  perfectDrawEnabled: false
4660
4686
  });
@@ -5946,9 +5972,12 @@ async function loadLocale(code) {
5946
5972
  }
5947
5973
  // Annotate the CommonJS export names for ESM import in node:
5948
5974
  0 && (module.exports = {
5975
+ ACCESSIBILITY_RING_COLOR,
5949
5976
  ACCESSIBILITY_TYPES,
5950
5977
  CHART_STORAGE_KEY,
5951
5978
  DEFAULT_CURRENCY,
5979
+ LABEL_STYLE_MAX_SIZE,
5980
+ LABEL_STYLE_MIN_SIZE,
5952
5981
  MAX_EVENT_INVENTORY,
5953
5982
  MAX_GA_CAPACITY,
5954
5983
  PickerController,
@@ -5956,6 +5985,7 @@ async function loadLocale(code) {
5956
5985
  SeatmapRenderer,
5957
5986
  UNGROUPED_ID,
5958
5987
  accessibilityMeta,
5988
+ accessibilityRingColor,
5959
5989
  allObjects,
5960
5990
  applyHidden,
5961
5991
  chartBounds,