@dreamboard-games/sdk 0.4.0-alpha.11 → 0.4.0-alpha.13

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 (43) hide show
  1. package/REFERENCE.md +444 -9
  2. package/dist/authoring/index.js +3 -3
  3. package/dist/authoring-compiler.js +4 -4
  4. package/dist/authoring-materialize-cli.js +4 -4
  5. package/dist/{chunk-THTFQZZ3.js → chunk-42HQLHVA.js} +3 -3
  6. package/dist/{chunk-RP6QDQGI.js → chunk-7JBPOJOF.js} +46 -1
  7. package/dist/chunk-7JBPOJOF.js.map +1 -0
  8. package/dist/{chunk-SACZWUA6.js → chunk-HIH6Y4FA.js} +86 -1224
  9. package/dist/{chunk-SACZWUA6.js.map → chunk-HIH6Y4FA.js.map} +1 -1
  10. package/dist/{chunk-RU3Z5J6V.js → chunk-KZFHTUI5.js} +4 -4
  11. package/dist/{chunk-HRWI2DIJ.js → chunk-MLFHVYF7.js} +2 -2
  12. package/dist/{chunk-3OY46H7D.js → chunk-OFIDC7DJ.js} +3 -3
  13. package/dist/{chunk-CP3BF3B2.js → chunk-THWT4V3Z.js} +2 -2
  14. package/dist/{chunk-CP3BF3B2.js.map → chunk-THWT4V3Z.js.map} +1 -1
  15. package/dist/{chunk-4IIY742N.js → chunk-UTSBXZAM.js} +2 -2
  16. package/dist/chunk-VWTKGIYF.js +90 -0
  17. package/dist/chunk-VWTKGIYF.js.map +1 -0
  18. package/dist/codegen.js +1 -1
  19. package/dist/{index-CRfZ21dM.d.ts → index-CR69MyWr.d.ts} +1 -1
  20. package/dist/index.js +2 -2
  21. package/dist/package-set.d.ts +2 -2
  22. package/dist/package-set.js +2 -2
  23. package/dist/reducer/advanced.js +7 -82
  24. package/dist/reducer/advanced.js.map +1 -1
  25. package/dist/reducer-contract.js +1 -1
  26. package/dist/reference-game-compiler.js +2 -2
  27. package/dist/reference-game-source-manifest-cli.js +2 -2
  28. package/dist/runtime/workspace-contract.d.ts +342 -10
  29. package/dist/runtime/workspace-contract.js +7 -1
  30. package/dist/runtime.d.ts +1 -1
  31. package/dist/runtime.js +7 -3
  32. package/dist/runtime.js.map +1 -1
  33. package/dist/testing-runtime.js +2 -2
  34. package/dist/testing.d.ts +84 -20
  35. package/dist/testing.js +167 -23
  36. package/dist/testing.js.map +1 -1
  37. package/package.json +1 -1
  38. package/dist/chunk-RP6QDQGI.js.map +0 -1
  39. /package/dist/{chunk-THTFQZZ3.js.map → chunk-42HQLHVA.js.map} +0 -0
  40. /package/dist/{chunk-RU3Z5J6V.js.map → chunk-KZFHTUI5.js.map} +0 -0
  41. /package/dist/{chunk-HRWI2DIJ.js.map → chunk-MLFHVYF7.js.map} +0 -0
  42. /package/dist/{chunk-3OY46H7D.js.map → chunk-OFIDC7DJ.js.map} +0 -0
  43. /package/dist/{chunk-4IIY742N.js.map → chunk-UTSBXZAM.js.map} +0 -0
@@ -1,18 +1,23 @@
1
- export { C as ClientParamSchemaMap, D as DefineGameUIConfig, W as WorkspaceBoardSurface, a as WorkspaceBoardSurfaceDescriptor, b as WorkspaceBoardTargetInputSlot, c as WorkspaceCardCollectionSurface, d as WorkspaceCardCollectionSurfaceDescriptor, e as WorkspaceCardInputSlot, f as WorkspaceFormInputSlot, g as WorkspaceHandSurface, h as WorkspaceHandSurfaceDescriptor, i as WorkspaceInteractionFormDescriptor, j as WorkspaceInteractionFormsDescriptor, k as WorkspaceInteractionSlotComponent, l as WorkspacePileSurface, m as WorkspacePileSurfaceDescriptor, n as WorkspacePilesSurfaceDescriptor, o as WorkspaceSurfaceSpec, p as createWorkspaceUIContract } from '../index-CRfZ21dM.js';
2
- import { a1 as InteractionDialogProps } from '../ui-contract-BC4JpysE.js';
3
- export { c as BoardGridInteractionFilter, g as BoardHexGridProps, i as BoardHexViewProps, m as BoardSpaceTargetProps, o as BoardSquareGridInteractionFilter, p as BoardSquareGridProps, G as DreamboardUI, M as GameMeState, Q as GamePlayersState, R as GameRenderState, U as GameTurnState, b3 as TypedGame, b5 as UIContract, b7 as UIRootProps, bh as ZoneCardRenderItem, bl as ZoneListProps } from '../ui-contract-BC4JpysE.js';
4
- export { b as ResourceCounterComponents } from '../ResourceCounter-BFxJknqp.js';
5
- import { ReactNode } from 'react';
6
- import '../hex-board-view-aKkblDp6.js';
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-CR69MyWr.js';
2
+ export { a as ClientParamSchemaMap, d as WorkspaceCardCollectionSurface, f as WorkspaceCardInputSlot, h as WorkspaceHandSurface, m as WorkspacePileSurface, q as createWorkspaceUIContract } from '../index-CR69MyWr.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-BC4JpysE.js';
4
+ export { c as BoardGridInteractionFilter, m as BoardSpaceTargetProps, o as BoardSquareGridInteractionFilter } from '../ui-contract-BC4JpysE.js';
5
+ import { ReactNode, ButtonHTMLAttributes, ReactElement } from 'react';
6
+ import { b as InteractionDescriptor } from '../plugin-state-BRH3UiUp.js';
7
+ import { av as PhaseNamesOfDefinition, a8 as InteractionIdOfDefinitionPhase, x as ClientParamsOfInteractionOfDefinition, a3 as InputKeysWithCollectorKindOfDefinition, I as DefaultedClientParamKeysOfInteractionOfDefinition, bd as ViewNamesOfDefinition, be as ViewOfDefinition } from '../views-BbCGDuCs.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';
7
10
  import 'react/jsx-runtime';
8
- import '../player-state-Cqpyeql0.js';
9
- import '../types.js';
10
11
  import '../ThemeProvider-CElaL2ik.js';
11
- import '../plugin-state-BRH3UiUp.js';
12
+ import '../types.js';
12
13
  import '../primitive-props-BNHDkgd7.js';
13
14
  import '../attributes-DbvyMbXw.js';
14
15
  import '../types-DJj5MJkl.js';
15
16
  import '../runtime-api-CgPuEVeF.js';
17
+ import '../player-state-Cqpyeql0.js';
18
+ import '../runtime-BhuaOkIL.js';
19
+ import 'zod';
20
+ import './protocol-Bcas2Xa8.js';
16
21
 
17
22
  interface WorkspaceInteractionFormDialogProps extends Omit<InteractionDialogProps, "children"> {
18
23
  title: ReactNode;
@@ -24,4 +29,331 @@ interface WorkspaceInteractionFormDialogProps extends Omit<InteractionDialogProp
24
29
  showCloseButton?: boolean;
25
30
  }
26
31
 
27
- export type { WorkspaceInteractionFormDialogProps };
32
+ interface GameUiManifestTypes {
33
+ readonly PlayerId: string;
34
+ readonly ResourceId: string;
35
+ readonly ZoneId: string;
36
+ readonly CardId: string;
37
+ readonly CardType: string;
38
+ readonly CardProperties: Record<string, unknown>;
39
+ readonly BoardBaseId: string;
40
+ readonly SpaceId: string;
41
+ readonly EdgeId: string;
42
+ readonly VertexId: string;
43
+ readonly PlayerCardZoneId: string;
44
+ readonly CardZoneId: string;
45
+ }
46
+ type GameUiPhaseName<Game> = PhaseNamesOfDefinition<Game>;
47
+ type GameUiViewName<Game> = ViewNamesOfDefinition<Game>;
48
+ type GameUiView<Game> = Extract<"player", GameUiViewName<Game>> extends never ? never : ViewOfDefinition<Game, Extract<"player", GameUiViewName<Game>>>;
49
+ type GameUiInteractionIdForPhase<Game, Phase extends GameUiPhaseName<Game>> = InteractionIdOfDefinitionPhase<Game, Phase>;
50
+ type GameUiInteractionKey<Game> = {
51
+ [Phase in GameUiPhaseName<Game>]: `${Phase}.${GameUiInteractionIdForPhase<Game, Phase>}`;
52
+ }[GameUiPhaseName<Game>];
53
+ type PhaseOfInteractionKey<Game, Key extends GameUiInteractionKey<Game>> = Key extends `${infer Phase}.${string}` ? Extract<Phase, GameUiPhaseName<Game>> : never;
54
+ type IdOfInteractionKey<Game, Key extends GameUiInteractionKey<Game>> = Key extends `${infer Phase}.${infer Id}` ? Phase extends GameUiPhaseName<Game> ? Extract<Id, GameUiInteractionIdForPhase<Game, Phase>> : never : never;
55
+ type GameUiInteractionParamsOf<Game, Key extends GameUiInteractionKey<Game>> = ClientParamsOfInteractionOfDefinition<Game, PhaseOfInteractionKey<Game, Key>, IdOfInteractionKey<Game, Key>>;
56
+ type CollectorKind = "form" | "board-vertex" | "board-edge" | "board-tile" | "board-space" | "card" | "prompt";
57
+ 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;
58
+ 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);
59
+ type GameUiInteractionSlot = {
60
+ readonly Field: WorkspaceInteractionSlotComponent;
61
+ readonly Options: WorkspaceInteractionSlotComponent<{
62
+ children: (option: {
63
+ value: unknown;
64
+ label: string;
65
+ }) => ReactNode;
66
+ }>;
67
+ readonly Value: WorkspaceInteractionSlotComponent<{
68
+ children: (value: unknown | undefined) => ReactNode;
69
+ }>;
70
+ readonly Default: WorkspaceInteractionSlotComponent;
71
+ readonly Card: WorkspaceInteractionSlotComponent<{
72
+ value: string;
73
+ }>;
74
+ readonly Cards: WorkspaceInteractionSlotComponent<{
75
+ children: (card: {
76
+ id: string;
77
+ }) => ReactNode;
78
+ }>;
79
+ readonly Target: WorkspaceInteractionSlotComponent<{
80
+ value: string;
81
+ }>;
82
+ };
83
+ 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>;
84
+ type GameUiInteractionFormSurface<Game, Contract extends UIContract, Key extends GameUiInteractionKey<Game>> = {
85
+ readonly Root: WorkspaceInteractionSlotComponent;
86
+ readonly Form: DreamboardUI<Contract>["Interaction"]["Form"];
87
+ readonly Dialog: (props: WorkspaceInteractionFormDialogProps) => ReactElement | null;
88
+ readonly State: DreamboardUI<Contract>["Interaction"]["State"];
89
+ readonly Arm: DreamboardUI<Contract>["Interaction"]["Trigger"];
90
+ readonly Submit: DreamboardUI<Contract>["Interaction"]["Submit"];
91
+ readonly Field: <Input extends GameUiInteractionInputKeys<Game, Key>>(props: {
92
+ input: Input;
93
+ children?: ReactNode;
94
+ }) => ReactElement | null;
95
+ readonly slot: {
96
+ readonly [Input in GameUiInteractionInputKeys<Game, Key>]: GameUiCollectorSlot<Game, Key, Input>;
97
+ };
98
+ };
99
+ type GameUiInteractionRoutes<Game> = Partial<{
100
+ [Key in GameUiInteractionKey<Game>]: {
101
+ readonly collect: {
102
+ [Input in GameUiInteractionInputKeys<Game, Key>]: GameUiCollectorSlot<Game, Key, Input>;
103
+ };
104
+ };
105
+ }>;
106
+ type GameUiZoneCard<Manifest extends GameUiManifestTypes> = ZoneCardRenderItem<Manifest["CardId"], Manifest["CardType"], Manifest["CardProperties"]> extends infer Item ? Item extends {
107
+ zone: string;
108
+ } ? Omit<Item, "zone"> & {
109
+ zone: Manifest["ZoneId"];
110
+ } : never : never;
111
+ type GameUiBoardSurface<Manifest extends GameUiManifestTypes, _Board extends Manifest["BoardBaseId"] = Manifest["BoardBaseId"]> = WorkspaceBoardSurface<Manifest["SpaceId"], Manifest["EdgeId"], Manifest["VertexId"], Manifest["SpaceId"]> & {
112
+ readonly __board?: _Board;
113
+ };
114
+ type ZoneCardsComponent<Manifest extends GameUiManifestTypes> = WorkspaceInteractionSlotComponent<Omit<ZoneListProps, "children" | "empty"> & {
115
+ empty?: ReactNode;
116
+ children: (card: GameUiZoneCard<Manifest>) => ReactNode;
117
+ }>;
118
+ type ZoneCardComponent<Manifest extends GameUiManifestTypes> = WorkspaceInteractionSlotComponent<Omit<ButtonHTMLAttributes<HTMLButtonElement>, "type" | "value"> & {
119
+ card: GameUiZoneCard<Manifest>;
120
+ }>;
121
+ type GameUiHandCardIntent<Card extends string, Target extends string> = {
122
+ type: "activate";
123
+ cardId: Card;
124
+ source: "tap" | "keyboard";
125
+ } | {
126
+ type: "previewStart";
127
+ cardId: Card;
128
+ } | {
129
+ type: "previewEnd";
130
+ cardId: Card;
131
+ } | {
132
+ type: "drop";
133
+ cardId: Card;
134
+ targetId: Target;
135
+ source: "pointer" | "keyboard";
136
+ };
137
+ type GameUiHandSelectionSummary<Card extends string> = {
138
+ readonly selectedCount: number;
139
+ readonly selectedIds: readonly Card[];
140
+ readonly hasInvalidSelection: boolean;
141
+ };
142
+ type GameUiHandProps<Manifest extends GameUiManifestTypes> = Omit<ZoneListProps, "children" | "empty"> & {
143
+ empty?: ReactNode;
144
+ children: (card: GameUiZoneCard<Manifest>, state: InteractionVisualState) => ReactNode;
145
+ layout?: "fan" | "compressed-fan" | "tray" | "strip" | "stack" | {
146
+ desktop?: "fan" | "compressed-fan" | "tray" | "strip" | "stack";
147
+ mobile?: "fan" | "compressed-fan" | "tray" | "strip" | "stack";
148
+ };
149
+ mobileInteraction?: "direct-activate" | "drag-to-target";
150
+ cardSize?: "sm" | "md" | "lg";
151
+ ariaLabel?: string;
152
+ dropTargets?: ReadonlyArray<{
153
+ target: {
154
+ readonly kind: "card";
155
+ readonly card: Manifest["CardId"];
156
+ } | {
157
+ readonly kind: "space" | "tile";
158
+ readonly target: Manifest["SpaceId"];
159
+ } | {
160
+ readonly kind: "edge";
161
+ readonly target: Manifest["EdgeId"];
162
+ } | {
163
+ readonly kind: "vertex";
164
+ readonly target: Manifest["VertexId"];
165
+ };
166
+ label: string;
167
+ render: (state: unknown) => ReactNode;
168
+ className?: string;
169
+ role?: string;
170
+ order?: number;
171
+ }>;
172
+ renderDropTargets?: (children: ReactNode) => ReactNode;
173
+ onCardIntent?: (intent: GameUiHandCardIntent<Manifest["CardId"], Manifest["CardId"] | Manifest["SpaceId"] | Manifest["EdgeId"] | Manifest["VertexId"]>) => void;
174
+ onSelectionSummary?: (summary: GameUiHandSelectionSummary<Manifest["CardId"]>) => void;
175
+ };
176
+ type GameUiHandSurface<Manifest extends GameUiManifestTypes, Zones extends readonly Manifest["ZoneId"][] = readonly Manifest["ZoneId"][]> = {
177
+ readonly Hand: WorkspaceInteractionSlotComponent<Omit<GameUiHandProps<Manifest>, "children"> & {
178
+ children: ReactNode;
179
+ }>;
180
+ readonly Cards: WorkspaceInteractionSlotComponent<{
181
+ children: (card: GameUiZoneCard<Manifest>, state: InteractionVisualState) => ReactNode;
182
+ }>;
183
+ readonly Summary: (props: {
184
+ children?: ReactNode | ((summary: GameUiHandSelectionSummary<Manifest["CardId"]>) => ReactNode);
185
+ }) => ReactElement | null;
186
+ readonly Actions: (props: {
187
+ children?: ReactNode | ((summary: GameUiHandSelectionSummary<Manifest["CardId"]>) => ReactNode);
188
+ }) => ReactElement | null;
189
+ readonly Card: ZoneCardComponent<Manifest>;
190
+ readonly Staging: WorkspaceInteractionSlotComponent<{
191
+ children: (card: Extract<GameUiZoneCard<Manifest>, {
192
+ hidden: false;
193
+ }>) => ReactNode;
194
+ label?: ReactNode;
195
+ renderEmptySlot?: (index: number) => ReactNode;
196
+ cardSize?: "sm" | "md" | "lg";
197
+ ariaLabel?: string;
198
+ className?: string;
199
+ }>;
200
+ readonly slot: {
201
+ readonly card: GameUiInteractionSlot & {
202
+ readonly __zones?: Zones;
203
+ };
204
+ };
205
+ };
206
+ type GameUiPileSurface<Manifest extends GameUiManifestTypes> = {
207
+ readonly Pile: ZoneCardsComponent<Manifest>;
208
+ readonly Card: ZoneCardComponent<Manifest>;
209
+ };
210
+ type GameUiCardCollectionSurface<Manifest extends GameUiManifestTypes, Zones extends readonly Manifest["ZoneId"][] = readonly Manifest["ZoneId"][]> = {
211
+ readonly Collection: ZoneCardsComponent<Manifest>;
212
+ readonly Card: ZoneCardComponent<Manifest>;
213
+ readonly slot: {
214
+ readonly card: GameUiInteractionSlot & {
215
+ readonly __zones?: Zones;
216
+ };
217
+ };
218
+ };
219
+ type UiRegistry<Game, Manifest extends GameUiManifestTypes> = {
220
+ interactions: {
221
+ [Key in GameUiInteractionKey<Game>]: {
222
+ interaction: Key;
223
+ phase: PhaseOfInteractionKey<Game, Key>;
224
+ id: IdOfInteractionKey<Game, Key>;
225
+ };
226
+ };
227
+ inputs: {
228
+ [Key in GameUiInteractionInputKeys<Game, GameUiInteractionKey<Game>>]: {
229
+ input: Key;
230
+ };
231
+ };
232
+ prompts: {
233
+ [Key in GameUiInteractionKey<Game>]: {
234
+ interaction: Key;
235
+ };
236
+ };
237
+ promptOptions: Record<string, {
238
+ value: string;
239
+ }>;
240
+ players: {
241
+ [Key in Manifest["PlayerId"]]: {
242
+ player: Key;
243
+ };
244
+ };
245
+ zones: {
246
+ [Key in Manifest["ZoneId"]]: {
247
+ zone: Key;
248
+ };
249
+ };
250
+ cards: {
251
+ [Key in Manifest["CardId"]]: {
252
+ card: Key;
253
+ };
254
+ };
255
+ phases: {
256
+ [Key in GameUiPhaseName<Game>]: {
257
+ phase: Key;
258
+ };
259
+ };
260
+ boardTargets: {
261
+ [Key in Manifest["SpaceId"] | Manifest["EdgeId"] | Manifest["VertexId"]]: {
262
+ target: Key;
263
+ };
264
+ };
265
+ };
266
+ type GameUiContract<Game, Manifest extends GameUiManifestTypes> = UiRegistry<Game, Manifest>;
267
+ 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> & {
268
+ readonly __zone?: Zone;
269
+ } : Spec extends WorkspacePilesSurfaceDescriptor<infer Zones extends readonly Manifest["CardZoneId"][]> ? {
270
+ readonly [Zone in Zones[number]]: GameUiPileSurface<Manifest>;
271
+ } : 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>>>> ? {
272
+ readonly [Key in keyof Forms]: GameUiInteractionFormSurface<Game, Contract, Forms[Key]>;
273
+ } : Spec extends WorkspaceSurfaceSpec ? {
274
+ readonly [Key in keyof Spec]: SurfaceValue<Game, Manifest, Contract, Spec[Key]>;
275
+ } : never;
276
+ type GameUiHexBoardId<HexBoards> = keyof HexBoards & string;
277
+ type GameUiSquareBoardId<SquareBoards> = keyof SquareBoards & string;
278
+ type GameUiHexBoardTopology<HexBoards, Id extends GameUiHexBoardId<HexBoards>> = Extract<HexBoards[Id], AnyHexBoardInput>;
279
+ type GameUiSquareBoardTopology<SquareBoards, Id extends GameUiSquareBoardId<SquareBoards>> = Extract<SquareBoards[Id], AnySquareBoardInput>;
280
+ type GameUiHexBoardSpaceId<HexBoards, Id extends GameUiHexBoardId<HexBoards>> = BoardSpaceIdOf<GameUiHexBoardTopology<HexBoards, Id>>;
281
+ type GameUiBoardNamespace<Manifest extends GameUiManifestTypes, Contract extends UIContract, HexBoards, SquareBoards> = Omit<DreamboardUI<Contract>["Board"], "HexView" | "HexGrid" | "SquareGrid"> & {
282
+ surface<const Board extends Manifest["BoardBaseId"]>(board: Board): WorkspaceBoardSurfaceDescriptor<Board>;
283
+ useSurface<const Board extends Manifest["BoardBaseId"]>(name: string, options?: {
284
+ board: Board;
285
+ }): GameUiBoardSurface<Manifest, Board>;
286
+ HexView<const Id extends GameUiHexBoardId<HexBoards>, const SpaceView extends {
287
+ id: GameUiHexBoardSpaceId<HexBoards, Id>;
288
+ }>(props: Omit<BoardHexViewProps<GameUiHexBoardTopology<HexBoards, Id>, SpaceView>, "board"> & {
289
+ board: Id;
290
+ }): ReactElement;
291
+ HexGrid<const Id extends GameUiHexBoardId<HexBoards>, const SpaceView extends {
292
+ id: GameUiHexBoardSpaceId<HexBoards, Id>;
293
+ }>(props: Omit<BoardHexGridProps<GameUiHexBoardTopology<HexBoards, Id>, SpaceView>, "board" | "interactions"> & {
294
+ board: Id;
295
+ }): ReactElement;
296
+ SquareGrid<const Id extends GameUiSquareBoardId<SquareBoards>>(props: Omit<BoardSquareGridProps<GameUiSquareBoardTopology<SquareBoards, Id>>, "board" | "interactions"> & {
297
+ board: Id;
298
+ }): ReactElement;
299
+ };
300
+ type GameWorkspaceUI<Game, Manifest extends GameUiManifestTypes, Contract extends GameUiContract<Game, Manifest>, HexBoards, SquareBoards> = Omit<DreamboardUI<Contract>, "Root" | "Game" | "Interaction" | "Board" | "Zone" | "Prompt" | "PromptInbox"> & {
301
+ Root(props: UIRootProps): ReactElement;
302
+ defineSurfaces<const Spec extends WorkspaceSurfaceSpec>(spec: Spec): () => SurfaceValue<Game, Manifest, Contract, Spec>;
303
+ defineGameUI<Surfaces>(config: DefineGameUIConfig<GameRenderState<GameUiView<Game>, Manifest["PlayerId"], GameUiPhaseName<Game>>, Surfaces> & {
304
+ useSurfaces: () => Surfaces;
305
+ interactionRoutes?: () => GameUiInteractionRoutes<Game>;
306
+ phases: {
307
+ readonly [Phase in GameUiPhaseName<Game>]: (context: {
308
+ game: GameRenderState<GameUiView<Game>, Manifest["PlayerId"], GameUiPhaseName<Game>>;
309
+ surfaces: Surfaces;
310
+ }) => ReactNode;
311
+ };
312
+ }): (props: Omit<UIRootProps, "children">) => ReactElement;
313
+ readonly Game: TypedGame<Contract, GameUiView<Game>, Manifest["PlayerId"], GameUiPhaseName<Game>>;
314
+ readonly Interaction: Pick<DreamboardUI<Contract>["Interaction"], "State" | "Dialog"> & {
315
+ useForm<Key extends GameUiInteractionKey<Game>>(interaction: Key): GameUiInteractionFormSurface<Game, Contract, Key>;
316
+ form<const Interaction extends GameUiInteractionKey<Game>>(interaction: Interaction): WorkspaceInteractionFormDescriptor<Interaction>;
317
+ forms<const Interactions extends Readonly<Record<string, GameUiInteractionKey<Game>>>>(interactions: Interactions): WorkspaceInteractionFormsDescriptor<Interactions>;
318
+ Routes(props: {
319
+ routes: GameUiInteractionRoutes<Game>;
320
+ fallback?: ReactNode;
321
+ includeUnavailable?: boolean | null;
322
+ }): ReactElement;
323
+ };
324
+ readonly Board: GameUiBoardNamespace<Manifest, Contract, HexBoards, SquareBoards>;
325
+ readonly Zone: {
326
+ hand<const Zone extends Manifest["PlayerCardZoneId"]>(zone: Zone, options: {
327
+ role: "primary" | "auxiliary" | "task";
328
+ label: string;
329
+ order?: number;
330
+ }): WorkspaceHandSurfaceDescriptor<Zone>;
331
+ pile<const Zone extends Manifest["CardZoneId"]>(zone: Zone): WorkspacePileSurfaceDescriptor<Zone>;
332
+ collection<const Zones extends readonly Manifest["CardZoneId"][]>(zones: Zones, options?: {
333
+ mode?: "all" | "top-card";
334
+ }): WorkspaceCardCollectionSurfaceDescriptor<Zones>;
335
+ } & DreamboardUI<Contract>["Zone"];
336
+ readonly ResourceCounter: ResourceCounterComponents<Manifest["ResourceId"]>;
337
+ };
338
+ interface CreateGameUiContractOptions<Game, Manifest extends GameUiManifestTypes, HexBoards extends Record<string, unknown>, SquareBoards extends Record<string, unknown>> {
339
+ readonly game: Game;
340
+ readonly resourceIds: readonly Manifest["ResourceId"][];
341
+ readonly resourcePresentationById?: Partial<Record<string, {
342
+ label?: string;
343
+ icon?: string;
344
+ }>>;
345
+ readonly hexStaticBoards: HexBoards;
346
+ readonly squareStaticBoards: SquareBoards;
347
+ }
348
+ declare function createGameUiContract<Game, Manifest extends GameUiManifestTypes, HexBoards extends Record<string, unknown>, SquareBoards extends Record<string, unknown>>(options: CreateGameUiContractOptions<Game, Manifest, HexBoards, SquareBoards>): {
349
+ uiContract: GameUiContract<Game, Manifest>;
350
+ UI: GameWorkspaceUI<Game, Manifest, GameUiContract<Game, Manifest>, HexBoards, SquareBoards>;
351
+ clientParamSchemasByPhase: Readonly<Record<string, Readonly<Record<string, ClientParamSchema>>>>;
352
+ };
353
+ type GameUiGameRootState<Game, Manifest extends GameUiManifestTypes> = GameRenderState<GameUiView<Game>, Manifest["PlayerId"], GameUiPhaseName<Game>>;
354
+ type GameUiPlayers<Manifest extends GameUiManifestTypes> = GamePlayersState<Manifest["PlayerId"]>;
355
+ type GameUiMe<Manifest extends GameUiManifestTypes> = GameMeState<Manifest["PlayerId"]>;
356
+ type GameUiTurn<Game, Manifest extends GameUiManifestTypes> = GameTurnState<Manifest["PlayerId"], GameUiPhaseName<Game>>;
357
+ type GameUiInteractionDescriptor<Game, Key extends GameUiInteractionKey<Game>> = InteractionDescriptor<Key>;
358
+
359
+ export { BoardHexGridProps, BoardHexViewProps, BoardSquareGridProps, DefineGameUIConfig, DreamboardUI, GameMeState, GamePlayersState, GameRenderState, GameTurnState, type GameUiBoardSurface, type GameUiCardCollectionSurface, type GameUiContract, type GameUiGameRootState, type GameUiHandSurface, type GameUiInteractionDescriptor, type GameUiInteractionFormSurface, type GameUiInteractionKey, type GameUiInteractionParamsOf, type GameUiInteractionRoutes, type GameUiManifestTypes, type GameUiMe, type GameUiPhaseName, type GameUiPileSurface, type GameUiPlayers, 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, createGameUiContract };
@@ -1,17 +1,23 @@
1
1
  import {
2
+ createGameUiContract,
2
3
  createWorkspaceUIContract
3
- } from "../chunk-RP6QDQGI.js";
4
+ } from "../chunk-7JBPOJOF.js";
5
+ import "../chunk-VWTKGIYF.js";
4
6
  import "../chunk-WAQUD4IG.js";
5
7
  import "../chunk-MPVC2SU6.js";
6
8
  import "../chunk-T3ZKNUZ7.js";
7
9
  import "../chunk-YOLIZMXR.js";
8
10
  import "../chunk-VDXOF4FW.js";
9
11
  import "../chunk-B33RRZ4O.js";
12
+ import "../chunk-5XTAQ4EQ.js";
13
+ import "../chunk-YNW3KBDE.js";
10
14
  import "../chunk-WHR5UW3F.js";
11
15
  import "../chunk-PF7L4BMG.js";
12
16
  import "../chunk-FBQNCOPQ.js";
17
+ import "../chunk-3PFDHTR7.js";
13
18
  import "../chunk-PZ5AY32C.js";
14
19
  export {
20
+ createGameUiContract,
15
21
  createWorkspaceUIContract
16
22
  };
17
23
  //# sourceMappingURL=workspace-contract.js.map
package/dist/runtime.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { b5 as UIContract$1, G as DreamboardUI$1, b3 as TypedGame$1 } from './ui-contract-BC4JpysE.js';
2
2
  export { c as BoardGridInteractionFilter, g as BoardHexGridProps, i as BoardHexViewProps, m as BoardSpaceTargetProps, o as BoardSquareGridInteractionFilter, p as BoardSquareGridProps, M as GameMeState, Q as GamePlayersState, R as GameRenderState, U as GameTurnState, b7 as UIRootProps, bh as ZoneCardRenderItem, bl as ZoneListProps } from './ui-contract-BC4JpysE.js';
3
- export { C as ClientParamSchemaMap, W as WorkspaceBoardSurface, a as WorkspaceBoardSurfaceDescriptor, b as WorkspaceBoardTargetInputSlot, c as WorkspaceCardCollectionSurface, d as WorkspaceCardCollectionSurfaceDescriptor, e as WorkspaceCardInputSlot, f as WorkspaceFormInputSlot, g as WorkspaceHandSurface, h as WorkspaceHandSurfaceDescriptor, i as WorkspaceInteractionFormDescriptor, j as WorkspaceInteractionFormsDescriptor, k as WorkspaceInteractionSlotComponent, l as WorkspacePileSurface, m as WorkspacePileSurfaceDescriptor, n as WorkspacePilesSurfaceDescriptor, o as WorkspaceSurfaceSpec, p as createWorkspaceUIContract } from './index-CRfZ21dM.js';
3
+ export { a as ClientParamSchemaMap, W as WorkspaceBoardSurface, b as WorkspaceBoardSurfaceDescriptor, c as WorkspaceBoardTargetInputSlot, d as WorkspaceCardCollectionSurface, e as WorkspaceCardCollectionSurfaceDescriptor, f as WorkspaceCardInputSlot, g as WorkspaceFormInputSlot, h as WorkspaceHandSurface, i as WorkspaceHandSurfaceDescriptor, j as WorkspaceInteractionFormDescriptor, k as WorkspaceInteractionFormsDescriptor, l as WorkspaceInteractionSlotComponent, m as WorkspacePileSurface, n as WorkspacePileSurfaceDescriptor, o as WorkspacePilesSurfaceDescriptor, p as WorkspaceSurfaceSpec, q as createWorkspaceUIContract } from './index-CR69MyWr.js';
4
4
  import * as react_jsx_runtime from 'react/jsx-runtime';
5
5
  import react__default from 'react';
6
6
  import { c as RuntimeDiagnosticHandler } from './runtime-api-CgPuEVeF.js';
package/dist/runtime.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  createWorkspaceUIContract
3
- } from "./chunk-RP6QDQGI.js";
3
+ } from "./chunk-7JBPOJOF.js";
4
+ import "./chunk-VWTKGIYF.js";
4
5
  import "./chunk-WAQUD4IG.js";
5
6
  import "./chunk-MPVC2SU6.js";
6
7
  import "./chunk-T3ZKNUZ7.js";
@@ -13,17 +14,20 @@ import {
13
14
  createPluginRuntimeClient
14
15
  } from "./chunk-NQTXQWUP.js";
15
16
  import "./chunk-B33RRZ4O.js";
17
+ import "./chunk-5XTAQ4EQ.js";
18
+ import "./chunk-YNW3KBDE.js";
16
19
  import "./chunk-WHR5UW3F.js";
17
20
  import "./chunk-PF7L4BMG.js";
18
21
  import {
19
22
  DREAMBOARD_SDK_VERSION
20
- } from "./chunk-HRWI2DIJ.js";
21
- import "./chunk-CP3BF3B2.js";
23
+ } from "./chunk-MLFHVYF7.js";
24
+ import "./chunk-THWT4V3Z.js";
22
25
  import {
23
26
  DREAMBOARD_PLUGIN_PROTOCOL,
24
27
  DREAMBOARD_PLUGIN_PROTOCOL_VERSION,
25
28
  HostToPluginEnvelopeSchema
26
29
  } from "./chunk-FBQNCOPQ.js";
30
+ import "./chunk-3PFDHTR7.js";
27
31
  import "./chunk-PZ5AY32C.js";
28
32
 
29
33
  // src/runtime/hooks/usePluginRuntime.ts
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/runtime/hooks/usePluginRuntime.ts","../src/runtime/browser/post-message-transport.ts","../src/runtime/components/PluginRuntime.tsx"],"sourcesContent":["import { useState, useEffect, useRef } from \"react\";\nimport { DREAMBOARD_SDK_VERSION } from \"../../package-set.js\";\nimport { createPostMessagePluginTransport } from \"../browser/post-message-transport.js\";\nimport { createPluginRuntimeClient } from \"../core/create-plugin-runtime-client.js\";\nimport type { PluginRuntimeClient } from \"../core/types.js\";\nimport type { RuntimeDiagnosticHandler } from \"../types/runtime-api.js\";\n\nconst BUNDLED_SDK_VERSION = DREAMBOARD_SDK_VERSION;\n\nexport interface UsePluginRuntimeOptions {\n /**\n * Timeout in milliseconds to wait for the first gameplay frame.\n * @default 10000 (10 seconds)\n */\n timeout?: number;\n onDiagnostic?: RuntimeDiagnosticHandler;\n}\n\nexport interface UsePluginRuntimeResult {\n /** The transport-agnostic plugin runtime client. */\n runtime: PluginRuntimeClient;\n /** Whether the initial reducer-native snapshot is available and ready */\n isReady: boolean;\n /**\n * True when the plugin was ready before but the current snapshot has no\n * projected view — e.g. you've acted and are waiting on the rest of the\n * table in a simultaneous phase. Lets the loading affordance read as a\n * mid-game wait rather than a cold \"still loading\" stall.\n */\n waiting: boolean;\n /** Error message if initialization failed */\n error: string | null;\n}\n\nfunction hasProjectedView(runtime: PluginRuntimeClient): boolean {\n const frame = runtime.getFrame();\n return (\n frame !== null && frame.view !== null && typeof frame.view !== \"undefined\"\n );\n}\n\n/**\n * Hook that creates and manages a PluginRuntimeClient instance.\n *\n * This hook handles:\n * 1. Creating the runtime client\n * 2. Waiting for the first gameplay frame before setting isReady\n *\n * In the new architecture, the host only renders the plugin when a reducer-native\n * snapshot is available, so isReady should become true quickly after init.\n *\n * @example\n * ```tsx\n * function PluginRuntime({ children }: { children: React.ReactNode }) {\n * const { runtime, isReady, error } = usePluginRuntime();\n *\n * if (error) {\n * return <div>Error: {error}</div>;\n * }\n *\n * if (!isReady) {\n * return <GameSkeleton message=\"Waiting for game state...\" />;\n * }\n *\n * return <RuntimeProvider runtime={runtime}>{children}</RuntimeProvider>;\n * }\n * ```\n */\nexport function usePluginRuntime(\n options: UsePluginRuntimeOptions = {},\n): UsePluginRuntimeResult {\n const { timeout = 10000, onDiagnostic } = options;\n const [error, setError] = useState<string | null>(null);\n\n // Create runtime once and keep stable reference\n const [runtime] = useState<PluginRuntimeClient>(() =>\n createPluginRuntimeClient({\n transport: createPostMessagePluginTransport({\n bundledSdkVersion: BUNDLED_SDK_VERSION,\n onInvalidMessage: (reason, value) => {\n const message =\n `Plugin runtime rejected a host message (${reason}). ` +\n `Bundled @dreamboard-games/sdk version: ${BUNDLED_SDK_VERSION}. ` +\n \"The host and plugin bundle may have incompatible SDK/runtime contract versions.\";\n setError(message);\n onDiagnostic?.({\n type: \"runtimeLog\",\n level: \"warn\",\n message,\n details: [value],\n });\n },\n }),\n }),\n );\n const [isReady, setIsReady] = useState(() => hasProjectedView(runtime));\n // Latches once we've shown a view, so a later view-less snapshot reads as a\n // mid-game wait rather than a fresh load. (A ref, so it never re-triggers a\n // render on its own.)\n const hasBeenReadyRef = useRef(false);\n if (isReady) hasBeenReadyRef.current = true;\n\n useEffect(() => {\n void onDiagnostic;\n }, [onDiagnostic]);\n\n // Subscribe to gameplay frames and set isReady when the first projected view arrives.\n useEffect(() => {\n const markReadyFromFrame = () => {\n if (!hasProjectedView(runtime)) {\n return false;\n }\n setError(null);\n setIsReady(true);\n return true;\n };\n\n if (markReadyFromFrame()) {\n return;\n }\n\n // Set up timeout\n const timeoutId = setTimeout(() => {\n if (!markReadyFromFrame()) {\n setError(\n `Timed out waiting for the initial projected view after ${timeout}ms. ` +\n \"Ensure the host sends a gameplay frame with a seat view.\",\n );\n }\n }, timeout);\n\n // Fallback poll for dev/HMR flows where the runtime frame may already\n // exist but the first subscribe callback is missed.\n const pollId = setInterval(() => {\n if (markReadyFromFrame()) {\n clearInterval(pollId);\n clearTimeout(timeoutId);\n }\n }, 100);\n\n const unsubscribe = runtime.subscribeFrame(() => {\n if (!hasProjectedView(runtime)) {\n setIsReady(false);\n return;\n }\n clearInterval(pollId);\n clearTimeout(timeoutId);\n setError(null);\n setIsReady(true);\n });\n\n return () => {\n clearInterval(pollId);\n clearTimeout(timeoutId);\n unsubscribe?.();\n };\n }, [runtime, timeout]);\n\n return {\n runtime,\n isReady,\n waiting: hasBeenReadyRef.current && !isReady,\n error,\n };\n}\n","import {\n DREAMBOARD_PLUGIN_PROTOCOL,\n DREAMBOARD_PLUGIN_PROTOCOL_VERSION,\n HostToPluginEnvelopeSchema,\n type HostToPluginEnvelope,\n type PluginToHostPayload,\n} from \"@dreamboard-games/plugin-runtime-contract\";\nimport type { PluginTransport } from \"../core/types.js\";\n\nexport interface PostMessagePluginTransportOptions {\n readonly targetWindow?: Window;\n readonly parentWindow?: Window;\n readonly bundledSdkVersion?: string;\n readonly onInvalidMessage?: (reason: string, value: unknown) => void;\n}\n\nexport function createPostMessagePluginTransport(\n options: PostMessagePluginTransportOptions = {},\n): PluginTransport {\n const targetWindow = options.targetWindow ?? window;\n const parentWindow = options.parentWindow ?? targetWindow.parent;\n const bundledSdkVersion = options.bundledSdkVersion?.trim() || \"unknown\";\n let channel: {\n readonly channelId: string;\n readonly hostOrigin: string;\n readonly hostWindow: Window;\n } | null = null;\n let outboundSequence = 0;\n let invalidEnvelopeReported = false;\n\n const reportInvalidEnvelope = (reason: string, value: unknown) => {\n options.onInvalidMessage?.(reason, value);\n\n if (!channel || invalidEnvelopeReported) {\n return;\n }\n\n invalidEnvelopeReported = true;\n channel.hostWindow.postMessage(\n {\n protocol: DREAMBOARD_PLUGIN_PROTOCOL,\n version: DREAMBOARD_PLUGIN_PROTOCOL_VERSION,\n channelId: channel.channelId,\n sequence: ++outboundSequence,\n payload: {\n type: \"runtime.error\",\n code: \"host-runtime-protocol-mismatch\",\n message:\n `Plugin runtime rejected a host message (${reason}). ` +\n `Bundled @dreamboard-games/sdk version: ${bundledSdkVersion}. ` +\n \"The host and plugin bundle may have incompatible SDK/runtime contract versions.\",\n },\n },\n channel.hostOrigin,\n );\n };\n\n return {\n start(onMessage) {\n const handleMessage = (event: MessageEvent) => {\n if (event.source !== parentWindow) {\n return;\n }\n const parseResult = HostToPluginEnvelopeSchema.safeParse(event.data);\n if (!parseResult.success) {\n reportInvalidEnvelope(\"invalid-envelope\", event.data);\n return;\n }\n const envelope = parseResult.data;\n if (!channel) {\n if (envelope.payload.type !== \"runtime.init\") {\n return;\n }\n channel = {\n channelId: envelope.channelId,\n hostOrigin: event.origin,\n hostWindow: event.source as Window,\n };\n }\n if (\n envelope.channelId !== channel.channelId ||\n event.origin !== channel.hostOrigin ||\n event.source !== channel.hostWindow\n ) {\n reportInvalidEnvelope(\"channel-mismatch\", event.data);\n return;\n }\n onMessage(envelope as HostToPluginEnvelope);\n };\n\n targetWindow.addEventListener(\"message\", handleMessage);\n return () => {\n targetWindow.removeEventListener(\"message\", handleMessage);\n channel = null;\n };\n },\n send(payload: PluginToHostPayload) {\n if (!channel) {\n throw new Error(\"Plugin transport is not initialized.\");\n }\n channel.hostWindow.postMessage(\n {\n protocol: DREAMBOARD_PLUGIN_PROTOCOL,\n version: DREAMBOARD_PLUGIN_PROTOCOL_VERSION,\n channelId: channel.channelId,\n sequence: ++outboundSequence,\n payload,\n },\n channel.hostOrigin,\n );\n },\n };\n}\n","import React from \"react\";\nimport { usePluginRuntime } from \"../hooks/usePluginRuntime.js\";\nimport { GameSkeleton } from \"../../ui.js\";\nimport type { RuntimeDiagnosticHandler } from \"../types/runtime-api.js\";\nimport { PluginRuntimeBoundary } from \"./PluginRuntimeBoundary.js\";\n\nexport interface PluginRuntimeProps {\n /** Child components to render after gameplay frame has started */\n children: React.ReactNode;\n /**\n * Timeout in milliseconds to wait for the first gameplay-frame snapshot.\n * @default 10000 (10 seconds)\n */\n timeout?: number;\n /** Custom loading component to show while waiting for gameplay frame */\n loadingComponent?: React.ReactNode;\n /** Custom error component to show when initialization fails */\n errorComponent?: (error: string) => React.ReactNode;\n onDiagnostic?: RuntimeDiagnosticHandler;\n}\n\n/**\n * PluginRuntime provides the RuntimeContext for plugin components.\n *\n * This component:\n * - Creates a transport-backed runtime client\n * - Waits for the first projected gameplay frame before rendering children\n * - Provides runtime commands plus session/frame state to all child components\n *\n * @example\n * ```tsx\n * // In your plugin's index.tsx\n * import { PluginRuntime } from \"./components/dreamboard\";\n * import App from './App';\n *\n * ReactDOM.createRoot(document.getElementById('root')!).render(\n * <PluginRuntime>\n * <App />\n * </PluginRuntime>\n * );\n * ```\n */\nexport function PluginRuntime({\n children,\n timeout = 10000,\n loadingComponent,\n errorComponent,\n onDiagnostic,\n}: PluginRuntimeProps) {\n const { runtime, isReady, waiting, error } = usePluginRuntime({\n timeout,\n onDiagnostic,\n });\n\n if (error) {\n if (errorComponent) {\n return <>{errorComponent(error)}</>;\n }\n return (\n <div className=\"flex h-full w-full items-center justify-center bg-gray-50\">\n <div className=\"text-center p-6\">\n <p className=\"text-red-600 font-medium mb-2\">Failed to load game</p>\n <p className=\"text-gray-600 text-sm\">{error}</p>\n </div>\n </div>\n );\n }\n\n if (!isReady) {\n if (loadingComponent) {\n return <>{loadingComponent}</>;\n }\n // Once the game has rendered, a view-less snapshot is a mid-game wait (you\n // acted and are waiting on the table), not a cold load — say so rather than\n // reading as a stalled \"Waiting for game state\".\n return (\n <GameSkeleton\n message={\n waiting\n ? \"Waiting for the other players…\"\n : \"Waiting for game state...\"\n }\n />\n );\n }\n\n return (\n <PluginRuntimeBoundary runtime={runtime}>{children}</PluginRuntimeBoundary>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,UAAU,WAAW,cAAc;;;ACgBrC,SAAS,iCACd,UAA6C,CAAC,GAC7B;AACjB,QAAM,eAAe,QAAQ,gBAAgB;AAC7C,QAAM,eAAe,QAAQ,gBAAgB,aAAa;AAC1D,QAAM,oBAAoB,QA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AAAA,MAChE,oBAAC,OAAE,WAAU,yBAAyB,iBAAM;AAAA,OAC9C,GACF;AAAA,EAEJ;AAEA,MAAI,CAAC,SAAS;AACZ,QAAI,kBAAkB;AACpB,aAAO,gCAAG,4BAAiB;AAAA,IAC7B;AAIA,WACE;AAAA,MAAC;AAAA;AAAA,QACC,SACE,UACI,wCACA;AAAA;AAAA,IAER;AAAA,EAEJ;AAEA,SACE,oBAAC,yBAAsB,SAAmB,UAAS;AAEvD;","names":[]}
1
+ {"version":3,"sources":["../src/runtime/hooks/usePluginRuntime.ts","../src/runtime/browser/post-message-transport.ts","../src/runtime/components/PluginRuntime.tsx"],"sourcesContent":["import { useState, useEffect, useRef } from \"react\";\nimport { DREAMBOARD_SDK_VERSION } from \"../../package-set.js\";\nimport { createPostMessagePluginTransport } from \"../browser/post-message-transport.js\";\nimport { createPluginRuntimeClient } from \"../core/create-plugin-runtime-client.js\";\nimport type { PluginRuntimeClient } from \"../core/types.js\";\nimport type { RuntimeDiagnosticHandler } from \"../types/runtime-api.js\";\n\nconst BUNDLED_SDK_VERSION = DREAMBOARD_SDK_VERSION;\n\nexport interface UsePluginRuntimeOptions {\n /**\n * Timeout in milliseconds to wait for the first gameplay frame.\n * @default 10000 (10 seconds)\n */\n timeout?: number;\n onDiagnostic?: RuntimeDiagnosticHandler;\n}\n\nexport interface UsePluginRuntimeResult {\n /** The transport-agnostic plugin runtime client. */\n runtime: PluginRuntimeClient;\n /** Whether the initial reducer-native snapshot is available and ready */\n isReady: boolean;\n /**\n * True when the plugin was ready before but the current snapshot has no\n * projected view — e.g. you've acted and are waiting on the rest of the\n * table in a simultaneous phase. Lets the loading affordance read as a\n * mid-game wait rather than a cold \"still loading\" stall.\n */\n waiting: boolean;\n /** Error message if initialization failed */\n error: string | null;\n}\n\nfunction hasProjectedView(runtime: PluginRuntimeClient): boolean {\n const frame = runtime.getFrame();\n return (\n frame !== null && frame.view !== null && typeof frame.view !== \"undefined\"\n );\n}\n\n/**\n * Hook that creates and manages a PluginRuntimeClient instance.\n *\n * This hook handles:\n * 1. Creating the runtime client\n * 2. Waiting for the first gameplay frame before setting isReady\n *\n * In the new architecture, the host only renders the plugin when a reducer-native\n * snapshot is available, so isReady should become true quickly after init.\n *\n * @example\n * ```tsx\n * function PluginRuntime({ children }: { children: React.ReactNode }) {\n * const { runtime, isReady, error } = usePluginRuntime();\n *\n * if (error) {\n * return <div>Error: {error}</div>;\n * }\n *\n * if (!isReady) {\n * return <GameSkeleton message=\"Waiting for game state...\" />;\n * }\n *\n * return <RuntimeProvider runtime={runtime}>{children}</RuntimeProvider>;\n * }\n * ```\n */\nexport function usePluginRuntime(\n options: UsePluginRuntimeOptions = {},\n): UsePluginRuntimeResult {\n const { timeout = 10000, onDiagnostic } = options;\n const [error, setError] = useState<string | null>(null);\n\n // Create runtime once and keep stable reference\n const [runtime] = useState<PluginRuntimeClient>(() =>\n createPluginRuntimeClient({\n transport: createPostMessagePluginTransport({\n bundledSdkVersion: BUNDLED_SDK_VERSION,\n onInvalidMessage: (reason, value) => {\n const message =\n `Plugin runtime rejected a host message (${reason}). ` +\n `Bundled @dreamboard-games/sdk version: ${BUNDLED_SDK_VERSION}. ` +\n \"The host and plugin bundle may have incompatible SDK/runtime contract versions.\";\n setError(message);\n onDiagnostic?.({\n type: \"runtimeLog\",\n level: \"warn\",\n message,\n details: [value],\n });\n },\n }),\n }),\n );\n const [isReady, setIsReady] = useState(() => hasProjectedView(runtime));\n // Latches once we've shown a view, so a later view-less snapshot reads as a\n // mid-game wait rather than a fresh load. (A ref, so it never re-triggers a\n // render on its own.)\n const hasBeenReadyRef = useRef(false);\n if (isReady) hasBeenReadyRef.current = true;\n\n useEffect(() => {\n void onDiagnostic;\n }, [onDiagnostic]);\n\n // Subscribe to gameplay frames and set isReady when the first projected view arrives.\n useEffect(() => {\n const markReadyFromFrame = () => {\n if (!hasProjectedView(runtime)) {\n return false;\n }\n setError(null);\n setIsReady(true);\n return true;\n };\n\n if (markReadyFromFrame()) {\n return;\n }\n\n // Set up timeout\n const timeoutId = setTimeout(() => {\n if (!markReadyFromFrame()) {\n setError(\n `Timed out waiting for the initial projected view after ${timeout}ms. ` +\n \"Ensure the host sends a gameplay frame with a seat view.\",\n );\n }\n }, timeout);\n\n // Fallback poll for dev/HMR flows where the runtime frame may already\n // exist but the first subscribe callback is missed.\n const pollId = setInterval(() => {\n if (markReadyFromFrame()) {\n clearInterval(pollId);\n clearTimeout(timeoutId);\n }\n }, 100);\n\n const unsubscribe = runtime.subscribeFrame(() => {\n if (!hasProjectedView(runtime)) {\n setIsReady(false);\n return;\n }\n clearInterval(pollId);\n clearTimeout(timeoutId);\n setError(null);\n setIsReady(true);\n });\n\n return () => {\n clearInterval(pollId);\n clearTimeout(timeoutId);\n unsubscribe?.();\n };\n }, [runtime, timeout]);\n\n return {\n runtime,\n isReady,\n waiting: hasBeenReadyRef.current && !isReady,\n error,\n };\n}\n","import {\n DREAMBOARD_PLUGIN_PROTOCOL,\n DREAMBOARD_PLUGIN_PROTOCOL_VERSION,\n HostToPluginEnvelopeSchema,\n type HostToPluginEnvelope,\n type PluginToHostPayload,\n} from \"@dreamboard-games/plugin-runtime-contract\";\nimport type { PluginTransport } from \"../core/types.js\";\n\nexport interface PostMessagePluginTransportOptions {\n readonly targetWindow?: Window;\n readonly parentWindow?: Window;\n readonly bundledSdkVersion?: string;\n readonly onInvalidMessage?: (reason: string, value: unknown) => void;\n}\n\nexport function createPostMessagePluginTransport(\n options: PostMessagePluginTransportOptions = {},\n): PluginTransport {\n const targetWindow = options.targetWindow ?? window;\n const parentWindow = options.parentWindow ?? targetWindow.parent;\n const bundledSdkVersion = options.bundledSdkVersion?.trim() || \"unknown\";\n let channel: {\n readonly channelId: string;\n readonly hostOrigin: string;\n readonly hostWindow: Window;\n } | null = null;\n let outboundSequence = 0;\n let invalidEnvelopeReported = false;\n\n const reportInvalidEnvelope = (reason: string, value: unknown) => {\n options.onInvalidMessage?.(reason, value);\n\n if (!channel || invalidEnvelopeReported) {\n return;\n }\n\n invalidEnvelopeReported = true;\n channel.hostWindow.postMessage(\n {\n protocol: DREAMBOARD_PLUGIN_PROTOCOL,\n version: DREAMBOARD_PLUGIN_PROTOCOL_VERSION,\n channelId: channel.channelId,\n sequence: ++outboundSequence,\n payload: {\n type: \"runtime.error\",\n code: \"host-runtime-protocol-mismatch\",\n message:\n `Plugin runtime rejected a host message (${reason}). ` +\n `Bundled @dreamboard-games/sdk version: ${bundledSdkVersion}. ` +\n \"The host and plugin bundle may have incompatible SDK/runtime contract versions.\",\n },\n },\n channel.hostOrigin,\n );\n };\n\n return {\n start(onMessage) {\n const handleMessage = (event: MessageEvent) => {\n if (event.source !== parentWindow) {\n return;\n }\n const parseResult = HostToPluginEnvelopeSchema.safeParse(event.data);\n if (!parseResult.success) {\n reportInvalidEnvelope(\"invalid-envelope\", event.data);\n return;\n }\n const envelope = parseResult.data;\n if (!channel) {\n if (envelope.payload.type !== \"runtime.init\") {\n return;\n }\n channel = {\n channelId: envelope.channelId,\n hostOrigin: event.origin,\n hostWindow: event.source as Window,\n };\n }\n if (\n envelope.channelId !== channel.channelId ||\n event.origin !== channel.hostOrigin ||\n event.source !== channel.hostWindow\n ) {\n reportInvalidEnvelope(\"channel-mismatch\", event.data);\n return;\n }\n onMessage(envelope as HostToPluginEnvelope);\n };\n\n targetWindow.addEventListener(\"message\", handleMessage);\n return () => {\n targetWindow.removeEventListener(\"message\", handleMessage);\n channel = null;\n };\n },\n send(payload: PluginToHostPayload) {\n if (!channel) {\n throw new Error(\"Plugin transport is not initialized.\");\n }\n channel.hostWindow.postMessage(\n {\n protocol: DREAMBOARD_PLUGIN_PROTOCOL,\n version: DREAMBOARD_PLUGIN_PROTOCOL_VERSION,\n channelId: channel.channelId,\n sequence: ++outboundSequence,\n payload,\n },\n channel.hostOrigin,\n );\n },\n };\n}\n","import React from \"react\";\nimport { usePluginRuntime } from \"../hooks/usePluginRuntime.js\";\nimport { GameSkeleton } from \"../../ui.js\";\nimport type { RuntimeDiagnosticHandler } from \"../types/runtime-api.js\";\nimport { PluginRuntimeBoundary } from \"./PluginRuntimeBoundary.js\";\n\nexport interface PluginRuntimeProps {\n /** Child components to render after gameplay frame has started */\n children: React.ReactNode;\n /**\n * Timeout in milliseconds to wait for the first gameplay-frame snapshot.\n * @default 10000 (10 seconds)\n */\n timeout?: number;\n /** Custom loading component to show while waiting for gameplay frame */\n loadingComponent?: React.ReactNode;\n /** Custom error component to show when initialization fails */\n errorComponent?: (error: string) => React.ReactNode;\n onDiagnostic?: RuntimeDiagnosticHandler;\n}\n\n/**\n * PluginRuntime provides the RuntimeContext for plugin components.\n *\n * This component:\n * - Creates a transport-backed runtime client\n * - Waits for the first projected gameplay frame before rendering children\n * - Provides runtime commands plus session/frame state to all child components\n *\n * @example\n * ```tsx\n * // In your plugin's index.tsx\n * import { PluginRuntime } from \"./components/dreamboard\";\n * import App from './App';\n *\n * ReactDOM.createRoot(document.getElementById('root')!).render(\n * <PluginRuntime>\n * <App />\n * </PluginRuntime>\n * );\n * ```\n */\nexport function PluginRuntime({\n children,\n timeout = 10000,\n loadingComponent,\n errorComponent,\n onDiagnostic,\n}: PluginRuntimeProps) {\n const { runtime, isReady, waiting, error } = usePluginRuntime({\n timeout,\n onDiagnostic,\n });\n\n if (error) {\n if (errorComponent) {\n return <>{errorComponent(error)}</>;\n }\n return (\n <div className=\"flex h-full w-full items-center justify-center bg-gray-50\">\n <div className=\"text-center p-6\">\n <p className=\"text-red-600 font-medium mb-2\">Failed to load game</p>\n <p className=\"text-gray-600 text-sm\">{error}</p>\n </div>\n </div>\n );\n }\n\n if (!isReady) {\n if (loadingComponent) {\n return <>{loadingComponent}</>;\n }\n // Once the game has rendered, a view-less snapshot is a mid-game wait (you\n // acted and are waiting on the table), not a cold load — say so rather than\n // reading as a stalled \"Waiting for game state\".\n return (\n <GameSkeleton\n message={\n waiting\n ? \"Waiting for the other players…\"\n : \"Waiting for game state...\"\n }\n />\n );\n }\n\n return (\n <PluginRuntimeBoundary run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AS,SAAS,MAAM,IAAI,iBAAiB;AAAA,IAC5D;AAAA,IACA;AAAA,EACF,CAAC;AAED,MAAI,OAAO;AACT,QAAI,gBAAgB;AAClB,aAAO,gCAAG,yBAAe,KAAK,GAAE;AAAA,IAClC;AACA,WACE,oBAAC,SAAI,WAAU,6DACb,+BAAC,SAAI,WAAU,mBACb;AAAA,0BAAC,OAAE,WAAU,iCAAgC,iCAAmB;AAAA,MAChE,oBAAC,OAAE,WAAU,yBAAyB,iBAAM;AAAA,OAC9C,GACF;AAAA,EAEJ;AAEA,MAAI,CAAC,SAAS;AACZ,QAAI,kBAAkB;AACpB,aAAO,gCAAG,4BAAiB;AAAA,IAC7B;AAIA,WACE;AAAA,MAAC;AAAA;AAAA,QACC,SACE,UACI,wCACA;AAAA;AAAA,IAER;AAAA,EAEJ;AAEA,SACE,oBAAC,yBAAsB,SAAmB,UAAS;AAEvD;","names":[]}
@@ -5,11 +5,11 @@ import {
5
5
  materializeScenarioRuntimeCheckpoint,
6
6
  replayScenario,
7
7
  resolveScenarioCommandParams
8
- } from "./chunk-RU3Z5J6V.js";
9
- import "./chunk-5XTAQ4EQ.js";
8
+ } from "./chunk-KZFHTUI5.js";
10
9
  import {
11
10
  interactionDomainEligibleCount
12
11
  } from "./chunk-XDGRC6OR.js";
12
+ import "./chunk-5XTAQ4EQ.js";
13
13
  import "./chunk-YNW3KBDE.js";
14
14
  import "./chunk-PF7L4BMG.js";
15
15
  import "./chunk-FBQNCOPQ.js";