@dreamboard-games/sdk 0.4.0-alpha.0 → 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.
- package/README.md +8 -1
- package/REFERENCE.md +1849 -379
- package/dist/{ResourceCounter-BTXklCEZ.d.ts → ResourceCounter-BuiNstXs.d.ts} +5 -1
- package/dist/{ThemeProvider-DvMl17Ny.d.ts → ThemeProvider-B1sIoBlX.d.ts} +1 -1
- package/dist/attributes-DbvyMbXw.d.ts +68 -0
- package/dist/authoring/index.d.ts +66 -0
- package/dist/authoring/index.js +560 -0
- package/dist/authoring/index.js.map +1 -0
- package/dist/browser-interaction.d.ts +246 -44
- package/dist/browser-interaction.js +14 -1
- package/dist/{chunk-Q5O7GPVY.js → chunk-45FI6XII.js} +630 -375
- package/dist/chunk-45FI6XII.js.map +1 -0
- package/dist/{chunk-4G7552LO.js → chunk-6JQFGSLD.js} +216 -47
- package/dist/chunk-6JQFGSLD.js.map +1 -0
- package/dist/{chunk-NBAEEHAU.js → chunk-CP35NPPY.js} +5926 -5266
- package/dist/chunk-CP35NPPY.js.map +1 -0
- package/dist/{chunk-2LDZ5C3T.js → chunk-FWVV2X74.js} +2 -2
- package/dist/{chunk-MNKDSGIA.js → chunk-HWJS3VOJ.js} +6 -2
- package/dist/chunk-HWJS3VOJ.js.map +1 -0
- package/dist/chunk-K5ZRJTZZ.js +328 -0
- package/dist/chunk-K5ZRJTZZ.js.map +1 -0
- package/dist/{chunk-U5KBV2BA.js → chunk-N6ZDIMRB.js} +444 -223
- package/dist/chunk-N6ZDIMRB.js.map +1 -0
- package/dist/chunk-O6M6PN4E.js +1225 -0
- package/dist/chunk-O6M6PN4E.js.map +1 -0
- package/dist/chunk-PF7L4BMG.js +117 -0
- package/dist/chunk-PF7L4BMG.js.map +1 -0
- package/dist/{chunk-P7F4L2FF.js → chunk-WOWFONLZ.js} +609 -1287
- package/dist/chunk-WOWFONLZ.js.map +1 -0
- package/dist/{chunk-QLG6VEMW.js → chunk-WUIVY2KE.js} +318 -21
- package/dist/chunk-WUIVY2KE.js.map +1 -0
- package/dist/chunk-ZAS2SENW.js +12 -0
- package/dist/chunk-ZAS2SENW.js.map +1 -0
- package/dist/codegen.d.ts +11 -1
- package/dist/codegen.js +1 -1
- package/dist/{components-DaIqi9QM.d.ts → components-BbWPnZCF.d.ts} +37 -70
- package/dist/{hex-board-view-UCUjMALd.d.ts → hex-board-view-Kz9Q_zsv.d.ts} +1 -1
- package/dist/index.js +2 -1
- package/dist/package-set.d.ts +2 -2
- package/dist/package-set.js +2 -1
- package/dist/player-state-Cqpyeql0.d.ts +371 -0
- package/dist/protocol-BP193lva.d.ts +267 -0
- package/dist/reducer/advanced.d.ts +2 -2
- package/dist/reducer/advanced.js +1 -1
- package/dist/reducer-contract.js +1 -1
- package/dist/reducer.d.ts +7 -7
- package/dist/reducer.js +190 -183
- package/dist/reducer.js.map +1 -1
- package/dist/runtime/primitives.d.ts +10 -9
- package/dist/runtime/primitives.js +9 -6
- package/dist/runtime/runtime-api.d.ts +2 -2
- package/dist/runtime/workspace-contract.d.ts +28 -76
- package/dist/runtime/workspace-contract.js +7 -5
- package/dist/runtime-api-BJharVaj.d.ts +198 -0
- package/dist/runtime-api-C6aWo9c0.d.ts +95 -0
- package/dist/runtime-json-CQ9QbLZ5.d.ts +5 -0
- package/dist/runtime.d.ts +80 -11
- package/dist/runtime.js +89 -445
- package/dist/runtime.js.map +1 -1
- package/dist/testing.d.ts +643 -22
- package/dist/testing.js +1371 -76
- package/dist/testing.js.map +1 -1
- package/dist/types-CYeN0wLK.d.ts +29 -0
- package/dist/{attributes-BeRyboMS.d.ts → types-DJj5MJkl.d.ts} +32 -55
- package/dist/types.d.ts +14 -7
- package/dist/ui/components.d.ts +4 -5
- package/dist/ui/components.js +19 -1
- package/dist/ui/player-state.d.ts +2 -365
- package/dist/ui/plugin-styles.css +1 -1
- package/dist/{ui-contract-BUC6iS3s.d.ts → ui-contract-CY7cxsCC.d.ts} +17 -26
- package/dist/ui.d.ts +8 -13
- package/dist/ui.js +20 -2
- package/dist/{views-B0hlW6IT.d.ts → views-fn2RuXOx.d.ts} +59 -44
- package/package.json +28 -4
- package/dist/chunk-4G7552LO.js.map +0 -1
- package/dist/chunk-MNKDSGIA.js.map +0 -1
- package/dist/chunk-NBAEEHAU.js.map +0 -1
- package/dist/chunk-P7F4L2FF.js.map +0 -1
- package/dist/chunk-Q5O7GPVY.js.map +0 -1
- package/dist/chunk-QLG6VEMW.js.map +0 -1
- package/dist/chunk-U5KBV2BA.js.map +0 -1
- package/dist/hex-color-MhOyuY-o.d.ts +0 -8
- package/dist/runtime-api-BXd70c2e.d.ts +0 -490
- /package/dist/{chunk-2LDZ5C3T.js.map → chunk-FWVV2X74.js.map} +0 -0
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import { bd as ZoneCardRenderItem } from '../ui-contract-
|
|
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
|
|
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
|
|
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-
|
|
9
|
-
import '../
|
|
8
|
+
import '../hex-board-view-Kz9Q_zsv.js';
|
|
9
|
+
import '../player-state-Cqpyeql0.js';
|
|
10
10
|
import '../types.js';
|
|
11
|
-
import '../
|
|
12
|
-
import '../
|
|
13
|
-
import '../
|
|
11
|
+
import '../ThemeProvider-B1sIoBlX.js';
|
|
12
|
+
import '../attributes-DbvyMbXw.js';
|
|
13
|
+
import '../types-DJj5MJkl.js';
|
|
14
|
+
import '../runtime-api-C6aWo9c0.js';
|
|
14
15
|
|
|
15
16
|
interface InteractionDraftReadiness {
|
|
16
17
|
values: Record<string, unknown>;
|
|
@@ -222,6 +223,6 @@ declare function dropTargetIdFor(kind: RuntimeDropTargetKind, value: string): st
|
|
|
222
223
|
* to decide whether to mount a drag surface even before the author wires
|
|
223
224
|
* dropTargets.
|
|
224
225
|
*/
|
|
225
|
-
declare function descriptorsHaveDestinationInput(
|
|
226
|
+
declare function descriptorsHaveDestinationInput(availableInteractions: readonly InteractionDescriptor[]): boolean;
|
|
226
227
|
|
|
227
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,14 +82,17 @@ import {
|
|
|
82
82
|
useZoneCards,
|
|
83
83
|
useZonePileContext,
|
|
84
84
|
useZonePrimitiveContext
|
|
85
|
-
} from "../chunk-
|
|
86
|
-
import "../chunk-
|
|
87
|
-
import "../chunk-
|
|
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-
|
|
93
|
+
import "../chunk-O6M6PN4E.js";
|
|
94
|
+
import "../chunk-WUIVY2KE.js";
|
|
95
|
+
import "../chunk-PF7L4BMG.js";
|
|
93
96
|
import "../chunk-PZ5AY32C.js";
|
|
94
97
|
export {
|
|
95
98
|
Board,
|
|
@@ -107,6 +110,7 @@ export {
|
|
|
107
110
|
Game,
|
|
108
111
|
GameChrome,
|
|
109
112
|
GameRoot,
|
|
113
|
+
GameViewport,
|
|
110
114
|
HandSurfaceView,
|
|
111
115
|
Interaction,
|
|
112
116
|
InteractionCardInput,
|
|
@@ -132,7 +136,6 @@ export {
|
|
|
132
136
|
PlayerRosterName,
|
|
133
137
|
PlayerRosterRoot,
|
|
134
138
|
PlayerRosterScore,
|
|
135
|
-
PlayerRosterSwitchButton,
|
|
136
139
|
Prompt,
|
|
137
140
|
PromptDialog,
|
|
138
141
|
PromptInbox,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {
|
|
2
|
-
|
|
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,30 +1,18 @@
|
|
|
1
|
-
import { l as BoardSpaceTargetProps, bh as ZoneListProps, b1 as UIContract
|
|
2
|
-
export { f as BoardHexGridProps, h as BoardHexViewProps, I as GameMeState, M as GamePlayersState, N as GameRenderState, Q as GameTurnState, b3 as UIRootProps, bd as ZoneCardRenderItem } from '../ui-contract-
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import '../
|
|
9
|
-
import '../ui/player-state.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
|
+
import { ReactNode, ReactElement, ButtonHTMLAttributes } from 'react';
|
|
4
|
+
import { H as HandRole } from '../ResourceCounter-BuiNstXs.js';
|
|
5
|
+
export { b as ResourceCounterComponents } from '../ResourceCounter-BuiNstXs.js';
|
|
6
|
+
import 'react/jsx-runtime';
|
|
7
|
+
import '../hex-board-view-Kz9Q_zsv.js';
|
|
8
|
+
import '../player-state-Cqpyeql0.js';
|
|
10
9
|
import '../types.js';
|
|
11
|
-
import '../
|
|
12
|
-
import '../
|
|
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-
|
|
15
|
-
|
|
16
|
-
type PluginRuntimeDiagnosticEvent = {
|
|
17
|
-
type: "runtimeLog";
|
|
18
|
-
level: "log" | "warn" | "error";
|
|
19
|
-
message: string;
|
|
20
|
-
details?: readonly unknown[];
|
|
21
|
-
} | {
|
|
22
|
-
type: "internalError";
|
|
23
|
-
code: string;
|
|
24
|
-
message: string;
|
|
25
|
-
stack?: string;
|
|
26
|
-
};
|
|
27
|
-
type PluginRuntimeDiagnosticHandler = (event: PluginRuntimeDiagnosticEvent) => void;
|
|
14
|
+
import '../attributes-DbvyMbXw.js';
|
|
15
|
+
import '../types-DJj5MJkl.js';
|
|
28
16
|
|
|
29
17
|
interface ClientParamSchema {
|
|
30
18
|
safeParse: (value: unknown) => {
|
|
@@ -42,43 +30,6 @@ interface ClientParamSchema {
|
|
|
42
30
|
}
|
|
43
31
|
type ClientParamSchemaMap = Readonly<Record<string, Readonly<Record<string, ClientParamSchema>>>>;
|
|
44
32
|
|
|
45
|
-
interface PluginRuntimeProps {
|
|
46
|
-
/** Child components to render after state sync has started */
|
|
47
|
-
children: react__default.ReactNode;
|
|
48
|
-
/**
|
|
49
|
-
* Timeout in milliseconds to wait for the first state-sync snapshot.
|
|
50
|
-
* @default 10000 (10 seconds)
|
|
51
|
-
*/
|
|
52
|
-
timeout?: number;
|
|
53
|
-
/** Custom loading component to show while waiting for state sync */
|
|
54
|
-
loadingComponent?: react__default.ReactNode;
|
|
55
|
-
/** Custom error component to show when initialization fails */
|
|
56
|
-
errorComponent?: (error: string) => react__default.ReactNode;
|
|
57
|
-
onDiagnostic?: PluginRuntimeDiagnosticHandler;
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* PluginRuntime provides the RuntimeContext for plugin components.
|
|
61
|
-
*
|
|
62
|
-
* This component:
|
|
63
|
-
* - Creates a RuntimeAPI instance using the SDK-provided implementation
|
|
64
|
-
* - Waits for the first reducer-native state-sync snapshot before rendering children
|
|
65
|
-
* - Provides RuntimeAPI and session state to all child components
|
|
66
|
-
*
|
|
67
|
-
* @example
|
|
68
|
-
* ```tsx
|
|
69
|
-
* // In your plugin's index.tsx
|
|
70
|
-
* import { PluginRuntime } from "./components/dreamboard";
|
|
71
|
-
* import App from './App';
|
|
72
|
-
*
|
|
73
|
-
* ReactDOM.createRoot(document.getElementById('root')!).render(
|
|
74
|
-
* <PluginRuntime>
|
|
75
|
-
* <App />
|
|
76
|
-
* </PluginRuntime>
|
|
77
|
-
* );
|
|
78
|
-
* ```
|
|
79
|
-
*/
|
|
80
|
-
declare function PluginRuntime({ children, timeout, loadingComponent, errorComponent, onDiagnostic, }: PluginRuntimeProps): react_jsx_runtime.JSX.Element;
|
|
81
|
-
|
|
82
33
|
type WorkspaceInteractionSlotComponent<Props = object> = (props: Props extends {
|
|
83
34
|
children: unknown;
|
|
84
35
|
} ? Props : Props & {
|
|
@@ -148,8 +99,19 @@ type WorkspaceZoneStagingComponent<Card> = WorkspaceInteractionSlotComponent<{
|
|
|
148
99
|
ariaLabel?: string;
|
|
149
100
|
className?: string;
|
|
150
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
|
+
}>;
|
|
151
108
|
interface WorkspaceHandSurface<Zone extends string, Card> {
|
|
152
|
-
readonly Hand:
|
|
109
|
+
readonly Hand: WorkspaceInteractionSlotComponent<{
|
|
110
|
+
children: ReactNode;
|
|
111
|
+
}>;
|
|
112
|
+
readonly Cards: WorkspaceHandCardsComponent<Card>;
|
|
113
|
+
readonly Summary: WorkspaceHandSummaryComponent;
|
|
114
|
+
readonly Actions: WorkspaceHandSummaryComponent;
|
|
153
115
|
readonly Card: WorkspaceZoneCardComponent<Card>;
|
|
154
116
|
readonly Staging: WorkspaceZoneStagingComponent<Card>;
|
|
155
117
|
readonly slot: {
|
|
@@ -203,7 +165,7 @@ type WorkspaceSurfaceDescriptor = WorkspaceBoardSurfaceDescriptor | WorkspaceHan
|
|
|
203
165
|
interface WorkspaceSurfaceSpec {
|
|
204
166
|
readonly [key: string]: WorkspaceSurfaceDescriptor | WorkspaceSurfaceSpec;
|
|
205
167
|
}
|
|
206
|
-
interface WorkspaceContractOptions<Contract extends UIContract
|
|
168
|
+
interface WorkspaceContractOptions<Contract extends UIContract, Resource extends string, Card, HexBoards extends Record<string, unknown>> {
|
|
207
169
|
readonly uiContract: Contract;
|
|
208
170
|
readonly clientParamSchemasByPhase?: ClientParamSchemaMap;
|
|
209
171
|
readonly formInputKeysForInteraction: (interaction: string) => ReadonlySet<string>;
|
|
@@ -217,16 +179,6 @@ interface WorkspaceContractOptions<Contract extends UIContract$1, Resource exten
|
|
|
217
179
|
readonly zoneIdFromZoneCard: (card: Card) => string;
|
|
218
180
|
}
|
|
219
181
|
|
|
220
|
-
declare function createWorkspaceUIContract<WorkspaceUI, Contract extends UIContract
|
|
221
|
-
|
|
222
|
-
interface DreamboardUIRegister {
|
|
223
|
-
}
|
|
224
|
-
type UIContract = UIContract$1;
|
|
225
|
-
type RegisteredUIContract = DreamboardUIRegister extends {
|
|
226
|
-
ui: infer Registered extends UIContract;
|
|
227
|
-
} ? Registered : UIContract;
|
|
228
|
-
type RegisteredUI = RegisteredUIContract;
|
|
229
|
-
type DreamboardUI<Contract extends UIContract = RegisteredUI> = DreamboardUI$1<Contract>;
|
|
230
|
-
type TypedGame<Contract extends UIContract, View = unknown, Player extends string = string, Phase extends string = string> = TypedGame$1<Contract, View, Player, Phase>;
|
|
182
|
+
declare function createWorkspaceUIContract<WorkspaceUI, Contract extends UIContract, Resource extends string, Card, HexBoards extends Record<string, unknown>>(options: WorkspaceContractOptions<Contract, Resource, Card, HexBoards>): WorkspaceUI;
|
|
231
183
|
|
|
232
|
-
export { BoardSpaceTargetProps, type ClientParamSchemaMap,
|
|
184
|
+
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 };
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createWorkspaceUIContract
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
5
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-6JQFGSLD.js";
|
|
4
|
+
import "../chunk-WOWFONLZ.js";
|
|
5
|
+
import "../chunk-FWVV2X74.js";
|
|
6
6
|
import "../chunk-T3ZKNUZ7.js";
|
|
7
|
-
import "../chunk-
|
|
7
|
+
import "../chunk-45FI6XII.js";
|
|
8
8
|
import "../chunk-VDXOF4FW.js";
|
|
9
|
-
import "../chunk-
|
|
9
|
+
import "../chunk-O6M6PN4E.js";
|
|
10
|
+
import "../chunk-WUIVY2KE.js";
|
|
11
|
+
import "../chunk-PF7L4BMG.js";
|
|
10
12
|
import "../chunk-PZ5AY32C.js";
|
|
11
13
|
export {
|
|
12
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,13 +1,82 @@
|
|
|
1
|
-
|
|
2
|
-
export {
|
|
3
|
-
export { ClientParamSchemaMap,
|
|
4
|
-
|
|
5
|
-
import 'react';
|
|
6
|
-
import '
|
|
7
|
-
import './
|
|
8
|
-
|
|
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';
|
|
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';
|
|
4
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
|
+
import react__default from 'react';
|
|
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';
|
|
9
13
|
import './types.js';
|
|
10
|
-
import './
|
|
11
|
-
import './ThemeProvider-DvMl17Ny.js';
|
|
14
|
+
import './ThemeProvider-B1sIoBlX.js';
|
|
12
15
|
import './primitive-props-BNHDkgd7.js';
|
|
13
|
-
import './attributes-
|
|
16
|
+
import './attributes-DbvyMbXw.js';
|
|
17
|
+
import './types-DJj5MJkl.js';
|
|
18
|
+
import './protocol-BP193lva.js';
|
|
19
|
+
|
|
20
|
+
interface PluginRuntimeProps {
|
|
21
|
+
/** Child components to render after gameplay frame has started */
|
|
22
|
+
children: react__default.ReactNode;
|
|
23
|
+
/**
|
|
24
|
+
* Timeout in milliseconds to wait for the first gameplay-frame snapshot.
|
|
25
|
+
* @default 10000 (10 seconds)
|
|
26
|
+
*/
|
|
27
|
+
timeout?: number;
|
|
28
|
+
/** Custom loading component to show while waiting for gameplay frame */
|
|
29
|
+
loadingComponent?: react__default.ReactNode;
|
|
30
|
+
/** Custom error component to show when initialization fails */
|
|
31
|
+
errorComponent?: (error: string) => react__default.ReactNode;
|
|
32
|
+
onDiagnostic?: RuntimeDiagnosticHandler;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* PluginRuntime provides the RuntimeContext for plugin components.
|
|
36
|
+
*
|
|
37
|
+
* This component:
|
|
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
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```tsx
|
|
44
|
+
* // In your plugin's index.tsx
|
|
45
|
+
* import { PluginRuntime } from "./components/dreamboard";
|
|
46
|
+
* import App from './App';
|
|
47
|
+
*
|
|
48
|
+
* ReactDOM.createRoot(document.getElementById('root')!).render(
|
|
49
|
+
* <PluginRuntime>
|
|
50
|
+
* <App />
|
|
51
|
+
* </PluginRuntime>
|
|
52
|
+
* );
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
declare function PluginRuntime({ children, timeout, loadingComponent, errorComponent, onDiagnostic, }: PluginRuntimeProps): react_jsx_runtime.JSX.Element;
|
|
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
|
+
|
|
71
|
+
interface DreamboardUIRegister {
|
|
72
|
+
readonly __dreamboardUIRegister?: never;
|
|
73
|
+
}
|
|
74
|
+
type UIContract = UIContract$1;
|
|
75
|
+
type RegisteredUIContract = DreamboardUIRegister extends {
|
|
76
|
+
ui: infer Registered extends UIContract;
|
|
77
|
+
} ? Registered : UIContract;
|
|
78
|
+
type RegisteredUI = RegisteredUIContract;
|
|
79
|
+
type DreamboardUI<Contract extends UIContract = RegisteredUI> = DreamboardUI$1<Contract>;
|
|
80
|
+
type TypedGame<Contract extends UIContract, View = unknown, Player extends string = string, Phase extends string = string> = TypedGame$1<Contract, View, Player, Phase>;
|
|
81
|
+
|
|
82
|
+
export { type DreamboardUI, type DreamboardUIRegister, PluginRuntime, PluginRuntimeBoundary, PluginRuntimeClient, PluginRuntimeClientOptions, type PluginRuntimeProps, PluginTransport, type PostMessagePluginTransportOptions, type RegisteredUI, type TypedGame, type UIContract, createPluginRuntimeClient, createPostMessagePluginTransport };
|