courthive-components 3.1.0 → 3.3.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/dist/components/ladderChart/index.d.ts +2 -0
- package/dist/components/ladderChart/ladderChart.d.ts +2 -0
- package/dist/components/ladderChart/types.d.ts +72 -0
- package/dist/components/policy-catalog/engine/policyCatalogStore.d.ts +11 -0
- package/dist/components/policy-catalog/types.d.ts +13 -1
- package/dist/components/policy-catalog/ui/editorShell.d.ts +1 -0
- package/dist/components/tournament-card/styles.d.ts +1 -0
- package/dist/components/tournament-card/types.d.ts +26 -1
- package/dist/courthive-components.css +1 -1
- package/dist/courthive-components.es.js +4381 -3243
- package/dist/courthive-components.umd.js +44 -44
- package/dist/{dist-CwJOJWf0.mjs → dist-DiYU0jFr.mjs} +529 -487
- package/dist/index.d.ts +2 -0
- package/dist/{range-CBX41Ttl.mjs → range-CRxwaxeo.mjs} +125 -58
- package/dist/types.d.ts +14 -2
- package/package.json +6 -6
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LadderChart — public types.
|
|
3
|
+
*
|
|
4
|
+
* Visualizes a player's (or any subject's) ordinal progression across a
|
|
5
|
+
* time series. Each datum places a mark at (date, rung), connected
|
|
6
|
+
* chronologically by an optional line.
|
|
7
|
+
*
|
|
8
|
+
* Originally a D3v3 "Ladder chart" in tennisvisuals. Rewritten for
|
|
9
|
+
* D3v7 + TypeScript + the courthive-components vanilla-component
|
|
10
|
+
* pattern (returns SVG element via factory function; no framework).
|
|
11
|
+
*/
|
|
12
|
+
export interface LadderChartDatum {
|
|
13
|
+
/** Mark X position. Pass a Date or an ISO-8601 string. */
|
|
14
|
+
date: Date | string;
|
|
15
|
+
/** Mark Y position: 0-based index into `rungs[]`. 0 is the bottom rung. */
|
|
16
|
+
rung: number;
|
|
17
|
+
/** Optional mark color override (CSS color string). Falls back to `markColor`. */
|
|
18
|
+
color?: string;
|
|
19
|
+
/** Optional mark radius override (px). Falls back to `markRadius`. */
|
|
20
|
+
radius?: number;
|
|
21
|
+
/** Optional label for the mark (used in tooltip/aria). Examples: tournament name. */
|
|
22
|
+
label?: string;
|
|
23
|
+
/** Optional secondary label (used in tooltip body). Examples: result string. */
|
|
24
|
+
detail?: string;
|
|
25
|
+
/** Arbitrary attached data, forwarded to onClick/onHover callbacks. */
|
|
26
|
+
meta?: Record<string, unknown>;
|
|
27
|
+
}
|
|
28
|
+
export interface LadderChartMargins {
|
|
29
|
+
top?: number;
|
|
30
|
+
right?: number;
|
|
31
|
+
bottom?: number;
|
|
32
|
+
left?: number;
|
|
33
|
+
}
|
|
34
|
+
export interface LadderChartConfig {
|
|
35
|
+
/** Ordinal rung labels, ordered bottom → top. Example: ['R128','R64','R32','R16','QF','SF','F','W']. */
|
|
36
|
+
rungs: string[];
|
|
37
|
+
/** Mark data. May be unsorted; the renderer sorts by date for the connector. */
|
|
38
|
+
data: LadderChartDatum[];
|
|
39
|
+
/** Chart width in px. Defaults to container's clientWidth (or 600). */
|
|
40
|
+
width?: number;
|
|
41
|
+
/** Chart height in px. Defaults to 240. */
|
|
42
|
+
height?: number;
|
|
43
|
+
margins?: LadderChartMargins;
|
|
44
|
+
/** Optional chart title rendered above the plot. */
|
|
45
|
+
title?: string;
|
|
46
|
+
/** Optional subtitle / source text rendered below the plot. */
|
|
47
|
+
source?: string;
|
|
48
|
+
/** Draw a connector line between marks in chronological order. Default: true. */
|
|
49
|
+
showConnector?: boolean;
|
|
50
|
+
/** Default mark color when datum has no `color` override. Default: `var(--sp-accent)` → `#3366cc`. */
|
|
51
|
+
markColor?: string;
|
|
52
|
+
/** Default mark radius in px when datum has no `radius`. Default: 6. */
|
|
53
|
+
markRadius?: number;
|
|
54
|
+
/** Connector line color. Default: `var(--sp-muted)` → `#94a3b8`. */
|
|
55
|
+
connectorColor?: string;
|
|
56
|
+
/** X-axis date format token (d3-time-format). Auto-selected if absent. */
|
|
57
|
+
xTickFormat?: string;
|
|
58
|
+
/** Maximum number of X-axis ticks. Default: 8. */
|
|
59
|
+
xMaxTicks?: number;
|
|
60
|
+
/** Click handler for a mark. */
|
|
61
|
+
onMarkClick?: (datum: LadderChartDatum, event: MouseEvent) => void;
|
|
62
|
+
/** Hover handler; receives null when the cursor leaves all marks. */
|
|
63
|
+
onMarkHover?: (datum: LadderChartDatum | null, event: MouseEvent | null) => void;
|
|
64
|
+
}
|
|
65
|
+
export interface LadderChartInstance {
|
|
66
|
+
/** The mounted SVG element (already inside the container). */
|
|
67
|
+
element: SVGSVGElement;
|
|
68
|
+
/** Re-render with new partial config (e.g. swap data on player change). */
|
|
69
|
+
update(next: Partial<LadderChartConfig>): void;
|
|
70
|
+
/** Remove the chart from its parent + detach listeners. */
|
|
71
|
+
destroy(): void;
|
|
72
|
+
}
|
|
@@ -10,6 +10,7 @@ export declare class PolicyCatalogStore {
|
|
|
10
10
|
setCatalogGroupBy(mode: CatalogGroupBy): void;
|
|
11
11
|
selectPolicy(id: string): void;
|
|
12
12
|
clearSelection(): void;
|
|
13
|
+
renamePolicy(name: string): void;
|
|
13
14
|
updateEditorDraft(data: Record<string, unknown>): void;
|
|
14
15
|
markDirty(): void;
|
|
15
16
|
markClean(): void;
|
|
@@ -18,8 +19,18 @@ export declare class PolicyCatalogStore {
|
|
|
18
19
|
applyPolicy(): void;
|
|
19
20
|
addNewPolicy(policyType: string): string;
|
|
20
21
|
duplicatePolicy(sourceId: string): string | null;
|
|
22
|
+
/**
|
|
23
|
+
* Swap a placeholder id (returned from addNewPolicy/duplicatePolicy) for a
|
|
24
|
+
* canonical id assigned by the persistence backend. Idempotent and a no-op
|
|
25
|
+
* when the placeholder is gone (e.g. user deleted before reconciliation).
|
|
26
|
+
*/
|
|
27
|
+
reconcilePolicyId(localId: string, serverId: string): void;
|
|
21
28
|
deletePolicy(id: string): void;
|
|
22
29
|
subscribe(listener: PolicyCatalogChangeListener): () => void;
|
|
23
30
|
private setState;
|
|
24
31
|
private emit;
|
|
32
|
+
private localIdCounter;
|
|
33
|
+
private nextLocalId;
|
|
34
|
+
private appendAndSelect;
|
|
35
|
+
private runCreateAndReconcile;
|
|
25
36
|
}
|
|
@@ -25,6 +25,12 @@ export interface PolicyCatalogState {
|
|
|
25
25
|
groupBy: CatalogGroupBy;
|
|
26
26
|
selectedId: string | null;
|
|
27
27
|
editorDraft: Record<string, unknown> | null;
|
|
28
|
+
/**
|
|
29
|
+
* Live name buffer for the selected policy. Populated on selection from the
|
|
30
|
+
* catalog item and mutated by the rename input so renames survive across
|
|
31
|
+
* editor remounts. `savePolicy` writes this back to the catalog item.
|
|
32
|
+
*/
|
|
33
|
+
editedName: string | null;
|
|
28
34
|
dirty: boolean;
|
|
29
35
|
}
|
|
30
36
|
export type PolicyCatalogChangeListener = (state: PolicyCatalogState) => void;
|
|
@@ -47,7 +53,13 @@ export interface PolicyCatalogConfig {
|
|
|
47
53
|
editorPlugins?: PolicyEditorPlugin[];
|
|
48
54
|
onPolicySaved?: (item: PolicyCatalogItem) => void;
|
|
49
55
|
onPolicyApplied?: (item: PolicyCatalogItem) => void;
|
|
50
|
-
|
|
56
|
+
/**
|
|
57
|
+
* Fired when "+" creates a new policy. If the host persists the new policy
|
|
58
|
+
* to a backend that mints its own canonical id, return that id (sync or
|
|
59
|
+
* Promise) — the store will reconcile the local placeholder id so subsequent
|
|
60
|
+
* Save calls hit the right backend record. Return void to keep the local id.
|
|
61
|
+
*/
|
|
62
|
+
onPolicyCreated?: (item: PolicyCatalogItem) => string | void | Promise<string | void>;
|
|
51
63
|
onPolicyDeleted?: (id: string) => void;
|
|
52
64
|
onSelectionChanged?: (item: PolicyCatalogItem | null) => void;
|
|
53
65
|
}
|
|
@@ -18,6 +18,7 @@ export declare const tcFooterStyle: () => string;
|
|
|
18
18
|
export declare const tcFeeBadgeStyle: () => string;
|
|
19
19
|
export declare const tcPlayerCountStyle: () => string;
|
|
20
20
|
export declare const tcEventCountStyle: () => string;
|
|
21
|
+
export declare const tcTierBadgeStyle: () => string;
|
|
21
22
|
export declare const tcSkeletonStyle: () => string;
|
|
22
23
|
export declare const tcSkeletonLineStyle: () => string;
|
|
23
24
|
export declare const tcSkeletonBlockStyle: () => string;
|
|
@@ -4,6 +4,23 @@ export interface TournamentStatusPill {
|
|
|
4
4
|
kind: TournamentStatusKind;
|
|
5
5
|
label: string;
|
|
6
6
|
}
|
|
7
|
+
/**
|
|
8
|
+
* Federation-specific competitive tier. Mirrors the factory's
|
|
9
|
+
* `TierClassification` shape (kept in lockstep but duplicated here to
|
|
10
|
+
* avoid pulling tods-competition-factory into the component's runtime
|
|
11
|
+
* dependency graph).
|
|
12
|
+
*
|
|
13
|
+
* - `system`: federation namespace, e.g. `'ITF_JUNIOR'`, `'ATP'`, `'PPA'`.
|
|
14
|
+
* - `value`: the tier within that system, e.g. `'J500'`, `'Masters 1000'`, `'Gold'`.
|
|
15
|
+
* - `numericRank`: optional sort key — lower = more prestigious. Used by
|
|
16
|
+
* the card / table column to sort tournaments without round-tripping
|
|
17
|
+
* through a ranking policy.
|
|
18
|
+
*/
|
|
19
|
+
export interface TierClassification {
|
|
20
|
+
system: string;
|
|
21
|
+
value: string;
|
|
22
|
+
numericRank?: number;
|
|
23
|
+
}
|
|
7
24
|
export interface TournamentEntryFee {
|
|
8
25
|
amount: number;
|
|
9
26
|
currencyCode?: string;
|
|
@@ -39,8 +56,16 @@ export interface TournamentCardData {
|
|
|
39
56
|
updatedAt?: string;
|
|
40
57
|
/** When true, render an offline/local indicator */
|
|
41
58
|
offline?: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Competitive tier classification (federation-specific). When present
|
|
61
|
+
* and the `'tier'` field is in `TournamentCardConfig.body` (default), the
|
|
62
|
+
* card renders a small chip displaying `tournamentTier.value`. The
|
|
63
|
+
* Tabulator list view sorts on `numericRank` ascending with `value`
|
|
64
|
+
* lex fallback.
|
|
65
|
+
*/
|
|
66
|
+
tournamentTier?: TierClassification;
|
|
42
67
|
}
|
|
43
|
-
export type TournamentCardField = 'title' | 'location' | 'dateRange' | 'feeBadge' | 'playerCount' | 'eventCount' | 'organizerName' | 'updatedAt';
|
|
68
|
+
export type TournamentCardField = 'title' | 'tier' | 'location' | 'dateRange' | 'feeBadge' | 'playerCount' | 'eventCount' | 'organizerName' | 'updatedAt';
|
|
44
69
|
export type TournamentCardCornerField = 'status' | 'offline';
|
|
45
70
|
export interface TournamentCardConfig {
|
|
46
71
|
/** Whether to render the image zone. Defaults to true. */
|