@dreamboard-games/sdk 0.4.0-alpha.1 → 0.4.0-alpha.2

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 (78) hide show
  1. package/REFERENCE.md +1215 -125
  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-XXBSIPJX.js → chunk-CP35NPPY.js} +131 -59
  15. package/dist/chunk-CP35NPPY.js.map +1 -0
  16. package/dist/{chunk-XJYUSD5F.js → chunk-FWVV2X74.js} +2 -2
  17. package/dist/{chunk-IUGKW2GS.js → chunk-HWJS3VOJ.js} +6 -2
  18. package/dist/chunk-HWJS3VOJ.js.map +1 -0
  19. package/dist/chunk-K5ZRJTZZ.js +328 -0
  20. package/dist/chunk-K5ZRJTZZ.js.map +1 -0
  21. package/dist/{chunk-7LZZEI25.js → chunk-N6ZDIMRB.js} +1 -1
  22. package/dist/chunk-N6ZDIMRB.js.map +1 -0
  23. package/dist/chunk-O6M6PN4E.js +1225 -0
  24. package/dist/chunk-O6M6PN4E.js.map +1 -0
  25. package/dist/{chunk-AEUXCFGM.js → chunk-PF7L4BMG.js} +1 -8
  26. package/dist/{chunk-AEUXCFGM.js.map → chunk-PF7L4BMG.js.map} +1 -1
  27. package/dist/{chunk-CZMFAS3E.js → chunk-WOWFONLZ.js} +517 -1274
  28. package/dist/chunk-WOWFONLZ.js.map +1 -0
  29. package/dist/{chunk-MALRKLRR.js → chunk-WUIVY2KE.js} +301 -12
  30. package/dist/chunk-WUIVY2KE.js.map +1 -0
  31. package/dist/chunk-ZAS2SENW.js +12 -0
  32. package/dist/chunk-ZAS2SENW.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.js +2 -1
  38. package/dist/package-set.d.ts +2 -2
  39. package/dist/package-set.js +2 -1
  40. package/dist/player-state-Cqpyeql0.d.ts +371 -0
  41. package/dist/protocol-BP193lva.d.ts +267 -0
  42. package/dist/reducer/advanced.js +1 -1
  43. package/dist/reducer-contract.js +1 -1
  44. package/dist/reducer.js +2 -2
  45. package/dist/reducer.js.map +1 -1
  46. package/dist/runtime/primitives.d.ts +10 -10
  47. package/dist/runtime/primitives.js +9 -7
  48. package/dist/runtime/runtime-api.d.ts +2 -2
  49. package/dist/runtime/workspace-contract.d.ts +23 -12
  50. package/dist/runtime/workspace-contract.js +7 -6
  51. package/dist/runtime-api-BJharVaj.d.ts +198 -0
  52. package/dist/runtime-api-C6aWo9c0.d.ts +95 -0
  53. package/dist/runtime.d.ts +35 -31
  54. package/dist/runtime.js +87 -797
  55. package/dist/runtime.js.map +1 -1
  56. package/dist/testing.d.ts +254 -140
  57. package/dist/testing.js +964 -149
  58. package/dist/testing.js.map +1 -1
  59. package/dist/types-CYeN0wLK.d.ts +29 -0
  60. package/dist/{types-BqzHkNMA.d.ts → types-DJj5MJkl.d.ts} +32 -5
  61. package/dist/types.d.ts +13 -8
  62. package/dist/ui/components.d.ts +4 -5
  63. package/dist/ui/components.js +19 -1
  64. package/dist/ui/player-state.d.ts +2 -365
  65. package/dist/{ui-contract-W2-kxObe.d.ts → ui-contract-CY7cxsCC.d.ts} +16 -26
  66. package/dist/ui.d.ts +7 -8
  67. package/dist/ui.js +20 -2
  68. package/package.json +25 -19
  69. package/dist/chunk-3K362ZKR.js.map +0 -1
  70. package/dist/chunk-7LZZEI25.js.map +0 -1
  71. package/dist/chunk-7W6TQO3X.js.map +0 -1
  72. package/dist/chunk-CZMFAS3E.js.map +0 -1
  73. package/dist/chunk-IUGKW2GS.js.map +0 -1
  74. package/dist/chunk-MALRKLRR.js.map +0 -1
  75. package/dist/chunk-XXBSIPJX.js.map +0 -1
  76. package/dist/hex-color-MhOyuY-o.d.ts +0 -8
  77. package/dist/runtime-api-BXd70c2e.d.ts +0 -490
  78. /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,18 +1,18 @@
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';
1
+ import { l as BoardSpaceTargetProps, bh as ZoneListProps, b1 as UIContract } from '../ui-contract-CY7cxsCC.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-CY7cxsCC.js';
3
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';
4
+ import { H as HandRole } from '../ResourceCounter-BuiNstXs.js';
5
+ export { b as ResourceCounterComponents } from '../ResourceCounter-BuiNstXs.js';
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
17
  interface ClientParamSchema {
18
18
  safeParse: (value: unknown) => {
@@ -99,8 +99,19 @@ type WorkspaceZoneStagingComponent<Card> = WorkspaceInteractionSlotComponent<{
99
99
  ariaLabel?: string;
100
100
  className?: string;
101
101
  }>;
102
+ type WorkspaceHandCardsComponent<Card> = WorkspaceInteractionSlotComponent<{
103
+ children: (card: Card, state: unknown) => ReactNode;
104
+ }>;
105
+ type WorkspaceHandSummaryComponent = WorkspaceInteractionSlotComponent<{
106
+ children?: ReactNode | ((summary: unknown) => ReactNode);
107
+ }>;
102
108
  interface WorkspaceHandSurface<Zone extends string, Card> {
103
- readonly Hand: WorkspaceZoneCardsComponent<Card>;
109
+ readonly Hand: WorkspaceInteractionSlotComponent<{
110
+ children: ReactNode;
111
+ }>;
112
+ readonly Cards: WorkspaceHandCardsComponent<Card>;
113
+ readonly Summary: WorkspaceHandSummaryComponent;
114
+ readonly Actions: WorkspaceHandSummaryComponent;
104
115
  readonly Card: WorkspaceZoneCardComponent<Card>;
105
116
  readonly Staging: WorkspaceZoneStagingComponent<Card>;
106
117
  readonly slot: {
@@ -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 };
package/dist/runtime.d.ts CHANGED
@@ -1,53 +1,43 @@
1
- import { b1 as UIContract$1, A as DreamboardUI$1, a$ as TypedGame$1 } from './ui-contract-W2-kxObe.js';
2
- export { f as BoardHexGridProps, h as BoardHexViewProps, l as BoardSpaceTargetProps, I as GameMeState, M as GamePlayersState, N as GameRenderState, Q as GameTurnState, b3 as UIRootProps, bd as ZoneCardRenderItem, bh as ZoneListProps } from './ui-contract-W2-kxObe.js';
3
- export { a as InteractionDescriptor } from './runtime-api-BXd70c2e.js';
1
+ import { b1 as UIContract$1, A as DreamboardUI$1, a$ as TypedGame$1 } from './ui-contract-CY7cxsCC.js';
2
+ export { f as BoardHexGridProps, h as BoardHexViewProps, l as BoardSpaceTargetProps, I as GameMeState, M as GamePlayersState, N as GameRenderState, Q as GameTurnState, b3 as UIRootProps, bd as ZoneCardRenderItem, bh as ZoneListProps } from './ui-contract-CY7cxsCC.js';
4
3
  export { ClientParamSchemaMap, WorkspaceBoardSurface, WorkspaceBoardSurfaceDescriptor, WorkspaceBoardTargetInputSlot, WorkspaceCardCollectionSurface, WorkspaceCardCollectionSurfaceDescriptor, WorkspaceCardInputSlot, WorkspaceFormInputSlot, WorkspaceHandSurface, WorkspaceHandSurfaceDescriptor, WorkspaceInteractionFormDescriptor, WorkspaceInteractionFormsDescriptor, WorkspaceInteractionSlotComponent, WorkspacePileSurface, WorkspacePileSurfaceDescriptor, WorkspacePilesSurfaceDescriptor, WorkspaceSurfaceSpec, createWorkspaceUIContract } from './runtime/workspace-contract.js';
5
4
  import * as react_jsx_runtime from 'react/jsx-runtime';
6
5
  import react__default from 'react';
7
- export { b as ResourceCounterComponents } from './ResourceCounter-BTXklCEZ.js';
8
- import './hex-board-view-UCUjMALd.js';
9
- import './ui/player-state.js';
6
+ import { c as RuntimeDiagnosticHandler } from './runtime-api-C6aWo9c0.js';
7
+ import { P as PluginRuntimeClient, a as PluginRuntimeClientOptions, b as PluginTransport } from './types-CYeN0wLK.js';
8
+ export { R as RuntimeClock, c as RuntimeIdFactory } from './types-CYeN0wLK.js';
9
+ export { a as InteractionDescriptor } from './runtime-api-BJharVaj.js';
10
+ export { b as ResourceCounterComponents } from './ResourceCounter-BuiNstXs.js';
11
+ import './hex-board-view-Kz9Q_zsv.js';
12
+ import './player-state-Cqpyeql0.js';
10
13
  import './types.js';
11
- import './hex-color-MhOyuY-o.js';
12
- import './ThemeProvider-DvMl17Ny.js';
14
+ import './ThemeProvider-B1sIoBlX.js';
13
15
  import './primitive-props-BNHDkgd7.js';
14
- import './attributes-BrZtP9az.js';
15
- import './types-BqzHkNMA.js';
16
-
17
- type PluginRuntimeDiagnosticEvent = {
18
- type: "runtimeLog";
19
- level: "log" | "warn" | "error";
20
- message: string;
21
- details?: readonly unknown[];
22
- } | {
23
- type: "internalError";
24
- code: string;
25
- message: string;
26
- stack?: string;
27
- };
28
- type PluginRuntimeDiagnosticHandler = (event: PluginRuntimeDiagnosticEvent) => void;
16
+ import './attributes-DbvyMbXw.js';
17
+ import './types-DJj5MJkl.js';
18
+ import './protocol-BP193lva.js';
29
19
 
30
20
  interface PluginRuntimeProps {
31
- /** Child components to render after state sync has started */
21
+ /** Child components to render after gameplay frame has started */
32
22
  children: react__default.ReactNode;
33
23
  /**
34
- * Timeout in milliseconds to wait for the first state-sync snapshot.
24
+ * Timeout in milliseconds to wait for the first gameplay-frame snapshot.
35
25
  * @default 10000 (10 seconds)
36
26
  */
37
27
  timeout?: number;
38
- /** Custom loading component to show while waiting for state sync */
28
+ /** Custom loading component to show while waiting for gameplay frame */
39
29
  loadingComponent?: react__default.ReactNode;
40
30
  /** Custom error component to show when initialization fails */
41
31
  errorComponent?: (error: string) => react__default.ReactNode;
42
- onDiagnostic?: PluginRuntimeDiagnosticHandler;
32
+ onDiagnostic?: RuntimeDiagnosticHandler;
43
33
  }
44
34
  /**
45
35
  * PluginRuntime provides the RuntimeContext for plugin components.
46
36
  *
47
37
  * This component:
48
- * - Creates a RuntimeAPI instance using the SDK-provided implementation
49
- * - Waits for the first reducer-native state-sync snapshot before rendering children
50
- * - Provides RuntimeAPI and session state to all child components
38
+ * - Creates a transport-backed runtime client
39
+ * - Waits for the first projected gameplay frame before rendering children
40
+ * - Provides runtime commands plus session/frame state to all child components
51
41
  *
52
42
  * @example
53
43
  * ```tsx
@@ -64,6 +54,20 @@ interface PluginRuntimeProps {
64
54
  */
65
55
  declare function PluginRuntime({ children, timeout, loadingComponent, errorComponent, onDiagnostic, }: PluginRuntimeProps): react_jsx_runtime.JSX.Element;
66
56
 
57
+ declare function PluginRuntimeBoundary({ runtime, children, }: {
58
+ runtime: PluginRuntimeClient;
59
+ children: react__default.ReactNode;
60
+ }): react_jsx_runtime.JSX.Element;
61
+
62
+ declare function createPluginRuntimeClient(options: PluginRuntimeClientOptions): PluginRuntimeClient;
63
+
64
+ interface PostMessagePluginTransportOptions {
65
+ readonly targetWindow?: Window;
66
+ readonly parentWindow?: Window;
67
+ readonly onInvalidMessage?: (reason: string, value: unknown) => void;
68
+ }
69
+ declare function createPostMessagePluginTransport(options?: PostMessagePluginTransportOptions): PluginTransport;
70
+
67
71
  interface DreamboardUIRegister {
68
72
  readonly __dreamboardUIRegister?: never;
69
73
  }
@@ -75,4 +79,4 @@ type RegisteredUI = RegisteredUIContract;
75
79
  type DreamboardUI<Contract extends UIContract = RegisteredUI> = DreamboardUI$1<Contract>;
76
80
  type TypedGame<Contract extends UIContract, View = unknown, Player extends string = string, Phase extends string = string> = TypedGame$1<Contract, View, Player, Phase>;
77
81
 
78
- export { type DreamboardUI, type DreamboardUIRegister, PluginRuntime, type PluginRuntimeProps, type RegisteredUI, type TypedGame, type UIContract };
82
+ export { type DreamboardUI, type DreamboardUIRegister, PluginRuntime, PluginRuntimeBoundary, PluginRuntimeClient, PluginRuntimeClientOptions, type PluginRuntimeProps, PluginTransport, type PostMessagePluginTransportOptions, type RegisteredUI, type TypedGame, type UIContract, createPluginRuntimeClient, createPostMessagePluginTransport };