courthive-components 4.1.2 → 4.2.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.
@@ -16,6 +16,8 @@ export { buildScheduleDateStrip } from './ui/dateStrip';
16
16
  export { buildScheduleIssuesPanel } from './ui/issuesPanel';
17
17
  export { buildMatchUpCatalog } from './ui/matchUpCatalog';
18
18
  export { buildMatchUpCard } from './ui/matchUpCard';
19
+ export type { CardTimeStatus, MatchUpCardCallbacks, MatchUpCardOptions } from './ui/matchUpCard';
20
+ export { applyRelatedHighlight, clearRelatedHighlight, RELATED_HIGHLIGHT } from './ui/matchUpHighlight';
19
21
  export { buildScheduleInspectorPanel } from './ui/inspectorPanel';
20
22
  export type { ScheduleInspectorPanelOptions } from './ui/inspectorPanel';
21
23
  export { buildCourtGridSlot } from './ui/courtGridSlot';
@@ -140,6 +140,12 @@ export interface SchedulePageConfig {
140
140
  * nothing. Consumers that build cards themselves (e.g. a Scheduled panel calling
141
141
  * `buildMatchUpCard` directly) pass the same function as `MatchUpCardOptions.renderExtra`. */
142
142
  renderCardExtra?: (matchUp: CatalogMatchUpItem) => HTMLElement | null;
143
+ /** MatchUps a card is entangled with, resolved when the pointer enters it and
144
+ * highlighted wherever the page draws them — grid cells, other cards, strip
145
+ * cells. The consumer owns the relation; this component sees one matchUp at a
146
+ * time and could not compute "waiting on" if it wanted to. Omit to leave
147
+ * cards without hover highlighting. */
148
+ relatedMatchUpIds?: (matchUp: CatalogMatchUpItem) => string[];
143
149
  /** Consumer-owned buttons rendered right-aligned in the court grid header.
144
150
  * Consumer keeps live refs and mutates state (visibility, disabled, label) directly. */
145
151
  headerActions?: HTMLElement | HTMLElement[];
@@ -1,4 +1,11 @@
1
1
  import { CatalogMatchUpItem } from '../types';
2
+ /**
3
+ * Grading for the prominent time header. The consumer owns the rule — the card
4
+ * knows only that `ok` is achievable, `warn` is achievable-but-compromised and
5
+ * `alert` is not achievable at all. Omitted leaves the header at its default
6
+ * (green) styling, which is what every consumer got before this option existed.
7
+ */
8
+ export type CardTimeStatus = 'ok' | 'warn' | 'alert';
2
9
  export interface MatchUpCardCallbacks {
3
10
  onClick?: (matchUp: CatalogMatchUpItem) => void;
4
11
  }
@@ -20,5 +27,17 @@ export interface MatchUpCardOptions {
20
27
  * its default styling (used for non-catalog renders + scheduled / completed
21
28
  * cards where round priority is meaningless). */
22
29
  roundOffset?: number;
30
+ /** Grading for the `prominentTime` header — see `CardTimeStatus`. Ignored when
31
+ * the header is not rendered. */
32
+ timeStatus?: CardTimeStatus;
33
+ /** Hover text for the time header, explaining what the grading is reading.
34
+ * A colour that cannot be interrogated is a colour the operator learns to
35
+ * distrust, so a graded header should always carry one. */
36
+ timeTitle?: string;
37
+ /** MatchUps this card depends on, resolved on hover and highlighted wherever
38
+ * they are drawn — see `matchUpHighlight.ts`. The consumer owns the relation;
39
+ * this component sees one matchUp and could not compute "waiting on". Omit to
40
+ * leave the card without hover highlighting. */
41
+ relatedMatchUpIds?: (item: CatalogMatchUpItem) => string[];
23
42
  }
24
43
  export declare function buildMatchUpCard(item: CatalogMatchUpItem, callbacks: MatchUpCardCallbacks, options?: MatchUpCardOptions): HTMLElement;
@@ -9,5 +9,7 @@ export interface MatchUpCatalogCallbacks {
9
9
  onDropRemove?: (matchUpId: string) => void;
10
10
  /** Forwarded to every card as `MatchUpCardOptions.renderExtra`. See that contract. */
11
11
  renderCardExtra?: (matchUp: CatalogMatchUpItem) => HTMLElement | null;
12
+ /** Forwarded to every card as `MatchUpCardOptions.relatedMatchUpIds`. See that contract. */
13
+ relatedMatchUpIds?: (matchUp: CatalogMatchUpItem) => string[];
12
14
  }
13
15
  export declare function buildMatchUpCatalog(callbacks: MatchUpCatalogCallbacks): UIPanel<SchedulePageState>;
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Schedule page — "related matchUp" highlighting.
3
+ *
4
+ * Hovering a catalog card lights up the matchUps it depends on wherever they
5
+ * appear: court-grid cells, other cards, the active strip. Anything carrying
6
+ * `data-matchup-id` participates, which is every surface on the page, so no
7
+ * registry is needed — the document already knows where each matchUp is drawn.
8
+ *
9
+ * ── Why this is not the conflict highlight ──
10
+ *
11
+ * `scheduleGridCell.ts` already highlights on hover, driven by `issueIds` from
12
+ * `proConflicts`, and paints amber. That relation is *conflict*: two matchUps
13
+ * that cannot both stand. The relation a catalog card carries is different and
14
+ * usually benign — the quarterfinal this semifinal is waiting on, the match a
15
+ * player walked off an hour ago. Painting those amber would teach the operator
16
+ * that a normal draw is full of conflicts, so this is a separate class with a
17
+ * separate colour, and the two can be lit at once without lying about either.
18
+ *
19
+ * The consumer supplies the relation: this component sees one matchUp at a time
20
+ * and could not compute "waiting on" if it wanted to.
21
+ */
22
+ export declare const RELATED_HIGHLIGHT = "spl-related-highlight";
23
+ /**
24
+ * Drop every related highlight in the document.
25
+ *
26
+ * Exported because `mouseleave` is not guaranteed to fire: the catalog rebuilds
27
+ * its cards on every state change, and a card removed while the pointer is over
28
+ * it never fires one — which would strand the highlight until the next hover
29
+ * happened to clear it. Consumers that rebuild cards themselves call this first.
30
+ */
31
+ export declare function clearRelatedHighlight(): void;
32
+ /** Light up every element drawn for one of `matchUpIds`. Clears any previous set first. */
33
+ export declare function applyRelatedHighlight(matchUpIds: string[]): void;
34
+ /**
35
+ * Wire hover highlighting onto one card.
36
+ *
37
+ * The relation is resolved on `mouseenter` rather than at build time: it depends
38
+ * on tournament state that moves under a card which may sit unrebuilt for
39
+ * minutes, and resolving it per hover costs one pass instead of one per card in
40
+ * every render.
41
+ *
42
+ * `dragstart` clears as well — a card being dragged is about to be re-parented
43
+ * by the browser, and a highlight left standing behind it reads as a result of
44
+ * the drop rather than a leftover of the hover.
45
+ */
46
+ export declare function attachRelatedHighlight(card: HTMLElement, resolve: () => string[]): void;