courthive-components 6.4.2 → 6.5.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.
@@ -1,5 +1,5 @@
1
- import { MatchUp } from '../../types';
2
1
  import { InlineScoringCallbacks, InlineScoringEngineState } from './inlineScoringTypes';
2
+ import { MatchUp } from '../../types';
3
3
  /**
4
4
  * Manages ScoringEngine instances for inline scoring in draw brackets.
5
5
  * One engine per matchUpId; lazily created on first interaction.
@@ -16,9 +16,10 @@ export interface InlineScoringCallbacks {
16
16
  matchUp: MatchUp;
17
17
  engine: any;
18
18
  }) => void;
19
+ /** `winningSide` is absent when a combined-point total ends level (a tie is a finished result). */
19
20
  onMatchComplete?: (params: {
20
21
  matchUpId: string;
21
- winningSide: number;
22
+ winningSide?: number;
22
23
  engine: any;
23
24
  }) => void;
24
25
  onEndMatch?: (params: {
@@ -0,0 +1,21 @@
1
+ /**
2
+ * What the picker offers for a match root and a set's tiebreak point. Moved unchanged from the retired
3
+ * `matchUpFormatLogic.ts`, whose other exports served the modal the state machine replaced.
4
+ */
5
+ export declare const MATCH_ROOTS: readonly ["SET", "HAL", "QTR", "PER", "INN", "RND", "FRM", "MAP"];
6
+ export declare const MATCH_ROOT_LABELS: Record<string, string>;
7
+ /**
8
+ * Returns valid bestOf options for a given match root.
9
+ * SET root: [1,3,5,7,9] — odd counts; the factory parses any best-of count (#5136)
10
+ * Other roots: [1..12] (wide range for cross-sport)
11
+ */
12
+ export declare function getBestOfOptionsForRoot(matchRoot?: string): number[];
13
+ /**
14
+ * Calculate valid tiebreakAt options based on setTo value
15
+ */
16
+ export declare function getTiebreakAtOptions(setTo: number): number[];
17
+ /**
18
+ * Auto-adjust tiebreakAt when setTo changes
19
+ * Returns the new tiebreakAt value that should be used
20
+ */
21
+ export declare function autoAdjustTiebreakAt(newSetTo: number, currentTiebreakAt: number): number;
@@ -72,5 +72,41 @@ export interface ViewConfig {
72
72
  combinedPoints?: CombinedPointsConfig;
73
73
  }
74
74
  export declare const CUSTOM = "Custom";
75
+ /**
76
+ * The picker's own words, in English. A consumer translates them through `config.labels` (CA, 2026-10-11):
77
+ * `what` holds the singular set-type names and `whatPlural` the plural ones, and a label that carries a
78
+ * number is a template with `{n}`, so a language can put the number where its word order needs it. Each
79
+ * key falls back to English on its own, so a consumer that translates some keys keeps the rest.
80
+ */
81
+ export declare const DEFAULT_LABELS: {
82
+ what: {
83
+ sets: string;
84
+ tiebreaks: string;
85
+ timedSets: string;
86
+ outs: string;
87
+ pointsTotal: string;
88
+ };
89
+ whatPlural: {
90
+ sets: string;
91
+ tiebreaks: string;
92
+ timedSets: string;
93
+ outs: string;
94
+ pointsTotal: string;
95
+ };
96
+ advantage: {
97
+ ad: string;
98
+ noAd: string;
99
+ };
100
+ matchRoots: Record<string, string>;
101
+ setTo: string;
102
+ tiebreakTo: string;
103
+ winBy: string;
104
+ minutes: string;
105
+ outs: string;
106
+ maxMinutes: string;
107
+ pointsTotal: string;
108
+ tieAllowed: string;
109
+ consecutive: string;
110
+ };
75
111
  export declare function gameFormatText(gameFormat: GameFormat | undefined, labels?: any): string;
76
112
  export declare function deriveView(state: EditorState, config: ViewConfig): EditorView;
@@ -31,15 +31,46 @@ export interface MatchUpFormatConfig {
31
31
  bestOf?: string;
32
32
  exactly?: string;
33
33
  };
34
+ /** The set-type names, singular ("Best of 1 Set"). */
34
35
  what?: {
35
36
  sets?: string;
36
37
  tiebreaks?: string;
37
38
  timedSets?: string;
39
+ outs?: string;
40
+ pointsTotal?: string;
41
+ };
42
+ /** The set-type names, plural ("Best of 3 Sets"). */
43
+ whatPlural?: {
44
+ sets?: string;
45
+ tiebreaks?: string;
46
+ timedSets?: string;
47
+ outs?: string;
48
+ pointsTotal?: string;
38
49
  };
39
50
  advantage?: {
40
51
  ad?: string;
41
52
  noAd?: string;
42
53
  };
54
+ /** Match-root names by code (SET, HAL, QTR, PER, INN, RND, FRM, MAP). */
55
+ matchRoots?: Record<string, string>;
56
+ /** 'to {n}': games to win a set. */
57
+ setTo?: string;
58
+ /** 'TB to {n}': points to win a tiebreak. */
59
+ tiebreakTo?: string;
60
+ /** 'Win by {n}': a margin to win (a tiebreak, a set, or a points total after a tie). */
61
+ winBy?: string;
62
+ /** '{n} Minutes': a timed set's length. */
63
+ minutes?: string;
64
+ /** '{n} outs': outs per side. */
65
+ outs?: string;
66
+ /** '{n} min': the match time limit. */
67
+ maxMinutes?: string;
68
+ /** '{n} points': a points total. */
69
+ pointsTotal?: string;
70
+ /** '{n} consecutive': a game format without its own consecutive2-4 label. */
71
+ consecutive?: string;
72
+ /** A points total whose tie stands as the result. */
73
+ tieAllowed?: string;
43
74
  };
44
75
  options?: {
45
76
  bestOf?: number[];
@@ -0,0 +1,10 @@
1
+ import { SetScore } from '../types';
2
+ /**
3
+ * A combined-point total that allows a tie (`SET1-S:P32`) can end level, 16–16: COMPLETED with no winner
4
+ * (CA, 2026-10-11: ties are valid). The score dialogs otherwise finish a match only on a winner.
5
+ *
6
+ * The factory decides whether the set is over (`checkSetIsComplete` hands a combined-point set to its own
7
+ * `analyzeCombinedPointSet`); this adds only that the format lets a tie stand and the totals are level. A
8
+ * deciding-point or win-by format (`P32DP`, `P32WB2`) never ends level, so it is never a completed tie.
9
+ */
10
+ export declare function isCompletedCombinedPointTie(sets: SetScore[], matchUpFormat?: string): boolean;
@@ -15,8 +15,8 @@ import { SetScore } from '../types';
15
15
  * of 7, and a low of 5 in `S:6NOAD` completed to **7** instead of 6 — a 7-5 in a format where first to
16
16
  * six wins.
17
17
  *
18
- * Every OTHER reader of this flag in the package had it right — `freeScore.ts`, `matchUpFormat.ts`,
19
- * `matchUpFormatLogic.ts` and the format picker all read `.NoAD`. This one type was the outlier, which
18
+ * Every OTHER reader of this flag in the package had it right — `freeScore.ts` and the format picker
19
+ * (`matchUpFormat/machine/codec.ts`) both read `.NoAD`. This one type was the outlier, which
20
20
  * is the shape the architectural standards call mock divergence: a hand-written mirror that renames a
21
21
  * field and then certifies the rename.
22
22
  */