courthive-components 1.6.0 → 1.7.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.
Files changed (26) hide show
  1. package/dist/components/competitivenessBar/aggregateCompetitiveness.d.ts +3 -0
  2. package/dist/components/competitivenessBar/buildCompetitivenessBar.d.ts +6 -0
  3. package/dist/components/competitivenessBar/buildCompetitivenessDonut.d.ts +6 -0
  4. package/dist/components/competitivenessBar/index.d.ts +7 -0
  5. package/dist/components/competitivenessBar/types.d.ts +6 -0
  6. package/dist/components/composition-editor/compositionEditorStore.d.ts +5 -3
  7. package/dist/components/composition-editor/compositionEditorTypes.d.ts +4 -2
  8. package/dist/components/composition-editor/sections/colorsSection.d.ts +3 -0
  9. package/dist/components/draw-card/buildDrawCard.d.ts +2 -0
  10. package/dist/components/draw-card/buildSkeletonCard.d.ts +2 -0
  11. package/dist/components/draw-card/defaultConfig.d.ts +3 -0
  12. package/dist/components/draw-card/index.d.ts +6 -0
  13. package/dist/components/draw-card/mapDraw.d.ts +18 -0
  14. package/dist/components/draw-card/styles.d.ts +18 -0
  15. package/dist/components/draw-card/types.d.ts +59 -0
  16. package/dist/components/event-card/styles.d.ts +4 -0
  17. package/dist/compositions/resolvePublishedComposition.d.ts +12 -1
  18. package/dist/courthive-components.css +1 -1
  19. package/dist/courthive-components.es.js +5755 -5124
  20. package/dist/courthive-components.umd.js +33 -33
  21. package/dist/index.d.ts +4 -0
  22. package/dist/styles/applyCompositionColors.d.ts +9 -0
  23. package/dist/styles/themes/index.d.ts +1 -0
  24. package/dist/styles/themes/typtiTheme.d.ts +1 -0
  25. package/dist/types.d.ts +25 -0
  26. package/package.json +3 -3
@@ -0,0 +1,3 @@
1
+ import { CompetitivenessBuckets } from './types';
2
+ export declare function aggregateCompetitiveness(items: any[]): CompetitivenessBuckets;
3
+ export declare function totalBuckets(buckets: CompetitivenessBuckets): number;
@@ -0,0 +1,6 @@
1
+ import { CompetitivenessBuckets } from './types';
2
+ export interface BuildCompetitivenessBarResult {
3
+ element: HTMLElement;
4
+ update: (buckets: CompetitivenessBuckets) => void;
5
+ }
6
+ export declare function buildCompetitivenessBar(): BuildCompetitivenessBarResult;
@@ -0,0 +1,6 @@
1
+ import { CompetitivenessBuckets } from './types';
2
+ export interface BuildCompetitivenessDonutResult {
3
+ element: HTMLElement;
4
+ update: (buckets: CompetitivenessBuckets) => void;
5
+ }
6
+ export declare function buildCompetitivenessDonut(): BuildCompetitivenessDonutResult;
@@ -0,0 +1,7 @@
1
+ export { buildCompetitivenessBar } from './buildCompetitivenessBar';
2
+ export { buildCompetitivenessDonut } from './buildCompetitivenessDonut';
3
+ export { aggregateCompetitiveness, totalBuckets } from './aggregateCompetitiveness';
4
+ export { COMPETITIVENESS_BUCKETS } from './types';
5
+ export type { BuildCompetitivenessBarResult } from './buildCompetitivenessBar';
6
+ export type { BuildCompetitivenessDonutResult } from './buildCompetitivenessDonut';
7
+ export type { CompetitivenessBucket, CompetitivenessBuckets } from './types';
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Competitiveness Bar — Type Definitions.
3
+ */
4
+ export declare const COMPETITIVENESS_BUCKETS: readonly ["COMPETITIVE", "ROUTINE", "DECISIVE", "WALKOVER"];
5
+ export type CompetitivenessBucket = (typeof COMPETITIVENESS_BUCKETS)[number];
6
+ export type CompetitivenessBuckets = Record<CompetitivenessBucket, number>;
@@ -1,4 +1,4 @@
1
- import { Configuration } from '../../types';
1
+ import { CompositionColors, Configuration } from '../../types';
2
2
  import { CompositionEditorConfig, CompositionEditorState, CompositionEditorListener, SectionId } from './compositionEditorTypes';
3
3
  export declare class CompositionEditorStore {
4
4
  private state;
@@ -9,14 +9,16 @@ export declare class CompositionEditorStore {
9
9
  subscribe(listener: CompositionEditorListener): () => void;
10
10
  toggleSection(sectionId: SectionId): void;
11
11
  setTheme(theme: string): void;
12
+ setColorField<K extends keyof CompositionColors>(key: K, value: CompositionColors[K] | undefined): void;
13
+ clearColors(): void;
12
14
  setCompositionName(name: string): void;
13
15
  setConfigField<K extends keyof Configuration>(key: K, value: Configuration[K]): void;
14
16
  /** Update a nested object field (e.g., gameScore, placeHolders, scaleAttributes) */
15
17
  setConfigNestedField<K extends keyof Configuration>(key: K, nestedKey: string, value: unknown): void;
16
18
  /** Replace the entire configuration (e.g., loading a preset) */
17
19
  setConfiguration(configuration: Configuration): void;
18
- /** Load a full composition (theme + config + name) */
19
- loadComposition(name: string, theme: string, configuration: Configuration): void;
20
+ /** Load a full composition (theme + config + name + colors) */
21
+ loadComposition(name: string, theme: string, configuration: Configuration, colors?: CompositionColors): void;
20
22
  resetToInitial(): void;
21
23
  private setState;
22
24
  private emit;
@@ -1,9 +1,10 @@
1
- import { Composition, Configuration } from '../../types';
1
+ import { Composition, CompositionColors, Configuration } from '../../types';
2
2
  /** JSON-serializable snapshot of a composition (no functions/DOM refs) */
3
3
  export interface SavedComposition {
4
4
  compositionName: string;
5
5
  theme: string;
6
6
  configuration: Configuration;
7
+ colors?: CompositionColors;
7
8
  version?: number;
8
9
  }
9
10
  export interface CompositionEditorConfig {
@@ -20,11 +21,12 @@ export interface CompositionEditorConfig {
20
21
  /** Restrict available theme choices */
21
22
  availableThemes?: string[];
22
23
  }
23
- export type SectionId = 'theme' | 'display' | 'score' | 'participant' | 'placeholder' | 'scale' | 'layout';
24
+ export type SectionId = 'theme' | 'colors' | 'display' | 'score' | 'participant' | 'placeholder' | 'scale' | 'layout';
24
25
  export interface CompositionEditorState {
25
26
  compositionName: string;
26
27
  theme: string;
27
28
  configuration: Configuration;
29
+ colors?: CompositionColors;
28
30
  expandedSections: Set<SectionId>;
29
31
  isDirty: boolean;
30
32
  readOnly: boolean;
@@ -0,0 +1,3 @@
1
+ import { CompositionEditorStore } from '../compositionEditorStore';
2
+ import { EditorPanel } from '../compositionEditorTypes';
3
+ export declare function buildColorsSection(store: CompositionEditorStore): EditorPanel;
@@ -0,0 +1,2 @@
1
+ import { DrawCardCallbacks, DrawCardConfig, DrawCardData } from './types';
2
+ export declare function buildDrawCard(data: DrawCardData, config?: Partial<DrawCardConfig>, callbacks?: DrawCardCallbacks): HTMLElement;
@@ -0,0 +1,2 @@
1
+ /** Placeholder card for loading states. Render 3–6 of these in the grid wrap. */
2
+ export declare function buildDrawSkeletonCard(): HTMLElement;
@@ -0,0 +1,3 @@
1
+ import { DrawCardConfig } from './types';
2
+ export declare const DEFAULT_DRAW_CARD_CONFIG: DrawCardConfig;
3
+ export declare function mergeDrawCardConfig(override?: Partial<DrawCardConfig>): DrawCardConfig;
@@ -0,0 +1,6 @@
1
+ export { buildDrawCard } from './buildDrawCard';
2
+ export { buildDrawSkeletonCard } from './buildSkeletonCard';
3
+ export { mapDrawDefinitionToCardData } from './mapDraw';
4
+ export { DEFAULT_DRAW_CARD_CONFIG, mergeDrawCardConfig } from './defaultConfig';
5
+ export type { MapDrawOptions } from './mapDraw';
6
+ export type { DrawCardCallbacks, DrawCardConfig, DrawCardCornerField, DrawCardData, DrawCardField, DrawMatchUpCounts, DrawStatusKind, DrawStatusPill } from './types';
@@ -0,0 +1,18 @@
1
+ import { DrawCardData, DrawMatchUpCounts, DrawStatusPill } from './types';
2
+ export interface MapDrawOptions {
3
+ lightMode?: boolean;
4
+ matchUpStats?: DrawMatchUpCounts;
5
+ /** Pre-computed averages (consumer might fetch via factory.getRatingsStats). */
6
+ utrAvg?: number;
7
+ wtnAvg?: number;
8
+ /** Pre-resolved publish flags from publishingGovernor. */
9
+ published?: boolean;
10
+ embargoActive?: boolean;
11
+ /** Pre-resolved entry count (consumer often has this via getAssignedParticipantIds). */
12
+ entryCount?: number;
13
+ /** Back-reference for click handlers. */
14
+ eventId?: string;
15
+ /** Override the resolved status. */
16
+ statusOverride?: DrawStatusPill | null;
17
+ }
18
+ export declare function mapDrawDefinitionToCardData(drawDefinition: any, options?: MapDrawOptions): DrawCardData;
@@ -0,0 +1,18 @@
1
+ export declare const dcCardStyle: () => string;
2
+ export declare const dcCardClickableStyle: () => string;
3
+ export declare const dcCornerBadgesStyle: () => string;
4
+ export declare const dcStatusPillStyle: () => string;
5
+ export declare const dcSecondaryBadgeStyle: () => string;
6
+ export declare const dcBodyStyle: () => string;
7
+ export declare const dcVizZoneStyle: () => string;
8
+ export declare const dcTitleRowStyle: () => string;
9
+ export declare const dcTitleStyle: () => string;
10
+ export declare const dcDrawTypeLabelStyle: () => string;
11
+ export declare const dcMetaLineStyle: () => string;
12
+ export declare const dcFooterStyle: () => string;
13
+ export declare const dcChipStyle: () => string;
14
+ export declare const dcProgressStyle: () => string;
15
+ export declare const dcProgressBarStyle: () => string;
16
+ export declare const dcProgressFillStyle: () => string;
17
+ export declare const dcSkeletonStyle: () => string;
18
+ export declare const dcSkeletonLineStyle: () => string;
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Draw Card — Type Definitions
3
+ *
4
+ * Flat data + JSON-serializable config consumed by buildDrawCard.
5
+ */
6
+ export type DrawStatusKind = 'ungenerated' | 'ready' | 'in-progress' | 'completed' | 'cancelled';
7
+ export interface DrawStatusPill {
8
+ kind: DrawStatusKind;
9
+ label: string;
10
+ }
11
+ export interface DrawMatchUpCounts {
12
+ total: number;
13
+ completed: number;
14
+ inProgress: number;
15
+ scheduled: number;
16
+ }
17
+ export interface DrawCardData {
18
+ drawId: string;
19
+ drawName: string;
20
+ /** TODS drawType code, e.g. 'SINGLE_ELIMINATION' / 'ROUND_ROBIN'. */
21
+ drawType?: string;
22
+ /** Human label derived from drawType (e.g. "Single Elimination"). */
23
+ drawTypeLabel?: string;
24
+ drawSize?: number;
25
+ entryCount?: number;
26
+ /** matchUpFormat code surfaced as a chip in the footer. */
27
+ matchUpFormat?: string;
28
+ flightNumber?: number;
29
+ /** undefined when the underlying flight hasn't been generated yet. */
30
+ matchUpCounts?: DrawMatchUpCounts;
31
+ /** True once `structures` have been created on the drawDefinition. */
32
+ generated: boolean;
33
+ published?: boolean;
34
+ embargoActive?: boolean;
35
+ /** Average ratings across the draw, when scaleValues are available. */
36
+ utrAvg?: number;
37
+ wtnAvg?: number;
38
+ status?: DrawStatusPill | null;
39
+ /** Back-reference for callers that need it on click; not rendered. */
40
+ eventId?: string;
41
+ /** Optional visualization element rendered above the body (e.g. histogram,
42
+ * competitiveness bar, sunburst). The card is intentionally agnostic about
43
+ * which viz lives here — the consumer instantiates it. Pair with
44
+ * `DrawCardConfig.showVisualization = true`. */
45
+ visualization?: HTMLElement | null;
46
+ }
47
+ export type DrawCardField = 'title' | 'drawTypeLabel' | 'drawSize' | 'matchUpFormat' | 'entries' | 'matchUpProgress' | 'ratings' | 'flightNumber';
48
+ export type DrawCardCornerField = 'status' | 'publishedBadge' | 'embargoBadge';
49
+ export interface DrawCardConfig {
50
+ cornerBadges: DrawCardCornerField[];
51
+ body: DrawCardField[];
52
+ footer: DrawCardField[];
53
+ /** When true and `DrawCardData.visualization` is set, the visualization
54
+ * element renders in a dedicated zone above the body. Default `false`. */
55
+ showVisualization?: boolean;
56
+ }
57
+ export interface DrawCardCallbacks {
58
+ onClick?: (data: DrawCardData) => void;
59
+ }
@@ -16,6 +16,10 @@ export declare const ecDateRangeStyle: () => string;
16
16
  export declare const ecFooterStyle: () => string;
17
17
  export declare const ecPlayerCountStyle: () => string;
18
18
  export declare const ecMatchUpProgressStyle: () => string;
19
+ export declare const ecProgressStyle: () => string;
20
+ export declare const ecProgressMetaStyle: () => string;
21
+ export declare const ecProgressBarStyle: () => string;
22
+ export declare const ecProgressFillStyle: () => string;
19
23
  export declare const ecUpdatedAtStyle: () => string;
20
24
  export declare const ecSkeletonStyle: () => string;
21
25
  export declare const ecSkeletonLineStyle: () => string;
@@ -1,12 +1,23 @@
1
- import { Composition, Configuration } from '../types';
1
+ import { Composition, CompositionColors, Configuration } from '../types';
2
2
  export interface DisplayExtensionValue {
3
3
  compositionName?: string;
4
4
  theme?: string;
5
5
  configuration?: Partial<Configuration>;
6
+ /** Per-composition color overrides snapshot. When present, wins over the
7
+ * named-composition's theme defaults. Set by TMX when applying a user
8
+ * composition so the colors travel with published draws even when the
9
+ * `compositionName` isn't a builtin known to this package. */
10
+ colors?: CompositionColors;
6
11
  }
7
12
  /**
8
13
  * Resolves a published composition from a DISPLAY extension value.
9
14
  * Returns a new composition object (never mutates the built-in singletons).
10
15
  * Falls back to 'National' if the named composition is not found.
16
+ *
17
+ * For user compositions (names not in the builtin map), the named lookup
18
+ * falls back to the default, but `display.theme`, `display.configuration`,
19
+ * and `display.colors` from the extension still apply — so TMX-side custom
20
+ * compositions render correctly in courthive-public as long as TMX persists
21
+ * the full snapshot.
11
22
  */
12
23
  export declare function resolvePublishedComposition(display?: DisplayExtensionValue, fallbackName?: string): Composition;