@seatlayer/core 0.28.1 → 0.28.3

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.js CHANGED
@@ -1090,9 +1090,10 @@ function compositeHexOver(foreground, background, opacity) {
1090
1090
  const channels = front.map((value, index) => Math.round(value * alpha + back[index] * (1 - alpha)));
1091
1091
  return `#${channels.map((value) => value.toString(16).padStart(2, "0")).join("")}`;
1092
1092
  }
1093
- function stateAwareBookableLabelInk(fill, preferred) {
1093
+ var AUTHORED_LABEL_MIN_CONTRAST = 3;
1094
+ function stateAwareBookableLabelInk(fill, preferred, minContrast = SMALL_TEXT_CONTRAST) {
1094
1095
  const preferredContrast = renderedTextContrast(preferred, fill);
1095
- if (preferredContrast != null && preferredContrast >= SMALL_TEXT_CONTRAST) return preferred;
1096
+ if (preferredContrast != null && preferredContrast >= minContrast) return preferred;
1096
1097
  const darkContrast = renderedTextContrast(DARK_BOOKABLE_LABEL_INK, fill) ?? 0;
1097
1098
  const lightContrast = renderedTextContrast(LIGHT_BOOKABLE_LABEL_INK, fill) ?? 0;
1098
1099
  if (darkContrast === 0 && lightContrast === 0) return preferred;
@@ -4507,7 +4508,7 @@ var _SeatmapRenderer = class _SeatmapRenderer {
4507
4508
  * authored per-seat colour through the same auto-contrast rule as sections. */
4508
4509
  seatLabelInk(seat, shape) {
4509
4510
  const fill = shape.fill();
4510
- return stateAwareBookableLabelInk(typeof fill === "string" ? fill : "", this.seatPreferredLabelInk(seat));
4511
+ return stateAwareBookableLabelInk(typeof fill === "string" ? fill : "", this.seatPreferredLabelInk(seat), AUTHORED_LABEL_MIN_CONTRAST);
4511
4512
  }
4512
4513
  /** Apply fill/stroke/opacity for a seat's current status + selection. */
4513
4514
  paintSeat(c, id) {
@@ -4602,7 +4603,7 @@ var _SeatmapRenderer = class _SeatmapRenderer {
4602
4603
  const accessGlyph = this.accessGlyphById.get(id);
4603
4604
  if (accessGlyph) {
4604
4605
  const fill = c.fill();
4605
- accessGlyph.fill(stateAwareBookableLabelInk(typeof fill === "string" ? fill : "", "#ffffff"));
4606
+ accessGlyph.fill(accessGlyphInk(typeof fill === "string" ? fill : ""));
4606
4607
  accessGlyph.opacity(c.opacity());
4607
4608
  accessGlyph.visible(this.accessGlyphShouldShow(id));
4608
4609
  }
@@ -6675,7 +6676,8 @@ var _SeatmapRenderer = class _SeatmapRenderer {
6675
6676
  const labelStyle = presentation?.labelStyle;
6676
6677
  const ink = stateAwareBookableLabelInk(
6677
6678
  background,
6678
- labelStyle?.color ?? this.theme.rowLabelColor ?? this.theme.textColor ?? "#e6e9f0"
6679
+ labelStyle?.color ?? this.theme.rowLabelColor ?? this.theme.textColor ?? "#e6e9f0",
6680
+ AUTHORED_LABEL_MIN_CONTRAST
6679
6681
  );
6680
6682
  const fontSize = labelStyle?.size ?? 12;
6681
6683
  const rotation = presentation?.rotation ?? 0;