@dreamboard-games/ui-sdk 0.0.41
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 +89 -0
- package/NOTICE +1 -0
- package/README.md +154 -0
- package/dist/components/ActionButton.d.ts +13 -0
- package/dist/components/ActionButton.d.ts.map +1 -0
- package/dist/components/ActionButton.js +14 -0
- package/dist/components/ActionPanel.d.ts +33 -0
- package/dist/components/ActionPanel.d.ts.map +1 -0
- package/dist/components/ActionPanel.js +148 -0
- package/dist/components/Card.d.ts +29 -0
- package/dist/components/Card.d.ts.map +1 -0
- package/dist/components/Card.js +220 -0
- package/dist/components/ChromeSuppressionContext.d.ts +7 -0
- package/dist/components/ChromeSuppressionContext.d.ts.map +1 -0
- package/dist/components/ChromeSuppressionContext.js +34 -0
- package/dist/components/CostDisplay.d.ts +22 -0
- package/dist/components/CostDisplay.d.ts.map +1 -0
- package/dist/components/CostDisplay.js +41 -0
- package/dist/components/DiceRoller.d.ts +30 -0
- package/dist/components/DiceRoller.d.ts.map +1 -0
- package/dist/components/DiceRoller.js +319 -0
- package/dist/components/Drawer.d.ts +19 -0
- package/dist/components/Drawer.d.ts.map +1 -0
- package/dist/components/Drawer.js +55 -0
- package/dist/components/ErrorBoundary.d.ts +24 -0
- package/dist/components/ErrorBoundary.d.ts.map +1 -0
- package/dist/components/ErrorBoundary.js +37 -0
- package/dist/components/GameEndDisplay.d.ts +27 -0
- package/dist/components/GameEndDisplay.d.ts.map +1 -0
- package/dist/components/GameEndDisplay.js +185 -0
- package/dist/components/GameSkeleton.d.ts +12 -0
- package/dist/components/GameSkeleton.d.ts.map +1 -0
- package/dist/components/GameSkeleton.js +54 -0
- package/dist/components/Hand.d.ts +99 -0
- package/dist/components/Hand.d.ts.map +1 -0
- package/dist/components/Hand.js +162 -0
- package/dist/components/HandDock.d.ts +35 -0
- package/dist/components/HandDock.d.ts.map +1 -0
- package/dist/components/HandDock.js +124 -0
- package/dist/components/InteractionForm.d.ts +50 -0
- package/dist/components/InteractionForm.d.ts.map +1 -0
- package/dist/components/InteractionForm.js +402 -0
- package/dist/components/MoreActions.d.ts +49 -0
- package/dist/components/MoreActions.d.ts.map +1 -0
- package/dist/components/MoreActions.js +64 -0
- package/dist/components/PhaseIndicator.d.ts +35 -0
- package/dist/components/PhaseIndicator.d.ts.map +1 -0
- package/dist/components/PhaseIndicator.js +212 -0
- package/dist/components/PlayArea.d.ts +28 -0
- package/dist/components/PlayArea.d.ts.map +1 -0
- package/dist/components/PlayArea.js +48 -0
- package/dist/components/PluginRuntime.d.ts +37 -0
- package/dist/components/PluginRuntime.d.ts.map +1 -0
- package/dist/components/PluginRuntime.js +47 -0
- package/dist/components/PrimaryActionButton.d.ts +98 -0
- package/dist/components/PrimaryActionButton.d.ts.map +1 -0
- package/dist/components/PrimaryActionButton.js +183 -0
- package/dist/components/PrimaryButton.d.ts +20 -0
- package/dist/components/PrimaryButton.d.ts.map +1 -0
- package/dist/components/PrimaryButton.js +5 -0
- package/dist/components/PromptDialogHost.d.ts +15 -0
- package/dist/components/PromptDialogHost.d.ts.map +1 -0
- package/dist/components/PromptDialogHost.js +22 -0
- package/dist/components/ResourceCounter.d.ts +38 -0
- package/dist/components/ResourceCounter.d.ts.map +1 -0
- package/dist/components/ResourceCounter.js +118 -0
- package/dist/components/ThemedButton.d.ts +12 -0
- package/dist/components/ThemedButton.d.ts.map +1 -0
- package/dist/components/ThemedButton.js +38 -0
- package/dist/components/Toast.d.ts +35 -0
- package/dist/components/Toast.d.ts.map +1 -0
- package/dist/components/Toast.js +116 -0
- package/dist/components/board/HexGrid.d.ts +344 -0
- package/dist/components/board/HexGrid.d.ts.map +1 -0
- package/dist/components/board/HexGrid.js +340 -0
- package/dist/components/board/NetworkGraph.d.ts +100 -0
- package/dist/components/board/NetworkGraph.d.ts.map +1 -0
- package/dist/components/board/NetworkGraph.js +123 -0
- package/dist/components/board/SlotSystem.d.ts +71 -0
- package/dist/components/board/SlotSystem.d.ts.map +1 -0
- package/dist/components/board/SlotSystem.js +87 -0
- package/dist/components/board/SquareGrid.d.ts +188 -0
- package/dist/components/board/SquareGrid.d.ts.map +1 -0
- package/dist/components/board/SquareGrid.js +328 -0
- package/dist/components/board/TrackBoard.d.ts +113 -0
- package/dist/components/board/TrackBoard.d.ts.map +1 -0
- package/dist/components/board/TrackBoard.js +135 -0
- package/dist/components/board/ZoneMap.d.ts +88 -0
- package/dist/components/board/ZoneMap.d.ts.map +1 -0
- package/dist/components/board/ZoneMap.js +133 -0
- package/dist/components/board/hex-board-view.d.ts +69 -0
- package/dist/components/board/hex-board-view.d.ts.map +1 -0
- package/dist/components/board/hex-board-view.js +60 -0
- package/dist/components/board/index.d.ts +23 -0
- package/dist/components/board/index.d.ts.map +1 -0
- package/dist/components/board/index.js +40 -0
- package/dist/components/board/interaction-accessibility.d.ts +5 -0
- package/dist/components/board/interaction-accessibility.d.ts.map +1 -0
- package/dist/components/board/interaction-accessibility.js +13 -0
- package/dist/components/board/target-layer.d.ts +13 -0
- package/dist/components/board/target-layer.d.ts.map +1 -0
- package/dist/components/board/target-layer.js +10 -0
- package/dist/components/card-render-content.type-test.d.ts +2 -0
- package/dist/components/card-render-content.type-test.d.ts.map +1 -0
- package/dist/components/card-render-content.type-test.js +1 -0
- package/dist/components/index.d.ts +34 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +35 -0
- package/dist/components/interaction-dialog-behavior.d.ts +15 -0
- package/dist/components/interaction-dialog-behavior.d.ts.map +1 -0
- package/dist/components/interaction-dialog-behavior.js +9 -0
- package/dist/components/surfaces/BlockerSurface.d.ts +27 -0
- package/dist/components/surfaces/BlockerSurface.d.ts.map +1 -0
- package/dist/components/surfaces/BlockerSurface.js +38 -0
- package/dist/components/surfaces/BoardSurface.d.ts +77 -0
- package/dist/components/surfaces/BoardSurface.d.ts.map +1 -0
- package/dist/components/surfaces/BoardSurface.js +180 -0
- package/dist/components/surfaces/ChromeSurface.d.ts +29 -0
- package/dist/components/surfaces/ChromeSurface.d.ts.map +1 -0
- package/dist/components/surfaces/ChromeSurface.js +34 -0
- package/dist/components/surfaces/ExhaustivenessAudit.d.ts +32 -0
- package/dist/components/surfaces/ExhaustivenessAudit.d.ts.map +1 -0
- package/dist/components/surfaces/ExhaustivenessAudit.js +65 -0
- package/dist/components/surfaces/InboxSurface.d.ts +40 -0
- package/dist/components/surfaces/InboxSurface.d.ts.map +1 -0
- package/dist/components/surfaces/InboxSurface.js +99 -0
- package/dist/components/surfaces/MarketSurface.d.ts +62 -0
- package/dist/components/surfaces/MarketSurface.d.ts.map +1 -0
- package/dist/components/surfaces/MarketSurface.js +242 -0
- package/dist/components/surfaces/PanelSurface.d.ts +111 -0
- package/dist/components/surfaces/PanelSurface.d.ts.map +1 -0
- package/dist/components/surfaces/PanelSurface.js +180 -0
- package/dist/components/surfaces/PlayerCardsSurface.d.ts +104 -0
- package/dist/components/surfaces/PlayerCardsSurface.d.ts.map +1 -0
- package/dist/components/surfaces/PlayerCardsSurface.js +178 -0
- package/dist/components/surfaces/internal/CardZoneFollowUpForm.d.ts +7 -0
- package/dist/components/surfaces/internal/CardZoneFollowUpForm.d.ts.map +1 -0
- package/dist/components/surfaces/internal/CardZoneFollowUpForm.js +9 -0
- package/dist/components/surfaces/internal/DefaultInteractionButton.d.ts +71 -0
- package/dist/components/surfaces/internal/DefaultInteractionButton.d.ts.map +1 -0
- package/dist/components/surfaces/internal/DefaultInteractionButton.js +82 -0
- package/dist/components/surfaces/internal/useCardZoneInteractions.d.ts +21 -0
- package/dist/components/surfaces/internal/useCardZoneInteractions.d.ts.map +1 -0
- package/dist/components/surfaces/internal/useCardZoneInteractions.js +202 -0
- package/dist/components/surfaces/types.d.ts +59 -0
- package/dist/components/surfaces/types.d.ts.map +1 -0
- package/dist/components/surfaces/types.js +1 -0
- package/dist/context/ClientParamSchemaContext.d.ts +21 -0
- package/dist/context/ClientParamSchemaContext.d.ts.map +1 -0
- package/dist/context/ClientParamSchemaContext.js +12 -0
- package/dist/context/InteractionDraftContext.d.ts +69 -0
- package/dist/context/InteractionDraftContext.d.ts.map +1 -0
- package/dist/context/InteractionDraftContext.js +145 -0
- package/dist/context/PluginSessionContext.d.ts +33 -0
- package/dist/context/PluginSessionContext.d.ts.map +1 -0
- package/dist/context/PluginSessionContext.js +38 -0
- package/dist/context/PluginStateContext.d.ts +116 -0
- package/dist/context/PluginStateContext.d.ts.map +1 -0
- package/dist/context/PluginStateContext.js +186 -0
- package/dist/context/RuntimeContext.d.ts +49 -0
- package/dist/context/RuntimeContext.d.ts.map +1 -0
- package/dist/context/RuntimeContext.js +67 -0
- package/dist/defaults/components.d.ts +52 -0
- package/dist/defaults/components.d.ts.map +1 -0
- package/dist/defaults/components.js +159 -0
- package/dist/defaults/index.d.ts +2 -0
- package/dist/defaults/index.d.ts.map +1 -0
- package/dist/defaults/index.js +1 -0
- package/dist/errors/ValidationError.d.ts +10 -0
- package/dist/errors/ValidationError.d.ts.map +1 -0
- package/dist/errors/ValidationError.js +23 -0
- package/dist/helpers/cards.d.ts +3 -0
- package/dist/helpers/cards.d.ts.map +1 -0
- package/dist/helpers/cards.js +11 -0
- package/dist/helpers/track-board.d.ts +79 -0
- package/dist/helpers/track-board.d.ts.map +1 -0
- package/dist/helpers/track-board.js +56 -0
- package/dist/hooks/useActivePlayers.d.ts +16 -0
- package/dist/hooks/useActivePlayers.d.ts.map +1 -0
- package/dist/hooks/useActivePlayers.js +17 -0
- package/dist/hooks/useBoardInteractions.d.ts +110 -0
- package/dist/hooks/useBoardInteractions.d.ts.map +1 -0
- package/dist/hooks/useBoardInteractions.js +248 -0
- package/dist/hooks/useBoardTopology.d.ts +23 -0
- package/dist/hooks/useBoardTopology.d.ts.map +1 -0
- package/dist/hooks/useBoardTopology.js +128 -0
- package/dist/hooks/useCards.d.ts +3 -0
- package/dist/hooks/useCards.d.ts.map +1 -0
- package/dist/hooks/useCards.js +5 -0
- package/dist/hooks/useGameSelector.d.ts +13 -0
- package/dist/hooks/useGameSelector.d.ts.map +1 -0
- package/dist/hooks/useGameSelector.js +67 -0
- package/dist/hooks/useGameView.d.ts +6 -0
- package/dist/hooks/useGameView.d.ts.map +1 -0
- package/dist/hooks/useGameView.js +7 -0
- package/dist/hooks/useHandLayout.d.ts +120 -0
- package/dist/hooks/useHandLayout.d.ts.map +1 -0
- package/dist/hooks/useHandLayout.js +235 -0
- package/dist/hooks/useHexBoard.d.ts +19 -0
- package/dist/hooks/useHexBoard.d.ts.map +1 -0
- package/dist/hooks/useHexBoard.js +28 -0
- package/dist/hooks/useHexGrid.d.ts +56 -0
- package/dist/hooks/useHexGrid.d.ts.map +1 -0
- package/dist/hooks/useHexGrid.js +112 -0
- package/dist/hooks/useInteractionByKey.d.ts +29 -0
- package/dist/hooks/useInteractionByKey.d.ts.map +1 -0
- package/dist/hooks/useInteractionByKey.js +263 -0
- package/dist/hooks/useInteractionHandle.d.ts +103 -0
- package/dist/hooks/useInteractionHandle.d.ts.map +1 -0
- package/dist/hooks/useInteractionHandle.js +254 -0
- package/dist/hooks/useIsMobile.d.ts +7 -0
- package/dist/hooks/useIsMobile.d.ts.map +1 -0
- package/dist/hooks/useIsMobile.js +29 -0
- package/dist/hooks/useIsMyTurn.d.ts +6 -0
- package/dist/hooks/useIsMyTurn.d.ts.map +1 -0
- package/dist/hooks/useIsMyTurn.js +11 -0
- package/dist/hooks/useLobby.d.ts +28 -0
- package/dist/hooks/useLobby.d.ts.map +1 -0
- package/dist/hooks/useLobby.js +60 -0
- package/dist/hooks/useMe.d.ts +11 -0
- package/dist/hooks/useMe.d.ts.map +1 -0
- package/dist/hooks/useMe.js +32 -0
- package/dist/hooks/usePanZoom.d.ts +113 -0
- package/dist/hooks/usePanZoom.d.ts.map +1 -0
- package/dist/hooks/usePanZoom.js +165 -0
- package/dist/hooks/usePlayerInfo.d.ts +4 -0
- package/dist/hooks/usePlayerInfo.d.ts.map +1 -0
- package/dist/hooks/usePlayerInfo.js +21 -0
- package/dist/hooks/usePlayerTurnOrder.d.ts +15 -0
- package/dist/hooks/usePlayerTurnOrder.d.ts.map +1 -0
- package/dist/hooks/usePlayerTurnOrder.js +22 -0
- package/dist/hooks/usePluginRuntime.d.ts +45 -0
- package/dist/hooks/usePluginRuntime.d.ts.map +1 -0
- package/dist/hooks/usePluginRuntime.js +92 -0
- package/dist/hooks/useSeatInbox.d.ts +22 -0
- package/dist/hooks/useSeatInbox.d.ts.map +1 -0
- package/dist/hooks/useSeatInbox.js +43 -0
- package/dist/hooks/useSimultaneousPhase.d.ts +7 -0
- package/dist/hooks/useSimultaneousPhase.d.ts.map +1 -0
- package/dist/hooks/useSimultaneousPhase.js +8 -0
- package/dist/hooks/useSquareBoard.d.ts +21 -0
- package/dist/hooks/useSquareBoard.d.ts.map +1 -0
- package/dist/hooks/useSquareBoard.js +67 -0
- package/dist/hooks/useSquareGrid.d.ts +96 -0
- package/dist/hooks/useSquareGrid.d.ts.map +1 -0
- package/dist/hooks/useSquareGrid.js +152 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +20 -0
- package/dist/internal/ui/alert.d.ts +8 -0
- package/dist/internal/ui/alert.d.ts.map +1 -0
- package/dist/internal/ui/alert.js +11 -0
- package/dist/internal/ui/button.d.ts +10 -0
- package/dist/internal/ui/button.d.ts.map +1 -0
- package/dist/internal/ui/button.js +21 -0
- package/dist/internal/ui/dialog.d.ts +16 -0
- package/dist/internal/ui/dialog.d.ts.map +1 -0
- package/dist/internal/ui/dialog.js +35 -0
- package/dist/internal/ui/input.d.ts +3 -0
- package/dist/internal/ui/input.d.ts.map +1 -0
- package/dist/internal/ui/input.js +5 -0
- package/dist/internal/ui/label.d.ts +4 -0
- package/dist/internal/ui/label.d.ts.map +1 -0
- package/dist/internal/ui/label.js +7 -0
- package/dist/internal/ui/select.d.ts +9 -0
- package/dist/internal/ui/select.d.ts.map +1 -0
- package/dist/internal/ui/select.js +23 -0
- package/dist/internal/ui/tooltip.d.ts +7 -0
- package/dist/internal/ui/tooltip.d.ts.map +1 -0
- package/dist/internal/ui/tooltip.js +16 -0
- package/dist/internal/ui/utils.d.ts +3 -0
- package/dist/internal/ui/utils.d.ts.map +1 -0
- package/dist/internal/ui/utils.js +4 -0
- package/dist/internal.d.ts +7 -0
- package/dist/internal.d.ts.map +1 -0
- package/dist/internal.js +4 -0
- package/dist/plugin-styles.css +246 -0
- package/dist/primitives/board.d.ts +29 -0
- package/dist/primitives/board.d.ts.map +1 -0
- package/dist/primitives/board.js +163 -0
- package/dist/primitives/game-ui-provider.d.ts +12 -0
- package/dist/primitives/game-ui-provider.d.ts.map +1 -0
- package/dist/primitives/game-ui-provider.js +7 -0
- package/dist/primitives/index.d.ts +8 -0
- package/dist/primitives/index.d.ts.map +1 -0
- package/dist/primitives/index.js +7 -0
- package/dist/primitives/interaction.d.ts +52 -0
- package/dist/primitives/interaction.d.ts.map +1 -0
- package/dist/primitives/interaction.js +250 -0
- package/dist/primitives/phase.d.ts +15 -0
- package/dist/primitives/phase.d.ts.map +1 -0
- package/dist/primitives/phase.js +18 -0
- package/dist/primitives/player-roster.d.ts +64 -0
- package/dist/primitives/player-roster.d.ts.map +1 -0
- package/dist/primitives/player-roster.js +149 -0
- package/dist/primitives/primitive-props.d.ts +15 -0
- package/dist/primitives/primitive-props.d.ts.map +1 -0
- package/dist/primitives/primitive-props.js +39 -0
- package/dist/primitives/prompt.d.ts +44 -0
- package/dist/primitives/prompt.d.ts.map +1 -0
- package/dist/primitives/prompt.js +101 -0
- package/dist/primitives/zone.d.ts +31 -0
- package/dist/primitives/zone.d.ts.map +1 -0
- package/dist/primitives/zone.js +58 -0
- package/dist/reducer.d.ts +21 -0
- package/dist/reducer.d.ts.map +1 -0
- package/dist/reducer.js +14 -0
- package/dist/runtime/createPluginRuntimeAPI.d.ts +67 -0
- package/dist/runtime/createPluginRuntimeAPI.d.ts.map +1 -0
- package/dist/runtime/createPluginRuntimeAPI.js +419 -0
- package/dist/theme/ThemeProvider.d.ts +98 -0
- package/dist/theme/ThemeProvider.d.ts.map +1 -0
- package/dist/theme/ThemeProvider.js +148 -0
- package/dist/theme/board.d.ts +42 -0
- package/dist/theme/board.d.ts.map +1 -0
- package/dist/theme/board.js +34 -0
- package/dist/theme/css-vars.d.ts +31 -0
- package/dist/theme/css-vars.d.ts.map +1 -0
- package/dist/theme/css-vars.js +88 -0
- package/dist/theme/derive.d.ts +66 -0
- package/dist/theme/derive.d.ts.map +1 -0
- package/dist/theme/derive.js +161 -0
- package/dist/theme/index.d.ts +22 -0
- package/dist/theme/index.d.ts.map +1 -0
- package/dist/theme/index.js +20 -0
- package/dist/theme/presets/arcade.d.ts +10 -0
- package/dist/theme/presets/arcade.d.ts.map +1 -0
- package/dist/theme/presets/arcade.js +257 -0
- package/dist/theme/presets/studio.d.ts +10 -0
- package/dist/theme/presets/studio.d.ts.map +1 -0
- package/dist/theme/presets/studio.js +257 -0
- package/dist/theme/presets/tabletop.d.ts +15 -0
- package/dist/theme/presets/tabletop.d.ts.map +1 -0
- package/dist/theme/presets/tabletop.js +262 -0
- package/dist/theme/tokens.d.ts +345 -0
- package/dist/theme/tokens.d.ts.map +1 -0
- package/dist/theme/tokens.js +57 -0
- package/dist/types/player-state.d.ts +337 -0
- package/dist/types/player-state.d.ts.map +1 -0
- package/dist/types/player-state.js +1 -0
- package/dist/types/plugin-state.d.ts +324 -0
- package/dist/types/plugin-state.d.ts.map +1 -0
- package/dist/types/plugin-state.js +1 -0
- package/dist/types/reducer-state.d.ts +10 -0
- package/dist/types/reducer-state.d.ts.map +1 -0
- package/dist/types/reducer-state.js +1 -0
- package/dist/types/runtime-api.d.ts +99 -0
- package/dist/types/runtime-api.d.ts.map +1 -0
- package/dist/types/runtime-api.js +1 -0
- package/dist/types/tiled-board.d.ts +187 -0
- package/dist/types/tiled-board.d.ts.map +1 -0
- package/dist/types/tiled-board.js +226 -0
- package/dist/ui-contract.d.ts +78 -0
- package/dist/ui-contract.d.ts.map +1 -0
- package/dist/ui-contract.js +15 -0
- package/dist/ui-sdk.d.ts +3409 -0
- package/dist/utils/interaction-inputs.d.ts +22 -0
- package/dist/utils/interaction-inputs.d.ts.map +1 -0
- package/dist/utils/interaction-inputs.js +219 -0
- package/dist/utils/interaction-labels.d.ts +4 -0
- package/dist/utils/interaction-labels.d.ts.map +1 -0
- package/dist/utils/interaction-labels.js +18 -0
- package/dist/utils/interaction-status.d.ts +15 -0
- package/dist/utils/interaction-status.d.ts.map +1 -0
- package/dist/utils/interaction-status.js +31 -0
- package/package.json +101 -0
- package/src/components/ActionButton.tsx +48 -0
- package/src/components/ActionPanel.tsx +310 -0
- package/src/components/Card.tsx +385 -0
- package/src/components/ChromeSuppressionContext.tsx +70 -0
- package/src/components/CostDisplay.test.tsx +23 -0
- package/src/components/CostDisplay.tsx +145 -0
- package/src/components/DiceRoller.tsx +601 -0
- package/src/components/Drawer.tsx +179 -0
- package/src/components/ErrorBoundary.tsx +119 -0
- package/src/components/GameEndDisplay.test.tsx +19 -0
- package/src/components/GameEndDisplay.tsx +398 -0
- package/src/components/GameSkeleton.tsx +260 -0
- package/src/components/Hand.tsx +387 -0
- package/src/components/HandDock.tsx +257 -0
- package/src/components/InteractionForm.test.tsx +303 -0
- package/src/components/InteractionForm.tsx +1029 -0
- package/src/components/MoreActions.test.tsx +93 -0
- package/src/components/MoreActions.tsx +143 -0
- package/src/components/PhaseIndicator.tsx +341 -0
- package/src/components/PlayArea.tsx +125 -0
- package/src/components/PluginRuntime.tsx +92 -0
- package/src/components/PrimaryActionButton.test.tsx +138 -0
- package/src/components/PrimaryActionButton.tsx +351 -0
- package/src/components/PrimaryButton.tsx +44 -0
- package/src/components/PromptDialogHost.tsx +92 -0
- package/src/components/ResourceCounter.test.tsx +29 -0
- package/src/components/ResourceCounter.tsx +275 -0
- package/src/components/ThemedButton.tsx +78 -0
- package/src/components/Toast.tsx +251 -0
- package/src/components/__fixtures__/ActionButton.fixture.tsx +234 -0
- package/src/components/__fixtures__/ActionPanel.fixture.tsx +298 -0
- package/src/components/__fixtures__/Card.fixture.tsx +185 -0
- package/src/components/__fixtures__/CostDisplay.fixture.tsx +156 -0
- package/src/components/__fixtures__/DiceRoller.fixture.tsx +435 -0
- package/src/components/__fixtures__/Drawer.fixture.tsx +113 -0
- package/src/components/__fixtures__/ErrorBoundary.fixture.tsx +82 -0
- package/src/components/__fixtures__/GameEndDisplay.fixture.tsx +188 -0
- package/src/components/__fixtures__/GameSkeleton.fixture.tsx +46 -0
- package/src/components/__fixtures__/Hand.fixture.tsx +522 -0
- package/src/components/__fixtures__/HexGrid.fixture.tsx +1181 -0
- package/src/components/__fixtures__/NetworkGraph.fixture.tsx +599 -0
- package/src/components/__fixtures__/PhaseIndicator.fixture.tsx +181 -0
- package/src/components/__fixtures__/PlayArea.fixture.tsx +221 -0
- package/src/components/__fixtures__/ResourceCounter.fixture.tsx +227 -0
- package/src/components/__fixtures__/SlotSystem.fixture.tsx +824 -0
- package/src/components/__fixtures__/SquareGrid.fixture.tsx +764 -0
- package/src/components/__fixtures__/Toast.fixture.tsx +97 -0
- package/src/components/__fixtures__/TrackBoard.fixture.tsx +685 -0
- package/src/components/__fixtures__/ZoneMap.fixture.tsx +754 -0
- package/src/components/board/HexGrid.tsx +1294 -0
- package/src/components/board/NetworkGraph.tsx +476 -0
- package/src/components/board/SlotSystem.tsx +339 -0
- package/src/components/board/SquareGrid.tsx +1165 -0
- package/src/components/board/TrackBoard.tsx +496 -0
- package/src/components/board/ZoneMap.tsx +448 -0
- package/src/components/board/hex-board-view.test.tsx +114 -0
- package/src/components/board/hex-board-view.ts +123 -0
- package/src/components/board/index.ts +142 -0
- package/src/components/board/interaction-accessibility.ts +21 -0
- package/src/components/board/target-layer-grids.test.tsx +420 -0
- package/src/components/board/target-layer.ts +30 -0
- package/src/components/card-render-content.type-test.ts +27 -0
- package/src/components/index.ts +208 -0
- package/src/components/interaction-dialog-behavior.test.ts +23 -0
- package/src/components/interaction-dialog-behavior.ts +22 -0
- package/src/components/surfaces/BlockerSurface.test.tsx +158 -0
- package/src/components/surfaces/BlockerSurface.tsx +127 -0
- package/src/components/surfaces/BoardSurface.tsx +340 -0
- package/src/components/surfaces/ChromeSurface.tsx +123 -0
- package/src/components/surfaces/ExhaustivenessAudit.tsx +91 -0
- package/src/components/surfaces/InboxSurface.test.tsx +149 -0
- package/src/components/surfaces/InboxSurface.tsx +245 -0
- package/src/components/surfaces/MarketSurface.tsx +544 -0
- package/src/components/surfaces/PanelSurface.test.tsx +496 -0
- package/src/components/surfaces/PanelSurface.tsx +458 -0
- package/src/components/surfaces/PlayerCardsSurface.tsx +525 -0
- package/src/components/surfaces/internal/CardZoneFollowUpForm.tsx +35 -0
- package/src/components/surfaces/internal/DefaultInteractionButton.tsx +219 -0
- package/src/components/surfaces/internal/useCardZoneInteractions.ts +311 -0
- package/src/components/surfaces/types.ts +100 -0
- package/src/context/ClientParamSchemaContext.tsx +44 -0
- package/src/context/InteractionDraftContext.tsx +204 -0
- package/src/context/PluginSessionContext.tsx +47 -0
- package/src/context/PluginStateContext.tsx +254 -0
- package/src/context/RuntimeContext.tsx +96 -0
- package/src/defaults/components.tsx +442 -0
- package/src/defaults/defaults.test.tsx +230 -0
- package/src/defaults/index.ts +1 -0
- package/src/errors/ValidationError.ts +29 -0
- package/src/helpers/cards.ts +19 -0
- package/src/helpers/track-board.ts +211 -0
- package/src/hooks/useActivePlayers.ts +19 -0
- package/src/hooks/useBoardInteractions.test.tsx +622 -0
- package/src/hooks/useBoardInteractions.ts +434 -0
- package/src/hooks/useBoardTopology.ts +316 -0
- package/src/hooks/useCards.test.tsx +129 -0
- package/src/hooks/useCards.ts +10 -0
- package/src/hooks/useGameSelector.ts +105 -0
- package/src/hooks/useGameView.ts +9 -0
- package/src/hooks/useHandLayout.ts +349 -0
- package/src/hooks/useHexBoard.ts +74 -0
- package/src/hooks/useHexGrid.ts +185 -0
- package/src/hooks/useInteractionByKey.ts +349 -0
- package/src/hooks/useInteractionHandle.ts +437 -0
- package/src/hooks/useIsMobile.ts +35 -0
- package/src/hooks/useIsMyTurn.test.tsx +99 -0
- package/src/hooks/useIsMyTurn.ts +15 -0
- package/src/hooks/useLobby.ts +76 -0
- package/src/hooks/useMe.ts +48 -0
- package/src/hooks/usePanZoom.ts +278 -0
- package/src/hooks/usePlayerInfo.ts +28 -0
- package/src/hooks/usePlayerTurnOrder.ts +23 -0
- package/src/hooks/usePluginRuntime.test.tsx +102 -0
- package/src/hooks/usePluginRuntime.ts +130 -0
- package/src/hooks/useSeatInbox.ts +61 -0
- package/src/hooks/useSimultaneousPhase.ts +10 -0
- package/src/hooks/useSquareBoard.ts +124 -0
- package/src/hooks/useSquareGrid.ts +328 -0
- package/src/index.test.ts +474 -0
- package/src/index.ts +148 -0
- package/src/internal/ui/alert.tsx +51 -0
- package/src/internal/ui/button.tsx +58 -0
- package/src/internal/ui/dialog.tsx +134 -0
- package/src/internal/ui/input.tsx +21 -0
- package/src/internal/ui/label.tsx +21 -0
- package/src/internal/ui/select.tsx +129 -0
- package/src/internal/ui/tooltip.tsx +54 -0
- package/src/internal/ui/utils.ts +5 -0
- package/src/internal.ts +18 -0
- package/src/plugin-styles.css +246 -0
- package/src/primitives/board.test.tsx +139 -0
- package/src/primitives/board.tsx +267 -0
- package/src/primitives/game-ui-provider.tsx +35 -0
- package/src/primitives/index.ts +83 -0
- package/src/primitives/interaction.test.tsx +420 -0
- package/src/primitives/interaction.tsx +405 -0
- package/src/primitives/phase.test.tsx +82 -0
- package/src/primitives/phase.tsx +43 -0
- package/src/primitives/player-roster.test.tsx +168 -0
- package/src/primitives/player-roster.tsx +301 -0
- package/src/primitives/primitive-props.tsx +82 -0
- package/src/primitives/prompt.test.tsx +159 -0
- package/src/primitives/prompt.tsx +203 -0
- package/src/primitives/zone.tsx +113 -0
- package/src/reducer.ts +42 -0
- package/src/runtime/createPluginRuntimeAPI.ts +605 -0
- package/src/theme/ThemeProvider.test.tsx +36 -0
- package/src/theme/ThemeProvider.tsx +252 -0
- package/src/theme/board.ts +61 -0
- package/src/theme/css-vars.ts +105 -0
- package/src/theme/derive.ts +240 -0
- package/src/theme/index.ts +61 -0
- package/src/theme/presets/arcade.ts +261 -0
- package/src/theme/presets/studio.ts +261 -0
- package/src/theme/presets/tabletop.ts +266 -0
- package/src/theme/theme.test.ts +258 -0
- package/src/theme/tokens.ts +392 -0
- package/src/types/player-state.ts +445 -0
- package/src/types/plugin-state.ts +407 -0
- package/src/types/reducer-state.ts +24 -0
- package/src/types/runtime-api.ts +114 -0
- package/src/types/tiled-board.ts +785 -0
- package/src/ui-contract.ts +168 -0
- package/src/utils/interaction-inputs.test.ts +109 -0
- package/src/utils/interaction-inputs.ts +331 -0
- package/src/utils/interaction-labels.ts +23 -0
- package/src/utils/interaction-status.ts +59 -0
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
import type { ViewCard } from "@dreamboard/sdk-types";
|
|
2
|
+
import type { PlayerId, CardId, CardIdsByDeckId, CardProperties, EdgeTypeId, VertexTypeId, BoardBaseId, BoardId, BoardRef, PerPlayer, PerPlayerBoardRef, PieceId, PieceTypeId, SharedBoardRef, SpaceId, SpaceTypeId, DieId } from "@dreamboard/manifest-contract";
|
|
3
|
+
export type { BoardRef, PerPlayer, PerPlayerBoardRef, SharedBoardRef };
|
|
4
|
+
/**
|
|
5
|
+
* Hands are keyed by the authored hand id and split per seat. The per-seat
|
|
6
|
+
* entries are populated from the runtime seat list, not the static manifest
|
|
7
|
+
* upper bound, so views always match what the backend actually computed.
|
|
8
|
+
*/
|
|
9
|
+
type CardIdsByHandId = Record<string, PerPlayer<CardId[]>>;
|
|
10
|
+
type StateName = string;
|
|
11
|
+
type TilePropertiesByBoardId = Record<BoardId, Record<string, unknown>>;
|
|
12
|
+
type EdgePropertiesByBoardId = Record<BoardId, Record<string, unknown>>;
|
|
13
|
+
type VertexPropertiesByBoardId = Record<BoardId, Record<string, unknown>>;
|
|
14
|
+
export interface Player {
|
|
15
|
+
/** Player ID */
|
|
16
|
+
playerId: PlayerId;
|
|
17
|
+
/** Player display name */
|
|
18
|
+
name: string;
|
|
19
|
+
/** Whether this player is the host */
|
|
20
|
+
isHost?: boolean;
|
|
21
|
+
/** Player's assigned color */
|
|
22
|
+
color?: string;
|
|
23
|
+
}
|
|
24
|
+
export interface HexTileState<B extends string = BoardId, SpaceIdValue extends SpaceId = SpaceId, Properties = B extends keyof TilePropertiesByBoardId ? TilePropertiesByBoardId[B] : undefined, View = unknown> {
|
|
25
|
+
/** Unique tile identifier */
|
|
26
|
+
id: SpaceIdValue;
|
|
27
|
+
/** Axial coordinate Q */
|
|
28
|
+
q: number;
|
|
29
|
+
/** Axial coordinate R */
|
|
30
|
+
r: number;
|
|
31
|
+
/** Tile type identifier for rendering */
|
|
32
|
+
typeId?: SpaceTypeId;
|
|
33
|
+
/** Display label on the tile */
|
|
34
|
+
label?: string;
|
|
35
|
+
/** Player ID who owns this tile */
|
|
36
|
+
owner?: PlayerId;
|
|
37
|
+
/** JSON-serialized custom properties */
|
|
38
|
+
properties?: Properties;
|
|
39
|
+
/**
|
|
40
|
+
* Optional view-projection overlay merged onto the static topology by
|
|
41
|
+
* `createHexBoardView` / `useHexBoardView`. Authored boards can also
|
|
42
|
+
* supply this directly when building tiles by hand.
|
|
43
|
+
*/
|
|
44
|
+
view?: View;
|
|
45
|
+
}
|
|
46
|
+
/** State of an edge on a reducer-projected hex board. */
|
|
47
|
+
export interface HexEdgeState<B extends string = BoardId, SpaceIdValue extends SpaceId = SpaceId, EdgeIdValue extends string = string, Properties = B extends keyof EdgePropertiesByBoardId ? EdgePropertiesByBoardId[B] : undefined> {
|
|
48
|
+
/** Unique edge identifier (serialized string, e.g., "tile1-tile2") */
|
|
49
|
+
id: EdgeIdValue;
|
|
50
|
+
/** First hex tile ID this edge borders */
|
|
51
|
+
hex1: SpaceIdValue;
|
|
52
|
+
/** Second hex tile ID this edge borders */
|
|
53
|
+
hex2: SpaceIdValue;
|
|
54
|
+
/** Edge type identifier for rendering */
|
|
55
|
+
typeId?: EdgeTypeId;
|
|
56
|
+
/** Display label for setup or rendering */
|
|
57
|
+
label?: string;
|
|
58
|
+
/** Player ID who owns this edge */
|
|
59
|
+
owner?: PlayerId;
|
|
60
|
+
/** JSON-serialized custom properties */
|
|
61
|
+
properties?: Properties;
|
|
62
|
+
}
|
|
63
|
+
/** State of a vertex on a reducer-projected hex board. */
|
|
64
|
+
export interface HexVertexState<B extends string = BoardId, SpaceIdValue extends SpaceId = SpaceId, VertexIdValue extends string = string, Properties = B extends keyof VertexPropertiesByBoardId ? VertexPropertiesByBoardId[B] : undefined> {
|
|
65
|
+
/** Unique vertex identifier (serialized string, e.g., "tile1-tile2-tile3") */
|
|
66
|
+
id: VertexIdValue;
|
|
67
|
+
/** The hex tile IDs this vertex touches */
|
|
68
|
+
hexes: readonly SpaceIdValue[];
|
|
69
|
+
/** Vertex type identifier for rendering */
|
|
70
|
+
typeId?: VertexTypeId;
|
|
71
|
+
/** Display label for setup or rendering */
|
|
72
|
+
label?: string;
|
|
73
|
+
/** Player ID who owns this vertex */
|
|
74
|
+
owner?: PlayerId;
|
|
75
|
+
/** JSON-serialized custom properties */
|
|
76
|
+
properties?: Properties;
|
|
77
|
+
}
|
|
78
|
+
/** Complete state of a reducer-projected hex board. */
|
|
79
|
+
export interface HexBoardState<B extends string = BoardId, SpaceIdValue extends SpaceId = SpaceId, EdgeIdValue extends string = string, VertexIdValue extends string = string, TileProperties = B extends keyof TilePropertiesByBoardId ? TilePropertiesByBoardId[B] : undefined, EdgeProperties = B extends keyof EdgePropertiesByBoardId ? EdgePropertiesByBoardId[B] : undefined, VertexProperties = B extends keyof VertexPropertiesByBoardId ? VertexPropertiesByBoardId[B] : undefined> {
|
|
80
|
+
/** Unique board identifier */
|
|
81
|
+
id: B;
|
|
82
|
+
/** All tiles on the board */
|
|
83
|
+
tiles: ReadonlyArray<HexTileState<B, SpaceIdValue, TileProperties>>;
|
|
84
|
+
/** All edges on the board */
|
|
85
|
+
edges: ReadonlyArray<HexEdgeState<B, SpaceIdValue, EdgeIdValue, EdgeProperties>>;
|
|
86
|
+
/** All vertices on the board */
|
|
87
|
+
vertices: ReadonlyArray<HexVertexState<B, SpaceIdValue, VertexIdValue, VertexProperties>>;
|
|
88
|
+
}
|
|
89
|
+
/** State of a node in a reducer-projected network board. */
|
|
90
|
+
export interface NetworkNodeState {
|
|
91
|
+
/** Unique node identifier */
|
|
92
|
+
id: SpaceId;
|
|
93
|
+
/** X coordinate position */
|
|
94
|
+
x: number;
|
|
95
|
+
/** Y coordinate position */
|
|
96
|
+
y: number;
|
|
97
|
+
/** Node type identifier for rendering */
|
|
98
|
+
typeId?: SpaceTypeId;
|
|
99
|
+
/** Display label on the node */
|
|
100
|
+
label?: string;
|
|
101
|
+
/** Player ID who owns this node */
|
|
102
|
+
owner?: PlayerId;
|
|
103
|
+
/** JSON-serialized custom properties */
|
|
104
|
+
properties?: string;
|
|
105
|
+
}
|
|
106
|
+
/** State of an edge connecting two nodes in a reducer-projected network board. */
|
|
107
|
+
export interface NetworkEdgeState {
|
|
108
|
+
/** Unique edge identifier */
|
|
109
|
+
id: string;
|
|
110
|
+
/** Source node ID */
|
|
111
|
+
from: SpaceId;
|
|
112
|
+
/** Target node ID */
|
|
113
|
+
to: SpaceId;
|
|
114
|
+
/** Edge type identifier for rendering */
|
|
115
|
+
typeId?: string;
|
|
116
|
+
/** Display label on the edge */
|
|
117
|
+
label?: string;
|
|
118
|
+
/** Player ID who owns this edge */
|
|
119
|
+
owner?: PlayerId;
|
|
120
|
+
/** JSON-serialized custom properties */
|
|
121
|
+
properties?: string;
|
|
122
|
+
}
|
|
123
|
+
/** State of a piece placed on a reducer-projected network node. */
|
|
124
|
+
export interface NetworkPieceState {
|
|
125
|
+
/** Unique piece identifier */
|
|
126
|
+
id: PieceId;
|
|
127
|
+
/** Node ID where this piece is placed */
|
|
128
|
+
nodeId: SpaceId;
|
|
129
|
+
/** Piece type identifier for rendering */
|
|
130
|
+
typeId?: PieceTypeId;
|
|
131
|
+
/** Player ID who owns this piece */
|
|
132
|
+
owner?: PlayerId;
|
|
133
|
+
/** JSON-serialized custom properties */
|
|
134
|
+
properties?: string;
|
|
135
|
+
}
|
|
136
|
+
/** Complete state of a reducer-projected network board. */
|
|
137
|
+
export interface NetworkBoardState {
|
|
138
|
+
/** Unique board identifier */
|
|
139
|
+
id: BoardId;
|
|
140
|
+
/** All nodes on the board */
|
|
141
|
+
nodes: NetworkNodeState[];
|
|
142
|
+
/** All edges on the board */
|
|
143
|
+
edges: NetworkEdgeState[];
|
|
144
|
+
/** All pieces on the board */
|
|
145
|
+
pieces: NetworkPieceState[];
|
|
146
|
+
}
|
|
147
|
+
/** State of a cell on a reducer-projected square grid board. */
|
|
148
|
+
export interface SquareCellState<SpaceIdValue extends SpaceId = SpaceId, Properties = Record<string, unknown>> {
|
|
149
|
+
/** Unique cell identifier */
|
|
150
|
+
id: SpaceIdValue;
|
|
151
|
+
/** Row index (0-based) */
|
|
152
|
+
row: number;
|
|
153
|
+
/** Column index (0-based) */
|
|
154
|
+
col: number;
|
|
155
|
+
/** Cell type identifier for rendering */
|
|
156
|
+
typeId?: SpaceTypeId;
|
|
157
|
+
/** Display label on the cell */
|
|
158
|
+
label?: string;
|
|
159
|
+
/** Player ID who owns this cell */
|
|
160
|
+
owner?: PlayerId;
|
|
161
|
+
/** JSON-serialized custom properties */
|
|
162
|
+
properties?: Properties;
|
|
163
|
+
}
|
|
164
|
+
/** State of an edge on a reducer-projected square grid board. */
|
|
165
|
+
export interface SquareEdgeState<SpaceIdValue extends SpaceId = SpaceId, EdgeIdValue extends string = string, Properties = Record<string, unknown>> {
|
|
166
|
+
/** Unique edge identifier */
|
|
167
|
+
id: EdgeIdValue;
|
|
168
|
+
/** The cell IDs this edge borders */
|
|
169
|
+
spaceIds: readonly SpaceIdValue[];
|
|
170
|
+
/** Edge type identifier for rendering */
|
|
171
|
+
typeId?: EdgeTypeId;
|
|
172
|
+
/** Display label for setup or rendering */
|
|
173
|
+
label?: string;
|
|
174
|
+
/** Player ID who owns this edge */
|
|
175
|
+
owner?: PlayerId;
|
|
176
|
+
/** JSON-serialized custom properties */
|
|
177
|
+
properties?: Properties;
|
|
178
|
+
}
|
|
179
|
+
/** State of a vertex on a reducer-projected square grid board. */
|
|
180
|
+
export interface SquareVertexState<SpaceIdValue extends SpaceId = SpaceId, VertexIdValue extends string = string, Properties = Record<string, unknown>> {
|
|
181
|
+
/** Unique vertex identifier */
|
|
182
|
+
id: VertexIdValue;
|
|
183
|
+
/** The cell IDs that touch this corner */
|
|
184
|
+
spaceIds: readonly SpaceIdValue[];
|
|
185
|
+
/** Vertex type identifier for rendering */
|
|
186
|
+
typeId?: VertexTypeId;
|
|
187
|
+
/** Display label for setup or rendering */
|
|
188
|
+
label?: string;
|
|
189
|
+
/** Player ID who owns this vertex */
|
|
190
|
+
owner?: PlayerId;
|
|
191
|
+
/** JSON-serialized custom properties */
|
|
192
|
+
properties?: Properties;
|
|
193
|
+
}
|
|
194
|
+
/** State of a piece placed on a reducer-projected square grid cell. */
|
|
195
|
+
export interface SquarePieceState<PieceIdValue extends PieceId = PieceId, Properties = Record<string, unknown>> {
|
|
196
|
+
/** Unique piece identifier */
|
|
197
|
+
id: PieceIdValue;
|
|
198
|
+
/** Row index where piece is located */
|
|
199
|
+
row: number;
|
|
200
|
+
/** Column index where piece is located */
|
|
201
|
+
col: number;
|
|
202
|
+
/** Piece type identifier for rendering */
|
|
203
|
+
typeId: PieceTypeId;
|
|
204
|
+
/** Player ID who owns this piece */
|
|
205
|
+
owner?: PlayerId;
|
|
206
|
+
/** JSON-serialized custom properties */
|
|
207
|
+
properties?: Properties;
|
|
208
|
+
}
|
|
209
|
+
/** Complete state of a reducer-projected square grid board. */
|
|
210
|
+
export interface SquareBoardState<B extends string = BoardId, SpaceIdValue extends SpaceId = SpaceId, EdgeIdValue extends string = string, VertexIdValue extends string = string, PieceIdValue extends PieceId = PieceId, CellProperties = Record<string, unknown>, EdgeProperties = Record<string, unknown>, VertexProperties = Record<string, unknown>, PieceProperties = Record<string, unknown>> {
|
|
211
|
+
/** Unique board identifier */
|
|
212
|
+
id: B;
|
|
213
|
+
/** Number of rows in the grid */
|
|
214
|
+
rows: number;
|
|
215
|
+
/** Number of columns in the grid */
|
|
216
|
+
cols: number;
|
|
217
|
+
/** All authored cells on the board */
|
|
218
|
+
cells: ReadonlyArray<SquareCellState<SpaceIdValue, CellProperties>>;
|
|
219
|
+
/** All edges on the board */
|
|
220
|
+
edges: ReadonlyArray<SquareEdgeState<SpaceIdValue, EdgeIdValue, EdgeProperties>>;
|
|
221
|
+
/** All vertices on the board */
|
|
222
|
+
vertices: ReadonlyArray<SquareVertexState<SpaceIdValue, VertexIdValue, VertexProperties>>;
|
|
223
|
+
/** All pieces on the board */
|
|
224
|
+
pieces: ReadonlyArray<SquarePieceState<PieceIdValue, PieceProperties>>;
|
|
225
|
+
}
|
|
226
|
+
/** State of a space on a reducer-projected track board. */
|
|
227
|
+
export interface TrackSpaceState {
|
|
228
|
+
/** Unique space identifier */
|
|
229
|
+
id: SpaceId;
|
|
230
|
+
/** Position index in the track sequence */
|
|
231
|
+
index: number;
|
|
232
|
+
/** X coordinate for rendering */
|
|
233
|
+
x: number;
|
|
234
|
+
/** Y coordinate for rendering */
|
|
235
|
+
y: number;
|
|
236
|
+
/** Display name of the space */
|
|
237
|
+
name?: string;
|
|
238
|
+
/** Space type identifier for rendering */
|
|
239
|
+
typeId?: SpaceTypeId;
|
|
240
|
+
/** Player ID who owns this space */
|
|
241
|
+
owner?: PlayerId;
|
|
242
|
+
/** IDs of spaces that can be reached from here (for branching tracks) */
|
|
243
|
+
nextSpaces?: SpaceId[];
|
|
244
|
+
/** JSON-serialized custom properties */
|
|
245
|
+
properties?: string;
|
|
246
|
+
}
|
|
247
|
+
/** State of a piece on a reducer-projected track board. */
|
|
248
|
+
export interface TrackPieceState {
|
|
249
|
+
/** Unique piece identifier */
|
|
250
|
+
id: PieceId;
|
|
251
|
+
/** ID of the space this piece occupies */
|
|
252
|
+
spaceId: SpaceId;
|
|
253
|
+
/** Player ID who owns this piece */
|
|
254
|
+
owner: PlayerId;
|
|
255
|
+
/** Piece type identifier for rendering */
|
|
256
|
+
typeId?: PieceTypeId;
|
|
257
|
+
/** JSON-serialized custom properties */
|
|
258
|
+
properties?: string;
|
|
259
|
+
}
|
|
260
|
+
/** Complete state of a reducer-projected track board. */
|
|
261
|
+
export interface TrackBoardState {
|
|
262
|
+
/** Unique board identifier */
|
|
263
|
+
id: BoardId;
|
|
264
|
+
/** All spaces on the track */
|
|
265
|
+
spaces: TrackSpaceState[];
|
|
266
|
+
/** All pieces on the track */
|
|
267
|
+
pieces: TrackPieceState[];
|
|
268
|
+
}
|
|
269
|
+
/** State of a reducer-projected die component. */
|
|
270
|
+
export interface DieState {
|
|
271
|
+
/** Unique die identifier */
|
|
272
|
+
id: DieId;
|
|
273
|
+
/** Number of sides on the die (e.g., 6 for standard die) */
|
|
274
|
+
sides: number;
|
|
275
|
+
/** Current face value (1 to sides, undefined if not rolled) */
|
|
276
|
+
currentValue?: number;
|
|
277
|
+
/** Optional color for visual identification */
|
|
278
|
+
color?: string;
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Collection of boards of a particular kind, split into shared boards
|
|
282
|
+
* (indexed by base id, e.g. `"market-board"`) and per-player boards
|
|
283
|
+
* (indexed by base id, then by the runtime seat list via `PerPlayer<T>`).
|
|
284
|
+
*
|
|
285
|
+
* Splitting by the `BoardRef` discriminator keeps the UI types honest about
|
|
286
|
+
* what the runtime actually produced: per-player board state only exists
|
|
287
|
+
* for the seats that are currently playing, never for a static `maxPlayers`
|
|
288
|
+
* upper bound.
|
|
289
|
+
*/
|
|
290
|
+
export interface BoardKindStates<State> {
|
|
291
|
+
/** Shared boards keyed by base id. */
|
|
292
|
+
shared: Record<BoardBaseId, State>;
|
|
293
|
+
/** Per-player boards keyed by base id, then by seat via `PerPlayer<T>`. */
|
|
294
|
+
perPlayer: Record<BoardBaseId, PerPlayer<State>>;
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* Container for all board states organized by kind.
|
|
298
|
+
* This is the strongly-typed board payload authored UIs consume from reducer views.
|
|
299
|
+
*/
|
|
300
|
+
export interface BoardStates {
|
|
301
|
+
/** Hex boards split into shared vs per-player collections. */
|
|
302
|
+
hex: BoardKindStates<HexBoardState>;
|
|
303
|
+
/** Network boards split into shared vs per-player collections. */
|
|
304
|
+
network: BoardKindStates<NetworkBoardState>;
|
|
305
|
+
/** Square grid boards split into shared vs per-player collections. */
|
|
306
|
+
square: BoardKindStates<SquareBoardState>;
|
|
307
|
+
/** Track boards split into shared vs per-player collections. */
|
|
308
|
+
track: BoardKindStates<TrackBoardState>;
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* Container for all dice states.
|
|
312
|
+
* Maps die IDs to their die state.
|
|
313
|
+
*/
|
|
314
|
+
export type DiceStates = Record<DieId, DieState>;
|
|
315
|
+
export interface GameState {
|
|
316
|
+
/** All currently active players (supports MULTIPLE_ACTIVE_PLAYER states) */
|
|
317
|
+
currentPlayerIds: PlayerId[];
|
|
318
|
+
decks: CardIdsByDeckId;
|
|
319
|
+
/**
|
|
320
|
+
* Player-scoped hands keyed by the authored hand id. The inner
|
|
321
|
+
* `PerPlayer<CardId[]>` is keyed by the runtime seat list and only
|
|
322
|
+
* contains entries for players who actually hold the hand.
|
|
323
|
+
*/
|
|
324
|
+
hands: CardIdsByHandId;
|
|
325
|
+
/** Map of card IDs to their card info including type and properties */
|
|
326
|
+
cards: Record<CardId, ViewCard<CardId, string, CardProperties>>;
|
|
327
|
+
/**
|
|
328
|
+
* Per-player resource totals keyed by the runtime seat list. The inner
|
|
329
|
+
* record maps resource id → amount for that seat.
|
|
330
|
+
*/
|
|
331
|
+
playerResources: PerPlayer<Record<string, number>>;
|
|
332
|
+
currentState: StateName;
|
|
333
|
+
isMyTurn: boolean;
|
|
334
|
+
boards: BoardStates;
|
|
335
|
+
dice: DiceStates;
|
|
336
|
+
}
|
|
337
|
+
//# sourceMappingURL=player-state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"player-state.d.ts","sourceRoot":"","sources":["../../src/types/player-state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,EACV,QAAQ,EACR,MAAM,EACN,eAAe,EACf,cAAc,EACd,UAAU,EACV,YAAY,EACZ,WAAW,EACX,OAAO,EACP,QAAQ,EACR,SAAS,EACT,iBAAiB,EACjB,OAAO,EACP,WAAW,EACX,cAAc,EACd,OAAO,EACP,WAAW,EACX,KAAK,EACN,MAAM,+BAA+B,CAAC;AAEvC,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,iBAAiB,EAAE,cAAc,EAAE,CAAC;AAEvE;;;;GAIG;AACH,KAAK,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;AAC3D,KAAK,SAAS,GAAG,MAAM,CAAC;AACxB,KAAK,uBAAuB,GAAG,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AACxE,KAAK,uBAAuB,GAAG,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AACxE,KAAK,yBAAyB,GAAG,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AAE1E,MAAM,WAAW,MAAM;IACrB,gBAAgB;IAChB,QAAQ,EAAE,QAAQ,CAAC;IACnB,0BAA0B;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,sCAAsC;IACtC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,8BAA8B;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,YAAY,CAC3B,CAAC,SAAS,MAAM,GAAG,OAAO,EA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AIG;IACH,KAAK,EAAE,eAAe,CAAC;IACvB,uEAAuE;IACvE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,cAAc,CAAC,CAAC,CAAC;IAChE;;;OAGG;IACH,eAAe,EAAE,SAAS,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACnD,YAAY,EAAE,SAAS,CAAC;IACxB,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,WAAW,CAAC;IACpB,IAAI,EAAE,UAAU,CAAC;CAClB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
import type { PlayerId } from "@dreamboard/manifest-contract";
|
|
2
|
+
/**
|
|
3
|
+
* Plugin State Types
|
|
4
|
+
*
|
|
5
|
+
* These types define the state structure that the host app sends to the plugin
|
|
6
|
+
* via state-sync messages. The plugin uses these types to access pre-computed
|
|
7
|
+
* game state without needing to parse raw SSE messages.
|
|
8
|
+
*/
|
|
9
|
+
type ActionName = string;
|
|
10
|
+
export interface SeatAssignment {
|
|
11
|
+
playerId: PlayerId;
|
|
12
|
+
controllerUserId?: string;
|
|
13
|
+
displayName: string;
|
|
14
|
+
playerColor?: string;
|
|
15
|
+
isHost?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface HistoryEntrySummary {
|
|
18
|
+
id: string;
|
|
19
|
+
version: number;
|
|
20
|
+
timestamp: string;
|
|
21
|
+
description: string;
|
|
22
|
+
playerId?: PlayerId;
|
|
23
|
+
actionType?: ActionName;
|
|
24
|
+
isCurrent: boolean;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Lobby state for the pre-game lobby phase
|
|
28
|
+
*/
|
|
29
|
+
export interface LobbyState {
|
|
30
|
+
/** Current seat assignments in the lobby */
|
|
31
|
+
seats: SeatAssignment[];
|
|
32
|
+
/** Whether the game can be started (all seats filled) */
|
|
33
|
+
canStart: boolean;
|
|
34
|
+
/** User ID of the session host */
|
|
35
|
+
hostUserId: string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Notification types that get queued for the plugin
|
|
39
|
+
*/
|
|
40
|
+
export type NotificationType = "YOUR_TURN" | "PROMPT_OPENED" | "ACTION_EXECUTED" | "ACTION_REJECTED" | "TURN_CHANGED" | "STATE_CHANGED" | "GAME_ENDED" | "ERROR";
|
|
41
|
+
/**
|
|
42
|
+
* YOUR_TURN notification payload
|
|
43
|
+
*/
|
|
44
|
+
export interface YourTurnPayload {
|
|
45
|
+
type: "YOUR_TURN";
|
|
46
|
+
activePlayers: PlayerId[];
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* PROMPT_OPENED notification payload
|
|
50
|
+
*/
|
|
51
|
+
export interface PromptOpenedPayload {
|
|
52
|
+
type: "PROMPT_OPENED";
|
|
53
|
+
promptId: string;
|
|
54
|
+
promptInstanceId: string;
|
|
55
|
+
targetPlayer: PlayerId;
|
|
56
|
+
title?: string;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* ACTION_EXECUTED notification payload
|
|
60
|
+
*/
|
|
61
|
+
export interface ActionExecutedPayload {
|
|
62
|
+
type: "ACTION_EXECUTED";
|
|
63
|
+
playerId: PlayerId;
|
|
64
|
+
actionType: string;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* ACTION_REJECTED notification payload
|
|
68
|
+
*/
|
|
69
|
+
export interface ActionRejectedPayload {
|
|
70
|
+
type: "ACTION_REJECTED";
|
|
71
|
+
reason: string;
|
|
72
|
+
targetPlayer?: string;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* STATE_CHANGED notification payload
|
|
76
|
+
*/
|
|
77
|
+
export interface StateChangedPayload {
|
|
78
|
+
type: "STATE_CHANGED";
|
|
79
|
+
newState: string;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* TURN_CHANGED notification payload
|
|
83
|
+
*/
|
|
84
|
+
export interface TurnChangedPayload {
|
|
85
|
+
type: "TURN_CHANGED";
|
|
86
|
+
previousPlayers: PlayerId[];
|
|
87
|
+
currentPlayers: PlayerId[];
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* GAME_ENDED notification payload
|
|
91
|
+
*/
|
|
92
|
+
export interface GameEndedPayload {
|
|
93
|
+
type: "GAME_ENDED";
|
|
94
|
+
winner?: string;
|
|
95
|
+
finalScores: Record<string, number>;
|
|
96
|
+
reason: string;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* ERROR notification payload
|
|
100
|
+
*/
|
|
101
|
+
export interface ErrorPayload {
|
|
102
|
+
type: "ERROR";
|
|
103
|
+
message: string;
|
|
104
|
+
code?: string;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Union of all notification payloads
|
|
108
|
+
*/
|
|
109
|
+
export type NotificationPayload = YourTurnPayload | PromptOpenedPayload | ActionExecutedPayload | ActionRejectedPayload | TurnChangedPayload | StateChangedPayload | GameEndedPayload | ErrorPayload;
|
|
110
|
+
/**
|
|
111
|
+
* Notification entry in the queue.
|
|
112
|
+
* Notifications are ephemeral events that the plugin can consume and mark as read.
|
|
113
|
+
*/
|
|
114
|
+
export interface Notification {
|
|
115
|
+
/** Unique notification ID */
|
|
116
|
+
id: string;
|
|
117
|
+
/** Type of notification */
|
|
118
|
+
type: NotificationType;
|
|
119
|
+
/** Type-specific payload */
|
|
120
|
+
payload: NotificationPayload;
|
|
121
|
+
/** Timestamp when the notification was created */
|
|
122
|
+
timestamp: number;
|
|
123
|
+
/** Whether the plugin has marked this notification as read */
|
|
124
|
+
read: boolean;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Session state that gets synchronized to the plugin.
|
|
128
|
+
* This includes player switching info that was previously sent via
|
|
129
|
+
* separate player-switched messages.
|
|
130
|
+
*/
|
|
131
|
+
export interface PluginSessionState {
|
|
132
|
+
/** Current session ID */
|
|
133
|
+
sessionId: string | null;
|
|
134
|
+
/** Player IDs that this user can control (immutable after game starts) */
|
|
135
|
+
controllablePlayerIds: PlayerId[];
|
|
136
|
+
/** The currently selected player ID that the user is controlling */
|
|
137
|
+
controllingPlayerId: PlayerId | null;
|
|
138
|
+
/** User ID of the controller */
|
|
139
|
+
userId: string | null;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* History state for the host's history navigator.
|
|
143
|
+
* Only sent to the host user.
|
|
144
|
+
*/
|
|
145
|
+
export interface HistoryState {
|
|
146
|
+
/** List of history entries (newest first when displayed) */
|
|
147
|
+
entries: HistoryEntrySummary[];
|
|
148
|
+
/** Index of the current state in the history */
|
|
149
|
+
currentIndex: number;
|
|
150
|
+
/** Whether there are earlier states to restore to */
|
|
151
|
+
canGoBack: boolean;
|
|
152
|
+
/** Whether there are later states to restore to */
|
|
153
|
+
canGoForward: boolean;
|
|
154
|
+
}
|
|
155
|
+
export interface GameplayPromptOption {
|
|
156
|
+
id: string;
|
|
157
|
+
label: string;
|
|
158
|
+
}
|
|
159
|
+
/** Choice option surfaced on a prompt-kind interaction's structured context. */
|
|
160
|
+
export interface InteractionContextOption {
|
|
161
|
+
id: string;
|
|
162
|
+
label?: string;
|
|
163
|
+
data?: unknown;
|
|
164
|
+
}
|
|
165
|
+
/** Structured context attached to a prompt-kind InteractionDescriptor. */
|
|
166
|
+
export interface InteractionContext {
|
|
167
|
+
/** Addressed player id. */
|
|
168
|
+
to: string;
|
|
169
|
+
title?: string;
|
|
170
|
+
/** Authored prompt payload. Shape is defined by the game's prompt schema. */
|
|
171
|
+
payload?: Record<string, unknown>;
|
|
172
|
+
/** Selectable options for choice-kind prompts. */
|
|
173
|
+
options?: readonly InteractionContextOption[];
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Authoritative interaction descriptor resolved by the trusted bundle.
|
|
177
|
+
* Eligibility, cost, and availability are authoritative — clients MUST NOT recompute.
|
|
178
|
+
*/
|
|
179
|
+
export type InteractionKind = "action" | "prompt";
|
|
180
|
+
export type InteractionCommitPolicy = {
|
|
181
|
+
mode: "manual";
|
|
182
|
+
} | {
|
|
183
|
+
mode: "autoWhenReady";
|
|
184
|
+
};
|
|
185
|
+
export interface InputSelection {
|
|
186
|
+
mode: "single" | "many";
|
|
187
|
+
min?: number;
|
|
188
|
+
max?: number;
|
|
189
|
+
distinct?: boolean;
|
|
190
|
+
}
|
|
191
|
+
export interface InputDomain {
|
|
192
|
+
type: "target" | "resourceMap" | "boundedNumber" | "choice" | "choiceList";
|
|
193
|
+
targetKind?: string;
|
|
194
|
+
boardId?: string;
|
|
195
|
+
zoneId?: string;
|
|
196
|
+
zoneIds?: readonly string[];
|
|
197
|
+
eligibleTargets?: readonly string[];
|
|
198
|
+
resources?: ReadonlyArray<{
|
|
199
|
+
resourceId: string;
|
|
200
|
+
label?: string;
|
|
201
|
+
icon?: string;
|
|
202
|
+
min: number;
|
|
203
|
+
max: number;
|
|
204
|
+
}>;
|
|
205
|
+
min?: number;
|
|
206
|
+
max?: number;
|
|
207
|
+
step?: number;
|
|
208
|
+
choices?: readonly InteractionChoiceOption[];
|
|
209
|
+
selection?: InputSelection;
|
|
210
|
+
}
|
|
211
|
+
export interface InteractionChoiceOption {
|
|
212
|
+
value: string;
|
|
213
|
+
label: string;
|
|
214
|
+
icon?: string;
|
|
215
|
+
badge?: string;
|
|
216
|
+
description?: string;
|
|
217
|
+
disabled?: boolean;
|
|
218
|
+
disabledReason?: string;
|
|
219
|
+
}
|
|
220
|
+
export interface InteractionInputDescriptor {
|
|
221
|
+
key: string;
|
|
222
|
+
kind: string;
|
|
223
|
+
domain: InputDomain;
|
|
224
|
+
defaultValue?: unknown;
|
|
225
|
+
}
|
|
226
|
+
export interface InteractionDescriptor<Key extends string = string> {
|
|
227
|
+
phaseName: string;
|
|
228
|
+
interactionKey: Key;
|
|
229
|
+
interactionId: string;
|
|
230
|
+
/**
|
|
231
|
+
* Authoring-level interaction kind. `"action"` is an ordinary interaction
|
|
232
|
+
* any active player may attempt. `"prompt"` is an addressed request whose
|
|
233
|
+
* `context` slot carries title/options so the default `InboxSurface` can
|
|
234
|
+
* render it without custom dispatch code.
|
|
235
|
+
*/
|
|
236
|
+
kind: InteractionKind;
|
|
237
|
+
/** Draft commit policy. Always materialized by the trusted reducer bundle. */
|
|
238
|
+
commit: InteractionCommitPolicy;
|
|
239
|
+
/** Source zone id for zone-scoped interactions (e.g., cardInput). */
|
|
240
|
+
zoneId?: string;
|
|
241
|
+
/** Source zone ids for zone-scoped interactions that span multiple zones. */
|
|
242
|
+
zoneIds?: readonly string[];
|
|
243
|
+
/** Ordered input descriptors. This is the canonical source for input keys, collector kind, and valid-value domains. */
|
|
244
|
+
inputs: readonly InteractionInputDescriptor[];
|
|
245
|
+
/** Resolved cost map keyed by resource id (if interaction declares one). */
|
|
246
|
+
cost?: Record<string, unknown>;
|
|
247
|
+
/** Snapshot of seat's currently available resources keyed by resource id. */
|
|
248
|
+
currentResources?: Record<string, unknown>;
|
|
249
|
+
/** Whether the interaction is executable as of this snapshot. */
|
|
250
|
+
available: boolean;
|
|
251
|
+
unavailableReason?: string;
|
|
252
|
+
/** Structured prompt context for prompt-kind interactions. */
|
|
253
|
+
context?: InteractionContext;
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Per-player view of a single zone. Mirrors the ZoneHandles wire shape from
|
|
257
|
+
* the trusted bundle's resolveZoneHandles; `cardsById` is JSON-serialized
|
|
258
|
+
* `ViewCard` and `playableByCardId` lists the interactions that are playable
|
|
259
|
+
* on each card (eligibility already filtered by each interaction's validate).
|
|
260
|
+
*/
|
|
261
|
+
export interface ZoneHandlesSnapshot<InteractionType extends string = string> {
|
|
262
|
+
cardIds: readonly string[];
|
|
263
|
+
cardsById: Readonly<Record<string, string>>;
|
|
264
|
+
playableByCardId: Readonly<Record<string, ReadonlyArray<InteractionDescriptor<InteractionType>>>>;
|
|
265
|
+
}
|
|
266
|
+
export interface SimultaneousPhaseSnapshot {
|
|
267
|
+
phaseName: string;
|
|
268
|
+
interactionId: string;
|
|
269
|
+
actorIds: PlayerId[];
|
|
270
|
+
sealedPlayerIds: PlayerId[];
|
|
271
|
+
pendingPlayerIds: PlayerId[];
|
|
272
|
+
}
|
|
273
|
+
export interface GameplaySnapshot<PhaseType extends string = string, StageType extends string = string, InteractionType extends string = string> {
|
|
274
|
+
currentPhase: PhaseType | null;
|
|
275
|
+
currentStage: StageType | null;
|
|
276
|
+
activePlayers: PlayerId[];
|
|
277
|
+
simultaneousPhase?: SimultaneousPhaseSnapshot | null;
|
|
278
|
+
availableInteractions: ReadonlyArray<InteractionDescriptor<InteractionType>>;
|
|
279
|
+
/**
|
|
280
|
+
* Zone handles scoped to the controlling player. Keyed by zoneId.
|
|
281
|
+
* Authored via phase `zones`; projected from `resolveZoneHandles`.
|
|
282
|
+
*/
|
|
283
|
+
zones: Readonly<Record<string, ZoneHandlesSnapshot<InteractionType>>>;
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* The complete state snapshot sent to the plugin via state-sync.
|
|
287
|
+
* This is the single source of truth for all reducer-native plugin state.
|
|
288
|
+
*/
|
|
289
|
+
export interface PluginStateSnapshot<View = unknown, PhaseType extends string = string, StageType extends string = string, InteractionType extends string = string> {
|
|
290
|
+
/** Projected seat-specific reducer-native view for the controlling player */
|
|
291
|
+
view: View | null;
|
|
292
|
+
/** Gameplay transport state that sits alongside the projected reducer view */
|
|
293
|
+
gameplay: GameplaySnapshot<PhaseType, StageType, InteractionType>;
|
|
294
|
+
/** Lobby state (from LOBBY_UPDATE) - null if game has started */
|
|
295
|
+
lobby: LobbyState | null;
|
|
296
|
+
/** Notification queue (from YOUR_TURN, ACTION_REJECTED, PROMPT_OPENED, etc.) */
|
|
297
|
+
notifications: Notification[];
|
|
298
|
+
/** Session state (includes controllingPlayerId for player switching) */
|
|
299
|
+
session: PluginSessionState;
|
|
300
|
+
/** History state for host navigation (null if not host or history disabled) */
|
|
301
|
+
history: HistoryState | null;
|
|
302
|
+
/** Monotonic sync ID for acknowledgment tracking */
|
|
303
|
+
syncId: number;
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* Message sent from host to plugin to sync state
|
|
307
|
+
*/
|
|
308
|
+
export interface StateSyncMessage {
|
|
309
|
+
type: "state-sync";
|
|
310
|
+
/** Sync ID for acknowledgment tracking */
|
|
311
|
+
syncId: number;
|
|
312
|
+
/** Complete state snapshot */
|
|
313
|
+
state: PluginStateSnapshot;
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* Message sent from plugin to host to acknowledge state receipt
|
|
317
|
+
*/
|
|
318
|
+
export interface StateAckMessage {
|
|
319
|
+
type: "state-ack";
|
|
320
|
+
/** Echoes back the syncId that was received */
|
|
321
|
+
syncId: number;
|
|
322
|
+
}
|
|
323
|
+
export {};
|
|
324
|
+
//# sourceMappingURL=plugin-state.d.ts.map
|