@dreamboard-games/sdk 0.5.0-alpha.2 → 0.5.0-alpha.3

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 (150) hide show
  1. package/README.md +136 -45
  2. package/dist/chunk-DMFVAZI2.js +16 -0
  3. package/dist/chunk-DMFVAZI2.js.map +1 -0
  4. package/dist/chunk-FMM5LVJW.js +833 -0
  5. package/dist/chunk-FMM5LVJW.js.map +1 -0
  6. package/dist/{chunk-S2JEDVWH.js → chunk-LRILEVKC.js} +6113 -6489
  7. package/dist/chunk-LRILEVKC.js.map +1 -0
  8. package/dist/chunk-SP234IY4.js +1363 -0
  9. package/dist/chunk-SP234IY4.js.map +1 -0
  10. package/dist/chunk-VUWNJXLJ.js +52 -0
  11. package/dist/chunk-VUWNJXLJ.js.map +1 -0
  12. package/dist/chunk-ZPRKWPEP.js +511 -0
  13. package/dist/chunk-ZPRKWPEP.js.map +1 -0
  14. package/dist/definition-BaHNPZol.d.ts +4639 -0
  15. package/dist/diagnostics-B0lgnuZ6.d.ts +65 -0
  16. package/dist/index.d.ts +3553 -1
  17. package/dist/index.js +1045 -6
  18. package/dist/index.js.map +1 -1
  19. package/dist/model-BHro6yXu.d.ts +288 -0
  20. package/dist/react.d.ts +32 -0
  21. package/dist/react.js +80 -0
  22. package/dist/react.js.map +1 -0
  23. package/dist/reducer.d.ts +1194 -79
  24. package/dist/reducer.js +4326 -121
  25. package/dist/reducer.js.map +1 -1
  26. package/dist/testing.d.ts +518 -564
  27. package/dist/testing.js +2448 -915
  28. package/dist/testing.js.map +1 -1
  29. package/dist/types-DimqnJBq.d.ts +86 -0
  30. package/package.json +26 -131
  31. package/dist/HandView-Bi2lxzQP.d.ts +0 -79
  32. package/dist/ResourceCounter-BFxJknqp.d.ts +0 -98
  33. package/dist/ThemeProvider-CElaL2ik.d.ts +0 -99
  34. package/dist/attributes-DbvyMbXw.d.ts +0 -68
  35. package/dist/browser-interaction.d.ts +0 -910
  36. package/dist/browser-interaction.js +0 -119
  37. package/dist/browser-interaction.js.map +0 -1
  38. package/dist/chunk-32PFKDV7.js +0 -11705
  39. package/dist/chunk-32PFKDV7.js.map +0 -1
  40. package/dist/chunk-3BAD4VC2.js +0 -263
  41. package/dist/chunk-3BAD4VC2.js.map +0 -1
  42. package/dist/chunk-3SKDNDPG.js +0 -104
  43. package/dist/chunk-3SKDNDPG.js.map +0 -1
  44. package/dist/chunk-5YV2WHJ4.js +0 -25
  45. package/dist/chunk-5YV2WHJ4.js.map +0 -1
  46. package/dist/chunk-ANRB4XKA.js +0 -90
  47. package/dist/chunk-ANRB4XKA.js.map +0 -1
  48. package/dist/chunk-BI4G3PM2.js +0 -1864
  49. package/dist/chunk-BI4G3PM2.js.map +0 -1
  50. package/dist/chunk-EVCLTY4Q.js +0 -935
  51. package/dist/chunk-EVCLTY4Q.js.map +0 -1
  52. package/dist/chunk-GDPKTBUR.js +0 -564
  53. package/dist/chunk-GDPKTBUR.js.map +0 -1
  54. package/dist/chunk-H6VDGFL5.js +0 -2903
  55. package/dist/chunk-H6VDGFL5.js.map +0 -1
  56. package/dist/chunk-LR3ZTWQF.js +0 -5960
  57. package/dist/chunk-LR3ZTWQF.js.map +0 -1
  58. package/dist/chunk-PF7L4BMG.js +0 -117
  59. package/dist/chunk-PF7L4BMG.js.map +0 -1
  60. package/dist/chunk-PN5O6GG2.js +0 -32
  61. package/dist/chunk-PN5O6GG2.js.map +0 -1
  62. package/dist/chunk-PZ5AY32C.js +0 -10
  63. package/dist/chunk-PZ5AY32C.js.map +0 -1
  64. package/dist/chunk-S2JEDVWH.js.map +0 -1
  65. package/dist/chunk-T3ZKNUZ7.js +0 -1
  66. package/dist/chunk-T3ZKNUZ7.js.map +0 -1
  67. package/dist/chunk-UGH54WZ2.js +0 -223
  68. package/dist/chunk-UGH54WZ2.js.map +0 -1
  69. package/dist/chunk-VCDWP5VL.js +0 -746
  70. package/dist/chunk-VCDWP5VL.js.map +0 -1
  71. package/dist/chunk-VDXOF4FW.js +0 -69
  72. package/dist/chunk-VDXOF4FW.js.map +0 -1
  73. package/dist/chunk-WHR5UW3F.js +0 -1988
  74. package/dist/chunk-WHR5UW3F.js.map +0 -1
  75. package/dist/chunk-Y75CFE77.js +0 -17
  76. package/dist/chunk-Y75CFE77.js.map +0 -1
  77. package/dist/chunk-Z7QCREWI.js +0 -3435
  78. package/dist/chunk-Z7QCREWI.js.map +0 -1
  79. package/dist/chunk-ZZGN2ATS.js +0 -1941
  80. package/dist/chunk-ZZGN2ATS.js.map +0 -1
  81. package/dist/components-gAbIz7hK.d.ts +0 -1284
  82. package/dist/definitions-BgmV_GhC.d.ts +0 -300
  83. package/dist/diagnostics-DIi3ina7.d.ts +0 -50
  84. package/dist/digest.d.ts +0 -8
  85. package/dist/game-CsZScpcn.d.ts +0 -763
  86. package/dist/hex-board-view-aKkblDp6.d.ts +0 -1228
  87. package/dist/index-CcT9Q7N7.d.ts +0 -193
  88. package/dist/index.d-DjzoK7zn.d.ts +0 -2101
  89. package/dist/package-set.d.ts +0 -13
  90. package/dist/package-set.js +0 -12
  91. package/dist/package-set.js.map +0 -1
  92. package/dist/player-state-Cqpyeql0.d.ts +0 -371
  93. package/dist/plugin-runtime-contract.d.ts +0 -17
  94. package/dist/plugin-runtime-contract.js +0 -92
  95. package/dist/plugin-runtime-contract.js.map +0 -1
  96. package/dist/primitive-props-BNHDkgd7.d.ts +0 -16
  97. package/dist/protocol-dYgafTYY.d.ts +0 -314
  98. package/dist/reducer/advanced.d.ts +0 -82
  99. package/dist/reducer/advanced.js +0 -51
  100. package/dist/reducer/advanced.js.map +0 -1
  101. package/dist/reducer-contract.d.ts +0 -11
  102. package/dist/reducer-contract.js +0 -16
  103. package/dist/reducer-contract.js.map +0 -1
  104. package/dist/reference-games/index.d.ts +0 -31
  105. package/dist/reference-games/index.js +0 -48
  106. package/dist/reference-games/index.js.map +0 -1
  107. package/dist/runtime/primitives.d.ts +0 -250
  108. package/dist/runtime/primitives.js +0 -189
  109. package/dist/runtime/primitives.js.map +0 -1
  110. package/dist/runtime/runtime-api.d.ts +0 -2
  111. package/dist/runtime/runtime-api.js +0 -1
  112. package/dist/runtime/runtime-api.js.map +0 -1
  113. package/dist/runtime/workspace-contract.d.ts +0 -392
  114. package/dist/runtime/workspace-contract.js +0 -28
  115. package/dist/runtime/workspace-contract.js.map +0 -1
  116. package/dist/runtime-RJ5orDJU.d.ts +0 -1699
  117. package/dist/runtime-api-Bz5pwNU_.d.ts +0 -296
  118. package/dist/runtime-json-CQ9QbLZ5.d.ts +0 -5
  119. package/dist/runtime.d.ts +0 -83
  120. package/dist/runtime.js +0 -242
  121. package/dist/runtime.js.map +0 -1
  122. package/dist/schema.d.ts +0 -379
  123. package/dist/stale-contract-artifact-error-XLaweZtF.d.ts +0 -18
  124. package/dist/testing-compiler.d.ts +0 -37
  125. package/dist/testing-compiler.js +0 -272
  126. package/dist/testing-compiler.js.map +0 -1
  127. package/dist/testing-runtime.d.ts +0 -119
  128. package/dist/testing-runtime.js +0 -212
  129. package/dist/testing-runtime.js.map +0 -1
  130. package/dist/types-DJj5MJkl.d.ts +0 -256
  131. package/dist/types-DR7DoB1x.d.ts +0 -28
  132. package/dist/types-JWCYHmu7.d.ts +0 -122
  133. package/dist/types.d.ts +0 -1958
  134. package/dist/types.js +0 -14
  135. package/dist/types.js.map +0 -1
  136. package/dist/ui/components.d.ts +0 -17
  137. package/dist/ui/components.js +0 -216
  138. package/dist/ui/components.js.map +0 -1
  139. package/dist/ui/defaults.d.ts +0 -19
  140. package/dist/ui/defaults.js +0 -104
  141. package/dist/ui/defaults.js.map +0 -1
  142. package/dist/ui/player-state.d.ts +0 -2
  143. package/dist/ui/player-state.js +0 -1
  144. package/dist/ui/player-state.js.map +0 -1
  145. package/dist/ui/plugin-styles.css +0 -2
  146. package/dist/ui-contract-GTUPkf8z.d.ts +0 -1168
  147. package/dist/ui.d.ts +0 -317
  148. package/dist/ui.js +0 -277
  149. package/dist/ui.js.map +0 -1
  150. package/dist/views-BpuWcOyN.d.ts +0 -1641
@@ -1,392 +0,0 @@
1
- import { W as WorkspaceBoardSurface, l as WorkspaceInteractionSlotComponent, c as WorkspaceBoardTargetInputSlot, g as WorkspaceFormInputSlot, p as WorkspaceSurfaceSpec, b as WorkspaceBoardSurfaceDescriptor, i as WorkspaceHandSurfaceDescriptor, n as WorkspacePileSurfaceDescriptor, o as WorkspacePilesSurfaceDescriptor, e as WorkspaceCardCollectionSurfaceDescriptor, j as WorkspaceInteractionFormDescriptor, k as WorkspaceInteractionFormsDescriptor, D as DefineGameUIConfig, C as ClientParamSchema } from '../index-CcT9Q7N7.js';
2
- export { a as ClientParamSchemaMap, d as WorkspaceCardCollectionSurface, f as WorkspaceCardInputSlot, h as WorkspaceHandSurface, m as WorkspacePileSurface, q as createWorkspaceUIContract } from '../index-CcT9Q7N7.js';
3
- import { a1 as InteractionDialogProps, bl as ZoneListProps, bh as ZoneCardRenderItem, R as GameRenderState, b5 as UIContract, G as DreamboardUI, M as GameMeState, Q as GamePlayersState, U as GameTurnState, b7 as UIRootProps, b3 as TypedGame, i as BoardHexViewProps, g as BoardHexGridProps, p as BoardSquareGridProps } from '../ui-contract-GTUPkf8z.js';
4
- export { c as BoardGridInteractionFilter, m as BoardSpaceTargetProps, o as BoardSquareGridInteractionFilter } from '../ui-contract-GTUPkf8z.js';
5
- import { ReactNode, ButtonHTMLAttributes, ReactElement } from 'react';
6
- import { b as InteractionDescriptor } from '../runtime-api-Bz5pwNU_.js';
7
- import { av as PhaseNamesOfDefinition, a8 as InteractionIdOfDefinitionPhase, x as ClientParamsOfInteractionOfDefinition, a3 as InputKeysWithCollectorKindOfDefinition, I as DefaultedClientParamKeysOfInteractionOfDefinition, bd as ViewNamesOfDefinition, be as ViewOfDefinition, aH as ReducerGameContractLike } from '../views-BpuWcOyN.js';
8
- import { P as InteractionVisualState, d as BoardSpaceIdOf, A as AnyHexBoardInput, a as AnySquareBoardInput } from '../hex-board-view-aKkblDp6.js';
9
- import { b as ResourceCounterComponents } from '../ResourceCounter-BFxJknqp.js';
10
- import { z } from 'zod';
11
- import { bk as RuntimeCardData } from '../runtime-RJ5orDJU.js';
12
- import 'react/jsx-runtime';
13
- import '../ThemeProvider-CElaL2ik.js';
14
- import '../types.js';
15
- import '../primitive-props-BNHDkgd7.js';
16
- import '../attributes-DbvyMbXw.js';
17
- import '../types-DJj5MJkl.js';
18
- import '../player-state-Cqpyeql0.js';
19
- import './protocol-dYgafTYY.js';
20
-
21
- interface WorkspaceInteractionFormDialogProps extends Omit<InteractionDialogProps, "children"> {
22
- title: ReactNode;
23
- description?: ReactNode;
24
- trigger?: ReactNode;
25
- children: ReactNode;
26
- contentClassName?: string;
27
- overlayClassName?: string;
28
- showCloseButton?: boolean;
29
- }
30
-
31
- interface GameUiManifestTypes {
32
- readonly PlayerId: string;
33
- readonly ResourceId: string;
34
- readonly ZoneId: string;
35
- readonly CardId: string;
36
- readonly CardType: string;
37
- readonly CardProperties: Record<string, unknown>;
38
- readonly BoardBaseId: string;
39
- readonly SpaceId: string;
40
- readonly EdgeId: string;
41
- readonly VertexId: string;
42
- readonly PlayerCardZoneId: string;
43
- readonly CardZoneId: string;
44
- }
45
- type GameUiPhaseName<Game> = PhaseNamesOfDefinition<Game>;
46
- type GameUiViewName<Game> = ViewNamesOfDefinition<Game>;
47
- type GameUiView<Game> = Extract<"player", GameUiViewName<Game>> extends never ? never : ViewOfDefinition<Game, Extract<"player", GameUiViewName<Game>>>;
48
- type GameUiInteractionIdForPhase<Game, Phase extends GameUiPhaseName<Game>> = InteractionIdOfDefinitionPhase<Game, Phase>;
49
- type GameUiInteractionKey<Game> = {
50
- [Phase in GameUiPhaseName<Game>]: `${Phase}.${GameUiInteractionIdForPhase<Game, Phase>}`;
51
- }[GameUiPhaseName<Game>];
52
- type PhaseOfInteractionKey<Game, Key extends GameUiInteractionKey<Game>> = Key extends `${infer Phase}.${string}` ? Extract<Phase, GameUiPhaseName<Game>> : never;
53
- type IdOfInteractionKey<Game, Key extends GameUiInteractionKey<Game>> = Key extends `${infer Phase}.${infer Id}` ? Phase extends GameUiPhaseName<Game> ? Extract<Id, GameUiInteractionIdForPhase<Game, Phase>> : never : never;
54
- type GameUiInteractionParamsOf<Game, Key extends GameUiInteractionKey<Game>> = ClientParamsOfInteractionOfDefinition<Game, PhaseOfInteractionKey<Game, Key>, IdOfInteractionKey<Game, Key>>;
55
- type CollectorKind = "form" | "board-vertex" | "board-edge" | "board-tile" | "board-space" | "card" | "prompt";
56
- type AuthoredInputKeys<Game, Key extends GameUiInteractionKey<Game>> = InputKeysWithCollectorKindOfDefinition<Game, PhaseOfInteractionKey<Game, Key>, IdOfInteractionKey<Game, Key>, CollectorKind> extends infer Input ? string extends Input ? never : Input & string : never;
57
- type GameUiInteractionInputKeys<Game, Key extends GameUiInteractionKey<Game>> = (string extends keyof GameUiInteractionParamsOf<Game, Key> ? never : keyof GameUiInteractionParamsOf<Game, Key> & string) | AuthoredInputKeys<Game, Key> | (DefaultedClientParamKeysOfInteractionOfDefinition<Game, PhaseOfInteractionKey<Game, Key>, IdOfInteractionKey<Game, Key>> & string);
58
- type GameUiInteractionSlot = {
59
- readonly Field: WorkspaceInteractionSlotComponent;
60
- readonly Options: WorkspaceInteractionSlotComponent<{
61
- children: (option: {
62
- value: unknown;
63
- label: string;
64
- }) => ReactNode;
65
- }>;
66
- readonly Value: WorkspaceInteractionSlotComponent<{
67
- children: (value: unknown | undefined) => ReactNode;
68
- }>;
69
- readonly Default: WorkspaceInteractionSlotComponent;
70
- readonly Card: WorkspaceInteractionSlotComponent<{
71
- value: string;
72
- }>;
73
- readonly Cards: WorkspaceInteractionSlotComponent<{
74
- children: (card: {
75
- id: string;
76
- }) => ReactNode;
77
- }>;
78
- readonly Target: WorkspaceInteractionSlotComponent<{
79
- value: string;
80
- }>;
81
- };
82
- type GameUiCollectorSlot<Game, Key extends GameUiInteractionKey<Game>, Input extends GameUiInteractionInputKeys<Game, Key>> = Input extends InputKeysWithCollectorKindOfDefinition<Game, PhaseOfInteractionKey<Game, Key>, IdOfInteractionKey<Game, Key>, "board-space"> ? WorkspaceBoardTargetInputSlot<"space", never> : Input extends InputKeysWithCollectorKindOfDefinition<Game, PhaseOfInteractionKey<Game, Key>, IdOfInteractionKey<Game, Key>, "board-edge"> ? WorkspaceBoardTargetInputSlot<"edge", never> : Input extends InputKeysWithCollectorKindOfDefinition<Game, PhaseOfInteractionKey<Game, Key>, IdOfInteractionKey<Game, Key>, "board-vertex"> ? WorkspaceBoardTargetInputSlot<"vertex", never> : Input extends InputKeysWithCollectorKindOfDefinition<Game, PhaseOfInteractionKey<Game, Key>, IdOfInteractionKey<Game, Key>, "board-tile"> ? WorkspaceBoardTargetInputSlot<"tile", never> : Input extends InputKeysWithCollectorKindOfDefinition<Game, PhaseOfInteractionKey<Game, Key>, IdOfInteractionKey<Game, Key>, "card"> ? GameUiInteractionSlot : WorkspaceFormInputSlot<Input>;
83
- type GameUiInteractionFormSurface<Game, Contract extends UIContract, Key extends GameUiInteractionKey<Game>> = {
84
- readonly Root: WorkspaceInteractionSlotComponent;
85
- readonly Form: DreamboardUI<Contract>["Interaction"]["Form"];
86
- readonly Dialog: (props: WorkspaceInteractionFormDialogProps) => ReactElement | null;
87
- readonly State: DreamboardUI<Contract>["Interaction"]["State"];
88
- readonly Arm: DreamboardUI<Contract>["Interaction"]["Trigger"];
89
- readonly Submit: DreamboardUI<Contract>["Interaction"]["Submit"];
90
- readonly Field: <Input extends GameUiInteractionInputKeys<Game, Key>>(props: {
91
- input: Input;
92
- children?: ReactNode;
93
- }) => ReactElement | null;
94
- readonly slot: {
95
- readonly [Input in GameUiInteractionInputKeys<Game, Key>]: GameUiCollectorSlot<Game, Key, Input>;
96
- };
97
- };
98
- type GameUiInteractionRoute<Game, Key extends GameUiInteractionKey<Game>> = {
99
- readonly collect: {
100
- [Input in GameUiInteractionInputKeys<Game, Key>]: GameUiCollectorSlot<Game, Key, Input>;
101
- };
102
- };
103
- type GameUiSimultaneousSubmitKey<Game> = Extract<GameUiInteractionKey<Game>, `${string}.submit`>;
104
- type GameUiNamedInteractionKey<Game> = Exclude<GameUiInteractionKey<Game>, GameUiSimultaneousSubmitKey<Game>>;
105
- type GameUiInteractionRoutes<Game> = {
106
- [Key in GameUiNamedInteractionKey<Game>]: GameUiInteractionRoute<Game, Key>;
107
- } & {
108
- [Key in GameUiSimultaneousSubmitKey<Game>]?: GameUiInteractionRoute<Game, Key>;
109
- };
110
- type GameUiZoneCard<Manifest extends GameUiManifestTypes> = ZoneCardRenderItem<Manifest["CardId"], Manifest["CardType"], Manifest["CardProperties"]> extends infer Item ? Item extends {
111
- zone: string;
112
- } ? Omit<Item, "zone"> & {
113
- zone: Manifest["ZoneId"];
114
- } : never : never;
115
- type GameUiBoardSurface<Manifest extends GameUiManifestTypes, _Board extends Manifest["BoardBaseId"] = Manifest["BoardBaseId"]> = WorkspaceBoardSurface<Manifest["SpaceId"], Manifest["EdgeId"], Manifest["VertexId"], Manifest["SpaceId"]> & {
116
- readonly __board?: _Board;
117
- };
118
- type ZoneCardsComponent<Manifest extends GameUiManifestTypes> = WorkspaceInteractionSlotComponent<Omit<ZoneListProps, "children" | "empty"> & {
119
- empty?: ReactNode;
120
- children: (card: GameUiZoneCard<Manifest>) => ReactNode;
121
- }>;
122
- type ZoneCardComponent<Manifest extends GameUiManifestTypes> = WorkspaceInteractionSlotComponent<Omit<ButtonHTMLAttributes<HTMLButtonElement>, "type" | "value"> & {
123
- card: GameUiZoneCard<Manifest>;
124
- }>;
125
- type GameUiHandCardIntent<Card extends string, Target extends string> = {
126
- type: "activate";
127
- cardId: Card;
128
- source: "tap" | "keyboard";
129
- } | {
130
- type: "previewStart";
131
- cardId: Card;
132
- } | {
133
- type: "previewEnd";
134
- cardId: Card;
135
- } | {
136
- type: "drop";
137
- cardId: Card;
138
- targetId: Target;
139
- source: "pointer" | "keyboard";
140
- };
141
- type GameUiHandSelectionSummary<Card extends string> = {
142
- readonly selectedCount: number;
143
- readonly selectedIds: readonly Card[];
144
- readonly hasInvalidSelection: boolean;
145
- };
146
- type GameUiHandProps<Manifest extends GameUiManifestTypes> = Omit<ZoneListProps, "children" | "empty"> & {
147
- empty?: ReactNode;
148
- children: (card: GameUiZoneCard<Manifest>, state: InteractionVisualState) => ReactNode;
149
- layout?: "fan" | "compressed-fan" | "tray" | "strip" | "stack" | {
150
- desktop?: "fan" | "compressed-fan" | "tray" | "strip" | "stack";
151
- mobile?: "fan" | "compressed-fan" | "tray" | "strip" | "stack";
152
- };
153
- mobileInteraction?: "direct-activate" | "drag-to-target";
154
- cardSize?: "sm" | "md" | "lg";
155
- ariaLabel?: string;
156
- dropTargets?: ReadonlyArray<{
157
- target: {
158
- readonly kind: "card";
159
- readonly card: Manifest["CardId"];
160
- } | {
161
- readonly kind: "space" | "tile";
162
- readonly target: Manifest["SpaceId"];
163
- } | {
164
- readonly kind: "edge";
165
- readonly target: Manifest["EdgeId"];
166
- } | {
167
- readonly kind: "vertex";
168
- readonly target: Manifest["VertexId"];
169
- };
170
- label: string;
171
- render: (state: unknown) => ReactNode;
172
- className?: string;
173
- role?: string;
174
- order?: number;
175
- }>;
176
- renderDropTargets?: (children: ReactNode) => ReactNode;
177
- onCardIntent?: (intent: GameUiHandCardIntent<Manifest["CardId"], Manifest["CardId"] | Manifest["SpaceId"] | Manifest["EdgeId"] | Manifest["VertexId"]>) => void;
178
- onSelectionSummary?: (summary: GameUiHandSelectionSummary<Manifest["CardId"]>) => void;
179
- };
180
- type GameUiHandSurface<Manifest extends GameUiManifestTypes, Zones extends readonly Manifest["ZoneId"][] = readonly Manifest["ZoneId"][]> = {
181
- readonly Hand: WorkspaceInteractionSlotComponent<Omit<GameUiHandProps<Manifest>, "children"> & {
182
- children: ReactNode;
183
- }>;
184
- readonly Cards: WorkspaceInteractionSlotComponent<{
185
- children: (card: GameUiZoneCard<Manifest>, state: InteractionVisualState) => ReactNode;
186
- }>;
187
- readonly Summary: (props: {
188
- children?: ReactNode | ((summary: GameUiHandSelectionSummary<Manifest["CardId"]>) => ReactNode);
189
- }) => ReactElement | null;
190
- readonly Actions: (props: {
191
- children?: ReactNode | ((summary: GameUiHandSelectionSummary<Manifest["CardId"]>) => ReactNode);
192
- }) => ReactElement | null;
193
- readonly Card: ZoneCardComponent<Manifest>;
194
- readonly Staging: WorkspaceInteractionSlotComponent<{
195
- children: (card: Extract<GameUiZoneCard<Manifest>, {
196
- hidden: false;
197
- }>) => ReactNode;
198
- label?: ReactNode;
199
- renderEmptySlot?: (index: number) => ReactNode;
200
- cardSize?: "sm" | "md" | "lg";
201
- ariaLabel?: string;
202
- className?: string;
203
- }>;
204
- readonly slot: {
205
- readonly card: GameUiInteractionSlot & {
206
- readonly __zones?: Zones;
207
- };
208
- };
209
- };
210
- type GameUiPileSurface<Manifest extends GameUiManifestTypes> = {
211
- readonly Pile: ZoneCardsComponent<Manifest>;
212
- readonly Card: ZoneCardComponent<Manifest>;
213
- };
214
- type GameUiCardCollectionSurface<Manifest extends GameUiManifestTypes, Zones extends readonly Manifest["ZoneId"][] = readonly Manifest["ZoneId"][]> = {
215
- readonly Collection: ZoneCardsComponent<Manifest>;
216
- readonly Card: ZoneCardComponent<Manifest>;
217
- readonly slot: {
218
- readonly card: GameUiInteractionSlot & {
219
- readonly __zones?: Zones;
220
- };
221
- };
222
- };
223
- type UiRegistry<Game, Manifest extends GameUiManifestTypes> = {
224
- interactions: {
225
- [Key in GameUiInteractionKey<Game>]: {
226
- interaction: Key;
227
- phase: PhaseOfInteractionKey<Game, Key>;
228
- id: IdOfInteractionKey<Game, Key>;
229
- };
230
- };
231
- inputs: {
232
- [Key in GameUiInteractionInputKeys<Game, GameUiInteractionKey<Game>>]: {
233
- input: Key;
234
- };
235
- };
236
- prompts: {
237
- [Key in GameUiInteractionKey<Game>]: {
238
- interaction: Key;
239
- };
240
- };
241
- promptOptions: Record<string, {
242
- value: string;
243
- }>;
244
- players: {
245
- [Key in Manifest["PlayerId"]]: {
246
- player: Key;
247
- };
248
- };
249
- zones: {
250
- [Key in Manifest["ZoneId"]]: {
251
- zone: Key;
252
- };
253
- };
254
- cards: {
255
- [Key in Manifest["CardId"]]: {
256
- card: Key;
257
- };
258
- };
259
- phases: {
260
- [Key in GameUiPhaseName<Game>]: {
261
- phase: Key;
262
- };
263
- };
264
- boardTargets: {
265
- [Key in Manifest["SpaceId"] | Manifest["EdgeId"] | Manifest["VertexId"]]: {
266
- target: Key;
267
- };
268
- };
269
- };
270
- type GameUiContract<Game, Manifest extends GameUiManifestTypes> = UiRegistry<Game, Manifest>;
271
- type SurfaceValue<Game, Manifest extends GameUiManifestTypes, Contract extends UIContract, Spec> = Spec extends WorkspaceBoardSurfaceDescriptor<infer Board extends Manifest["BoardBaseId"]> ? GameUiBoardSurface<Manifest, Board> : Spec extends WorkspaceHandSurfaceDescriptor<infer Zone extends Manifest["PlayerCardZoneId"]> ? GameUiHandSurface<Manifest, readonly [Zone]> : Spec extends WorkspacePileSurfaceDescriptor<infer Zone extends Manifest["CardZoneId"]> ? GameUiPileSurface<Manifest> & {
272
- readonly __zone?: Zone;
273
- } : Spec extends WorkspacePilesSurfaceDescriptor<infer Zones extends readonly Manifest["CardZoneId"][]> ? {
274
- readonly [Zone in Zones[number]]: GameUiPileSurface<Manifest>;
275
- } : Spec extends WorkspaceCardCollectionSurfaceDescriptor<infer Zones extends readonly Manifest["CardZoneId"][]> ? GameUiCardCollectionSurface<Manifest, Zones> : Spec extends WorkspaceInteractionFormDescriptor<infer Interaction extends GameUiInteractionKey<Game>> ? GameUiInteractionFormSurface<Game, Contract, Interaction> : Spec extends WorkspaceInteractionFormsDescriptor<infer Forms extends Readonly<Record<string, GameUiInteractionKey<Game>>>> ? {
276
- readonly [Key in keyof Forms]: GameUiInteractionFormSurface<Game, Contract, Forms[Key]>;
277
- } : Spec extends WorkspaceSurfaceSpec ? {
278
- readonly [Key in keyof Spec]: SurfaceValue<Game, Manifest, Contract, Spec[Key]>;
279
- } : never;
280
- type GameUiHexBoardId<HexBoards> = keyof HexBoards & string;
281
- type GameUiSquareBoardId<SquareBoards> = keyof SquareBoards & string;
282
- type GameUiHexBoardTopology<HexBoards, Id extends GameUiHexBoardId<HexBoards>> = Extract<HexBoards[Id], AnyHexBoardInput>;
283
- type GameUiSquareBoardTopology<SquareBoards, Id extends GameUiSquareBoardId<SquareBoards>> = Extract<SquareBoards[Id], AnySquareBoardInput>;
284
- type GameUiHexBoardSpaceId<HexBoards, Id extends GameUiHexBoardId<HexBoards>> = BoardSpaceIdOf<GameUiHexBoardTopology<HexBoards, Id>>;
285
- type GameUiBoardNamespace<Manifest extends GameUiManifestTypes, Contract extends UIContract, HexBoards, SquareBoards> = Omit<DreamboardUI<Contract>["Board"], "HexView" | "HexGrid" | "SquareGrid"> & {
286
- surface<const Board extends Manifest["BoardBaseId"]>(board: Board): WorkspaceBoardSurfaceDescriptor<Board>;
287
- useSurface<const Board extends Manifest["BoardBaseId"]>(name: string, options?: {
288
- board: Board;
289
- }): GameUiBoardSurface<Manifest, Board>;
290
- HexView<const Id extends GameUiHexBoardId<HexBoards>, const SpaceView extends {
291
- id: GameUiHexBoardSpaceId<HexBoards, Id>;
292
- }>(props: Omit<BoardHexViewProps<GameUiHexBoardTopology<HexBoards, Id>, SpaceView>, "board"> & {
293
- board: Id;
294
- }): ReactElement;
295
- HexGrid<const Id extends GameUiHexBoardId<HexBoards>, const SpaceView extends {
296
- id: GameUiHexBoardSpaceId<HexBoards, Id>;
297
- }>(props: Omit<BoardHexGridProps<GameUiHexBoardTopology<HexBoards, Id>, SpaceView>, "board" | "interactions"> & {
298
- board: Id;
299
- }): ReactElement;
300
- SquareGrid<const Id extends GameUiSquareBoardId<SquareBoards>>(props: Omit<BoardSquareGridProps<GameUiSquareBoardTopology<SquareBoards, Id>>, "board" | "interactions"> & {
301
- board: Id;
302
- }): ReactElement;
303
- };
304
- type GameWorkspaceUI<Game, Manifest extends GameUiManifestTypes, Contract extends GameUiContract<Game, Manifest>, HexBoards, SquareBoards> = Omit<DreamboardUI<Contract>, "Root" | "Game" | "Interaction" | "Board" | "Zone" | "Prompt" | "PromptInbox"> & {
305
- Root(props: UIRootProps): ReactElement;
306
- defineSurfaces<const Spec extends WorkspaceSurfaceSpec>(spec: Spec): () => SurfaceValue<Game, Manifest, Contract, Spec>;
307
- defineGameUI<Surfaces>(config: DefineGameUIConfig<GameRenderState<GameUiView<Game>, Manifest["PlayerId"], GameUiPhaseName<Game>>, Surfaces> & {
308
- useSurfaces: () => Surfaces;
309
- interactionRoutes?: () => GameUiInteractionRoutes<Game>;
310
- phases: {
311
- readonly [Phase in GameUiPhaseName<Game>]: (context: {
312
- game: GameRenderState<GameUiView<Game>, Manifest["PlayerId"], GameUiPhaseName<Game>>;
313
- surfaces: Surfaces;
314
- }) => ReactNode;
315
- };
316
- }): (props: Omit<UIRootProps, "children">) => ReactElement;
317
- readonly Game: TypedGame<Contract, GameUiView<Game>, Manifest["PlayerId"], GameUiPhaseName<Game>>;
318
- readonly Interaction: Pick<DreamboardUI<Contract>["Interaction"], "State" | "Dialog"> & {
319
- useForm<Key extends GameUiInteractionKey<Game>>(interaction: Key): GameUiInteractionFormSurface<Game, Contract, Key>;
320
- form<const Interaction extends GameUiInteractionKey<Game>>(interaction: Interaction): WorkspaceInteractionFormDescriptor<Interaction>;
321
- forms<const Interactions extends Readonly<Record<string, GameUiInteractionKey<Game>>>>(interactions: Interactions): WorkspaceInteractionFormsDescriptor<Interactions>;
322
- Routes(props: {
323
- routes: GameUiInteractionRoutes<Game>;
324
- fallback?: ReactNode;
325
- includeUnavailable?: boolean | null;
326
- }): ReactElement;
327
- };
328
- readonly Board: GameUiBoardNamespace<Manifest, Contract, HexBoards, SquareBoards>;
329
- readonly Zone: {
330
- hand<const Zone extends Manifest["PlayerCardZoneId"]>(zone: Zone, options: {
331
- role: "primary" | "auxiliary" | "task";
332
- label: string;
333
- order?: number;
334
- }): WorkspaceHandSurfaceDescriptor<Zone>;
335
- pile<const Zone extends Manifest["CardZoneId"]>(zone: Zone): WorkspacePileSurfaceDescriptor<Zone>;
336
- collection<const Zones extends readonly Manifest["CardZoneId"][]>(zones: Zones, options?: {
337
- mode?: "all" | "top-card";
338
- }): WorkspaceCardCollectionSurfaceDescriptor<Zones>;
339
- } & DreamboardUI<Contract>["Zone"];
340
- readonly ResourceCounter: ResourceCounterComponents<Manifest["ResourceId"]>;
341
- };
342
- interface CreateGameUiContractOptions<Game, Manifest extends GameUiManifestTypes, HexBoards extends Record<string, unknown>, SquareBoards extends Record<string, unknown>> {
343
- readonly game: Game;
344
- readonly resourceIds: readonly Manifest["ResourceId"][];
345
- readonly resourcePresentationById?: Partial<Record<string, {
346
- label?: string;
347
- icon?: string;
348
- }>>;
349
- readonly hexStaticBoards: HexBoards;
350
- readonly squareStaticBoards: SquareBoards;
351
- }
352
- declare function createGameUiContract<Game, Manifest extends GameUiManifestTypes, HexBoards extends Record<string, unknown>, SquareBoards extends Record<string, unknown>>(options: CreateGameUiContractOptions<Game, Manifest, HexBoards, SquareBoards>): {
353
- uiContract: GameUiContract<Game, Manifest>;
354
- UI: GameWorkspaceUI<Game, Manifest, GameUiContract<Game, Manifest>, HexBoards, SquareBoards>;
355
- clientParamSchemasByPhase: Readonly<Record<string, Readonly<Record<string, ClientParamSchema>>>>;
356
- };
357
- type GameUiGameRootState<Game, Manifest extends GameUiManifestTypes> = GameRenderState<GameUiView<Game>, Manifest["PlayerId"], GameUiPhaseName<Game>>;
358
- type GameUiPlayers<Manifest extends GameUiManifestTypes> = GamePlayersState<Manifest["PlayerId"]>;
359
- type GameUiMe<Manifest extends GameUiManifestTypes> = GameMeState<Manifest["PlayerId"]>;
360
- type GameUiTurn<Game, Manifest extends GameUiManifestTypes> = GameTurnState<Manifest["PlayerId"], GameUiPhaseName<Game>>;
361
- type GameUiInteractionDescriptor<Game, Key extends GameUiInteractionKey<Game>> = InteractionDescriptor<Key>;
362
-
363
- type GameWithManifest = {
364
- contract: ReducerGameContractLike;
365
- };
366
- type ManifestOf<G extends GameWithManifest> = G["contract"]["manifest"];
367
- type Id<G extends GameWithManifest, K extends keyof ManifestOf<G>["ids"]> = z.output<ManifestOf<G>["ids"][K]> & string;
368
- type Table<G extends GameWithManifest> = z.output<ManifestOf<G>["tableSchema"]>;
369
- type GameUiManifestOf<G extends GameWithManifest> = {
370
- PlayerId: Id<G, "playerId">;
371
- ResourceId: Id<G, "resourceId">;
372
- ZoneId: Id<G, "zoneId">;
373
- CardId: Id<G, "cardId">;
374
- CardType: Id<G, "cardType">;
375
- CardProperties: Table<G>["cards"][keyof Table<G>["cards"]] extends RuntimeCardData ? Table<G>["cards"][keyof Table<G>["cards"]]["properties"] : Record<string, unknown>;
376
- BoardBaseId: Id<G, "boardBaseId">;
377
- SpaceId: Id<G, "spaceId">;
378
- EdgeId: Id<G, "edgeId">;
379
- VertexId: Id<G, "vertexId">;
380
- PlayerCardZoneId: Id<G, "playerZoneId">;
381
- CardZoneId: Id<G, "zoneId">;
382
- };
383
- type GameUiRootStateOf<G extends GameWithManifest> = GameUiGameRootState<G, GameUiManifestOf<G>>;
384
- type GameUiHandSurfaceOf<G extends GameWithManifest> = GameUiHandSurface<GameUiManifestOf<G>>;
385
- /** Bind UI primitives directly to an authored game's inferred contract. */
386
- declare function createGameUi<const G extends GameWithManifest>(game: G): {
387
- uiContract: GameUiContract<G, GameUiManifestOf<G>>;
388
- UI: GameWorkspaceUI<G, GameUiManifestOf<G>, GameUiContract<G, GameUiManifestOf<G>>, NonNullable<ManifestOf<G>["staticBoards"]>["hex"], NonNullable<ManifestOf<G>["staticBoards"]>["square"]>;
389
- clientParamSchemasByPhase: Readonly<Record<string, Readonly<Record<string, ClientParamSchema>>>>;
390
- };
391
-
392
- export { BoardHexGridProps, BoardHexViewProps, BoardSquareGridProps, DefineGameUIConfig, DreamboardUI, GameMeState, GamePlayersState, GameRenderState, GameTurnState, type GameUiBoardSurface, type GameUiCardCollectionSurface, type GameUiContract, type GameUiGameRootState, type GameUiHandSurface, type GameUiHandSurfaceOf, type GameUiInteractionDescriptor, type GameUiInteractionFormSurface, type GameUiInteractionKey, type GameUiInteractionParamsOf, type GameUiInteractionRoutes, type GameUiManifestOf, type GameUiManifestTypes, type GameUiMe, type GameUiPhaseName, type GameUiPileSurface, type GameUiPlayers, type GameUiRootStateOf, type GameUiTurn, type GameUiView, type GameUiViewName, type GameWorkspaceUI, ResourceCounterComponents, TypedGame, UIContract, UIRootProps, WorkspaceBoardSurface, WorkspaceBoardSurfaceDescriptor, WorkspaceBoardTargetInputSlot, WorkspaceCardCollectionSurfaceDescriptor, WorkspaceFormInputSlot, WorkspaceHandSurfaceDescriptor, WorkspaceInteractionFormDescriptor, type WorkspaceInteractionFormDialogProps, WorkspaceInteractionFormsDescriptor, WorkspaceInteractionSlotComponent, WorkspacePileSurfaceDescriptor, WorkspacePilesSurfaceDescriptor, WorkspaceSurfaceSpec, ZoneCardRenderItem, ZoneListProps, createGameUi, createGameUiContract };
@@ -1,28 +0,0 @@
1
- import {
2
- createGameUi,
3
- createGameUiContract,
4
- createWorkspaceUIContract
5
- } from "../chunk-EVCLTY4Q.js";
6
- import "../chunk-ANRB4XKA.js";
7
- import "../chunk-PN5O6GG2.js";
8
- import "../chunk-LR3ZTWQF.js";
9
- import "../chunk-T3ZKNUZ7.js";
10
- import "../chunk-GDPKTBUR.js";
11
- import "../chunk-3SKDNDPG.js";
12
- import "../chunk-32PFKDV7.js";
13
- import "../chunk-VDXOF4FW.js";
14
- import "../chunk-WHR5UW3F.js";
15
- import "../chunk-VCDWP5VL.js";
16
- import "../chunk-ZZGN2ATS.js";
17
- import "../chunk-H6VDGFL5.js";
18
- import "../chunk-5YV2WHJ4.js";
19
- import "../chunk-PF7L4BMG.js";
20
- import "../chunk-Z7QCREWI.js";
21
- import "../chunk-UGH54WZ2.js";
22
- import "../chunk-PZ5AY32C.js";
23
- export {
24
- createGameUi,
25
- createGameUiContract,
26
- createWorkspaceUIContract
27
- };
28
- //# sourceMappingURL=workspace-contract.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}