@dreamboard-games/sdk 0.4.0-alpha.1 → 0.4.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 (79) hide show
  1. package/REFERENCE.md +1318 -201
  2. package/dist/{ResourceCounter-BTXklCEZ.d.ts → ResourceCounter-BuiNstXs.d.ts} +5 -1
  3. package/dist/{ThemeProvider-DvMl17Ny.d.ts → ThemeProvider-B1sIoBlX.d.ts} +1 -1
  4. package/dist/{attributes-BrZtP9az.d.ts → attributes-DbvyMbXw.d.ts} +17 -2
  5. package/dist/authoring/index.d.ts +66 -0
  6. package/dist/authoring/index.js +560 -0
  7. package/dist/authoring/index.js.map +1 -0
  8. package/dist/browser-interaction.d.ts +205 -5
  9. package/dist/browser-interaction.js +14 -2
  10. package/dist/{chunk-7W6TQO3X.js → chunk-45FI6XII.js} +613 -366
  11. package/dist/chunk-45FI6XII.js.map +1 -0
  12. package/dist/{chunk-3K362ZKR.js → chunk-6JQFGSLD.js} +202 -38
  13. package/dist/chunk-6JQFGSLD.js.map +1 -0
  14. package/dist/{chunk-IUGKW2GS.js → chunk-BKD7XAWB.js} +6 -2
  15. package/dist/chunk-BKD7XAWB.js.map +1 -0
  16. package/dist/{chunk-XXBSIPJX.js → chunk-CP35NPPY.js} +131 -59
  17. package/dist/chunk-CP35NPPY.js.map +1 -0
  18. package/dist/chunk-DQ7GCD6C.js +12 -0
  19. package/dist/chunk-DQ7GCD6C.js.map +1 -0
  20. package/dist/{chunk-XJYUSD5F.js → chunk-FWVV2X74.js} +2 -2
  21. package/dist/chunk-K5ZRJTZZ.js +328 -0
  22. package/dist/chunk-K5ZRJTZZ.js.map +1 -0
  23. package/dist/{chunk-7LZZEI25.js → chunk-N6ZDIMRB.js} +1 -1
  24. package/dist/chunk-N6ZDIMRB.js.map +1 -0
  25. package/dist/chunk-O6M6PN4E.js +1225 -0
  26. package/dist/chunk-O6M6PN4E.js.map +1 -0
  27. package/dist/{chunk-AEUXCFGM.js → chunk-PF7L4BMG.js} +1 -8
  28. package/dist/{chunk-AEUXCFGM.js.map → chunk-PF7L4BMG.js.map} +1 -1
  29. package/dist/{chunk-CZMFAS3E.js → chunk-WOWFONLZ.js} +517 -1274
  30. package/dist/chunk-WOWFONLZ.js.map +1 -0
  31. package/dist/{chunk-MALRKLRR.js → chunk-WUIVY2KE.js} +301 -12
  32. package/dist/chunk-WUIVY2KE.js.map +1 -0
  33. package/dist/codegen.d.ts +11 -3
  34. package/dist/codegen.js +1 -1
  35. package/dist/{components-Dqr_LuZJ.d.ts → components-BbWPnZCF.d.ts} +37 -6
  36. package/dist/{hex-board-view-UCUjMALd.d.ts → hex-board-view-Kz9Q_zsv.d.ts} +1 -1
  37. package/dist/index-BLwlj7mO.d.ts +191 -0
  38. package/dist/index.js +2 -1
  39. package/dist/package-set.d.ts +2 -2
  40. package/dist/package-set.js +2 -1
  41. package/dist/player-state-Cqpyeql0.d.ts +371 -0
  42. package/dist/protocol-BP193lva.d.ts +267 -0
  43. package/dist/reducer/advanced.js +1 -1
  44. package/dist/reducer-contract.js +1 -1
  45. package/dist/reducer.js +2 -2
  46. package/dist/reducer.js.map +1 -1
  47. package/dist/runtime/primitives.d.ts +10 -10
  48. package/dist/runtime/primitives.js +9 -7
  49. package/dist/runtime/runtime-api.d.ts +2 -2
  50. package/dist/runtime/workspace-contract.d.ts +21 -167
  51. package/dist/runtime/workspace-contract.js +7 -6
  52. package/dist/runtime-api-BJharVaj.d.ts +198 -0
  53. package/dist/runtime-api-C6aWo9c0.d.ts +95 -0
  54. package/dist/runtime.d.ts +36 -32
  55. package/dist/runtime.js +87 -797
  56. package/dist/runtime.js.map +1 -1
  57. package/dist/testing.d.ts +254 -140
  58. package/dist/testing.js +964 -149
  59. package/dist/testing.js.map +1 -1
  60. package/dist/types-CYeN0wLK.d.ts +29 -0
  61. package/dist/{types-BqzHkNMA.d.ts → types-DJj5MJkl.d.ts} +32 -5
  62. package/dist/types.d.ts +13 -8
  63. package/dist/ui/components.d.ts +4 -5
  64. package/dist/ui/components.js +19 -1
  65. package/dist/ui/player-state.d.ts +2 -365
  66. package/dist/{ui-contract-W2-kxObe.d.ts → ui-contract-CY7cxsCC.d.ts} +16 -26
  67. package/dist/ui.d.ts +7 -8
  68. package/dist/ui.js +20 -2
  69. package/package.json +25 -19
  70. package/dist/chunk-3K362ZKR.js.map +0 -1
  71. package/dist/chunk-7LZZEI25.js.map +0 -1
  72. package/dist/chunk-7W6TQO3X.js.map +0 -1
  73. package/dist/chunk-CZMFAS3E.js.map +0 -1
  74. package/dist/chunk-IUGKW2GS.js.map +0 -1
  75. package/dist/chunk-MALRKLRR.js.map +0 -1
  76. package/dist/chunk-XXBSIPJX.js.map +0 -1
  77. package/dist/hex-color-MhOyuY-o.d.ts +0 -8
  78. package/dist/runtime-api-BXd70c2e.d.ts +0 -490
  79. /package/dist/{chunk-XJYUSD5F.js.map → chunk-FWVV2X74.js.map} +0 -0
@@ -1,17 +1,17 @@
1
- import { bd as ZoneCardRenderItem } from '../ui-contract-W2-kxObe.js';
2
- export { B as Board, a as BoardEdgeTarget, b as BoardEdgeTargetProps, c as BoardHexGrid, d as BoardHexGridInteractionFilter, e as BoardHexGridInteractions, f as BoardHexGridProps, g as BoardHexView, h as BoardHexViewProps, i as BoardRoot, j as BoardRootProps, k as BoardSpaceTarget, l as BoardSpaceTargetProps, m as BoardState, n as BoardStateProps, o as BoardTarget, p as BoardTargetExtraInputs, q as BoardTargetProps, r as BoardVertexTarget, s as BoardVertexTargetProps, D as Dice, t as DiceComponents, u as DiceRoot, v as DiceRootProps, w as DiceState, x as DiceValue, y as DiceValues, z as DiceValuesProps, G as Game, C as GameActiveActionState, E as GameChrome, F as GameChromeProps, H as GameChromeState, I as GameMeState, J as GamePendingInputState, K as GamePlayer, L as GamePlayerEntry, M as GamePlayersState, N as GameRenderState, O as GameRoot, P as GameRootProps, Q as GameTurnState, R as Interaction, S as InteractionCardInput, T as InteractionCardInputProps, U as InteractionCardInputRenderState, V as InteractionDescription, W as InteractionDialog, X as InteractionDialogProps, Y as InteractionDialogRenderState, Z as InteractionDialogState, _ as InteractionFieldPrimitiveProps, $ as InteractionFormPrimitive, a0 as InteractionFormPrimitiveProps, a1 as InteractionInput, a2 as InteractionInputProps, a3 as InteractionLabel, a4 as InteractionPartProps, a5 as InteractionRoot, a6 as InteractionRootProps, a7 as InteractionRoute, a8 as InteractionRoutes, a9 as InteractionRoutesMap, aa as InteractionRoutesProps, ab as InteractionState, ac as InteractionStateProps, ad as InteractionStateSnapshot, ae as InteractionSubmit, af as InteractionSubmitProps, ag as InteractionSwitch, ah as InteractionSwitchProps, ai as InteractionSwitchRenderState, aj as InteractionSwitchRouteMap, ak as InteractionTrigger, al as InteractionTriggerProps, am as InteractionUnavailableMessage, an as InteractionValidationMessage, ao as Phase, ap as PhaseFallback, aq as PhaseRouteMap, ar as PhaseSwitch, as as PhaseSwitchProps, at as PlayerRoster, au as PlayerRosterBadge, av as PlayerRosterBadges, aw as PlayerRosterComponents, ax as PlayerRosterEmpty, ay as PlayerRosterEntry, az as PlayerRosterList, aA as PlayerRosterListProps, aB as PlayerRosterName, aC as PlayerRosterPartProps, aD as PlayerRosterRoot, aE as PlayerRosterRootProps, aF as PlayerRosterScore, aG as PlayerRosterSwitchButton, aH as PlayerRosterSwitchButtonProps, aI as Prompt, aJ as PromptDialog, aK as PromptDialogProps, aL as PromptDialogRenderState, aM as PromptDialogState, aN as PromptInbox, aO as PromptInboxEmpty, aP as PromptInboxItems, aQ as PromptInboxItemsProps, aR as PromptInboxRoot, aS as PromptMessage, aT as PromptOption, aU as PromptOptionProps, aV as PromptOptionRenderItem, aW as PromptOptions, aX as PromptOptionsProps, aY as PromptRoot, aZ as PromptRootProps, a_ as PromptTitle, b0 as UI, b2 as UIRoot, b3 as UIRootProps, b4 as UseZoneCardsOptions, b5 as UseZoneCardsResult, b6 as Zone, b7 as ZoneCardAction, b8 as ZoneCardActionExtraInputs, b9 as ZoneCardActionProps, ba as ZoneCardActionResult, bb as ZoneCardAt, bc as ZoneCardAtProps, be as ZoneItem, bf as ZoneItemProps, bg as ZoneList, bh as ZoneListProps, bi as ZonePileCards, bj as ZonePileCardsProps, bk as ZonePileContextValue, bl as ZonePileCount, bm as ZonePileCountProps, bn as ZonePileDescription, bo as ZonePileDescriptionProps, bp as ZonePileLabel, bq as ZonePileLabelProps, br as ZonePileRoot, bs as ZonePileRootProps, bt as ZonePileTrigger, bu as ZonePileTriggerProps, bv as ZoneRoot, bw as ZoneRootProps, bx as ZoneTopCard, by as ZoneTopCardProps, bz as createZoneCardRenderItem, bA as normalizeDiceState, bB as useBoardPrimitiveContext, bC as useDicePrimitiveContext, bD as useGameActionError, bE as useInteractionPrimitiveContext, bF as useOptionalZonePrimitiveContext, bG as useResolvedCardTargetValue, bH as useZoneCardContext, bI as useZoneCards, bJ as useZonePileContext, bK as useZonePrimitiveContext } from '../ui-contract-W2-kxObe.js';
1
+ import { bd as ZoneCardRenderItem } from '../ui-contract-CY7cxsCC.js';
2
+ export { B as Board, a as BoardEdgeTarget, b as BoardEdgeTargetProps, c as BoardHexGrid, d as BoardHexGridInteractionFilter, e as BoardHexGridInteractions, f as BoardHexGridProps, g as BoardHexView, h as BoardHexViewProps, i as BoardRoot, j as BoardRootProps, k as BoardSpaceTarget, l as BoardSpaceTargetProps, m as BoardState, n as BoardStateProps, o as BoardTarget, p as BoardTargetExtraInputs, q as BoardTargetProps, r as BoardVertexTarget, s as BoardVertexTargetProps, D as Dice, t as DiceComponents, u as DiceRoot, v as DiceRootProps, w as DiceState, x as DiceValue, y as DiceValues, z as DiceValuesProps, G as Game, C as GameActiveActionState, E as GameChrome, F as GameChromeProps, H as GameChromeState, I as GameMeState, J as GamePendingInputState, K as GamePlayer, L as GamePlayerEntry, M as GamePlayersState, N as GameRenderState, O as GameRoot, P as GameRootProps, Q as GameTurnState, R as GameViewport, S as GameViewportProps, T as Interaction, U as InteractionCardInput, V as InteractionCardInputProps, W as InteractionCardInputRenderState, X as InteractionDescription, Y as InteractionDialog, Z as InteractionDialogProps, _ as InteractionDialogRenderState, $ as InteractionDialogState, a0 as InteractionFieldPrimitiveProps, a1 as InteractionFormPrimitive, a2 as InteractionFormPrimitiveProps, a3 as InteractionInput, a4 as InteractionInputProps, a5 as InteractionLabel, a6 as InteractionPartProps, a7 as InteractionRoot, a8 as InteractionRootProps, a9 as InteractionRoute, aa as InteractionRoutes, ab as InteractionRoutesMap, ac as InteractionRoutesProps, ad as InteractionState, ae as InteractionStateProps, af as InteractionStateSnapshot, ag as InteractionSubmit, ah as InteractionSubmitProps, ai as InteractionSwitch, aj as InteractionSwitchProps, ak as InteractionSwitchRenderState, al as InteractionSwitchRouteMap, am as InteractionTrigger, an as InteractionTriggerProps, ao as InteractionUnavailableMessage, ap as InteractionValidationMessage, aq as Phase, ar as PhaseFallback, as as PhaseRouteMap, at as PhaseSwitch, au as PhaseSwitchProps, av as PlayerRoster, aw as PlayerRosterBadge, ax as PlayerRosterBadges, ay as PlayerRosterComponents, az as PlayerRosterEmpty, aA as PlayerRosterEntry, aB as PlayerRosterList, aC as PlayerRosterListProps, aD as PlayerRosterName, aE as PlayerRosterPartProps, aF as PlayerRosterRoot, aG as PlayerRosterRootProps, aH as PlayerRosterScore, aI as Prompt, aJ as PromptDialog, aK as PromptDialogProps, aL as PromptDialogRenderState, aM as PromptDialogState, aN as PromptInbox, aO as PromptInboxEmpty, aP as PromptInboxItems, aQ as PromptInboxItemsProps, aR as PromptInboxRoot, aS as PromptMessage, aT as PromptOption, aU as PromptOptionProps, aV as PromptOptionRenderItem, aW as PromptOptions, aX as PromptOptionsProps, aY as PromptRoot, aZ as PromptRootProps, a_ as PromptTitle, b0 as UI, b2 as UIRoot, b3 as UIRootProps, b4 as UseZoneCardsOptions, b5 as UseZoneCardsResult, b6 as Zone, b7 as ZoneCardAction, b8 as ZoneCardActionExtraInputs, b9 as ZoneCardActionProps, ba as ZoneCardActionResult, bb as ZoneCardAt, bc as ZoneCardAtProps, be as ZoneItem, bf as ZoneItemProps, bg as ZoneList, bh as ZoneListProps, bi as ZonePileCards, bj as ZonePileCardsProps, bk as ZonePileContextValue, bl as ZonePileCount, bm as ZonePileCountProps, bn as ZonePileDescription, bo as ZonePileDescriptionProps, bp as ZonePileLabel, bq as ZonePileLabelProps, br as ZonePileRoot, bs as ZonePileRootProps, bt as ZonePileTrigger, bu as ZonePileTriggerProps, bv as ZoneRoot, bw as ZoneRootProps, bx as ZoneTopCard, by as ZoneTopCardProps, bz as createZoneCardRenderItem, bA as normalizeDiceState, bB as useBoardPrimitiveContext, bC as useDicePrimitiveContext, bD as useGameActionError, bE as useInteractionPrimitiveContext, bF as useOptionalZonePrimitiveContext, bG as useResolvedCardTargetValue, bH as useZoneCardContext, bI as useZoneCards, bJ as useZonePileContext, bK as useZonePrimitiveContext } from '../ui-contract-CY7cxsCC.js';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
  import { ReactNode } from 'react';
5
5
  import { a as CardIntent, I as InteractionVisualState, b as HandLayoutKind, c as HandLayoutPolicy, H as HandInteractionPolicy, C as CardDropTargetVisualState } from '../HandView-PYDmehVD.js';
6
- import { a as InteractionDescriptor, d as PluginStateSnapshot } from '../runtime-api-BXd70c2e.js';
6
+ import { a as InteractionDescriptor } from '../runtime-api-BJharVaj.js';
7
7
  export { P as PrimitiveCommonProps, a as PrimitiveDataAttributes, c as composeEventHandlers, r as renderPrimitive } from '../primitive-props-BNHDkgd7.js';
8
- import '../hex-board-view-UCUjMALd.js';
9
- import '../ui/player-state.js';
8
+ import '../hex-board-view-Kz9Q_zsv.js';
9
+ import '../player-state-Cqpyeql0.js';
10
10
  import '../types.js';
11
- import '../hex-color-MhOyuY-o.js';
12
- import '../ThemeProvider-DvMl17Ny.js';
13
- import '../attributes-BrZtP9az.js';
14
- import '../types-BqzHkNMA.js';
11
+ import '../ThemeProvider-B1sIoBlX.js';
12
+ import '../attributes-DbvyMbXw.js';
13
+ import '../types-DJj5MJkl.js';
14
+ import '../runtime-api-C6aWo9c0.js';
15
15
 
16
16
  interface InteractionDraftReadiness {
17
17
  values: Record<string, unknown>;
@@ -223,6 +223,6 @@ declare function dropTargetIdFor(kind: RuntimeDropTargetKind, value: string): st
223
223
  * to decide whether to mount a drag surface even before the author wires
224
224
  * dropTargets.
225
225
  */
226
- declare function descriptorsHaveDestinationInput(state: PluginStateSnapshot): boolean;
226
+ declare function descriptorsHaveDestinationInput(availableInteractions: readonly InteractionDescriptor[]): boolean;
227
227
 
228
228
  export { type AuthoredCardIntent, HandSurfaceView, type HandSurfaceViewProps, type RuntimeCardIntentResult, type RuntimeDropTarget, type UseCardIntentAdapterOptions, ZoneCardRenderItem, decodeAuthoredCardIntent, descriptorsHaveDestinationInput, dropTargetIdFor, useCardIntentAdapter };
@@ -14,6 +14,7 @@ import {
14
14
  Game,
15
15
  GameChrome,
16
16
  GameRoot,
17
+ GameViewport,
17
18
  HandSurfaceView,
18
19
  Interaction,
19
20
  InteractionCardInput,
@@ -39,7 +40,6 @@ import {
39
40
  PlayerRosterName,
40
41
  PlayerRosterRoot,
41
42
  PlayerRosterScore,
42
- PlayerRosterSwitchButton,
43
43
  Prompt,
44
44
  PromptDialog,
45
45
  PromptInbox,
@@ -82,15 +82,17 @@ import {
82
82
  useZoneCards,
83
83
  useZonePileContext,
84
84
  useZonePrimitiveContext
85
- } from "../chunk-CZMFAS3E.js";
86
- import "../chunk-XJYUSD5F.js";
87
- import "../chunk-7W6TQO3X.js";
85
+ } from "../chunk-WOWFONLZ.js";
86
+ import "../chunk-FWVV2X74.js";
87
+ import "../chunk-T3ZKNUZ7.js";
88
+ import "../chunk-45FI6XII.js";
88
89
  import {
89
90
  composeEventHandlers,
90
91
  renderPrimitive
91
92
  } from "../chunk-VDXOF4FW.js";
92
- import "../chunk-MALRKLRR.js";
93
- import "../chunk-AEUXCFGM.js";
93
+ import "../chunk-O6M6PN4E.js";
94
+ import "../chunk-WUIVY2KE.js";
95
+ import "../chunk-PF7L4BMG.js";
94
96
  import "../chunk-PZ5AY32C.js";
95
97
  export {
96
98
  Board,
@@ -108,6 +110,7 @@ export {
108
110
  Game,
109
111
  GameChrome,
110
112
  GameRoot,
113
+ GameViewport,
111
114
  HandSurfaceView,
112
115
  Interaction,
113
116
  InteractionCardInput,
@@ -133,7 +136,6 @@ export {
133
136
  PlayerRosterName,
134
137
  PlayerRosterRoot,
135
138
  PlayerRosterScore,
136
- PlayerRosterSwitchButton,
137
139
  Prompt,
138
140
  PromptDialog,
139
141
  PromptInbox,
@@ -1,2 +1,2 @@
1
- export { c as PluginSessionState, d as PluginStateSnapshot, R as RuntimeAPI, S as SubmissionError, V as ValidationResult, Z as ZoneHandlesSnapshot } from '../runtime-api-BXd70c2e.js';
2
- import '../hex-color-MhOyuY-o.js';
1
+ export { a as PluginSessionState, R as RuntimeAPI, b as RuntimeDiagnosticEvent, c as RuntimeDiagnosticHandler, S as SubmissionError, V as ValidationResult } from '../runtime-api-C6aWo9c0.js';
2
+ export { Z as ZoneHandlesSnapshot } from '../runtime-api-BJharVaj.js';
@@ -1,173 +1,27 @@
1
- import { l as BoardSpaceTargetProps, bh as ZoneListProps, b1 as UIContract } from '../ui-contract-W2-kxObe.js';
2
- export { f as BoardHexGridProps, h as BoardHexViewProps, A as DreamboardUI, I as GameMeState, M as GamePlayersState, N as GameRenderState, Q as GameTurnState, a$ as TypedGame, b3 as UIRootProps, bd as ZoneCardRenderItem } from '../ui-contract-W2-kxObe.js';
3
- import { ReactNode, ReactElement, ButtonHTMLAttributes } from 'react';
4
- import { H as HandRole } from '../ResourceCounter-BTXklCEZ.js';
5
- export { b as ResourceCounterComponents } from '../ResourceCounter-BTXklCEZ.js';
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-BLwlj7mO.js';
2
+ import { Z as InteractionDialogProps } from '../ui-contract-CY7cxsCC.js';
3
+ export { f as BoardHexGridProps, h as BoardHexViewProps, l as BoardSpaceTargetProps, A as DreamboardUI, I as GameMeState, M as GamePlayersState, N as GameRenderState, Q as GameTurnState, a$ as TypedGame, b1 as UIContract, b3 as UIRootProps, bd as ZoneCardRenderItem, bh as ZoneListProps } from '../ui-contract-CY7cxsCC.js';
4
+ export { b as ResourceCounterComponents } from '../ResourceCounter-BuiNstXs.js';
5
+ import { ReactNode } from 'react';
6
6
  import 'react/jsx-runtime';
7
- import '../hex-board-view-UCUjMALd.js';
8
- import '../ui/player-state.js';
7
+ import '../hex-board-view-Kz9Q_zsv.js';
8
+ import '../player-state-Cqpyeql0.js';
9
9
  import '../types.js';
10
- import '../hex-color-MhOyuY-o.js';
11
- import '../ThemeProvider-DvMl17Ny.js';
12
- import '../runtime-api-BXd70c2e.js';
10
+ import '../ThemeProvider-B1sIoBlX.js';
11
+ import '../runtime-api-BJharVaj.js';
12
+ import '../runtime-api-C6aWo9c0.js';
13
13
  import '../primitive-props-BNHDkgd7.js';
14
- import '../attributes-BrZtP9az.js';
15
- import '../types-BqzHkNMA.js';
14
+ import '../attributes-DbvyMbXw.js';
15
+ import '../types-DJj5MJkl.js';
16
16
 
17
- interface ClientParamSchema {
18
- safeParse: (value: unknown) => {
19
- success: true;
20
- data: Record<string, unknown>;
21
- } | {
22
- success: false;
23
- error: {
24
- issues: ReadonlyArray<{
25
- path: readonly PropertyKey[];
26
- message: string;
27
- }>;
28
- };
29
- };
17
+ interface WorkspaceInteractionFormDialogProps extends Omit<InteractionDialogProps, "children"> {
18
+ title: ReactNode;
19
+ description?: ReactNode;
20
+ trigger?: ReactNode;
21
+ children: ReactNode;
22
+ contentClassName?: string;
23
+ overlayClassName?: string;
24
+ showCloseButton?: boolean;
30
25
  }
31
- type ClientParamSchemaMap = Readonly<Record<string, Readonly<Record<string, ClientParamSchema>>>>;
32
26
 
33
- type WorkspaceInteractionSlotComponent<Props = object> = (props: Props extends {
34
- children: unknown;
35
- } ? Props : Props & {
36
- children?: ReactNode;
37
- }) => ReactElement | null;
38
- interface WorkspaceFormInputSlot<Input extends string = string> {
39
- readonly Field: WorkspaceInteractionSlotComponent;
40
- readonly Options: WorkspaceInteractionSlotComponent<{
41
- children?: (option: {
42
- value: unknown;
43
- label: string;
44
- }) => ReactNode;
45
- }>;
46
- readonly Value: WorkspaceInteractionSlotComponent<{
47
- children: (value: unknown | undefined) => ReactNode;
48
- }>;
49
- readonly Default: WorkspaceInteractionSlotComponent;
50
- readonly __input?: Input;
51
- }
52
- interface WorkspaceCardInputSlot<Card extends string = string> {
53
- readonly Card: WorkspaceInteractionSlotComponent<{
54
- value: Card;
55
- } & Omit<ButtonHTMLAttributes<HTMLButtonElement>, "children" | "disabled" | "aria-disabled" | "aria-pressed" | "onClick" | "type" | "value">>;
56
- readonly Cards: WorkspaceInteractionSlotComponent<{
57
- children: (card: {
58
- id: Card;
59
- }) => ReactNode;
60
- }>;
61
- readonly Value: WorkspaceInteractionSlotComponent<{
62
- children: (value: unknown | undefined) => ReactNode;
63
- }>;
64
- readonly Default: WorkspaceInteractionSlotComponent;
65
- }
66
- interface WorkspaceBoardTargetInputSlot<Kind extends "space" | "edge" | "vertex" | "tile", Target extends string = string> {
67
- readonly Target: WorkspaceInteractionSlotComponent<{
68
- value: Target;
69
- } & Omit<ButtonHTMLAttributes<HTMLButtonElement>, "children" | "disabled" | "aria-disabled" | "aria-pressed" | "onClick" | "type" | "value">>;
70
- readonly Value: WorkspaceInteractionSlotComponent<{
71
- children: (value: unknown | undefined) => ReactNode;
72
- }>;
73
- readonly Default: WorkspaceInteractionSlotComponent;
74
- readonly __kind?: Kind;
75
- }
76
- interface WorkspaceBoardSurface<Space extends string = string, Edge extends string = string, Vertex extends string = string, Tile extends string = string> {
77
- readonly Root: WorkspaceInteractionSlotComponent;
78
- readonly Space: <Target extends Space>(props: BoardSpaceTargetProps<Target>) => ReactElement | null;
79
- readonly slot: {
80
- readonly space: WorkspaceBoardTargetInputSlot<"space", Space>;
81
- readonly playerSpace: WorkspaceBoardTargetInputSlot<"space", Space>;
82
- readonly edge: WorkspaceBoardTargetInputSlot<"edge", Edge>;
83
- readonly vertex: WorkspaceBoardTargetInputSlot<"vertex", Vertex>;
84
- readonly tile: WorkspaceBoardTargetInputSlot<"tile", Tile>;
85
- };
86
- }
87
- type WorkspaceZoneCardsComponent<Card> = WorkspaceInteractionSlotComponent<Omit<ZoneListProps, "children" | "empty"> & {
88
- empty?: ReactNode;
89
- children: (card: Card) => ReactNode;
90
- }>;
91
- type WorkspaceZoneCardComponent<Card> = WorkspaceInteractionSlotComponent<Omit<ButtonHTMLAttributes<HTMLButtonElement>, "type" | "value"> & {
92
- card: Card;
93
- }>;
94
- type WorkspaceZoneStagingComponent<Card> = WorkspaceInteractionSlotComponent<{
95
- children: (card: Card) => ReactNode;
96
- label?: ReactNode;
97
- renderEmptySlot?: (index: number) => ReactNode;
98
- cardSize?: "sm" | "md" | "lg";
99
- ariaLabel?: string;
100
- className?: string;
101
- }>;
102
- interface WorkspaceHandSurface<Zone extends string, Card> {
103
- readonly Hand: WorkspaceZoneCardsComponent<Card>;
104
- readonly Card: WorkspaceZoneCardComponent<Card>;
105
- readonly Staging: WorkspaceZoneStagingComponent<Card>;
106
- readonly slot: {
107
- readonly card: WorkspaceCardInputSlot<Zone>;
108
- };
109
- }
110
- interface WorkspacePileSurface<Card> {
111
- readonly Pile: WorkspaceZoneCardsComponent<Card>;
112
- readonly Card: WorkspaceZoneCardComponent<Card>;
113
- }
114
- interface WorkspaceCardCollectionSurface<Zone extends string, Card> {
115
- readonly Collection: WorkspaceZoneCardsComponent<Card>;
116
- readonly Card: WorkspaceZoneCardComponent<Card>;
117
- readonly slot: {
118
- readonly card: WorkspaceCardInputSlot<Zone>;
119
- };
120
- }
121
- interface WorkspaceBoardSurfaceDescriptor<Board extends string = string> {
122
- readonly kind: "board";
123
- readonly board: Board;
124
- }
125
- interface WorkspaceHandSurfaceDescriptor<Zone extends string = string> {
126
- readonly kind: "hand";
127
- readonly zone: Zone;
128
- readonly role: HandRole;
129
- readonly label: string;
130
- readonly order?: number;
131
- }
132
- interface WorkspacePileSurfaceDescriptor<Zone extends string = string> {
133
- readonly kind: "pile";
134
- readonly zone: Zone;
135
- }
136
- interface WorkspacePilesSurfaceDescriptor<Zones extends readonly string[] = readonly string[]> {
137
- readonly kind: "piles";
138
- readonly zones: Zones;
139
- }
140
- interface WorkspaceCardCollectionSurfaceDescriptor<Zones extends readonly string[] = readonly string[]> {
141
- readonly kind: "cardCollection";
142
- readonly zones: Zones;
143
- readonly mode?: "all" | "top-card";
144
- }
145
- interface WorkspaceInteractionFormsDescriptor<Interactions extends Readonly<Record<string, string>> = Readonly<Record<string, string>>> {
146
- readonly kind: "forms";
147
- readonly interactions: Interactions;
148
- }
149
- interface WorkspaceInteractionFormDescriptor<Interaction extends string = string> {
150
- readonly kind: "form";
151
- readonly interaction: Interaction;
152
- }
153
- type WorkspaceSurfaceDescriptor = WorkspaceBoardSurfaceDescriptor | WorkspaceHandSurfaceDescriptor | WorkspacePileSurfaceDescriptor | WorkspacePilesSurfaceDescriptor | WorkspaceCardCollectionSurfaceDescriptor | WorkspaceInteractionFormDescriptor | WorkspaceInteractionFormsDescriptor;
154
- interface WorkspaceSurfaceSpec {
155
- readonly [key: string]: WorkspaceSurfaceDescriptor | WorkspaceSurfaceSpec;
156
- }
157
- interface WorkspaceContractOptions<Contract extends UIContract, Resource extends string, Card, HexBoards extends Record<string, unknown>> {
158
- readonly uiContract: Contract;
159
- readonly clientParamSchemasByPhase?: ClientParamSchemaMap;
160
- readonly formInputKeysForInteraction: (interaction: string) => ReadonlySet<string>;
161
- readonly resourceIds: readonly Resource[];
162
- readonly resourcePresentationById?: Partial<Record<string, {
163
- label?: string;
164
- icon?: string;
165
- }>>;
166
- readonly hexStaticBoards: HexBoards;
167
- readonly cardIdFromZoneCard: (card: Card) => string;
168
- readonly zoneIdFromZoneCard: (card: Card) => string;
169
- }
170
-
171
- declare function createWorkspaceUIContract<WorkspaceUI, Contract extends UIContract, Resource extends string, Card, HexBoards extends Record<string, unknown>>(options: WorkspaceContractOptions<Contract, Resource, Card, HexBoards>): WorkspaceUI;
172
-
173
- export { BoardSpaceTargetProps, type ClientParamSchemaMap, UIContract, type WorkspaceBoardSurface, type WorkspaceBoardSurfaceDescriptor, type WorkspaceBoardTargetInputSlot, type WorkspaceCardCollectionSurface, type WorkspaceCardCollectionSurfaceDescriptor, type WorkspaceCardInputSlot, type WorkspaceFormInputSlot, type WorkspaceHandSurface, type WorkspaceHandSurfaceDescriptor, type WorkspaceInteractionFormDescriptor, type WorkspaceInteractionFormsDescriptor, type WorkspaceInteractionSlotComponent, type WorkspacePileSurface, type WorkspacePileSurfaceDescriptor, type WorkspacePilesSurfaceDescriptor, type WorkspaceSurfaceSpec, ZoneListProps, createWorkspaceUIContract };
27
+ export type { WorkspaceInteractionFormDialogProps };
@@ -1,13 +1,14 @@
1
1
  import {
2
2
  createWorkspaceUIContract
3
- } from "../chunk-3K362ZKR.js";
4
- import "../chunk-CZMFAS3E.js";
5
- import "../chunk-XJYUSD5F.js";
3
+ } from "../chunk-6JQFGSLD.js";
4
+ import "../chunk-WOWFONLZ.js";
5
+ import "../chunk-FWVV2X74.js";
6
6
  import "../chunk-T3ZKNUZ7.js";
7
- import "../chunk-7W6TQO3X.js";
7
+ import "../chunk-45FI6XII.js";
8
8
  import "../chunk-VDXOF4FW.js";
9
- import "../chunk-MALRKLRR.js";
10
- import "../chunk-AEUXCFGM.js";
9
+ import "../chunk-O6M6PN4E.js";
10
+ import "../chunk-WUIVY2KE.js";
11
+ import "../chunk-PF7L4BMG.js";
11
12
  import "../chunk-PZ5AY32C.js";
12
13
  export {
13
14
  createWorkspaceUIContract
@@ -0,0 +1,198 @@
1
+ import './runtime-api-C6aWo9c0.js';
2
+
3
+ /** Choice option surfaced on a prompt-kind interaction's structured context. */
4
+ interface InteractionContextOption {
5
+ id: string;
6
+ label?: string;
7
+ }
8
+ /** Structured context attached to a prompt-kind InteractionDescriptor. */
9
+ interface InteractionContext {
10
+ /** Addressed player id. */
11
+ to: string;
12
+ title?: string;
13
+ /** Authored prompt payload. Shape is defined by the game's prompt schema. */
14
+ payload?: Record<string, unknown>;
15
+ /** Selectable options for choice-kind prompts. */
16
+ options?: readonly InteractionContextOption[];
17
+ }
18
+ type InteractionCommitPolicy = {
19
+ mode: "manual";
20
+ } | {
21
+ mode: "autoWhenReady";
22
+ };
23
+ type InputSelection = {
24
+ mode: "single";
25
+ } | {
26
+ mode: "many";
27
+ min: number;
28
+ max?: number;
29
+ distinct?: boolean;
30
+ };
31
+ type InputDomain = CardTargetDomain | BoardTargetDomain | ResourceMapDomain | BoundedNumberDomain | ChoiceDomain | ChoiceListDomain;
32
+ type InputDomainResolver = EagerInputDomainDependencies | LazyInputDomainDependencies;
33
+ interface EagerInputDomainDependencies {
34
+ mode: "eager";
35
+ dependentCases: readonly InputDomainDependencyCase[];
36
+ }
37
+ interface LazyInputDomainDependencies {
38
+ mode: "lazy";
39
+ dependsOn: readonly string[];
40
+ resolver: {
41
+ interactionKey?: string;
42
+ inputKey: string;
43
+ };
44
+ }
45
+ interface ResolvedCardTargetDomain {
46
+ type: "cardTarget";
47
+ projection: "resolved";
48
+ zoneId?: string;
49
+ zoneIds?: readonly string[];
50
+ eligibleTargets: readonly string[];
51
+ selection?: InputSelection;
52
+ dependencies?: InputDomainResolver;
53
+ }
54
+ interface LazyCardTargetDomain {
55
+ type: "cardTarget";
56
+ projection: "lazy";
57
+ zoneId?: string;
58
+ zoneIds?: readonly string[];
59
+ selection?: InputSelection;
60
+ dependencies: LazyInputDomainDependencies;
61
+ }
62
+ type CardTargetDomain = ResolvedCardTargetDomain | LazyCardTargetDomain;
63
+ interface ResolvedBoardTargetDomain {
64
+ type: "boardTarget";
65
+ projection: "resolved";
66
+ targetKind: string;
67
+ boardId?: string;
68
+ eligibleTargets: readonly string[];
69
+ selection?: InputSelection;
70
+ dependencies?: InputDomainResolver;
71
+ }
72
+ interface LazyBoardTargetDomain {
73
+ type: "boardTarget";
74
+ projection: "lazy";
75
+ targetKind: string;
76
+ boardId?: string;
77
+ selection?: InputSelection;
78
+ dependencies: LazyInputDomainDependencies;
79
+ }
80
+ type BoardTargetDomain = ResolvedBoardTargetDomain | LazyBoardTargetDomain;
81
+ interface ResourceMapDomain {
82
+ type: "resourceMap";
83
+ resources?: ReadonlyArray<{
84
+ resourceId: string;
85
+ label?: string;
86
+ icon?: string;
87
+ min: number;
88
+ max: number;
89
+ }>;
90
+ dependencies?: InputDomainResolver;
91
+ }
92
+ interface BoundedNumberDomain {
93
+ type: "boundedNumber";
94
+ min?: number;
95
+ max?: number;
96
+ step?: number;
97
+ dependencies?: InputDomainResolver;
98
+ }
99
+ interface ChoiceDomain {
100
+ type: "choice";
101
+ choices?: readonly InteractionChoiceOption[];
102
+ selection?: InputSelection;
103
+ dependencies?: InputDomainResolver;
104
+ }
105
+ interface ChoiceListDomain {
106
+ type: "choiceList";
107
+ choices?: readonly InteractionChoiceOption[];
108
+ min?: number;
109
+ max?: number;
110
+ selection?: InputSelection;
111
+ dependencies?: InputDomainResolver;
112
+ }
113
+ interface InputDomainDependencyCase {
114
+ when: Readonly<Record<string, string>>;
115
+ domain: InputDomain;
116
+ }
117
+ interface InteractionChoiceOption {
118
+ value: string | null;
119
+ label: string;
120
+ icon?: string;
121
+ badge?: string;
122
+ description?: string;
123
+ disabled?: boolean;
124
+ disabledReason?: string;
125
+ }
126
+ interface InteractionInputDescriptor {
127
+ key: string;
128
+ kind: string;
129
+ domain: InputDomain;
130
+ defaultValue?: unknown;
131
+ }
132
+ interface InteractionDiagnosticReason {
133
+ ruleId: string;
134
+ errorCode: string;
135
+ }
136
+ type InteractionAvailability = {
137
+ status: "available";
138
+ } | {
139
+ status: "notYourTurn";
140
+ reason: string;
141
+ } | {
142
+ status: "insufficientResources";
143
+ reason: string;
144
+ missingResources: Readonly<Record<string, number>>;
145
+ } | {
146
+ status: "blocked";
147
+ reason: string;
148
+ code?: string;
149
+ };
150
+ interface InteractionDescriptorBase<Key extends string = string> {
151
+ phaseName: string;
152
+ interactionKey: Key;
153
+ interactionId: string;
154
+ /** Draft commit policy. Always materialized by the trusted reducer bundle. */
155
+ commit: InteractionCommitPolicy;
156
+ /** Canonical descriptor digest used by browser replay/protocol tooling when projected by the host. */
157
+ descriptorDigest?: string;
158
+ /** Explicit authoring/runtime actor seat used by browser replay draft digests. */
159
+ actorSeat?: number;
160
+ /** Canonical draft digest used by browser replay/protocol tooling when projected by the host. */
161
+ draftDigest?: string;
162
+ /** Source zone id for zone-scoped interactions (e.g., cardInput). */
163
+ zoneId?: string;
164
+ /** Source zone ids for zone-scoped interactions that span multiple zones. */
165
+ zoneIds?: readonly string[];
166
+ /** Ordered input descriptors. This is the canonical source for input keys, collector kind, and valid-value domains. */
167
+ inputs: readonly InteractionInputDescriptor[];
168
+ /** Resolved cost map keyed by resource id (if interaction declares one). */
169
+ cost?: Record<string, unknown>;
170
+ /** Snapshot of seat's currently available resources keyed by resource id. */
171
+ currentResources?: Record<string, unknown>;
172
+ /** Authoritative availability state for this descriptor. */
173
+ availability: InteractionAvailability;
174
+ /** Optional verbose diagnostics for dev tooling; omitted from production projections. */
175
+ reasons?: readonly InteractionDiagnosticReason[];
176
+ }
177
+ type ActionInteractionDescriptor<Key extends string = string> = InteractionDescriptorBase<Key> & {
178
+ kind: "action";
179
+ };
180
+ type PromptInteractionDescriptor<Key extends string = string> = InteractionDescriptorBase<Key> & {
181
+ kind: "prompt";
182
+ /** Structured prompt context for prompt-kind interactions. */
183
+ context: InteractionContext;
184
+ };
185
+ type InteractionDescriptor<Key extends string = string> = ActionInteractionDescriptor<Key> | PromptInteractionDescriptor<Key>;
186
+ /**
187
+ * Per-player view of a single zone. Mirrors the ZoneHandles wire shape from
188
+ * the trusted bundle's resolveZoneHandles; `cardViewsById` is JSON-serialized
189
+ * `ViewCard` and `playableByCardId` lists the interactions that are playable
190
+ * on each card (eligibility already filtered by each interaction's validate).
191
+ */
192
+ interface ZoneHandlesSnapshot<InteractionType extends string = string> {
193
+ cardIds: readonly string[];
194
+ cardViewsById: Readonly<Record<string, string>>;
195
+ playableByCardId: Readonly<Record<string, ReadonlyArray<InteractionDescriptor<InteractionType>>>>;
196
+ }
197
+
198
+ export type { InputDomain as I, ZoneHandlesSnapshot as Z, InteractionDescriptor as a, InteractionInputDescriptor as b };
@@ -0,0 +1,95 @@
1
+ type PlayerId = string;
2
+
3
+ /**
4
+ * Result of validating a player action
5
+ */
6
+ interface ValidationResult {
7
+ /** Whether the action is valid */
8
+ valid: boolean;
9
+ /** Machine-readable error code if validation failed */
10
+ errorCode?: string;
11
+ /** Human-readable error message if validation failed */
12
+ message?: string;
13
+ }
14
+ /**
15
+ * Structured authoritative submission failure returned by runtime submit APIs.
16
+ */
17
+ interface SubmissionError extends Error {
18
+ /** Machine-readable error code when available */
19
+ errorCode?: string;
20
+ }
21
+ type RuntimeDiagnosticEvent = {
22
+ type: "runtimeLog";
23
+ level: "log" | "warn" | "error";
24
+ message: string;
25
+ details?: readonly unknown[];
26
+ } | {
27
+ type: "internalError";
28
+ code: string;
29
+ message: string;
30
+ stack?: string;
31
+ };
32
+ type RuntimeDiagnosticHandler = (event: RuntimeDiagnosticEvent) => void;
33
+ /**
34
+ * Plugin session state
35
+ */
36
+ interface PluginSessionState {
37
+ /** Session initialization status */
38
+ status: "loading" | "ready";
39
+ /** Current session ID (null if not initialized) */
40
+ sessionId: string | null;
41
+ /** The player perspective represented by the current gameplay frame */
42
+ controllingPlayerId: PlayerId | null;
43
+ }
44
+ /**
45
+ * RuntimeAPI provides the interface between plugin code and the game runtime.
46
+ * This API is exposed to plugin iframes for subscribing to game events and submitting actions.
47
+ */
48
+ interface RuntimeAPI {
49
+ /**
50
+ * Validate a player interaction before submitting it. `params` is typed
51
+ * as `unknown` because a `promptInput` collector can declare a scalar
52
+ * response schema (`z.enum([...])`, `z.string()`, `z.number()`, ...)
53
+ * while ordinary collectors pass an object.
54
+ *
55
+ * @param interactionId - Identifier of the interaction
56
+ * @param params - Interaction-specific payload
57
+ * @returns Promise that resolves with validation result
58
+ */
59
+ validateInteraction: (interactionId: string, params: unknown) => Promise<ValidationResult>;
60
+ /**
61
+ * Submit a player interaction to the game server. `submitInteraction`
62
+ * is the single submission verb for every interaction kind — authors
63
+ * do not split between "action" and "prompt response" calls.
64
+ *
65
+ * @param interactionId - Identifier of the interaction
66
+ * @param params - Interaction-specific payload (see
67
+ * {@link validateInteraction} for the `unknown` typing rationale)
68
+ * @throws SubmissionError if submission is rejected by the authority.
69
+ */
70
+ submitInteraction: (interactionId: string, params: unknown) => Promise<void>;
71
+ emitDiagnostic?: (event: RuntimeDiagnosticEvent) => void;
72
+ setDiagnosticHandler?: (handler: RuntimeDiagnosticHandler | undefined) => void;
73
+ /**
74
+ * Get the current plugin session state.
75
+ * Returns initialization status and session/player IDs.
76
+ *
77
+ * @returns Current plugin session state
78
+ *
79
+ * @example
80
+ * ```typescript
81
+ * const { status, sessionId, playerId } = runtime.getSessionState();
82
+ * if (status === "ready") {
83
+ * console.log('Connected to session:', sessionId);
84
+ * }
85
+ * ```
86
+ */
87
+ getSessionState: () => PluginSessionState;
88
+ /**
89
+ * Disconnect from the runtime and clean up all listeners.
90
+ * Should be called when the plugin is unmounting.
91
+ */
92
+ disconnect: () => void;
93
+ }
94
+
95
+ export type { PlayerId as P, RuntimeAPI as R, SubmissionError as S, ValidationResult as V, PluginSessionState as a, RuntimeDiagnosticEvent as b, RuntimeDiagnosticHandler as c };