courthive-components 3.0.0 → 3.1.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/README.md CHANGED
@@ -18,13 +18,13 @@ This library provides a comprehensive set of UI components for building tourname
18
18
  ## Installation
19
19
 
20
20
  ```bash
21
- npm install courthive-components
22
- # or
23
- yarn add courthive-components
24
- # or
25
21
  pnpm add courthive-components
26
22
  ```
27
23
 
24
+ (External consumers may also use `npm install courthive-components` or
25
+ `yarn add courthive-components`. Inside the CourtHive monorepo,
26
+ pnpm is the only supported manager.)
27
+
28
28
  ## Quick Start
29
29
 
30
30
  ```javascript
@@ -0,0 +1,10 @@
1
+ import { SeedingPolicyData, SeedingPositioning } from '../types';
2
+ export declare const POSITIONING_OPTIONS: {
3
+ value: SeedingPositioning;
4
+ label: string;
5
+ description: string;
6
+ }[];
7
+ /** Draw types that meaningfully use a positioning override. Mirrors factory drawDefinitionConstants. */
8
+ export declare const DRAW_TYPE_OPTIONS: string[];
9
+ export declare function emptySeedingPolicy(): SeedingPolicyData;
10
+ export declare function positioningLabel(value: SeedingPositioning | undefined): string;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Seeding Editor — Public API
3
+ */
4
+ export { SeedingEditorControl, createSeedingEditor } from './seedingEditorControl';
5
+ export { SeedingEditorStore } from './seedingEditorStore';
6
+ export { buildSeedingEditorPanel } from './seedingEditorPanel';
7
+ export { emptySeedingPolicy, POSITIONING_OPTIONS, DRAW_TYPE_OPTIONS } from './domain/seedingProjections';
8
+ export type { SeedingPolicyData, SeedingProfile, SeedingPositioning, SeedsCountThreshold, SeedingEditorState, SeedingEditorSection, SeedingEditorChangeListener, SeedingEditorConfig } from './types';
@@ -0,0 +1,6 @@
1
+ import { SeedingEditorConfig, SeedingEditorState } from '../types';
2
+ import { SeedingEditorStore } from '../seedingEditorStore';
3
+ export declare function buildDrawTypeOverridesSection(store: SeedingEditorStore, config: SeedingEditorConfig): {
4
+ element: HTMLElement;
5
+ update(state: SeedingEditorState): void;
6
+ };
@@ -0,0 +1,6 @@
1
+ import { SeedingEditorState } from '../types';
2
+ import { SeedingEditorStore } from '../seedingEditorStore';
3
+ export declare function buildFlagsSection(store: SeedingEditorStore): {
4
+ element: HTMLElement;
5
+ update(state: SeedingEditorState): void;
6
+ };
@@ -0,0 +1,6 @@
1
+ import { SeedingEditorState } from '../types';
2
+ import { SeedingEditorStore } from '../seedingEditorStore';
3
+ export declare function buildProfileSection(store: SeedingEditorStore): {
4
+ element: HTMLElement;
5
+ update(state: SeedingEditorState): void;
6
+ };
@@ -0,0 +1,6 @@
1
+ import { SeedingEditorState } from '../types';
2
+ import { SeedingEditorStore } from '../seedingEditorStore';
3
+ export declare function buildThresholdsSection(store: SeedingEditorStore): {
4
+ element: HTMLElement;
5
+ update(state: SeedingEditorState): void;
6
+ };
@@ -0,0 +1,20 @@
1
+ import { SeedingEditorStore } from './seedingEditorStore';
2
+ import { SeedingPolicyData, SeedingEditorConfig } from './types';
3
+ import { PolicyEditorInstance as CatalogEditorInstance } from '../../types';
4
+ export declare class SeedingEditorControl {
5
+ private readonly store;
6
+ private readonly panel;
7
+ private readonly unsubscribe;
8
+ private container;
9
+ constructor(config: SeedingEditorConfig);
10
+ render(container: HTMLElement): void;
11
+ destroy(): void;
12
+ getData(): SeedingPolicyData;
13
+ setData(data: SeedingPolicyData): void;
14
+ getStore(): SeedingEditorStore;
15
+ static createEditorInstance(config: {
16
+ initialData: Record<string, unknown>;
17
+ onChange: (data: Record<string, unknown>) => void;
18
+ }): CatalogEditorInstance;
19
+ }
20
+ export declare function createSeedingEditor(config: SeedingEditorConfig, container: HTMLElement): SeedingEditorControl;
@@ -0,0 +1,6 @@
1
+ import { SeedingEditorState, SeedingEditorConfig } from './types';
2
+ import { SeedingEditorStore } from './seedingEditorStore';
3
+ export declare function buildSeedingEditorPanel(store: SeedingEditorStore, config: SeedingEditorConfig): {
4
+ element: HTMLElement;
5
+ update(state: SeedingEditorState): void;
6
+ };
@@ -0,0 +1,26 @@
1
+ import { SeedingPolicyData, SeedingEditorState, SeedingEditorSection, SeedingEditorChangeListener, SeedingEditorConfig, SeedsCountThreshold, SeedingPositioning } from './types';
2
+ export declare class SeedingEditorStore {
3
+ private state;
4
+ private readonly listeners;
5
+ private readonly config;
6
+ constructor(config: SeedingEditorConfig);
7
+ getState(): SeedingEditorState;
8
+ getData(): SeedingPolicyData;
9
+ setData(data: SeedingPolicyData): void;
10
+ toggleSection(sectionId: SeedingEditorSection): void;
11
+ setPolicyName(value: string): void;
12
+ setPositioning(value: SeedingPositioning): void;
13
+ setValidSeedPositionsIgnore(value: boolean): void;
14
+ setDuplicateSeedNumbers(value: boolean): void;
15
+ setDrawSizeProgression(value: boolean): void;
16
+ addThreshold(): void;
17
+ removeThreshold(index: number): void;
18
+ setThresholdField(index: number, field: keyof SeedsCountThreshold, value: number): void;
19
+ sortThresholds(): void;
20
+ addDrawTypeOverride(drawType: string, positioning: SeedingPositioning): void;
21
+ removeDrawTypeOverride(drawType: string): void;
22
+ setDrawTypeOverridePositioning(drawType: string, positioning: SeedingPositioning): void;
23
+ subscribe(listener: SeedingEditorChangeListener): () => void;
24
+ private commitDraft;
25
+ private emit;
26
+ }
@@ -0,0 +1,24 @@
1
+ export declare const sdEditorStyle: () => string;
2
+ export declare const sdSectionStyle: () => string;
3
+ export declare const sdSectionHeaderStyle: () => string;
4
+ export declare const sdSectionChevronStyle: () => string;
5
+ export declare const sdSectionBodyStyle: () => string;
6
+ export declare const sdFieldRowStyle: () => string;
7
+ export declare const sdFieldLabelStyle: () => string;
8
+ export declare const sdFieldInputStyle: () => string;
9
+ export declare const sdCheckboxRowStyle: () => string;
10
+ export declare const sdCheckboxDescStyle: () => string;
11
+ export declare const sdRadioGroupStyle: () => string;
12
+ export declare const sdRadioOptionStyle: () => string;
13
+ export declare const sdAddBtnStyle: () => string;
14
+ export declare const sdSortBtnStyle: () => string;
15
+ export declare const sdRemoveBtnStyle: () => string;
16
+ export declare const sdTableWrapStyle: () => string;
17
+ export declare const sdTableStyle: () => string;
18
+ export declare const sdNumberCellInputStyle: () => string;
19
+ export declare const sdEmptyStyle: () => string;
20
+ export declare const sdActionsRowStyle: () => string;
21
+ export declare const sdOverrideRowStyle: () => string;
22
+ export declare const sdOverrideAddRowStyle: () => string;
23
+ export declare const sdOverrideDrawTypeStyle: () => string;
24
+ export declare const sdSelectStyle: () => string;
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Seeding Policy Editor — Type Definitions
3
+ *
4
+ * Mirrors the factory's seeding policy data shape (see
5
+ * factory/src/fixtures/policies/POLICY_SEEDING_*.ts).
6
+ */
7
+ export type SeedingPositioning = 'SEPARATE' | 'WATERFALL' | 'CLUSTER';
8
+ export interface SeedsCountThreshold {
9
+ drawSize: number;
10
+ minimumParticipantCount: number;
11
+ seedsCount: number;
12
+ }
13
+ export interface SeedingProfile {
14
+ positioning?: SeedingPositioning;
15
+ drawTypes?: Record<string, {
16
+ positioning: SeedingPositioning;
17
+ }>;
18
+ }
19
+ export interface SeedingPolicyData {
20
+ policyName?: string;
21
+ seedingProfile?: SeedingProfile;
22
+ validSeedPositions?: {
23
+ ignore: boolean;
24
+ };
25
+ duplicateSeedNumbers?: boolean;
26
+ drawSizeProgression?: boolean;
27
+ seedsCountThresholds?: SeedsCountThreshold[];
28
+ }
29
+ export type SeedingEditorSection = 'profile' | 'flags' | 'thresholds' | 'drawTypeOverrides';
30
+ export interface SeedingEditorState {
31
+ draft: SeedingPolicyData;
32
+ expandedSections: Set<SeedingEditorSection>;
33
+ dirty: boolean;
34
+ }
35
+ export type SeedingEditorChangeListener = (state: SeedingEditorState) => void;
36
+ export interface SeedingEditorConfig {
37
+ initialPolicy?: SeedingPolicyData;
38
+ /** Override the list of drawTypes offered in the overrides picker. */
39
+ drawTypes?: string[];
40
+ onChange?: (policy: SeedingPolicyData) => void;
41
+ }
@@ -16,7 +16,9 @@ export { buildPolicyCatalogLayout } from './ui/policyCatalogLayout';
16
16
  export { buildJsonEditor } from './ui/jsonEditor';
17
17
  export { SchedulingEditorControl, createSchedulingEditor, SchedulingEditorStore, validateSchedulingPolicy, formatCodeLabel, emptySchedulingPolicy, buildSchedulingEditorPanel } from './editors/scheduling';
18
18
  export { RankingPointsEditorControl, createRankingPointsEditor, RankingPointsEditorStore, buildRankingPointsEditorPanel, emptyRankingPolicy } from './editors/ranking';
19
+ export { SeedingEditorControl, createSeedingEditor, SeedingEditorStore, buildSeedingEditorPanel, emptySeedingPolicy, POSITIONING_OPTIONS, DRAW_TYPE_OPTIONS } from './editors/seeding';
19
20
  export type { PolicyCatalogItem, PolicyCatalogState, PolicyCatalogChangeListener, PolicyCatalogConfig, PolicyEditorInstance, PolicyEditorPlugin, PolicySource, PolicyTypeGroup, PolicyTypeMeta, CatalogGroupBy, UIPanel } from './types';
20
21
  export type { SchedulingPolicyData, SchedulingEditorState, SchedulingEditorSection, SchedulingEditorChangeListener, SchedulingEditorConfig, SchedulingValidationResult, ValidationSeverity, MinutesEntry, AverageTimeEntry, RecoveryTimeEntry, MatchUpAverageTime, MatchUpRecoveryTime } from './editors/scheduling';
21
22
  export type { RankingPolicyData, RankingPointsEditorState, RankingEditorSection, RankingPointsEditorChangeListener, RankingPointsEditorConfig, AwardProfileData, QualityWinProfileData, AggregationRulesData, TableLayout } from './editors/ranking';
23
+ export type { SeedingPolicyData, SeedingProfile, SeedingPositioning, SeedsCountThreshold, SeedingEditorState, SeedingEditorSection, SeedingEditorChangeListener, SeedingEditorConfig } from './editors/seeding';
22
24
  export declare function createPolicyCatalog(config: PolicyCatalogConfig, container: HTMLElement): PolicyCatalogControl;