@graphite-sports/sdk 0.1.1 → 0.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.
Files changed (2) hide show
  1. package/index.d.ts +535 -33
  2. package/package.json +4 -1
package/index.d.ts CHANGED
@@ -1,13 +1,29 @@
1
1
  import { ChangeEventHandler } from 'react';
2
+ import { ColumnDef } from '@tanstack/react-table';
3
+ import { ColumnHelper } from '@tanstack/table-core';
4
+ import { ComponentProps } from 'react';
5
+ import { CSSProperties } from 'react';
2
6
  import type { DataTag } from '@tanstack/react-query';
3
- import type { FC } from 'react';
7
+ import { FC } from 'react';
4
8
  import { FocusEventHandler } from 'react';
5
9
  import { HTMLInputTypeAttribute } from 'react';
6
10
  import { JSX } from 'react/jsx-runtime';
7
11
  import { KeyboardEventHandler } from 'react';
12
+ import { default as React_2 } from 'react';
13
+ import * as React_3 from 'react';
8
14
  import { ReactNode } from 'react';
9
15
  import type { Ref } from 'react';
10
16
  import { RefObject } from 'react';
17
+ import { RowData } from '@tanstack/react-table';
18
+ import { RowModel } from '@tanstack/table-core';
19
+ import { SortingState } from '@tanstack/react-table';
20
+ import { Tab } from '@headlessui/react';
21
+ import { TabGroup } from '@headlessui/react';
22
+ import { Table as Table_2 } from '@tanstack/table-core';
23
+ import { TableFeature } from '@tanstack/table-core';
24
+ import { TabList } from '@headlessui/react';
25
+ import { TabPanel } from '@headlessui/react';
26
+ import { TabPanels } from '@headlessui/react';
11
27
  import { toast } from 'react-hot-toast';
12
28
  import type { UnusedSkipTokenOptions } from '@tanstack/react-query';
13
29
 
@@ -33,6 +49,31 @@ export declare type AppButtonProps = {
33
49
 
34
50
  export declare type AppButtonType = 'primary' | 'secondary' | 'danger';
35
51
 
52
+ export declare function AppCheckbox(props: AppCheckboxProps): JSX.Element;
53
+
54
+ export declare type AppCheckboxProps = {
55
+ checked: boolean;
56
+ onChange?(checked: boolean): void;
57
+ name?: string;
58
+ disabled?: boolean;
59
+ tabIndex?: number;
60
+ label?: string | React_2.ReactNode;
61
+ description?: string | React_2.ReactNode;
62
+ stopPropagation?: boolean;
63
+ readonly?: boolean;
64
+ };
65
+
66
+ export declare function AppDisclosure({ header, children, className, defaultOpen, transition, chevron, }: AppDisclosureProps): JSX.Element;
67
+
68
+ export declare type AppDisclosureProps = {
69
+ header: ReactNode;
70
+ children: ReactNode;
71
+ className?: string;
72
+ defaultOpen?: boolean;
73
+ transition?: boolean;
74
+ chevron?: boolean;
75
+ };
76
+
36
77
  export declare const AppInput: {
37
78
  ({ ref, inputRef, ...props }: AppInputProps & {
38
79
  ref?: React.RefObject<HTMLInputElement | null>;
@@ -63,11 +104,118 @@ export declare type AppInputProps = {
63
104
  autoFocus?: boolean;
64
105
  };
65
106
 
66
- declare type ArithmeticOperator = "add" | "subtract";
107
+ export declare function AppListbox<TVal>({ options, value, onChange, label, description, disabled, placeholder, className, direction, readonly: readonlyProp, required, }: AppListboxProps<TVal>): JSX.Element;
67
108
 
68
- declare type ArrayValue<T = Primitive> = Value<T>[];
109
+ export declare type AppListboxProps<TVal> = {
110
+ options: Option_2<TVal>[];
111
+ value?: TVal;
112
+ onChange?: (value: TVal) => void;
113
+ label?: React_2.ReactNode;
114
+ description?: React_2.ReactNode;
115
+ placeholder?: React_2.ReactNode;
116
+ disabled?: boolean;
117
+ className?: string;
118
+ direction?: 'up' | 'down';
119
+ readonly?: boolean;
120
+ required?: boolean;
121
+ };
69
122
 
70
- declare type BIB = Brand<number, 'bib'>;
123
+ export declare function AppNumberInput<IsRequired extends boolean = false>({ label, description, value, onChange, min, max, integer, placeholder, required, disabled, readonly: readonlyProp, className, layout, onKeyDown, onFocus, onBlur, tabIndex, autoFocus, inputRef, }: AppNumberInputProps<IsRequired>): JSX.Element;
124
+
125
+ export declare type AppNumberInputProps<IsRequired extends boolean = false> = {
126
+ label?: string;
127
+ description?: string;
128
+ min?: number | null;
129
+ max?: number | null;
130
+ integer?: boolean;
131
+ placeholder?: string;
132
+ required?: IsRequired;
133
+ disabled?: boolean;
134
+ readonly?: boolean;
135
+ className?: string;
136
+ layout?: InputLayout;
137
+ value?: NullableUnlessRequired<number, IsRequired>;
138
+ onChange?: (value: NullableUnlessRequired<number, IsRequired>) => void;
139
+ onKeyDown?: KeyboardEventHandler<HTMLInputElement>;
140
+ onFocus?: FocusEventHandler<HTMLInputElement>;
141
+ onBlur?: FocusEventHandler<HTMLInputElement>;
142
+ tabIndex?: number;
143
+ autoFocus?: boolean;
144
+ inputRef?: React.RefObject<HTMLInputElement | null>;
145
+ };
146
+
147
+ export declare function AppSwitch(props: AppSwitchProps): JSX.Element;
148
+
149
+ export declare type AppSwitchProps = {
150
+ checked?: boolean;
151
+ onChange?(checked: boolean): void;
152
+ name?: string;
153
+ disabled?: boolean;
154
+ tabIndex?: number;
155
+ label?: string | React_2.ReactNode;
156
+ description?: string | React_2.ReactNode;
157
+ className?: string;
158
+ readonly?: boolean;
159
+ };
160
+
161
+ export declare function AppTab({ className, ...props }: ComponentProps<typeof Tab>): JSX.Element;
162
+
163
+ export declare function AppTabGroup(props: ComponentProps<typeof TabGroup>): JSX.Element;
164
+
165
+ export declare function AppTable<TData extends RowData>({ data, columns, actions, allowSelect, getRowId, getRowState, rowClicked, rowHref, initialPageSize, initialSorting, pageSizes, enableSorting, autoResetPageIndex, emptyTableText, columnVisibilityStorageKey, }: TableProps<TData>): JSX.Element;
166
+
167
+ export declare type AppTableFeatures = typeof appTableFeatures;
168
+
169
+ /**
170
+ * The single feature registry every `AppTable` instance uses. Shared so callers can build their
171
+ * `ColumnDef`s against the same `TFeatures` via {@link createAppTableColumnHelper}.
172
+ */
173
+ export declare const appTableFeatures: {
174
+ columnSizingFeature: TableFeature;
175
+ rowSelectionFeature: TableFeature;
176
+ rowSortingFeature: TableFeature;
177
+ sortedRowModel: (table: Table_2<any, any>) => () => RowModel<any, any>;
178
+ rowPaginationFeature: TableFeature;
179
+ paginatedRowModel: (table: Table_2<any, any>) => () => RowModel<any, any>;
180
+ columnVisibilityFeature: TableFeature;
181
+ };
182
+
183
+ export declare function AppTabList({ className, ...props }: ComponentProps<typeof TabList>): JSX.Element;
184
+
185
+ export declare function AppTabPanel({ className, ...props }: ComponentProps<typeof TabPanel>): JSX.Element;
186
+
187
+ export declare function AppTabPanels(props: ComponentProps<typeof TabPanels>): JSX.Element;
188
+
189
+ /**
190
+ * A tooltip that costs nothing until it is pointed at.
191
+ *
192
+ * `TooltipPrimitive.Root` pulls in around nine components - the tooltip and portal providers,
193
+ * the popper, its anchor, the trigger and a presence wrapper - and mounts all of them whether or
194
+ * not the tooltip will ever be shown. A node graph puts hundreds of tooltips on screen at once,
195
+ * where that machinery dominated every render of the editor. So until the pointer or the
196
+ * keyboard reaches the trigger, only `children` is mounted; the first hover or focus arms the
197
+ * real tooltip and gets replayed onto it.
198
+ */
199
+ export declare function AppTooltip({ children, content, side, open, defaultOpen, onOpenChange, className, shortcut, ...props }: AppTooltipProps): JSX.Element;
200
+
201
+ export declare interface AppTooltipProps {
202
+ children: React_3.ReactNode;
203
+ content: React_3.ReactNode;
204
+ /** The keys that do what the trigger does, shown after `content`. */
205
+ shortcut?: Shortcut;
206
+ /** Preferred side of the trigger to render against. Defaults to "top". */
207
+ side?: 'top' | 'right' | 'bottom' | 'left';
208
+ open?: boolean;
209
+ defaultOpen?: boolean;
210
+ onOpenChange?: (open: boolean) => void;
211
+ className?: string;
212
+ }
213
+
214
+ export declare type ArithmeticOperator = "add" | "subtract";
215
+
216
+ export declare type ArrayValue<T = Primitive> = Value<T>[];
217
+
218
+ export declare type BIB = Brand<number, 'bib'>;
71
219
 
72
220
  /**
73
221
  * Mirrors the backend's `domain_id!` newtype IDs (graphite-engine/src/domain_id.rs) so distinct ID
@@ -79,6 +227,9 @@ export declare type Brand<T, B> = T & {
79
227
  readonly __brand: B;
80
228
  };
81
229
 
230
+ /** Stable reference — a new inline `select` on every `queryOptions()` call makes React Query re-select each render. */
231
+ export declare function buildCompetitorsMapped(competitors: CompetitorDAO[]): CompetitorsMapped;
232
+
82
233
  export declare const buildRoute: <Path extends "*" | "/" | "/workspace/:workspaceId" | "/workspace/:workspaceId/event/:eventId" | "/download" | "/login" | "/register" | "/preferences" | "/crate-workspace" | "/workspace/:workspaceId/create-event" | "/workspace/:workspaceId/event/:eventId/dashboard" | "/workspace/:workspaceId/event/:eventId/create-class" | "/workspace/:workspaceId/event/:eventId/class/:classId" | "/workspace/:workspaceId/event/:eventId/create-competitor" | "/workspace/:workspaceId/event/:eventId/create-team" | "/workspace/:workspaceId/event/:eventId/competitor/:competitorId" | "/workspace/:workspaceId/event/:eventId/create-format" | "/workspace/:workspaceId/event/:eventId/format/:formatId" | "/workspace/:workspaceId/event/:eventId/format/:formatId/tests" | "/workspace/:workspaceId/event/:eventId/format/:formatId/tests/:formatTestId" | "/workspace/:workspaceId/event/:eventId/graph" | "/workspace/:workspaceId/event/:eventId/lineage" | "/workspace/:workspaceId/event/:eventId/create-game" | "/workspace/:workspaceId/event/:eventId/game/:gameId" | "/workspace/:workspaceId/event/:eventId/table/:tableId" | "/workspace/:workspaceId/event/:eventId/create-game-format" | "/workspace/:workspaceId/event/:eventId/game-format/:gameFormatId" | "/workspace/:workspaceId/event/:eventId/create-template" | "/workspace/:workspaceId/event/:eventId/template/:templateId" | "/workspace/:workspaceId/event/:eventId/extension/$extensionIdentifier">(path: Path, params: PathParams<Path>, ...query: {
83
234
  '/': undefined;
84
235
  '/download': undefined;
@@ -191,6 +342,41 @@ export declare type CompetitorDAO = components['schemas']['CompetitorDAO'];
191
342
 
192
343
  export declare type CompetitorId = Brand<number, 'competitorId'>;
193
344
 
345
+ export declare type CompetitorInTeamDAO = components['schemas']['CompetitorInTeamDAO'];
346
+
347
+ export declare function competitorLabel(competitorsById: ReadonlyMap<CompetitorId, CompetitorDAO>, competitorId: CompetitorId | null): string;
348
+
349
+ export declare const CompetitorNameLineSpacer: FC<{
350
+ className?: string;
351
+ }>;
352
+
353
+ /**
354
+ * Shows which competitor is picked and lets the user pick another one.
355
+ */
356
+ export declare function CompetitorSelector<IsRequired extends boolean = false>({ value, onChange, onBlurChange, required, competitorsMapped, disabled, placeholder, className, inputClassName, forbiddenCompetitorsRef, }: CompetitorSelectorProps<IsRequired>): JSX.Element;
357
+
358
+ export declare type CompetitorSelectorProps<IsRequired extends boolean = false> = {
359
+ value: NullableUnlessRequired<CompetitorId, IsRequired>;
360
+ onChange?: (value: NullableUnlessRequired<CompetitorId, IsRequired>) => void;
361
+ /**
362
+ * Called when a competitor is picked from the menu.
363
+ */
364
+ onBlurChange?: (value: NullableUnlessRequired<CompetitorId, IsRequired>) => void;
365
+ required?: IsRequired;
366
+ competitorsMapped: CompetitorsMapped;
367
+ disabled?: boolean;
368
+ placeholder?: string;
369
+ className?: string;
370
+ inputClassName?: string;
371
+ onEnterKey?: () => void;
372
+ forbiddenCompetitorsRef?: RefObject<Set<CompetitorId>>;
373
+ };
374
+
375
+ export declare interface CompetitorsMapped {
376
+ byId: Map<CompetitorId, CompetitorDAO>;
377
+ byBib: Map<BIB, CompetitorDAO>;
378
+ }
379
+
194
380
  export declare type CompetitorType = components['schemas']['CompetitorType'];
195
381
 
196
382
  declare interface components {
@@ -1362,7 +1548,7 @@ declare interface components {
1362
1548
  kind: components["schemas"]["ExtensionKind"];
1363
1549
  };
1364
1550
  /** @enum {string} */
1365
- ExtensionError: "local-extension-not-found" | "failed-to-resolve-extension" | "failed-to-start" | "invalid-identifier";
1551
+ ExtensionError: "local-extension-not-found" | "failed-to-resolve-extension" | "failed-to-start" | "invalid-identifier" | "crashed";
1366
1552
  /** @description A single path segment on every platform without control characters, so it is a safe directory name. */
1367
1553
  ExtensionIdentifier: string;
1368
1554
  ExtensionKind: {
@@ -3850,7 +4036,6 @@ declare interface components {
3850
4036
  type: "unterminated-string";
3851
4037
  };
3852
4038
  PatchTableStateMutation: {
3853
- asOwner: components["schemas"]["TableOwnerDTO"];
3854
4039
  /** @description None resets the table state */
3855
4040
  state?: components["schemas"]["TableState"] | null;
3856
4041
  tableId: components["schemas"]["TableId"];
@@ -4896,15 +5081,7 @@ declare interface components {
4896
5081
  nodeId: components["schemas"]["FormatNodeTestId"];
4897
5082
  };
4898
5083
  /** @enum {string} */
4899
- TableOwner: "none" | "nodes" | "user" | "race-office";
4900
- /**
4901
- * @description Same as [TableOwner] but without [TableOwner::None] and [TableOwner::Nodes] as users can't set these.
4902
- * @enum {string}
4903
- */
4904
- TableOwnerDTO: "user" | "race-office";
4905
- TableOwnerQuery: {
4906
- asOwner: components["schemas"]["TableOwnerDTO"];
4907
- };
5084
+ TableOwner: "nodes" | "user";
4908
5085
  TablePathVariables_for_CommonWorkspaceId: {
4909
5086
  eventId: components["schemas"]["EventId"];
4910
5087
  tableId: components["schemas"]["TableId"];
@@ -5433,7 +5610,6 @@ declare interface components {
5433
5610
  variant: components["schemas"]["TableVariant"];
5434
5611
  };
5435
5612
  UpdateTableRowsLayerOneMutation: {
5436
- asOwner: components["schemas"]["TableOwnerDTO"];
5437
5613
  rows: components["schemas"]["Rows_for_Sorted"];
5438
5614
  tableId: components["schemas"]["TableId"];
5439
5615
  };
@@ -5492,7 +5668,7 @@ declare interface components {
5492
5668
  * Besides the infer keyword, works almost exactly like conditional types in typescript.
5493
5669
  * Checkout [this doc](https://www.typescriptlang.org/docs/handbook/2/conditional-types.html) for a good guide on the ts conditionals.
5494
5670
  */
5495
- declare interface Conditional<T, R> {
5671
+ export declare interface Conditional<T, R> {
5496
5672
  tTest: TypeExpr<T, R>;
5497
5673
  tTestBound: TypeExpr<T, R>;
5498
5674
  tThen: TypeExpr<T, R>;
@@ -5503,21 +5679,67 @@ declare interface Conditional<T, R> {
5503
5679
  infer: LocalParamID[];
5504
5680
  }
5505
5681
 
5682
+ export declare function confirmDeleteItem(modalControls: ModalControls, itemName: string): Promise<boolean>;
5683
+
5506
5684
  /**
5507
5685
  * Named type arguments of a [`TypeExpr::Constructor`](crate::TypeExpr::Constructor).
5508
5686
  *
5509
5687
  * Duplicate keys last-win in place: the original insertion position is kept.
5510
5688
  */
5511
- declare type ConstructorParams<T, R = ParamRef> = Record<string, TypeExpr<T, R>>;
5689
+ export declare type ConstructorParams<T, R = ParamRef> = Record<string, TypeExpr<T, R>>;
5690
+
5691
+ export declare interface ContextWasm {
5692
+ values: Record<string, Value<Primitive>>;
5693
+ }
5512
5694
 
5513
5695
  export declare interface ContributionHandle<DTO> {
5514
5696
  beforeSubmit: (dto: DTO) => Promise<DTO | null>;
5515
5697
  }
5516
5698
 
5699
+ /** `createColumnHelper<AppTableFeatures, TData>()`, bound to `AppTable`'s feature registry. */
5700
+ export declare function createAppTableColumnHelper<TData extends RowData>(): ColumnHelper< {
5701
+ columnSizingFeature: TableFeature;
5702
+ rowSelectionFeature: TableFeature;
5703
+ rowSortingFeature: TableFeature;
5704
+ sortedRowModel: (table: Table_2<any, any>) => () => RowModel<any, any>;
5705
+ rowPaginationFeature: TableFeature;
5706
+ paginatedRowModel: (table: Table_2<any, any>) => () => RowModel<any, any>;
5707
+ columnVisibilityFeature: TableFeature;
5708
+ }, TData>;
5709
+
5710
+ export declare const DateTimeInput: FC<DateTimeInputProps>;
5711
+
5712
+ export declare interface DateTimeInputProps {
5713
+ value: Date | null;
5714
+ onChange?: (value: Date | null) => void;
5715
+ label?: string;
5716
+ disabled?: boolean;
5717
+ className?: string;
5718
+ /**
5719
+ * If true, empty input is accepted and mapped to null.
5720
+ * Default: false
5721
+ */
5722
+ allowEmpty?: boolean;
5723
+ readonly?: boolean;
5724
+ }
5725
+
5726
+ export declare const DateTimeText: FC<DateTimeTextProps>;
5727
+
5728
+ export declare interface DateTimeTextProps {
5729
+ value: Date | number | string;
5730
+ className?: string;
5731
+ }
5732
+
5517
5733
  declare interface DetailedSupertypeDiagnostics<T> {
5518
5734
  layers: NoSupertypeLayer<T>[];
5519
5735
  }
5520
5736
 
5737
+ export declare interface DialogButton<T> {
5738
+ value: T;
5739
+ label: string;
5740
+ theme?: 'primary' | 'default' | 'danger';
5741
+ }
5742
+
5521
5743
  /** Spelled out because the inferred `queryOptions` type references TanStack's unexported `dataTagSymbol`, which breaks the SDK's declaration rollup. */
5522
5744
  export declare type EngineQueryOptions<T> = UnusedSkipTokenOptions<T, Error, T, readonly unknown[]> & {
5523
5745
  queryKey: DataTag<readonly unknown[], T, Error>;
@@ -5535,6 +5757,20 @@ export declare interface EventPath {
5535
5757
  eventId: EventId;
5536
5758
  }
5537
5759
 
5760
+ export declare type ExportableValue = string | number | boolean | null | undefined;
5761
+
5762
+ export declare class ExpressionInContextWasm {
5763
+ private constructor();
5764
+ free(): void;
5765
+ [Symbol.dispose](): void;
5766
+ /**
5767
+ * Runs the expression with the provided primitive values.
5768
+ * @throws {ExpressionInContextError} if the expression is not valid or
5769
+ * the returned value is non primitive and thus not serializable.
5770
+ */
5771
+ run(context: ContextWasm): Value<Primitive>;
5772
+ }
5773
+
5538
5774
  export declare type ExtensionContribution<K extends keyof ExtensionContributions> = {
5539
5775
  /**
5540
5776
  * must be unique per type
@@ -5610,6 +5846,12 @@ declare interface FieldTypeWithDefault {
5610
5846
  default: Value | null;
5611
5847
  }
5612
5848
 
5849
+ /**
5850
+ * How a competitor is written out. Kept apart from the components that show competitors so both
5851
+ * the picker and the selector can reach it without importing each other.
5852
+ */
5853
+ export declare function formatCompetitorName(competitor: CompetitorDAO): string;
5854
+
5613
5855
  declare type FormatGroupId = Brand<number, 'formatGroupId'>;
5614
5856
 
5615
5857
  declare type FormatId = Brand<number, 'formatId'>;
@@ -5726,16 +5968,41 @@ export declare type GameWithTables = components['schemas']['GameWithTables'];
5726
5968
 
5727
5969
  export declare const getClassesByEventQO: (workspaceId: CommonWorkspaceId, eventId: EventId) => EngineQueryOptions<ClassResponse[]>;
5728
5970
 
5971
+ export declare const getCompetitorInTeamMappingAtQueryOptions: (workspaceId: CommonWorkspaceId, eventId: EventId, at: string) => EngineQueryOptions<CompetitorInTeamDAO[]>;
5972
+
5729
5973
  /**
5730
5974
  * @deprecated useCompetitorsMapped instead
5731
5975
  */
5732
5976
  export declare const getCompetitorsQO: (workspaceId: CommonWorkspaceId, eventId: EventId, competitorTypeFilter?: CompetitorType) => EngineQueryOptions<CompetitorDAO[]>;
5733
5977
 
5978
+ export declare const getGameTableResolvedByGameQO: (workspaceId: CommonWorkspaceId, eventId: EventId, gameID: GameId, tableKind: "EntryList" | "ResultList") => EngineQueryOptions<TableSortedDTO>;
5979
+
5734
5980
  /**
5735
5981
  * Location of a validation error in the graph.
5736
5982
  */
5737
5983
  declare type GraphLocation = { type: "Edge"; data: number } | { type: "InputPort"; data: { nodeIdx: number; inputIdx: number } };
5738
5984
 
5985
+ export declare const H1: FC<H1Props>;
5986
+
5987
+ export declare interface H1Props {
5988
+ children?: ReactNode;
5989
+ className?: string;
5990
+ }
5991
+
5992
+ export declare const H2: FC<H2Props>;
5993
+
5994
+ export declare interface H2Props {
5995
+ children?: ReactNode;
5996
+ className?: string;
5997
+ noMargin?: boolean;
5998
+ }
5999
+
6000
+ export declare function HR({ className }: HRProps): JSX.Element;
6001
+
6002
+ export declare type HRProps = {
6003
+ className?: string;
6004
+ };
6005
+
5739
6006
  declare type InputIdx = Brand<number, 'inputIdx'>;
5740
6007
 
5741
6008
  export declare enum InputLayout {
@@ -5748,13 +6015,24 @@ export declare enum InputLayout {
5748
6015
  Fill = 2
5749
6016
  }
5750
6017
 
6018
+ export declare const LoadingOverlay: FC<LoadingOverlayProps>;
6019
+
6020
+ export declare type LoadingOverlayProps = {
6021
+ /** When true, children are dimmed and a centered loading indicator is shown. */
6022
+ active: boolean;
6023
+ children: ReactNode;
6024
+ /** Optional text shown below the spinner. */
6025
+ loadingText?: ReactNode;
6026
+ className?: string;
6027
+ };
6028
+
5751
6029
  export declare type Locales = 'de' | 'en';
5752
6030
 
5753
6031
  /**
5754
6032
  * Identifies a type parameter within a type expression or node signature.
5755
6033
  * Can be created from a single character (e.g. `'T'`) or a string (hashed for multi-char names).
5756
6034
  */
5757
- declare type LocalParamID = number;
6035
+ export declare type LocalParamID = number;
5758
6036
 
5759
6037
  declare type LogId = Brand<number, 'logId'>;
5760
6038
 
@@ -5764,6 +6042,9 @@ export declare type MergePathParams<A, B> = {
5764
6042
 
5765
6043
  export declare function Modal({ children, isOpen, onClose, closable, height, width, verticalPosition, horizontalPosition, lightbox, blockBackground, }: ModalProps): null;
5766
6044
 
6045
+ /** Modal inner body: explicit width; shell uses `width: 'fit'` and shrink-wraps to this. */
6046
+ export declare const modalBodyNarrow = "p-6 w-[min(500px,calc(100vw - 2rem))] min-w-0 md:min-w-[320px]";
6047
+
5767
6048
  export declare interface ModalConfig {
5768
6049
  id: string;
5769
6050
  content: ReactNode;
@@ -5805,7 +6086,7 @@ export declare interface ModalProps {
5805
6086
  * Function-like type for a node: generic parameters, inputs, outputs, and defaults.
5806
6087
  * Written in notation as `<T>(T) -> (T)` for the identity node.
5807
6088
  */
5808
- declare interface NodeSignature<T, R = ParamRef> {
6089
+ export declare interface NodeSignature<T, R = ParamRef> {
5809
6090
  /**
5810
6091
  * Generic parameters with their bounds and defaults.
5811
6092
  */
@@ -5862,7 +6143,24 @@ declare interface NoSupertypeLayer<T> {
5862
6143
 
5863
6144
  declare type NoSupertypeLayerReason = "UnknownTypeParam" | "NodeSignatureInputsVarg" | "NodeSignatureInputs" | "NodeSignatureOutputs" | "NodeSignatureTags" | "NodeSignatureRequiredTags" | "PortTypesVarg" | "PortTypesArity" | "PortTypesPort" | "Index" | "ConstructorArity" | "ConstructorParam";
5864
6145
 
5865
- declare type OperatorOf<T> = Extract<TypeOperators[keyof TypeOperators], [T, unknown]>[1];
6146
+ export declare function Note({ children, className }: NoteProps): JSX.Element;
6147
+
6148
+ export declare interface NoteProps {
6149
+ children: ReactNode;
6150
+ className?: string;
6151
+ }
6152
+
6153
+ /** `T` when `required` is true, otherwise `T | null`. */
6154
+ export declare type NullableUnlessRequired<T, Required extends boolean = false> = Required extends true ? T : T | null;
6155
+
6156
+ export declare type OperatorOf<T> = Extract<TypeOperators[keyof TypeOperators], [T, unknown]>[1];
6157
+
6158
+ declare interface Option_2<TVal> {
6159
+ label: React_2.ReactNode;
6160
+ value: TVal;
6161
+ disabled?: boolean;
6162
+ }
6163
+ export { Option_2 as Option }
5866
6164
 
5867
6165
  export declare interface OptionalQueryField<T> {
5868
6166
  kind: 'optional';
@@ -5871,10 +6169,20 @@ export declare interface OptionalQueryField<T> {
5871
6169
 
5872
6170
  declare type OutputIdx = Brand<number, 'outputIdx'>;
5873
6171
 
6172
+ export declare const Page: FC<PageProps>;
6173
+
6174
+ export declare type PageProps = {
6175
+ children?: ReactNode;
6176
+ /** Standard content padding (less on mobile). Default true. It is exposed as `--page-px` / `--page-py`. */
6177
+ padding?: boolean;
6178
+ className?: string;
6179
+ style?: CSSProperties;
6180
+ };
6181
+
5874
6182
  /**
5875
6183
  * References a local type parameter. This is context sensitive because parameters are scoped.
5876
6184
  */
5877
- declare interface ParamRef {
6185
+ export declare interface ParamRef {
5878
6186
  paramId: LocalParamID;
5879
6187
  /**
5880
6188
  * If false, this reference will not be used to collect candidates for the parameter.
@@ -5898,10 +6206,22 @@ export declare type PathSegmentParam<S extends string> = S extends `:${infer P}`
5898
6206
  [K in P]: string;
5899
6207
  } : Record<never, never>;
5900
6208
 
6209
+ export declare type PersistedStateOptions = {
6210
+ /**
6211
+ * Where to persist the state.
6212
+ * Default: StorageType.Session
6213
+ */
6214
+ storage: StorageType;
6215
+ /**
6216
+ * Useful if the version of the data ever changes
6217
+ */
6218
+ version?: number;
6219
+ };
6220
+
5901
6221
  /**
5902
6222
  * A list of port types, optionally with a variadic type (`...T`).
5903
6223
  */
5904
- declare interface PortTypes<T, R = ParamRef> {
6224
+ export declare interface PortTypes<T, R = ParamRef> {
5905
6225
  ports: TypeExpr<T, R>[];
5906
6226
  varg: TypeExpr<T, R> | null;
5907
6227
  }
@@ -5909,7 +6229,9 @@ declare interface PortTypes<T, R = ParamRef> {
5909
6229
  /**
5910
6230
  * Crate local version of [std::convert::Infallible]
5911
6231
  */
5912
- declare type Primitive = never;
6232
+ export declare type Primitive = never;
6233
+
6234
+ export declare function primValueToTypeExpr(value: Value<Primitive>): TypeExpr<Type, ParamRef>;
5913
6235
 
5914
6236
  export declare interface QueryCodec<T> {
5915
6237
  parse(value: string): T | null;
@@ -5950,13 +6272,41 @@ declare interface RecordTypeWithDefaults {
5950
6272
  properties: Record<string, FieldTypeWithDefault>;
5951
6273
  }
5952
6274
 
5953
- declare type RecordValue<T = Primitive> = Record<string, Value<T>>;
6275
+ export declare type RecordValue<T = Primitive> = Record<string, Value<T>>;
6276
+
6277
+ export declare function refocusWhenEnabled(input: HTMLInputElement | null | undefined, attempt?: number): void;
5954
6278
 
5955
6279
  export declare interface RepeatedQueryField<T> {
5956
6280
  kind: 'repeated';
5957
6281
  codec: QueryCodec<T>;
5958
6282
  }
5959
6283
 
6284
+ export declare function ResizablePanel({ value, onChange, edge, min, max, hideWhenBelowMin, onClose, children, className, contentClassName, }: ResizablePanelProps): JSX.Element;
6285
+
6286
+ export declare interface ResizablePanelProps {
6287
+ /** Current size value (width for left/right, height for top/bottom) */
6288
+ value: number;
6289
+ /** Called when size changes during drag */
6290
+ onChange: (value: number) => void;
6291
+ /** Which edge has the drag handle */
6292
+ edge: ResizeEdge;
6293
+ /** Minimum size (optional) */
6294
+ min?: number;
6295
+ /** Maximum size (optional) */
6296
+ max?: number;
6297
+ /** When true, collapses to 0 when dragged below min and fires onClose on mouse release */
6298
+ hideWhenBelowMin?: boolean;
6299
+ /** Called when hideWhenBelowMin is true and user releases mouse below minimum */
6300
+ onClose?: () => void;
6301
+ children: React_2.ReactNode;
6302
+ /** Additional class names for the container */
6303
+ className?: string;
6304
+ /** Additional class names for the content wrapper */
6305
+ contentClassName?: string;
6306
+ }
6307
+
6308
+ export declare type ResizeEdge = 'left' | 'right' | 'top' | 'bottom';
6309
+
5960
6310
  export declare interface RouterContextType {
5961
6311
  /** The pathname used for route matching and persistence keys. */
5962
6312
  path: string;
@@ -5993,6 +6343,18 @@ declare interface Row {
5993
6343
  columns: RecordValue;
5994
6344
  }
5995
6345
 
6346
+ export declare interface RowAction<T> {
6347
+ id: string;
6348
+ type?: AppButtonType;
6349
+ label: ReactNode | string;
6350
+ icon?: ReactNode;
6351
+ triggerSingle: (row: T) => void | Promise<void>;
6352
+ triggerMultiple?: (rows: T[]) => void | Promise<void>;
6353
+ supportsRow?: (row: T) => boolean;
6354
+ /** Stays available in read-only workspaces. */
6355
+ readOnlySafe?: boolean;
6356
+ }
6357
+
5996
6358
  declare type RowMutationId = Brand<number, 'rowMutationId'>;
5997
6359
 
5998
6360
  declare interface Rows<SortingState> {
@@ -6003,8 +6365,41 @@ declare interface Rows<SortingState> {
6003
6365
  rows: Row[];
6004
6366
  }
6005
6367
 
6368
+ export declare enum RowState {
6369
+ /** The item is persisted in the backend as displayed and is managed by nodes. */
6370
+ Unchanged = 0,
6371
+ /** The item is persisted but updated in the ui. */
6372
+ Updated = 1,
6373
+ /** The item is persisted but deleted in the ui. */
6374
+ Deleted = 2,
6375
+ /** The item is not yet persisted. */
6376
+ Added = 3
6377
+ }
6378
+
6379
+ export declare function SearchInput({ value, onChange, placeholder, className }: SearchInputProps): JSX.Element;
6380
+
6381
+ export declare type SearchInputProps = {
6382
+ value: string;
6383
+ onChange: (value: string) => void;
6384
+ placeholder?: string;
6385
+ className?: string;
6386
+ };
6387
+
6006
6388
  declare type SerializableNonPrimitiveValue = { type: "game-table"; data: Table<Unsorted_2, StateMetadata> } | { type: "game-table-sorted"; data: Table<Sorted_2, StateMetadata> } | { type: "row"; data: Row } | { type: "class"; data: number } | { type: "closure" };
6007
6389
 
6390
+ /**
6391
+ * A keyboard shortcut as the keys to press together, e.g. `['Mod', 'Shift', 'Z']`. `Mod` is Ctrl, or
6392
+ * Cmd on Apple platforms, matching handlers that read `ctrlKey || metaKey`. Pointer gestures
6393
+ * (`Click`, `Drag`, `Scroll`) are written like keys so they read the same way: "Shift+Click".
6394
+ */
6395
+ export declare type Shortcut = readonly string[];
6396
+
6397
+ /**
6398
+ * Shows a dialog that can be dismissed (ESC, click outside, or X button)
6399
+ * Returns the selected value or null if dismissed
6400
+ */
6401
+ export declare function showDialog<T>(modal: ModalControls, buttons: DialogButton<T>[], content: ReactNode): Promise<T | null>;
6402
+
6008
6403
  declare type Sorted = Brand<'sorted', 'sorted'>;
6009
6404
 
6010
6405
  /**
@@ -6023,6 +6418,11 @@ declare interface StateMetadata {
6023
6418
  state: TableState;
6024
6419
  }
6025
6420
 
6421
+ export declare enum StorageType {
6422
+ Session = 0,
6423
+ Local = 1
6424
+ }
6425
+
6026
6426
  /**
6027
6427
  * Combines rows with table attributes and state
6028
6428
  */
@@ -6032,13 +6432,77 @@ export declare type TableId = Brand<number, 'tableId'>;
6032
6432
 
6033
6433
  declare type TableLineageId = Brand<number, 'tableLineageId'>;
6034
6434
 
6035
- declare type TableSorting = "unsorted" | "sorted";
6435
+ export declare interface TableProps<TData extends RowData> {
6436
+ data: TData[];
6437
+ columns: ColumnDef<AppTableFeatures, TData, unknown>[];
6438
+ actions?: RowAction<TData>[];
6439
+ allowSelect?: boolean;
6440
+ getRowId?: (row: TData, index: number) => string;
6441
+ getRowState?: (row: TData) => RowState;
6442
+ rowClicked?: (row: TData) => void;
6443
+ /**
6444
+ * Route a row leads to. Clicking the row routes there (after `rowClicked`); a middle or Ctrl click
6445
+ * opens it in a new tab.
6446
+ */
6447
+ rowHref?: (row: TData) => string;
6448
+ /**
6449
+ * Default: true
6450
+ */
6451
+ enableSorting?: boolean;
6452
+ /** Should be one of pageSizes */
6453
+ initialPageSize?: number;
6454
+ initialSorting?: SortingState;
6455
+ pageSizes?: number[];
6456
+ /**
6457
+ * ~Composer:
6458
+ * When true (default), TanStack Table resets the page index when `data` changes.
6459
+ * Set to false if edits replace the `data` array often but you want to keep the current page.
6460
+ */
6461
+ autoResetPageIndex?: boolean;
6462
+ /** Text to be displayed when there is no data */
6463
+ emptyTableText?: ReactNode;
6464
+ /**
6465
+ * When provided, shows a "Columns" toggle button above the table and persists column
6466
+ * visibility to localStorage under this key. Columns with `enableHiding: false` are excluded.
6467
+ */
6468
+ columnVisibilityStorageKey?: string;
6469
+ }
6470
+
6471
+ export declare type TableSortedDTO = components['schemas']['Table_for_Sorted_and_StateMetadata'];
6472
+
6473
+ export declare type TableSorting = "unsorted" | "sorted";
6036
6474
 
6037
6475
  declare type TableState = number;
6038
6476
 
6477
+ export declare type TimeDelta = components['schemas']['TimeDeltaSchema'];
6478
+
6479
+ export declare const TimeDeltaInput: FC<TimeDeltaInputProps>;
6480
+
6481
+ export declare interface TimeDeltaInputProps {
6482
+ value: TimeDelta;
6483
+ onChange?: (value: TimeDelta) => void;
6484
+ label?: string;
6485
+ className?: string;
6486
+ readonly?: boolean;
6487
+ }
6488
+
6039
6489
  export { toast }
6040
6490
 
6041
- declare type Type = { type: "integer"; data: { min: number | null; max: number | null } } | { type: "float" } | { type: "string"; data: string | null } | { type: "boolean" } | { type: "iterable" } | { type: "countable" } | { type: "comparable" } | { type: "sortable" } | { type: "unit" } | { type: "time-delta" } | { type: "date-time" } | { type: "date" } | { type: "primitive" } | { type: "competitor-id" } | { type: "array" } | { type: "record" } | { type: "table" } | { type: "row" } | { type: "table-sorting"; data: TableSorting } | { type: "class" };
6491
+ export declare type Type = { type: "integer"; data: { min: number | null; max: number | null } } | { type: "float" } | { type: "string"; data: string | null } | { type: "boolean" } | { type: "iterable" } | { type: "countable" } | { type: "comparable" } | { type: "sortable" } | { type: "unit" } | { type: "time-delta" } | { type: "date-time" } | { type: "date" } | { type: "primitive" } | { type: "competitor-id" } | { type: "array" } | { type: "record" } | { type: "table" } | { type: "row" } | { type: "table-sorting"; data: TableSorting } | { type: "class" };
6492
+
6493
+ /**
6494
+ * Can be parsed from string with the following syntax:
6495
+ *
6496
+ * `TypeContext ::= <Record> "->" <TypeExpr>`
6497
+ *
6498
+ * # Examples:
6499
+ * - `{a: Integer} -> Float`
6500
+ * - `{} -> Any`
6501
+ */
6502
+ export declare interface TypeContext {
6503
+ variables: Record<string, TypeExpr<Type, ParamRef>>;
6504
+ returnType: TypeExpr<Type, ParamRef>;
6505
+ }
6042
6506
 
6043
6507
  /**
6044
6508
  * Type expression—the core type representation in nodety.
@@ -6049,18 +6513,18 @@ declare type Type = { type: "integer"; data: { min: number | null; max: number |
6049
6513
  * [`PartialEq`], [`Eq`] and [`Hash`] are structural: `A | B` is not equal to `B | A`.
6050
6514
  * [`Eq`] and [`Hash`] are available when `T: Eq + Hash`.
6051
6515
  */
6052
- declare type TypeExpr<T, R = ParamRef> = { type: "Type"; data: T } | { type: "Constructor"; data: { inner: T; parameters: ConstructorParams<T, R> } } | { type: "Operation"; data: { a: TypeExpr<T, R>; operator: OperatorOf<T>; b: TypeExpr<T, R> } } | { type: "NodeSignature"; data: NodeSignature<T, R> } | { type: "PortTypes"; data: PortTypes<T, R> } | { type: "Union"; data: [TypeExpr<T, R>, TypeExpr<T, R>] } | { type: "KeyOf"; data: TypeExpr<T, R> } | { type: "Index"; data: { expr: TypeExpr<T, R>; index: TypeExpr<T, R> } } | { type: "Intersection"; data: [TypeExpr<T, R>, TypeExpr<T, R>] } | { type: "Conditional"; data: Conditional<T, R> } | { type: "Any" } | { type: "Never" } | { type: "Ref"; data: R };
6516
+ export declare type TypeExpr<T, R = ParamRef> = { type: "Type"; data: T } | { type: "Constructor"; data: { inner: T; parameters: ConstructorParams<T, R> } } | { type: "Operation"; data: { a: TypeExpr<T, R>; operator: OperatorOf<T>; b: TypeExpr<T, R> } } | { type: "NodeSignature"; data: NodeSignature<T, R> } | { type: "PortTypes"; data: PortTypes<T, R> } | { type: "Union"; data: [TypeExpr<T, R>, TypeExpr<T, R>] } | { type: "KeyOf"; data: TypeExpr<T, R> } | { type: "Index"; data: { expr: TypeExpr<T, R>; index: TypeExpr<T, R> } } | { type: "Intersection"; data: [TypeExpr<T, R>, TypeExpr<T, R>] } | { type: "Conditional"; data: Conditional<T, R> } | { type: "Any" } | { type: "Never" } | { type: "Ref"; data: R };
6053
6517
 
6054
6518
  declare type TypeExprValidationError = { type: "UnknownVar"; var: LocalParamID } | { type: "CyclicReference" };
6055
6519
 
6056
- declare interface TypeOperators { graphite: [Type, ArithmeticOperator] }
6520
+ export declare interface TypeOperators { graphite: [Type, ArithmeticOperator] }
6057
6521
 
6058
- declare interface TypeOperators {}
6522
+ export declare interface TypeOperators {}
6059
6523
 
6060
6524
  /**
6061
6525
  * A generic type parameter with optional bound and default.
6062
6526
  */
6063
- declare interface TypeParameter<T, R = ParamRef> {
6527
+ export declare interface TypeParameter<T, R = ParamRef> {
6064
6528
  /**
6065
6529
  * Upper bound (e.g. `T extends Comparable`).
6066
6530
  */
@@ -6076,7 +6540,7 @@ declare interface TypeParameter<T, R = ParamRef> {
6076
6540
  *
6077
6541
  * Exists so that it can implement traits like [std::str::FromStr]
6078
6542
  */
6079
- declare type TypeParameters<T, R = ParamRef> = Record<LocalParamID, TypeParameter<T, R>>;
6543
+ export declare type TypeParameters<T, R = ParamRef> = Record<LocalParamID, TypeParameter<T, R>>;
6080
6544
 
6081
6545
  declare type Unsorted = Brand<'unsorted', 'unsorted'>;
6082
6546
 
@@ -6089,11 +6553,37 @@ declare type Unsorted_2 = null;
6089
6553
  /** The engine's active locale. Extensions ship their own dictionaries and select them by it. */
6090
6554
  export declare function useEngineLocale(): Locales;
6091
6555
 
6556
+ /** Returns a `fetch` for `path` (relative, e.g. `"items"`) on the calling extension's own backend in the current event. */
6557
+ export declare function useExtensionBackend(): (path: string, init?: RequestInit) => Promise<Response>;
6558
+
6559
+ /** The identifier the calling extension is installed under, e.g. the key of its `extensionData`. */
6560
+ export declare function useExtensionIdentifier(): string;
6561
+
6562
+ export declare function useMediaQuery(query: string): boolean;
6563
+
6092
6564
  export declare function useModal(): ModalControls;
6093
6565
 
6566
+ /**
6567
+ * @todo Add a parameter to save stuff in localstorage or even better, per user
6568
+ *
6569
+ * Wrapper for useState with persistence in sessionstorage.
6570
+ * Only serializes and writes to sessionstorage on window.beforeunload
6571
+ *
6572
+ * @param storageKey Key used for persisting the state. Only the key passed
6573
+ * in the to the first call of usePersistedState is used. Consequent keys are discarded.
6574
+ * @param initialState The initial state. Equal to useStates initial value
6575
+ */
6576
+ export declare function usePersistedState<S>(storageKey: string, initialState: S | (() => S), { storage: storageType, version }?: PersistedStateOptions): [S, (newState: S | ((prev: S) => S)) => void];
6577
+
6094
6578
  /** Hook to use the router context. Must be called within a <Router> provider. */
6095
6579
  export declare function useRouter(): RouterContextType;
6096
6580
 
6581
+ /**
6582
+ * Validates the expression and returns a `ExpressionInContextWasm` if the expression is valid.
6583
+ * @throws {ValidateExpressionError} if the expression is not valid.
6584
+ */
6585
+ export declare function validateExpression(expression: string, context: TypeContext): ExpressionInContextWasm;
6586
+
6097
6587
  /**
6098
6588
  * A validation error with its location and kind.
6099
6589
  */
@@ -6104,7 +6594,19 @@ declare interface ValidationError<T> {
6104
6594
 
6105
6595
  declare type ValidationErrorKind<T> = { type: "TypeParameterBoundsExceeded" } | { type: "TagMissing"; data: number[] } | { type: "MultipleEdgesOnOneInput" } | { type: "EdgeMissingOnInput" } | { type: "EdgeHasNoSourceOutput" } | { type: "InsufficientlyInferredTypes" } | { type: "NonPortTypesIO" } | { type: "TypeExprValidationError"; data: TypeExprValidationError } | { type: "TypeMismatch"; data: DetailedSupertypeDiagnostics<T> };
6106
6596
 
6107
- declare type Value<T = Primitive> = { type: "unit" } | { type: "float"; data: number } | { type: "integer"; data: number } | { type: "string"; data: string } | { type: "boolean"; data: boolean } | { type: "array"; data: ArrayValue<T> } | { type: "record"; data: RecordValue<T> } | { type: "time-delta"; data: [number, number] } | { type: "date-time"; data: string } | { type: "date"; data: string } | { type: "non-primitive"; data: T };
6597
+ export declare type Value<T = Primitive> = { type: "unit" } | { type: "float"; data: number } | { type: "integer"; data: number } | { type: "string"; data: string } | { type: "boolean"; data: boolean } | { type: "array"; data: ArrayValue<T> } | { type: "record"; data: RecordValue<T> } | { type: "time-delta"; data: [number, number] } | { type: "date-time"; data: string } | { type: "date"; data: string } | { type: "non-primitive"; data: T };
6598
+
6599
+ /**
6600
+ * Turns a Value into an ExportableValue
6601
+ */
6602
+ export declare function valueIntoExportable(value: Value): ExportableValue;
6603
+
6604
+ export declare function Warning({ children, className }: WarningProps): JSX.Element;
6605
+
6606
+ export declare interface WarningProps {
6607
+ children: ReactNode;
6608
+ className?: string;
6609
+ }
6108
6610
 
6109
6611
  /**
6110
6612
  * Same as GameDTO but with gameFormatId optional
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphite-sports/sdk",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "license": "MIT",
5
5
  "repository": "github:Graphite-sports/starter-extension",
6
6
  "homepage": "https://github.com/Graphite-sports/starter-extension",
@@ -10,7 +10,10 @@
10
10
  "index.d.ts"
11
11
  ],
12
12
  "peerDependencies": {
13
+ "@headlessui/react": "^2.2.7",
13
14
  "@tanstack/react-query": "^5.90.7",
15
+ "@tanstack/react-table": "^9.2.4",
16
+ "@tanstack/table-core": "^9.2.4",
14
17
  "react": "^19.1.1",
15
18
  "react-hot-toast": "^2.6.0"
16
19
  }