@dreamboard-games/sdk 0.2.0
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/LICENSE.md +96 -0
- package/README.md +12 -0
- package/dist/HandView-ncJIVLhN.d.ts +193 -0
- package/dist/ResourceCounter-CTREyF73.d.ts +102 -0
- package/dist/ThemeProvider-fy0_QzgO.d.ts +99 -0
- package/dist/bundle-TIZcw8LB.d.ts +281 -0
- package/dist/cards-Sl3b40Mv.d.ts +13 -0
- package/dist/chunk-7YAHLYBR.js +481 -0
- package/dist/chunk-7YAHLYBR.js.map +1 -0
- package/dist/chunk-FDNZTDD6.js +8085 -0
- package/dist/chunk-FDNZTDD6.js.map +1 -0
- package/dist/chunk-GKKBPPSW.js +598 -0
- package/dist/chunk-GKKBPPSW.js.map +1 -0
- package/dist/chunk-I46YJSOD.js +1 -0
- package/dist/chunk-I46YJSOD.js.map +1 -0
- package/dist/chunk-KAELH4KC.js +104 -0
- package/dist/chunk-KAELH4KC.js.map +1 -0
- package/dist/chunk-PZ5AY32C.js +10 -0
- package/dist/chunk-PZ5AY32C.js.map +1 -0
- package/dist/chunk-T3ZKNUZ7.js +1 -0
- package/dist/chunk-T3ZKNUZ7.js.map +1 -0
- package/dist/chunk-T52J5RMF.js +1 -0
- package/dist/chunk-T52J5RMF.js.map +1 -0
- package/dist/chunk-TDSWKVZ4.js +5401 -0
- package/dist/chunk-TDSWKVZ4.js.map +1 -0
- package/dist/chunk-U5C6BONG.js +34 -0
- package/dist/chunk-U5C6BONG.js.map +1 -0
- package/dist/chunk-VDXOF4FW.js +69 -0
- package/dist/chunk-VDXOF4FW.js.map +1 -0
- package/dist/chunk-VFTAA4WO.js +115 -0
- package/dist/chunk-VFTAA4WO.js.map +1 -0
- package/dist/chunk-WN74KVNY.js +17 -0
- package/dist/chunk-WN74KVNY.js.map +1 -0
- package/dist/chunk-WYPQ3GG5.js +10990 -0
- package/dist/chunk-WYPQ3GG5.js.map +1 -0
- package/dist/components-D5ZRE2Hl.d.ts +1451 -0
- package/dist/generated/runtime/primitives.d.ts +12 -0
- package/dist/generated/runtime/primitives.js +180 -0
- package/dist/generated/runtime/primitives.js.map +1 -0
- package/dist/generated/runtime-api.d.ts +3 -0
- package/dist/generated/runtime-api.js +2 -0
- package/dist/generated/runtime-api.js.map +1 -0
- package/dist/generated/runtime.d.ts +14 -0
- package/dist/generated/runtime.js +18 -0
- package/dist/generated/runtime.js.map +1 -0
- package/dist/generated/workspace-contract.d.ts +14 -0
- package/dist/generated/workspace-contract.js +14 -0
- package/dist/generated/workspace-contract.js.map +1 -0
- package/dist/hex-board-view-D_07hO6O.d.ts +933 -0
- package/dist/hex-color-MhOyuY-o.d.ts +8 -0
- package/dist/index-BwqPQtBu.d.ts +1433 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -0
- package/dist/infrastructure/reducer-bundle-abi.d.ts +1083 -0
- package/dist/infrastructure/reducer-bundle-abi.js +14 -0
- package/dist/infrastructure/reducer-bundle-abi.js.map +1 -0
- package/dist/infrastructure/workspace-codegen.d.ts +53 -0
- package/dist/infrastructure/workspace-codegen.js +44 -0
- package/dist/infrastructure/workspace-codegen.js.map +1 -0
- package/dist/manifest-contract-BNHVGFtU.d.ts +9 -0
- package/dist/package-set.d.ts +13 -0
- package/dist/package-set.js +12 -0
- package/dist/package-set.js.map +1 -0
- package/dist/primitive-props-DpKs-GCr.d.ts +11 -0
- package/dist/reducer.d.ts +3786 -0
- package/dist/reducer.js +8131 -0
- package/dist/reducer.js.map +1 -0
- package/dist/runtime/primitives.d.ts +226 -0
- package/dist/runtime/primitives.js +180 -0
- package/dist/runtime/primitives.js.map +1 -0
- package/dist/runtime/types/runtime-api.d.ts +1 -0
- package/dist/runtime/types/runtime-api.js +2 -0
- package/dist/runtime/types/runtime-api.js.map +1 -0
- package/dist/runtime/workspace-contract.d.ts +172 -0
- package/dist/runtime/workspace-contract.js +14 -0
- package/dist/runtime/workspace-contract.js.map +1 -0
- package/dist/runtime-api-3dshj6kK.d.ts +101 -0
- package/dist/runtime-api-DWxvTr-O.d.ts +379 -0
- package/dist/runtime.d.ts +58 -0
- package/dist/runtime.js +13 -0
- package/dist/runtime.js.map +1 -0
- package/dist/slots-1GPGihk8.d.ts +8 -0
- package/dist/testing.d.ts +149 -0
- package/dist/testing.js +513 -0
- package/dist/testing.js.map +1 -0
- package/dist/types.d.ts +496 -0
- package/dist/types.js +28 -0
- package/dist/types.js.map +1 -0
- package/dist/ui/components.d.ts +16 -0
- package/dist/ui/components.js +192 -0
- package/dist/ui/components.js.map +1 -0
- package/dist/ui/defaults.d.ts +19 -0
- package/dist/ui/defaults.js +104 -0
- package/dist/ui/defaults.js.map +1 -0
- package/dist/ui/plugin-styles.css +250 -0
- package/dist/ui/types/player-state.d.ts +365 -0
- package/dist/ui/types/player-state.js +1 -0
- package/dist/ui/types/player-state.js.map +1 -0
- package/dist/ui-contract-iQfTtUSL.d.ts +1161 -0
- package/dist/ui.d.ts +320 -0
- package/dist/ui.js +253 -0
- package/dist/ui.js.map +1 -0
- package/package.json +199 -0
- package/src/generated/reducer-contract/builders.ts +90 -0
- package/src/generated/reducer-contract/version.ts +9 -0
- package/src/generated/reducer-contract/wire.ts +100 -0
- package/src/generated/reducer-contract/zod.ts +101 -0
- package/src/generated/runtime/primitives.ts +2 -0
- package/src/generated/runtime-api.ts +5 -0
- package/src/generated/runtime.ts +35 -0
- package/src/generated/workspace-contract.ts +2 -0
- package/src/index.ts +7 -0
- package/src/infrastructure/reducer-bundle-abi.ts +8 -0
- package/src/infrastructure/reducer-contract/bundle.ts +37 -0
- package/src/infrastructure/workspace-codegen/hex-geometry.ts +69 -0
- package/src/infrastructure/workspace-codegen/index.ts +64 -0
- package/src/infrastructure/workspace-codegen/manifest-contract.ts +6632 -0
- package/src/infrastructure/workspace-codegen/manifest-validation.ts +795 -0
- package/src/infrastructure/workspace-codegen/ownership.ts +131 -0
- package/src/infrastructure/workspace-codegen/preset-card-sets.ts +169 -0
- package/src/infrastructure/workspace-codegen/seeds.ts +1705 -0
- package/src/infrastructure/workspace-codegen.ts +1 -0
- package/src/package-set.ts +19 -0
- package/src/reducer/authoring/contract.ts +157 -0
- package/src/reducer/authoring/effect.ts +224 -0
- package/src/reducer/authoring/game.ts +23 -0
- package/src/reducer/authoring/interaction.ts +98 -0
- package/src/reducer/authoring/phase.ts +300 -0
- package/src/reducer/authoring/types.ts +70 -0
- package/src/reducer/authoring/validation.ts +382 -0
- package/src/reducer/authoring/view-stage.ts +68 -0
- package/src/reducer/authoring.ts +29 -0
- package/src/reducer/bundle/ingress-bundle.ts +491 -0
- package/src/reducer/bundle/trusted/engine-instruction-resolver.ts +254 -0
- package/src/reducer/bundle/trusted/flow-instruction-resolver.ts +73 -0
- package/src/reducer/bundle/trusted/instruction-runner.ts +414 -0
- package/src/reducer/bundle/trusted/interaction-authorization.ts +137 -0
- package/src/reducer/bundle/trusted/interaction-collectors.ts +859 -0
- package/src/reducer/bundle/trusted/interaction-decision.ts +747 -0
- package/src/reducer/bundle/trusted/interaction-resolver.ts +95 -0
- package/src/reducer/bundle/trusted/interaction-types.ts +171 -0
- package/src/reducer/bundle/trusted/lifecycle-runner.ts +427 -0
- package/src/reducer/bundle/trusted/projection-builder.ts +356 -0
- package/src/reducer/bundle/trusted/projection-context.ts +39 -0
- package/src/reducer/bundle/trusted/rng-sampler.ts +150 -0
- package/src/reducer/bundle/trusted/runtime-registry.ts +120 -0
- package/src/reducer/bundle/trusted/runtime-scope.ts +336 -0
- package/src/reducer/bundle/trusted/simultaneous-player.ts +97 -0
- package/src/reducer/bundle/trusted/stage-resolver.ts +87 -0
- package/src/reducer/bundle/trusted/static-projection.ts +116 -0
- package/src/reducer/bundle/trusted/trusted-runtime-args.ts +97 -0
- package/src/reducer/bundle/trusted/trusted-runtime-result.ts +39 -0
- package/src/reducer/bundle/trusted/trusted-setup-profiles.ts +43 -0
- package/src/reducer/bundle/trusted/trusted-state-codec.ts +48 -0
- package/src/reducer/bundle/trusted-bundle.ts +97 -0
- package/src/reducer/bundle/types.ts +171 -0
- package/src/reducer/bundle.ts +2 -0
- package/src/reducer/client-param-schemas.ts +57 -0
- package/src/reducer/compose.ts +34 -0
- package/src/reducer/core/runtime-input.ts +30 -0
- package/src/reducer/core/runtime-instruction.ts +59 -0
- package/src/reducer/core/types.ts +62 -0
- package/src/reducer/definition-index.ts +277 -0
- package/src/reducer/derived.ts +106 -0
- package/src/reducer/effects.ts +92 -0
- package/src/reducer/engine/runtime-instruction-engine.ts +155 -0
- package/src/reducer/ingress/decode-runtime-input.ts +7 -0
- package/src/reducer/ingress/decode-session-state.ts +9 -0
- package/src/reducer/ingress/encode-session-state.ts +6 -0
- package/src/reducer/ingress/input-codec.ts +18 -0
- package/src/reducer/ingress/phase-schemas.ts +62 -0
- package/src/reducer/ingress/raw-types.ts +107 -0
- package/src/reducer/ingress/runtime-codec.ts +14 -0
- package/src/reducer/ingress/runtime-payload.ts +13 -0
- package/src/reducer/ingress/session-codec.ts +392 -0
- package/src/reducer/ingress/types.ts +6 -0
- package/src/reducer/inputs/boardInput.ts +217 -0
- package/src/reducer/inputs/boardTarget.ts +190 -0
- package/src/reducer/inputs/cardInput.ts +86 -0
- package/src/reducer/inputs/cardTarget.ts +101 -0
- package/src/reducer/inputs/choiceTarget.ts +104 -0
- package/src/reducer/inputs/defineInputs.ts +71 -0
- package/src/reducer/inputs/formInput.ts +809 -0
- package/src/reducer/inputs/many.ts +120 -0
- package/src/reducer/inputs/promptInput.ts +87 -0
- package/src/reducer/inputs/rngInput.ts +58 -0
- package/src/reducer/inputs/targetRule.ts +123 -0
- package/src/reducer/inputs.ts +41 -0
- package/src/reducer/model/definition.ts +1072 -0
- package/src/reducer/model/extract.ts +745 -0
- package/src/reducer/model/manifest.ts +570 -0
- package/src/reducer/model/queries.ts +641 -0
- package/src/reducer/model/runtime.ts +264 -0
- package/src/reducer/model/spec.ts +1386 -0
- package/src/reducer/model/table.ts +260 -0
- package/src/reducer/model.ts +7 -0
- package/src/reducer/ops.ts +1034 -0
- package/src/reducer/parse-utils.ts +28 -0
- package/src/reducer/per-player.ts +422 -0
- package/src/reducer/rng.ts +69 -0
- package/src/reducer/schema-helpers.ts +185 -0
- package/src/reducer/setup-bootstrap-helpers.ts +171 -0
- package/src/reducer/setup-bootstrap.ts +481 -0
- package/src/reducer/table-ops.ts +2671 -0
- package/src/reducer/table-queries.ts +372 -0
- package/src/reducer/transaction.ts +120 -0
- package/src/reducer.ts +314 -0
- package/src/runtime/primitives.ts +1 -0
- package/src/runtime/types/runtime-api.ts +1 -0
- package/src/runtime/workspace-contract.ts +32 -0
- package/src/runtime-internal/components/InteractionForm.tsx +1309 -0
- package/src/runtime-internal/components/PluginRuntime.tsx +103 -0
- package/src/runtime-internal/components/board/target-layer.ts +70 -0
- package/src/runtime-internal/context/ClientParamSchemaContext.tsx +44 -0
- package/src/runtime-internal/context/InteractionDraftContext.tsx +279 -0
- package/src/runtime-internal/context/PluginSessionContext.tsx +47 -0
- package/src/runtime-internal/context/PluginStateContext.tsx +262 -0
- package/src/runtime-internal/context/RuntimeContext.tsx +96 -0
- package/src/runtime-internal/defaults/components.tsx +409 -0
- package/src/runtime-internal/defaults/index.ts +11 -0
- package/src/runtime-internal/errors/ValidationError.ts +29 -0
- package/src/runtime-internal/hooks/useActivePlayers.ts +33 -0
- package/src/runtime-internal/hooks/useBoardInteractions.ts +665 -0
- package/src/runtime-internal/hooks/useGameSelector.ts +105 -0
- package/src/runtime-internal/hooks/useGameView.ts +9 -0
- package/src/runtime-internal/hooks/useInteractionByKey.ts +354 -0
- package/src/runtime-internal/hooks/useInteractionHandle.ts +438 -0
- package/src/runtime-internal/hooks/useIsMyTurn.ts +20 -0
- package/src/runtime-internal/hooks/useLobby.ts +76 -0
- package/src/runtime-internal/hooks/useMe.ts +48 -0
- package/src/runtime-internal/hooks/usePlayerInfo.ts +28 -0
- package/src/runtime-internal/hooks/usePlayerTurnOrder.ts +23 -0
- package/src/runtime-internal/hooks/usePluginRuntime.ts +147 -0
- package/src/runtime-internal/hooks/useSeatInbox.ts +61 -0
- package/src/runtime-internal/hooks/useSimultaneousPhase.ts +10 -0
- package/src/runtime-internal/index.ts +42 -0
- package/src/runtime-internal/internal.ts +43 -0
- package/src/runtime-internal/plugin-styles.css +250 -0
- package/src/runtime-internal/primitives/board.tsx +459 -0
- package/src/runtime-internal/primitives/dialog-lifecycle.ts +58 -0
- package/src/runtime-internal/primitives/dice.tsx +79 -0
- package/src/runtime-internal/primitives/game-ui-provider.tsx +35 -0
- package/src/runtime-internal/primitives/game.tsx +387 -0
- package/src/runtime-internal/primitives/hand-intent-adapter.ts +147 -0
- package/src/runtime-internal/primitives/hand-surface.tsx +594 -0
- package/src/runtime-internal/primitives/index.ts +196 -0
- package/src/runtime-internal/primitives/interaction-form-binding.tsx +56 -0
- package/src/runtime-internal/primitives/interaction-submit.ts +90 -0
- package/src/runtime-internal/primitives/interaction.tsx +987 -0
- package/src/runtime-internal/primitives/phase.tsx +43 -0
- package/src/runtime-internal/primitives/player-roster.tsx +302 -0
- package/src/runtime-internal/primitives/primitive-props.tsx +101 -0
- package/src/runtime-internal/primitives/prompt.tsx +255 -0
- package/src/runtime-internal/primitives/ui.tsx +60 -0
- package/src/runtime-internal/primitives/zone.tsx +791 -0
- package/src/runtime-internal/reducer.ts +30 -0
- package/src/runtime-internal/runtime/createPluginRuntimeAPI.ts +605 -0
- package/src/runtime-internal/types/plugin-state.ts +508 -0
- package/src/runtime-internal/types/reducer-state.ts +24 -0
- package/src/runtime-internal/types/runtime-api.ts +114 -0
- package/src/runtime-internal/ui-contract.ts +519 -0
- package/src/runtime-internal/utils/card-intent-adapter.ts +546 -0
- package/src/runtime-internal/utils/interaction-inputs.ts +492 -0
- package/src/runtime-internal/utils/interaction-labels.ts +23 -0
- package/src/runtime-internal/utils/interaction-router.ts +273 -0
- package/src/runtime-internal/utils/interaction-status.ts +74 -0
- package/src/runtime-internal/workspace-contract.ts +1170 -0
- package/src/runtime.ts +34 -0
- package/src/testing/create-expect-api.ts +352 -0
- package/src/testing/create-test-runtime.ts +381 -0
- package/src/testing/definitions.ts +127 -0
- package/src/testing/index.ts +3 -0
- package/src/testing.ts +1 -0
- package/src/type-stubs/manifest-contract.d.ts +42 -0
- package/src/type-stubs/manifest-contract.js +72 -0
- package/src/type-stubs/ui-contract.d.ts +5 -0
- package/src/type-stubs/ui-contract.js +1 -0
- package/src/types/authoring-card-properties.type-test.ts +266 -0
- package/src/types/authoring.ts +1282 -0
- package/src/types/cards.ts +19 -0
- package/src/types/contracts.ts +1550 -0
- package/src/types/generated-helpers.ts +35 -0
- package/src/types/index.ts +147 -0
- package/src/types/slots.ts +11 -0
- package/src/types.ts +1 -0
- package/src/ui/components/ActionButton.tsx +97 -0
- package/src/ui/components/ActionPanel.tsx +315 -0
- package/src/ui/components/Card.tsx +378 -0
- package/src/ui/components/CardDragSurface.tsx +1076 -0
- package/src/ui/components/ChromeSuppressionContext.tsx +70 -0
- package/src/ui/components/CostDisplay.tsx +145 -0
- package/src/ui/components/DiceRoller.tsx +581 -0
- package/src/ui/components/Drawer.tsx +180 -0
- package/src/ui/components/ErrorBoundary.tsx +275 -0
- package/src/ui/components/GameEndDisplay.tsx +398 -0
- package/src/ui/components/GameSkeleton.tsx +260 -0
- package/src/ui/components/Hand.tsx +468 -0
- package/src/ui/components/HandDock.tsx +299 -0
- package/src/ui/components/HandView.tsx +441 -0
- package/src/ui/components/MobileHandTray.tsx +381 -0
- package/src/ui/components/MoreActions.tsx +143 -0
- package/src/ui/components/PhaseIndicator.tsx +341 -0
- package/src/ui/components/PlayArea.tsx +146 -0
- package/src/ui/components/PrimaryActionButton.tsx +336 -0
- package/src/ui/components/PrimaryButton.tsx +45 -0
- package/src/ui/components/ResourceCounter.tsx +270 -0
- package/src/ui/components/StagingZone.tsx +134 -0
- package/src/ui/components/ThemedButton.tsx +113 -0
- package/src/ui/components/Toast.tsx +264 -0
- package/src/ui/components/board/HexGrid.tsx +1294 -0
- package/src/ui/components/board/NetworkGraph.tsx +476 -0
- package/src/ui/components/board/SlotSystem.tsx +388 -0
- package/src/ui/components/board/SquareGrid.tsx +1165 -0
- package/src/ui/components/board/TrackBoard.tsx +496 -0
- package/src/ui/components/board/ZoneMap.tsx +448 -0
- package/src/ui/components/board/hex-board-view.ts +123 -0
- package/src/ui/components/board/index.ts +142 -0
- package/src/ui/components/board/interaction-accessibility.ts +21 -0
- package/src/ui/components/board/target-layer.ts +66 -0
- package/src/ui/components/card-render-content.type-test.ts +27 -0
- package/src/ui/components/hand-layout-math.ts +163 -0
- package/src/ui/components/hand-pointer-engine.ts +413 -0
- package/src/ui/components/index.ts +245 -0
- package/src/ui/components.ts +1 -0
- package/src/ui/defaults/components.tsx +106 -0
- package/src/ui/defaults/index.ts +8 -0
- package/src/ui/defaults.ts +1 -0
- package/src/ui/errors/ValidationError.ts +29 -0
- package/src/ui/helpers/cards.ts +19 -0
- package/src/ui/helpers/track-board.ts +211 -0
- package/src/ui/hooks/useBoardTopology.ts +316 -0
- package/src/ui/hooks/useCards.ts +10 -0
- package/src/ui/hooks/useHandCardPointer.ts +381 -0
- package/src/ui/hooks/useHandLayout.ts +378 -0
- package/src/ui/hooks/useHandPresentation.ts +121 -0
- package/src/ui/hooks/useHexBoard.ts +74 -0
- package/src/ui/hooks/useHexGrid.ts +185 -0
- package/src/ui/hooks/useIsMobile.ts +35 -0
- package/src/ui/hooks/usePanZoom.ts +278 -0
- package/src/ui/hooks/useSquareBoard.ts +124 -0
- package/src/ui/hooks/useSquareGrid.ts +328 -0
- package/src/ui/index.ts +98 -0
- package/src/ui/internal/ui/alert.tsx +51 -0
- package/src/ui/internal/ui/button.tsx +58 -0
- package/src/ui/internal/ui/dialog.tsx +134 -0
- package/src/ui/internal/ui/input.tsx +21 -0
- package/src/ui/internal/ui/label.tsx +21 -0
- package/src/ui/internal/ui/select.tsx +129 -0
- package/src/ui/internal/ui/tooltip.tsx +54 -0
- package/src/ui/internal/ui/utils.ts +5 -0
- package/src/ui/plugin-styles.css +250 -0
- package/src/ui/primitives/dialog-lifecycle.ts +58 -0
- package/src/ui/primitives/dice.tsx +79 -0
- package/src/ui/primitives/primitive-props.tsx +101 -0
- package/src/ui/theme/ThemeProvider.tsx +252 -0
- package/src/ui/theme/board.ts +61 -0
- package/src/ui/theme/css-vars.ts +105 -0
- package/src/ui/theme/derive.ts +240 -0
- package/src/ui/theme/index.ts +61 -0
- package/src/ui/theme/presets/arcade.ts +261 -0
- package/src/ui/theme/presets/studio.ts +261 -0
- package/src/ui/theme/presets/tabletop.ts +266 -0
- package/src/ui/theme/tokens.ts +392 -0
- package/src/ui/types/hex-color.ts +20 -0
- package/src/ui/types/player-state.ts +463 -0
- package/src/ui/types/tiled-board.ts +785 -0
- package/src/ui/types/visual-state.ts +137 -0
- package/src/ui.ts +1 -0
|
@@ -0,0 +1,101 @@
|
|
|
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
|
+
/**
|
|
22
|
+
* Plugin session state
|
|
23
|
+
*/
|
|
24
|
+
interface PluginSessionState {
|
|
25
|
+
/** Session initialization status */
|
|
26
|
+
status: "loading" | "ready";
|
|
27
|
+
/** Current session ID (null if not initialized) */
|
|
28
|
+
sessionId: string | null;
|
|
29
|
+
/** Player IDs that this user can control (immutable after game starts) */
|
|
30
|
+
controllablePlayerIds: PlayerId[];
|
|
31
|
+
/** The currently selected player ID that the user is controlling */
|
|
32
|
+
controllingPlayerId: PlayerId | null;
|
|
33
|
+
/** User ID of the controller (null if not initialized) */
|
|
34
|
+
userId: string | null;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* RuntimeAPI provides the interface between plugin code and the game runtime.
|
|
38
|
+
* This API is exposed to plugin iframes for subscribing to game events and submitting actions.
|
|
39
|
+
*/
|
|
40
|
+
interface RuntimeAPI {
|
|
41
|
+
/**
|
|
42
|
+
* Validate a player interaction before submitting it. `params` is typed
|
|
43
|
+
* as `unknown` because a `promptInput` collector can declare a scalar
|
|
44
|
+
* response schema (`z.enum([...])`, `z.string()`, `z.number()`, ...)
|
|
45
|
+
* while ordinary collectors pass an object.
|
|
46
|
+
*
|
|
47
|
+
* @param playerId - ID of the player performing the interaction
|
|
48
|
+
* @param interactionId - Identifier of the interaction
|
|
49
|
+
* @param params - Interaction-specific payload
|
|
50
|
+
* @returns Promise that resolves with validation result
|
|
51
|
+
*/
|
|
52
|
+
validateInteraction: (playerId: PlayerId, interactionId: string, params: unknown) => Promise<ValidationResult>;
|
|
53
|
+
/**
|
|
54
|
+
* Submit a player interaction to the game server. `submitInteraction`
|
|
55
|
+
* is the single submission verb for every interaction kind — authors
|
|
56
|
+
* do not split between "action" and "prompt response" calls.
|
|
57
|
+
*
|
|
58
|
+
* @param playerId - ID of the player performing the interaction
|
|
59
|
+
* @param interactionId - Identifier of the interaction
|
|
60
|
+
* @param params - Interaction-specific payload (see
|
|
61
|
+
* {@link validateInteraction} for the `unknown` typing rationale)
|
|
62
|
+
* @throws SubmissionError if submission is rejected by the authority.
|
|
63
|
+
*/
|
|
64
|
+
submitInteraction: (playerId: PlayerId, interactionId: string, params: unknown) => Promise<void>;
|
|
65
|
+
/**
|
|
66
|
+
* Get the current plugin session state.
|
|
67
|
+
* Returns initialization status and session/player IDs.
|
|
68
|
+
*
|
|
69
|
+
* @returns Current plugin session state
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```typescript
|
|
73
|
+
* const { status, sessionId, playerId } = runtime.getSessionState();
|
|
74
|
+
* if (status === "ready") {
|
|
75
|
+
* console.log('Connected to session:', sessionId);
|
|
76
|
+
* }
|
|
77
|
+
* ```
|
|
78
|
+
*/
|
|
79
|
+
getSessionState: () => PluginSessionState;
|
|
80
|
+
/**
|
|
81
|
+
* Disconnect from the runtime and clean up all listeners.
|
|
82
|
+
* Should be called when the plugin is unmounting.
|
|
83
|
+
*/
|
|
84
|
+
disconnect: () => void;
|
|
85
|
+
/**
|
|
86
|
+
* Request to switch to a different player.
|
|
87
|
+
* Only works if the user controls multiple seats.
|
|
88
|
+
* The parent window will handle the switch and update the session state.
|
|
89
|
+
*
|
|
90
|
+
* @param playerId - ID of the player to switch to
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* ```typescript
|
|
94
|
+
* // Switch to player-2
|
|
95
|
+
* runtime.switchPlayer?.('player-2');
|
|
96
|
+
* ```
|
|
97
|
+
*/
|
|
98
|
+
switchPlayer?: (playerId: PlayerId) => void;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export type { PlayerId as P, RuntimeAPI as R, SubmissionError as S, ValidationResult as V, PluginSessionState as a };
|
|
@@ -0,0 +1,379 @@
|
|
|
1
|
+
import { P as PlayerId } from './runtime-api-3dshj6kK.js';
|
|
2
|
+
import { H as HexColor } from './hex-color-MhOyuY-o.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Plugin State Types
|
|
6
|
+
*
|
|
7
|
+
* These types define the state structure that the host app sends to the plugin
|
|
8
|
+
* via state-sync messages. The plugin uses these types to access pre-computed
|
|
9
|
+
* game state without needing to parse raw SSE messages.
|
|
10
|
+
*/
|
|
11
|
+
type ActionName = string;
|
|
12
|
+
interface SeatAssignment {
|
|
13
|
+
playerId: PlayerId;
|
|
14
|
+
controllerUserId?: string;
|
|
15
|
+
displayName: string;
|
|
16
|
+
playerColor?: HexColor;
|
|
17
|
+
isHost?: boolean;
|
|
18
|
+
}
|
|
19
|
+
interface HistoryEntrySummary {
|
|
20
|
+
id: string;
|
|
21
|
+
version: number;
|
|
22
|
+
timestamp: string;
|
|
23
|
+
description: string;
|
|
24
|
+
playerId?: PlayerId;
|
|
25
|
+
actionType?: ActionName;
|
|
26
|
+
isCurrent: boolean;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Lobby state for the pre-game lobby phase
|
|
30
|
+
*/
|
|
31
|
+
interface LobbyState {
|
|
32
|
+
/** Current seat assignments in the lobby */
|
|
33
|
+
seats: SeatAssignment[];
|
|
34
|
+
/** Whether the game can be started (all seats filled) */
|
|
35
|
+
canStart: boolean;
|
|
36
|
+
/** User ID of the session host */
|
|
37
|
+
hostUserId: string;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Notification types that get queued for the plugin
|
|
41
|
+
*/
|
|
42
|
+
type NotificationType = "YOUR_TURN" | "PROMPT_OPENED" | "ACTION_EXECUTED" | "ACTION_REJECTED" | "TURN_CHANGED" | "STATE_CHANGED" | "GAME_ENDED" | "ERROR";
|
|
43
|
+
/**
|
|
44
|
+
* YOUR_TURN notification payload
|
|
45
|
+
*/
|
|
46
|
+
interface YourTurnPayload {
|
|
47
|
+
type: "YOUR_TURN";
|
|
48
|
+
activePlayers: PlayerId[];
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* PROMPT_OPENED notification payload
|
|
52
|
+
*/
|
|
53
|
+
interface PromptOpenedPayload {
|
|
54
|
+
type: "PROMPT_OPENED";
|
|
55
|
+
promptId: string;
|
|
56
|
+
promptInstanceId: string;
|
|
57
|
+
targetPlayer: PlayerId;
|
|
58
|
+
title?: string;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* ACTION_EXECUTED notification payload
|
|
62
|
+
*/
|
|
63
|
+
interface ActionExecutedPayload {
|
|
64
|
+
type: "ACTION_EXECUTED";
|
|
65
|
+
playerId: PlayerId;
|
|
66
|
+
actionType: string;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* ACTION_REJECTED notification payload
|
|
70
|
+
*/
|
|
71
|
+
interface ActionRejectedPayload {
|
|
72
|
+
type: "ACTION_REJECTED";
|
|
73
|
+
reason: string;
|
|
74
|
+
targetPlayer?: string;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* STATE_CHANGED notification payload
|
|
78
|
+
*/
|
|
79
|
+
interface StateChangedPayload {
|
|
80
|
+
type: "STATE_CHANGED";
|
|
81
|
+
newState: string;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* TURN_CHANGED notification payload
|
|
85
|
+
*/
|
|
86
|
+
interface TurnChangedPayload {
|
|
87
|
+
type: "TURN_CHANGED";
|
|
88
|
+
previousPlayers: PlayerId[];
|
|
89
|
+
currentPlayers: PlayerId[];
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* GAME_ENDED notification payload
|
|
93
|
+
*/
|
|
94
|
+
interface GameEndedPayload {
|
|
95
|
+
type: "GAME_ENDED";
|
|
96
|
+
winner?: string;
|
|
97
|
+
finalScores: Record<string, number>;
|
|
98
|
+
reason: string;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* ERROR notification payload
|
|
102
|
+
*/
|
|
103
|
+
interface ErrorPayload {
|
|
104
|
+
type: "ERROR";
|
|
105
|
+
message: string;
|
|
106
|
+
code?: string;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Union of all notification payloads
|
|
110
|
+
*/
|
|
111
|
+
type NotificationPayload = YourTurnPayload | PromptOpenedPayload | ActionExecutedPayload | ActionRejectedPayload | TurnChangedPayload | StateChangedPayload | GameEndedPayload | ErrorPayload;
|
|
112
|
+
/**
|
|
113
|
+
* Notification entry in the queue.
|
|
114
|
+
* Notifications are ephemeral events that the plugin can consume and mark as read.
|
|
115
|
+
*/
|
|
116
|
+
interface Notification {
|
|
117
|
+
/** Unique notification ID */
|
|
118
|
+
id: string;
|
|
119
|
+
/** Type of notification */
|
|
120
|
+
type: NotificationType;
|
|
121
|
+
/** Type-specific payload */
|
|
122
|
+
payload: NotificationPayload;
|
|
123
|
+
/** Timestamp when the notification was created */
|
|
124
|
+
timestamp: number;
|
|
125
|
+
/** Whether the plugin has marked this notification as read */
|
|
126
|
+
read: boolean;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Session state that gets synchronized to the plugin.
|
|
130
|
+
* This includes player switching info that was previously sent via
|
|
131
|
+
* separate player-switched messages.
|
|
132
|
+
*/
|
|
133
|
+
interface PluginSessionState {
|
|
134
|
+
/** Current session ID */
|
|
135
|
+
sessionId: string | null;
|
|
136
|
+
/** Player IDs that this user can control (immutable after game starts) */
|
|
137
|
+
controllablePlayerIds: PlayerId[];
|
|
138
|
+
/** The currently selected player ID that the user is controlling */
|
|
139
|
+
controllingPlayerId: PlayerId | null;
|
|
140
|
+
/** User ID of the controller */
|
|
141
|
+
userId: string | null;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* History state for the host's history navigator.
|
|
145
|
+
* Only sent to the host user.
|
|
146
|
+
*/
|
|
147
|
+
interface HistoryState {
|
|
148
|
+
/** List of history entries (newest first when displayed) */
|
|
149
|
+
entries: HistoryEntrySummary[];
|
|
150
|
+
/** Index of the current state in the history */
|
|
151
|
+
currentIndex: number;
|
|
152
|
+
/** Whether there are earlier states to restore to */
|
|
153
|
+
canGoBack: boolean;
|
|
154
|
+
/** Whether there are later states to restore to */
|
|
155
|
+
canGoForward: boolean;
|
|
156
|
+
}
|
|
157
|
+
/** Choice option surfaced on a prompt-kind interaction's structured context. */
|
|
158
|
+
interface InteractionContextOption {
|
|
159
|
+
id: string;
|
|
160
|
+
label?: string;
|
|
161
|
+
}
|
|
162
|
+
/** Structured context attached to a prompt-kind InteractionDescriptor. */
|
|
163
|
+
interface InteractionContext {
|
|
164
|
+
/** Addressed player id. */
|
|
165
|
+
to: string;
|
|
166
|
+
title?: string;
|
|
167
|
+
/** Authored prompt payload. Shape is defined by the game's prompt schema. */
|
|
168
|
+
payload?: Record<string, unknown>;
|
|
169
|
+
/** Selectable options for choice-kind prompts. */
|
|
170
|
+
options?: readonly InteractionContextOption[];
|
|
171
|
+
}
|
|
172
|
+
type InteractionCommitPolicy = {
|
|
173
|
+
mode: "manual";
|
|
174
|
+
} | {
|
|
175
|
+
mode: "autoWhenReady";
|
|
176
|
+
};
|
|
177
|
+
type InputSelection = {
|
|
178
|
+
mode: "single";
|
|
179
|
+
} | {
|
|
180
|
+
mode: "many";
|
|
181
|
+
min: number;
|
|
182
|
+
max?: number;
|
|
183
|
+
distinct?: boolean;
|
|
184
|
+
};
|
|
185
|
+
type InputDomain = CardTargetDomain | BoardTargetDomain | ResourceMapDomain | BoundedNumberDomain | ChoiceDomain | ChoiceListDomain;
|
|
186
|
+
type InputDomainResolver = EagerInputDomainDependencies | LazyInputDomainDependencies;
|
|
187
|
+
interface EagerInputDomainDependencies {
|
|
188
|
+
mode: "eager";
|
|
189
|
+
dependentCases: readonly InputDomainDependencyCase[];
|
|
190
|
+
}
|
|
191
|
+
interface LazyInputDomainDependencies {
|
|
192
|
+
mode: "lazy";
|
|
193
|
+
dependsOn: readonly string[];
|
|
194
|
+
resolver: {
|
|
195
|
+
interactionKey?: string;
|
|
196
|
+
inputKey: string;
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
interface ResolvedCardTargetDomain {
|
|
200
|
+
type: "cardTarget";
|
|
201
|
+
projection: "resolved";
|
|
202
|
+
zoneId?: string;
|
|
203
|
+
zoneIds?: readonly string[];
|
|
204
|
+
eligibleTargets: readonly string[];
|
|
205
|
+
selection?: InputSelection;
|
|
206
|
+
dependencies?: InputDomainResolver;
|
|
207
|
+
}
|
|
208
|
+
interface LazyCardTargetDomain {
|
|
209
|
+
type: "cardTarget";
|
|
210
|
+
projection: "lazy";
|
|
211
|
+
zoneId?: string;
|
|
212
|
+
zoneIds?: readonly string[];
|
|
213
|
+
selection?: InputSelection;
|
|
214
|
+
dependencies: LazyInputDomainDependencies;
|
|
215
|
+
}
|
|
216
|
+
type CardTargetDomain = ResolvedCardTargetDomain | LazyCardTargetDomain;
|
|
217
|
+
interface ResolvedBoardTargetDomain {
|
|
218
|
+
type: "boardTarget";
|
|
219
|
+
projection: "resolved";
|
|
220
|
+
targetKind: string;
|
|
221
|
+
boardId?: string;
|
|
222
|
+
eligibleTargets: readonly string[];
|
|
223
|
+
selection?: InputSelection;
|
|
224
|
+
dependencies?: InputDomainResolver;
|
|
225
|
+
}
|
|
226
|
+
interface LazyBoardTargetDomain {
|
|
227
|
+
type: "boardTarget";
|
|
228
|
+
projection: "lazy";
|
|
229
|
+
targetKind: string;
|
|
230
|
+
boardId?: string;
|
|
231
|
+
selection?: InputSelection;
|
|
232
|
+
dependencies: LazyInputDomainDependencies;
|
|
233
|
+
}
|
|
234
|
+
type BoardTargetDomain = ResolvedBoardTargetDomain | LazyBoardTargetDomain;
|
|
235
|
+
interface ResourceMapDomain {
|
|
236
|
+
type: "resourceMap";
|
|
237
|
+
resources?: ReadonlyArray<{
|
|
238
|
+
resourceId: string;
|
|
239
|
+
label?: string;
|
|
240
|
+
icon?: string;
|
|
241
|
+
min: number;
|
|
242
|
+
max: number;
|
|
243
|
+
}>;
|
|
244
|
+
dependencies?: InputDomainResolver;
|
|
245
|
+
}
|
|
246
|
+
interface BoundedNumberDomain {
|
|
247
|
+
type: "boundedNumber";
|
|
248
|
+
min?: number;
|
|
249
|
+
max?: number;
|
|
250
|
+
step?: number;
|
|
251
|
+
dependencies?: InputDomainResolver;
|
|
252
|
+
}
|
|
253
|
+
interface ChoiceDomain {
|
|
254
|
+
type: "choice";
|
|
255
|
+
choices?: readonly InteractionChoiceOption[];
|
|
256
|
+
selection?: InputSelection;
|
|
257
|
+
dependencies?: InputDomainResolver;
|
|
258
|
+
}
|
|
259
|
+
interface ChoiceListDomain {
|
|
260
|
+
type: "choiceList";
|
|
261
|
+
choices?: readonly InteractionChoiceOption[];
|
|
262
|
+
min?: number;
|
|
263
|
+
max?: number;
|
|
264
|
+
selection?: InputSelection;
|
|
265
|
+
dependencies?: InputDomainResolver;
|
|
266
|
+
}
|
|
267
|
+
interface InputDomainDependencyCase {
|
|
268
|
+
when: Readonly<Record<string, string>>;
|
|
269
|
+
domain: InputDomain;
|
|
270
|
+
}
|
|
271
|
+
interface InteractionChoiceOption {
|
|
272
|
+
value: string | null;
|
|
273
|
+
label: string;
|
|
274
|
+
icon?: string;
|
|
275
|
+
badge?: string;
|
|
276
|
+
description?: string;
|
|
277
|
+
disabled?: boolean;
|
|
278
|
+
disabledReason?: string;
|
|
279
|
+
}
|
|
280
|
+
interface InteractionInputDescriptor {
|
|
281
|
+
key: string;
|
|
282
|
+
kind: string;
|
|
283
|
+
domain: InputDomain;
|
|
284
|
+
defaultValue?: unknown;
|
|
285
|
+
}
|
|
286
|
+
type InteractionAvailability = {
|
|
287
|
+
status: "available";
|
|
288
|
+
} | {
|
|
289
|
+
status: "notYourTurn";
|
|
290
|
+
reason: string;
|
|
291
|
+
} | {
|
|
292
|
+
status: "insufficientResources";
|
|
293
|
+
reason: string;
|
|
294
|
+
missingResources: Readonly<Record<string, number>>;
|
|
295
|
+
} | {
|
|
296
|
+
status: "blocked";
|
|
297
|
+
reason: string;
|
|
298
|
+
code?: string;
|
|
299
|
+
};
|
|
300
|
+
interface InteractionDescriptorBase<Key extends string = string> {
|
|
301
|
+
phaseName: string;
|
|
302
|
+
interactionKey: Key;
|
|
303
|
+
interactionId: string;
|
|
304
|
+
/** Draft commit policy. Always materialized by the trusted reducer bundle. */
|
|
305
|
+
commit: InteractionCommitPolicy;
|
|
306
|
+
/** Source zone id for zone-scoped interactions (e.g., cardInput). */
|
|
307
|
+
zoneId?: string;
|
|
308
|
+
/** Source zone ids for zone-scoped interactions that span multiple zones. */
|
|
309
|
+
zoneIds?: readonly string[];
|
|
310
|
+
/** Ordered input descriptors. This is the canonical source for input keys, collector kind, and valid-value domains. */
|
|
311
|
+
inputs: readonly InteractionInputDescriptor[];
|
|
312
|
+
/** Resolved cost map keyed by resource id (if interaction declares one). */
|
|
313
|
+
cost?: Record<string, unknown>;
|
|
314
|
+
/** Snapshot of seat's currently available resources keyed by resource id. */
|
|
315
|
+
currentResources?: Record<string, unknown>;
|
|
316
|
+
/** Authoritative availability state for this descriptor. */
|
|
317
|
+
availability: InteractionAvailability;
|
|
318
|
+
}
|
|
319
|
+
type ActionInteractionDescriptor<Key extends string = string> = InteractionDescriptorBase<Key> & {
|
|
320
|
+
kind: "action";
|
|
321
|
+
};
|
|
322
|
+
type PromptInteractionDescriptor<Key extends string = string> = InteractionDescriptorBase<Key> & {
|
|
323
|
+
kind: "prompt";
|
|
324
|
+
/** Structured prompt context for prompt-kind interactions. */
|
|
325
|
+
context: InteractionContext;
|
|
326
|
+
};
|
|
327
|
+
type InteractionDescriptor<Key extends string = string> = ActionInteractionDescriptor<Key> | PromptInteractionDescriptor<Key>;
|
|
328
|
+
/**
|
|
329
|
+
* Per-player view of a single zone. Mirrors the ZoneHandles wire shape from
|
|
330
|
+
* the trusted bundle's resolveZoneHandles; `cardViewsById` is JSON-serialized
|
|
331
|
+
* `ViewCard` and `playableByCardId` lists the interactions that are playable
|
|
332
|
+
* on each card (eligibility already filtered by each interaction's validate).
|
|
333
|
+
*/
|
|
334
|
+
interface ZoneHandlesSnapshot<InteractionType extends string = string> {
|
|
335
|
+
cardIds: readonly string[];
|
|
336
|
+
cardViewsById: Readonly<Record<string, string>>;
|
|
337
|
+
playableByCardId: Readonly<Record<string, ReadonlyArray<InteractionDescriptor<InteractionType>>>>;
|
|
338
|
+
}
|
|
339
|
+
interface SimultaneousPhaseSnapshot {
|
|
340
|
+
phaseName: string;
|
|
341
|
+
interactionId: string;
|
|
342
|
+
actorIds: PlayerId[];
|
|
343
|
+
sealedPlayerIds: PlayerId[];
|
|
344
|
+
pendingPlayerIds: PlayerId[];
|
|
345
|
+
}
|
|
346
|
+
interface GameplaySnapshot<PhaseType extends string = string, StageType extends string = string, InteractionType extends string = string> {
|
|
347
|
+
currentPhase: PhaseType | null;
|
|
348
|
+
currentStage: StageType | null;
|
|
349
|
+
activePlayers: PlayerId[];
|
|
350
|
+
simultaneousPhase?: SimultaneousPhaseSnapshot | null;
|
|
351
|
+
availableInteractions: ReadonlyArray<InteractionDescriptor<InteractionType>>;
|
|
352
|
+
/**
|
|
353
|
+
* Zone handles scoped to the controlling player. Keyed by zoneId.
|
|
354
|
+
* Authored via phase `zones`; projected from `resolveZoneHandles`.
|
|
355
|
+
*/
|
|
356
|
+
zones: Readonly<Record<string, ZoneHandlesSnapshot<InteractionType>>>;
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* The complete state snapshot sent to the plugin via state-sync.
|
|
360
|
+
* This is the single source of truth for all reducer-native plugin state.
|
|
361
|
+
*/
|
|
362
|
+
interface PluginStateSnapshot<View = unknown, PhaseType extends string = string, StageType extends string = string, InteractionType extends string = string> {
|
|
363
|
+
/** Projected seat-specific reducer-native view for the controlling player */
|
|
364
|
+
view: View | null;
|
|
365
|
+
/** Gameplay transport state that sits alongside the projected reducer view */
|
|
366
|
+
gameplay: GameplaySnapshot<PhaseType, StageType, InteractionType>;
|
|
367
|
+
/** Lobby state (from LOBBY_UPDATE) - null if game has started */
|
|
368
|
+
lobby: LobbyState | null;
|
|
369
|
+
/** Notification queue (from YOUR_TURN, ACTION_REJECTED, PROMPT_OPENED, etc.) */
|
|
370
|
+
notifications: Notification[];
|
|
371
|
+
/** Session state (includes controllingPlayerId for player switching) */
|
|
372
|
+
session: PluginSessionState;
|
|
373
|
+
/** History state for host navigation (null if not host or history disabled) */
|
|
374
|
+
history: HistoryState | null;
|
|
375
|
+
/** Monotonic sync ID for acknowledgment tracking */
|
|
376
|
+
syncId: number;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
export type { GameplaySnapshot as G, InputDomain as I, PluginStateSnapshot as P, ZoneHandlesSnapshot as Z, InteractionDescriptor as a, InteractionInputDescriptor as b };
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { b3 as UIContract$1, A as DreamboardUI$1, b1 as TypedGame$1 } from './ui-contract-iQfTtUSL.js';
|
|
2
|
+
export { a as InteractionDescriptor } from './runtime-api-DWxvTr-O.js';
|
|
3
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
+
import react__default from 'react';
|
|
5
|
+
import './hex-board-view-D_07hO6O.js';
|
|
6
|
+
import './ui/types/player-state.js';
|
|
7
|
+
import './cards-Sl3b40Mv.js';
|
|
8
|
+
import './hex-color-MhOyuY-o.js';
|
|
9
|
+
import './ThemeProvider-fy0_QzgO.js';
|
|
10
|
+
import './runtime-api-3dshj6kK.js';
|
|
11
|
+
|
|
12
|
+
interface PluginRuntimeProps {
|
|
13
|
+
/** Child components to render after state sync has started */
|
|
14
|
+
children: react__default.ReactNode;
|
|
15
|
+
/**
|
|
16
|
+
* Timeout in milliseconds to wait for the first state-sync snapshot.
|
|
17
|
+
* @default 10000 (10 seconds)
|
|
18
|
+
*/
|
|
19
|
+
timeout?: number;
|
|
20
|
+
/** Custom loading component to show while waiting for state sync */
|
|
21
|
+
loadingComponent?: react__default.ReactNode;
|
|
22
|
+
/** Custom error component to show when initialization fails */
|
|
23
|
+
errorComponent?: (error: string) => react__default.ReactNode;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* PluginRuntime provides the RuntimeContext for plugin components.
|
|
27
|
+
*
|
|
28
|
+
* This component:
|
|
29
|
+
* - Creates a RuntimeAPI instance using the SDK-provided implementation
|
|
30
|
+
* - Waits for the first reducer-native state-sync snapshot before rendering children
|
|
31
|
+
* - Provides RuntimeAPI and session state to all child components
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```tsx
|
|
35
|
+
* // In your plugin's index.tsx
|
|
36
|
+
* import { PluginRuntime } from "./components/dreamboard";
|
|
37
|
+
* import App from './App';
|
|
38
|
+
*
|
|
39
|
+
* ReactDOM.createRoot(document.getElementById('root')!).render(
|
|
40
|
+
* <PluginRuntime>
|
|
41
|
+
* <App />
|
|
42
|
+
* </PluginRuntime>
|
|
43
|
+
* );
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
declare function PluginRuntime({ children, timeout, loadingComponent, errorComponent, }: PluginRuntimeProps): react_jsx_runtime.JSX.Element;
|
|
47
|
+
|
|
48
|
+
interface DreamboardUIRegister {
|
|
49
|
+
}
|
|
50
|
+
type UIContract = UIContract$1;
|
|
51
|
+
type RegisteredUIContract = DreamboardUIRegister extends {
|
|
52
|
+
ui: infer Registered extends UIContract;
|
|
53
|
+
} ? Registered : UIContract;
|
|
54
|
+
type RegisteredUI = RegisteredUIContract;
|
|
55
|
+
type DreamboardUI<Contract extends UIContract = RegisteredUI> = DreamboardUI$1<Contract>;
|
|
56
|
+
type TypedGame<Contract extends UIContract, View = unknown, Player extends string = string, Phase extends string = string> = TypedGame$1<Contract, View, Player, Phase>;
|
|
57
|
+
|
|
58
|
+
export { type DreamboardUI, type DreamboardUIRegister, PluginRuntime, type PluginRuntimeProps, type RegisteredUI, type TypedGame, type UIContract };
|
package/dist/runtime.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import {
|
|
2
|
+
PluginRuntime
|
|
3
|
+
} from "./chunk-7YAHLYBR.js";
|
|
4
|
+
import "./chunk-U5C6BONG.js";
|
|
5
|
+
import "./chunk-TDSWKVZ4.js";
|
|
6
|
+
import "./chunk-KAELH4KC.js";
|
|
7
|
+
import "./chunk-WYPQ3GG5.js";
|
|
8
|
+
import "./chunk-VDXOF4FW.js";
|
|
9
|
+
import "./chunk-PZ5AY32C.js";
|
|
10
|
+
export {
|
|
11
|
+
PluginRuntime
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=runtime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
interface ViewSlotOccupant<PieceIdValue extends string = string, PlayerIdValue extends string = string, SlotIdValue extends string = string, Data extends Record<string, unknown> = Record<string, unknown>> {
|
|
2
|
+
pieceId: PieceIdValue;
|
|
3
|
+
playerId: PlayerIdValue | null;
|
|
4
|
+
slotId: SlotIdValue;
|
|
5
|
+
data?: Data;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export type { ViewSlotOccupant as V };
|