@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,824 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SlotSystem component fixtures
|
|
3
|
+
* Demonstrates worker placement visualization for Euro games
|
|
4
|
+
*/
|
|
5
|
+
import React, { useState } from "react";
|
|
6
|
+
import {
|
|
7
|
+
SlotSystem,
|
|
8
|
+
DefaultSlotItem,
|
|
9
|
+
DefaultSlotOccupant,
|
|
10
|
+
DefaultEmptySlot,
|
|
11
|
+
type SlotDefinition,
|
|
12
|
+
type SlotOccupant,
|
|
13
|
+
} from "../board/SlotSystem.js";
|
|
14
|
+
|
|
15
|
+
function Container({
|
|
16
|
+
children,
|
|
17
|
+
title,
|
|
18
|
+
}: {
|
|
19
|
+
children: React.ReactNode;
|
|
20
|
+
title: string;
|
|
21
|
+
}) {
|
|
22
|
+
return (
|
|
23
|
+
<div className="min-h-screen bg-gradient-to-br from-slate-800 to-slate-900 p-8">
|
|
24
|
+
<div className="max-w-4xl mx-auto">
|
|
25
|
+
<h2 className="text-xl font-bold text-white mb-4">{title}</h2>
|
|
26
|
+
<div className="bg-slate-800/50 rounded-xl p-4 border border-slate-700">
|
|
27
|
+
{children}
|
|
28
|
+
</div>
|
|
29
|
+
</div>
|
|
30
|
+
</div>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Helper to format cost/reward for display
|
|
35
|
+
function formatResources(
|
|
36
|
+
resources: Record<string, number> | undefined,
|
|
37
|
+
prefix: string,
|
|
38
|
+
): string | undefined {
|
|
39
|
+
if (!resources || Object.keys(resources).length === 0) return undefined;
|
|
40
|
+
return Object.entries(resources)
|
|
41
|
+
.map(([resource, amount]) => `${prefix}${amount} ${resource}`)
|
|
42
|
+
.join(", ");
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Agricola-style action spaces
|
|
46
|
+
const agricolaSlots: SlotDefinition[] = [
|
|
47
|
+
{
|
|
48
|
+
id: "plow-field",
|
|
49
|
+
name: "Plow 1 Field",
|
|
50
|
+
description: "Create a new field tile",
|
|
51
|
+
capacity: 1,
|
|
52
|
+
exclusive: true,
|
|
53
|
+
group: "Farming",
|
|
54
|
+
reward: { field: 1 },
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
id: "sow-bake",
|
|
58
|
+
name: "Sow and/or Bake",
|
|
59
|
+
description: "Sow grain/vegetables, bake bread",
|
|
60
|
+
capacity: 1,
|
|
61
|
+
exclusive: true,
|
|
62
|
+
group: "Farming",
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
id: "take-grain",
|
|
66
|
+
name: "Take 1 Grain",
|
|
67
|
+
description: "Take grain from the supply",
|
|
68
|
+
capacity: 1,
|
|
69
|
+
exclusive: true,
|
|
70
|
+
group: "Farming",
|
|
71
|
+
reward: { grain: 1 },
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
id: "take-vegetable",
|
|
75
|
+
name: "Take 1 Vegetable",
|
|
76
|
+
description: "Take vegetable from the supply",
|
|
77
|
+
capacity: 1,
|
|
78
|
+
exclusive: true,
|
|
79
|
+
group: "Farming",
|
|
80
|
+
reward: { vegetable: 1 },
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
id: "take-wood",
|
|
84
|
+
name: "Take Wood",
|
|
85
|
+
description: "Accumulating action",
|
|
86
|
+
capacity: 1,
|
|
87
|
+
exclusive: true,
|
|
88
|
+
group: "Resources",
|
|
89
|
+
reward: { wood: 3 },
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
id: "take-clay",
|
|
93
|
+
name: "Take Clay",
|
|
94
|
+
description: "Accumulating action",
|
|
95
|
+
capacity: 1,
|
|
96
|
+
exclusive: true,
|
|
97
|
+
group: "Resources",
|
|
98
|
+
reward: { clay: 2 },
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
id: "take-reed",
|
|
102
|
+
name: "Take Reed",
|
|
103
|
+
description: "Accumulating action",
|
|
104
|
+
capacity: 1,
|
|
105
|
+
exclusive: true,
|
|
106
|
+
group: "Resources",
|
|
107
|
+
reward: { reed: 1 },
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
id: "fishing",
|
|
111
|
+
name: "Fishing",
|
|
112
|
+
description: "Accumulating action",
|
|
113
|
+
capacity: 1,
|
|
114
|
+
exclusive: true,
|
|
115
|
+
group: "Resources",
|
|
116
|
+
reward: { food: 2 },
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
id: "build-rooms",
|
|
120
|
+
name: "Build Room(s)",
|
|
121
|
+
description: "Expand your home",
|
|
122
|
+
capacity: 1,
|
|
123
|
+
exclusive: true,
|
|
124
|
+
group: "Building",
|
|
125
|
+
cost: { wood: 5, reed: 2 },
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
id: "build-stables",
|
|
129
|
+
name: "Build Stables",
|
|
130
|
+
description: "Build animal housing",
|
|
131
|
+
capacity: 1,
|
|
132
|
+
exclusive: true,
|
|
133
|
+
group: "Building",
|
|
134
|
+
cost: { wood: 2 },
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
id: "family-growth",
|
|
138
|
+
name: "Family Growth",
|
|
139
|
+
description: "Add a family member",
|
|
140
|
+
capacity: 1,
|
|
141
|
+
exclusive: true,
|
|
142
|
+
group: "Family",
|
|
143
|
+
reward: { familyMember: 1 },
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
id: "day-laborer",
|
|
147
|
+
name: "Day Laborer",
|
|
148
|
+
description: "Get food quickly",
|
|
149
|
+
capacity: 1,
|
|
150
|
+
exclusive: false,
|
|
151
|
+
group: "Family",
|
|
152
|
+
reward: { food: 2 },
|
|
153
|
+
},
|
|
154
|
+
];
|
|
155
|
+
|
|
156
|
+
const playerColors: Record<string, string> = {
|
|
157
|
+
"player-1": "#ef4444",
|
|
158
|
+
"player-2": "#3b82f6",
|
|
159
|
+
"player-3": "#22c55e",
|
|
160
|
+
"player-4": "#eab308",
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
// Interactive worker placement demo
|
|
164
|
+
function InteractiveDemo() {
|
|
165
|
+
const [occupants, setOccupants] = useState<SlotOccupant[]>([
|
|
166
|
+
{ pieceId: "w1-1", playerId: "player-1", slotId: "take-wood" },
|
|
167
|
+
{ pieceId: "w2-1", playerId: "player-2", slotId: "plow-field" },
|
|
168
|
+
{ pieceId: "w2-2", playerId: "player-2", slotId: "take-grain" },
|
|
169
|
+
{ pieceId: "w3-1", playerId: "player-3", slotId: "fishing" },
|
|
170
|
+
]);
|
|
171
|
+
const [currentPlayer, setCurrentPlayer] = useState<string>("player-1");
|
|
172
|
+
const [workersRemaining, setWorkersRemaining] = useState<
|
|
173
|
+
Record<string, number>
|
|
174
|
+
>({
|
|
175
|
+
"player-1": 2,
|
|
176
|
+
"player-2": 1,
|
|
177
|
+
"player-3": 2,
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
const handleSlotClick = (slotId: string) => {
|
|
181
|
+
const remaining = workersRemaining[currentPlayer] ?? 0;
|
|
182
|
+
if (remaining <= 0) {
|
|
183
|
+
alert("No workers remaining! Pass to next player.");
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
// Add worker
|
|
188
|
+
const pieceId = `w${currentPlayer.slice(-1)}-${Date.now()}`;
|
|
189
|
+
setOccupants((prev) => [
|
|
190
|
+
...prev,
|
|
191
|
+
{ pieceId, playerId: currentPlayer, slotId },
|
|
192
|
+
]);
|
|
193
|
+
|
|
194
|
+
// Decrease remaining workers
|
|
195
|
+
setWorkersRemaining((prev) => ({
|
|
196
|
+
...prev,
|
|
197
|
+
[currentPlayer]: (prev[currentPlayer] ?? 0) - 1,
|
|
198
|
+
}));
|
|
199
|
+
|
|
200
|
+
// Next player
|
|
201
|
+
const players = Object.keys(workersRemaining);
|
|
202
|
+
const currentIndex = players.indexOf(currentPlayer);
|
|
203
|
+
const nextPlayer = players[(currentIndex + 1) % players.length];
|
|
204
|
+
if (nextPlayer) setCurrentPlayer(nextPlayer);
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
// Check if slot is available for current player
|
|
208
|
+
const isSlotAvailable = (
|
|
209
|
+
slot: SlotDefinition,
|
|
210
|
+
slotOccupants: SlotOccupant[],
|
|
211
|
+
) => {
|
|
212
|
+
if (slotOccupants.length >= slot.capacity) return false;
|
|
213
|
+
if (
|
|
214
|
+
slot.exclusive &&
|
|
215
|
+
slotOccupants.some((o) => o.playerId === currentPlayer)
|
|
216
|
+
)
|
|
217
|
+
return false;
|
|
218
|
+
if (slot.owner && slot.owner !== currentPlayer) return false;
|
|
219
|
+
return true;
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
return (
|
|
223
|
+
<Container title="Interactive Worker Placement (Agricola-style)">
|
|
224
|
+
<div className="mb-4 flex items-center justify-between">
|
|
225
|
+
<div className="flex gap-4">
|
|
226
|
+
{Object.entries(playerColors)
|
|
227
|
+
.slice(0, 3)
|
|
228
|
+
.map(([id, color]) => (
|
|
229
|
+
<span
|
|
230
|
+
key={id}
|
|
231
|
+
className={`flex items-center gap-2 px-3 py-1 rounded ${
|
|
232
|
+
currentPlayer === id ? "bg-slate-700 ring-2 ring-white" : ""
|
|
233
|
+
}`}
|
|
234
|
+
>
|
|
235
|
+
<div
|
|
236
|
+
className="w-4 h-4 rounded-full"
|
|
237
|
+
style={{ backgroundColor: color }}
|
|
238
|
+
/>
|
|
239
|
+
<span className="text-white text-sm">
|
|
240
|
+
{id
|
|
241
|
+
.replace("-", " ")
|
|
242
|
+
.replace(/\b\w/g, (c) => c.toUpperCase())}
|
|
243
|
+
</span>
|
|
244
|
+
<span className="text-slate-400 text-xs">
|
|
245
|
+
({workersRemaining[id]} workers)
|
|
246
|
+
</span>
|
|
247
|
+
</span>
|
|
248
|
+
))}
|
|
249
|
+
</div>
|
|
250
|
+
<button
|
|
251
|
+
onClick={() => {
|
|
252
|
+
setOccupants([]);
|
|
253
|
+
setWorkersRemaining({
|
|
254
|
+
"player-1": 3,
|
|
255
|
+
"player-2": 3,
|
|
256
|
+
"player-3": 3,
|
|
257
|
+
});
|
|
258
|
+
setCurrentPlayer("player-1");
|
|
259
|
+
}}
|
|
260
|
+
className="px-4 py-2 bg-slate-700 hover:bg-slate-600 text-white rounded text-sm"
|
|
261
|
+
>
|
|
262
|
+
Reset Round
|
|
263
|
+
</button>
|
|
264
|
+
</div>
|
|
265
|
+
<SlotSystem
|
|
266
|
+
slots={agricolaSlots}
|
|
267
|
+
occupants={occupants}
|
|
268
|
+
layout="grouped"
|
|
269
|
+
renderSlot={(slot, slotOccupants) => {
|
|
270
|
+
const available = isSlotAvailable(slot, slotOccupants);
|
|
271
|
+
return (
|
|
272
|
+
<DefaultSlotItem
|
|
273
|
+
name={slot.name}
|
|
274
|
+
description={slot.description}
|
|
275
|
+
capacity={slot.capacity}
|
|
276
|
+
occupantCount={slotOccupants.length}
|
|
277
|
+
isExclusive={slot.exclusive}
|
|
278
|
+
isAvailable={available}
|
|
279
|
+
costLabel={formatResources(slot.cost, "-")}
|
|
280
|
+
rewardLabel={formatResources(slot.reward, "+")}
|
|
281
|
+
onClick={() => handleSlotClick(slot.id)}
|
|
282
|
+
renderOccupants={() => (
|
|
283
|
+
<div className="flex gap-1">
|
|
284
|
+
{slotOccupants.map((o) => (
|
|
285
|
+
<DefaultSlotOccupant
|
|
286
|
+
key={o.pieceId}
|
|
287
|
+
color={playerColors[o.playerId]}
|
|
288
|
+
label={`${o.playerId}'s worker`}
|
|
289
|
+
/>
|
|
290
|
+
))}
|
|
291
|
+
{Array(slot.capacity - slotOccupants.length)
|
|
292
|
+
.fill(null)
|
|
293
|
+
.map((_, i) => (
|
|
294
|
+
<DefaultEmptySlot key={`empty-${i}`} />
|
|
295
|
+
))}
|
|
296
|
+
</div>
|
|
297
|
+
)}
|
|
298
|
+
/>
|
|
299
|
+
);
|
|
300
|
+
}}
|
|
301
|
+
/>
|
|
302
|
+
</Container>
|
|
303
|
+
);
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
// Simple grid layout
|
|
307
|
+
function GridLayoutDemo() {
|
|
308
|
+
const simpleSlots: SlotDefinition[] = [
|
|
309
|
+
{
|
|
310
|
+
id: "a1",
|
|
311
|
+
name: "Action A",
|
|
312
|
+
capacity: 1,
|
|
313
|
+
exclusive: true,
|
|
314
|
+
reward: { gold: 2 },
|
|
315
|
+
},
|
|
316
|
+
{
|
|
317
|
+
id: "a2",
|
|
318
|
+
name: "Action B",
|
|
319
|
+
capacity: 1,
|
|
320
|
+
exclusive: true,
|
|
321
|
+
reward: { gold: 3 },
|
|
322
|
+
},
|
|
323
|
+
{
|
|
324
|
+
id: "a3",
|
|
325
|
+
name: "Action C",
|
|
326
|
+
capacity: 2,
|
|
327
|
+
exclusive: false,
|
|
328
|
+
reward: { gold: 1 },
|
|
329
|
+
},
|
|
330
|
+
{
|
|
331
|
+
id: "a4",
|
|
332
|
+
name: "Action D",
|
|
333
|
+
capacity: 1,
|
|
334
|
+
exclusive: true,
|
|
335
|
+
cost: { gold: 1 },
|
|
336
|
+
},
|
|
337
|
+
{ id: "a5", name: "Action E", capacity: 3, exclusive: false },
|
|
338
|
+
{ id: "a6", name: "Action F", capacity: 1, exclusive: true },
|
|
339
|
+
];
|
|
340
|
+
|
|
341
|
+
const occupants: SlotOccupant[] = [
|
|
342
|
+
{ pieceId: "w1", playerId: "player-1", slotId: "a1" },
|
|
343
|
+
{ pieceId: "w2", playerId: "player-2", slotId: "a3" },
|
|
344
|
+
{ pieceId: "w3", playerId: "player-1", slotId: "a3" },
|
|
345
|
+
{ pieceId: "w4", playerId: "player-3", slotId: "a5" },
|
|
346
|
+
{ pieceId: "w5", playerId: "player-2", slotId: "a5" },
|
|
347
|
+
];
|
|
348
|
+
|
|
349
|
+
return (
|
|
350
|
+
<Container title="Responsive Grid Layout">
|
|
351
|
+
<SlotSystem
|
|
352
|
+
slots={simpleSlots}
|
|
353
|
+
occupants={occupants}
|
|
354
|
+
layout="grid"
|
|
355
|
+
minSlotWidth={200}
|
|
356
|
+
renderSlot={(slot, slotOccupants) => (
|
|
357
|
+
<DefaultSlotItem
|
|
358
|
+
name={slot.name}
|
|
359
|
+
capacity={slot.capacity}
|
|
360
|
+
occupantCount={slotOccupants.length}
|
|
361
|
+
isExclusive={slot.exclusive}
|
|
362
|
+
isAvailable={slotOccupants.length < slot.capacity}
|
|
363
|
+
costLabel={formatResources(slot.cost, "-")}
|
|
364
|
+
rewardLabel={formatResources(slot.reward, "+")}
|
|
365
|
+
renderOccupants={() => (
|
|
366
|
+
<div className="flex gap-1">
|
|
367
|
+
{slotOccupants.map((o) => (
|
|
368
|
+
<DefaultSlotOccupant
|
|
369
|
+
key={o.pieceId}
|
|
370
|
+
color={playerColors[o.playerId]}
|
|
371
|
+
/>
|
|
372
|
+
))}
|
|
373
|
+
{Array(slot.capacity - slotOccupants.length)
|
|
374
|
+
.fill(null)
|
|
375
|
+
.map((_, i) => (
|
|
376
|
+
<DefaultEmptySlot key={`empty-${i}`} />
|
|
377
|
+
))}
|
|
378
|
+
</div>
|
|
379
|
+
)}
|
|
380
|
+
/>
|
|
381
|
+
)}
|
|
382
|
+
/>
|
|
383
|
+
</Container>
|
|
384
|
+
);
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
// List layout
|
|
388
|
+
function ListLayoutDemo() {
|
|
389
|
+
const listSlots: SlotDefinition[] = [
|
|
390
|
+
{
|
|
391
|
+
id: "harvest",
|
|
392
|
+
name: "Harvest Fields",
|
|
393
|
+
description: "Collect grain and vegetables from your fields",
|
|
394
|
+
capacity: 1,
|
|
395
|
+
exclusive: true,
|
|
396
|
+
reward: { grain: 2, vegetable: 1 },
|
|
397
|
+
},
|
|
398
|
+
{
|
|
399
|
+
id: "market",
|
|
400
|
+
name: "Go to Market",
|
|
401
|
+
description: "Sell goods for gold",
|
|
402
|
+
capacity: 2,
|
|
403
|
+
exclusive: false,
|
|
404
|
+
reward: { gold: 3 },
|
|
405
|
+
},
|
|
406
|
+
{
|
|
407
|
+
id: "hire",
|
|
408
|
+
name: "Hire Worker",
|
|
409
|
+
description: "Add a new worker to your pool",
|
|
410
|
+
capacity: 1,
|
|
411
|
+
exclusive: true,
|
|
412
|
+
cost: { gold: 5 },
|
|
413
|
+
reward: { worker: 1 },
|
|
414
|
+
},
|
|
415
|
+
];
|
|
416
|
+
|
|
417
|
+
const occupants: SlotOccupant[] = [
|
|
418
|
+
{ pieceId: "w1", playerId: "player-1", slotId: "market" },
|
|
419
|
+
];
|
|
420
|
+
|
|
421
|
+
return (
|
|
422
|
+
<Container title="List Layout">
|
|
423
|
+
<SlotSystem
|
|
424
|
+
slots={listSlots}
|
|
425
|
+
occupants={occupants}
|
|
426
|
+
layout="list"
|
|
427
|
+
renderSlot={(slot, slotOccupants) => (
|
|
428
|
+
<DefaultSlotItem
|
|
429
|
+
name={slot.name}
|
|
430
|
+
description={slot.description}
|
|
431
|
+
capacity={slot.capacity}
|
|
432
|
+
occupantCount={slotOccupants.length}
|
|
433
|
+
isExclusive={slot.exclusive}
|
|
434
|
+
isAvailable={slotOccupants.length < slot.capacity}
|
|
435
|
+
costLabel={formatResources(slot.cost, "-")}
|
|
436
|
+
rewardLabel={formatResources(slot.reward, "+")}
|
|
437
|
+
renderOccupants={() => (
|
|
438
|
+
<div className="flex gap-1">
|
|
439
|
+
{slotOccupants.map((o) => (
|
|
440
|
+
<DefaultSlotOccupant
|
|
441
|
+
key={o.pieceId}
|
|
442
|
+
color={playerColors[o.playerId]}
|
|
443
|
+
/>
|
|
444
|
+
))}
|
|
445
|
+
{Array(slot.capacity - slotOccupants.length)
|
|
446
|
+
.fill(null)
|
|
447
|
+
.map((_, i) => (
|
|
448
|
+
<DefaultEmptySlot key={`empty-${i}`} />
|
|
449
|
+
))}
|
|
450
|
+
</div>
|
|
451
|
+
)}
|
|
452
|
+
/>
|
|
453
|
+
)}
|
|
454
|
+
/>
|
|
455
|
+
</Container>
|
|
456
|
+
);
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
// Multi-capacity slots demo
|
|
460
|
+
function MultiCapacityDemo() {
|
|
461
|
+
const multiSlots: SlotDefinition[] = [
|
|
462
|
+
{
|
|
463
|
+
id: "tavern",
|
|
464
|
+
name: "The Tavern",
|
|
465
|
+
description: "Gather and socialize",
|
|
466
|
+
capacity: 4,
|
|
467
|
+
exclusive: false,
|
|
468
|
+
},
|
|
469
|
+
{
|
|
470
|
+
id: "mine",
|
|
471
|
+
name: "The Mine",
|
|
472
|
+
description: "Extract ore",
|
|
473
|
+
capacity: 3,
|
|
474
|
+
exclusive: false,
|
|
475
|
+
},
|
|
476
|
+
{
|
|
477
|
+
id: "throne",
|
|
478
|
+
name: "The Throne",
|
|
479
|
+
description: "Audience with the king",
|
|
480
|
+
capacity: 1,
|
|
481
|
+
exclusive: true,
|
|
482
|
+
},
|
|
483
|
+
];
|
|
484
|
+
|
|
485
|
+
const occupants: SlotOccupant[] = [
|
|
486
|
+
{ pieceId: "w1", playerId: "player-1", slotId: "tavern" },
|
|
487
|
+
{ pieceId: "w2", playerId: "player-2", slotId: "tavern" },
|
|
488
|
+
{ pieceId: "w3", playerId: "player-3", slotId: "tavern" },
|
|
489
|
+
{ pieceId: "w4", playerId: "player-1", slotId: "mine" },
|
|
490
|
+
{ pieceId: "w5", playerId: "player-2", slotId: "mine" },
|
|
491
|
+
];
|
|
492
|
+
|
|
493
|
+
return (
|
|
494
|
+
<Container title="Multi-Capacity Slots">
|
|
495
|
+
<SlotSystem
|
|
496
|
+
slots={multiSlots}
|
|
497
|
+
occupants={occupants}
|
|
498
|
+
layout="grid"
|
|
499
|
+
minSlotWidth={250}
|
|
500
|
+
renderSlot={(slot, slotOccupants) => (
|
|
501
|
+
<DefaultSlotItem
|
|
502
|
+
name={slot.name}
|
|
503
|
+
description={slot.description}
|
|
504
|
+
capacity={slot.capacity}
|
|
505
|
+
occupantCount={slotOccupants.length}
|
|
506
|
+
isExclusive={slot.exclusive}
|
|
507
|
+
isAvailable={slotOccupants.length < slot.capacity}
|
|
508
|
+
renderOccupants={() => (
|
|
509
|
+
<div className="flex gap-1 flex-wrap">
|
|
510
|
+
{slotOccupants.map((o) => (
|
|
511
|
+
<DefaultSlotOccupant
|
|
512
|
+
key={o.pieceId}
|
|
513
|
+
color={playerColors[o.playerId]}
|
|
514
|
+
/>
|
|
515
|
+
))}
|
|
516
|
+
{Array(slot.capacity - slotOccupants.length)
|
|
517
|
+
.fill(null)
|
|
518
|
+
.map((_, i) => (
|
|
519
|
+
<DefaultEmptySlot key={`empty-${i}`} />
|
|
520
|
+
))}
|
|
521
|
+
</div>
|
|
522
|
+
)}
|
|
523
|
+
/>
|
|
524
|
+
)}
|
|
525
|
+
/>
|
|
526
|
+
<div className="mt-4 text-sm text-slate-400">
|
|
527
|
+
Tavern has 4 capacity (1 spot left), Mine has 3 (1 spot left), Throne is
|
|
528
|
+
exclusive (available)
|
|
529
|
+
</div>
|
|
530
|
+
</Container>
|
|
531
|
+
);
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
// Personal action spaces
|
|
535
|
+
function PersonalSlotsDemo() {
|
|
536
|
+
const currentPlayerId = "player-2";
|
|
537
|
+
|
|
538
|
+
const personalSlots: SlotDefinition[] = [
|
|
539
|
+
{
|
|
540
|
+
id: "shared-1",
|
|
541
|
+
name: "Town Square",
|
|
542
|
+
description: "Public action space",
|
|
543
|
+
capacity: 2,
|
|
544
|
+
exclusive: false,
|
|
545
|
+
},
|
|
546
|
+
{
|
|
547
|
+
id: "p1-home",
|
|
548
|
+
name: "Player 1 Home",
|
|
549
|
+
description: "Only Player 1 can use",
|
|
550
|
+
capacity: 1,
|
|
551
|
+
exclusive: true,
|
|
552
|
+
owner: "player-1",
|
|
553
|
+
},
|
|
554
|
+
{
|
|
555
|
+
id: "p2-home",
|
|
556
|
+
name: "Player 2 Home",
|
|
557
|
+
description: "Only Player 2 can use",
|
|
558
|
+
capacity: 1,
|
|
559
|
+
exclusive: true,
|
|
560
|
+
owner: "player-2",
|
|
561
|
+
},
|
|
562
|
+
{
|
|
563
|
+
id: "shared-2",
|
|
564
|
+
name: "Market",
|
|
565
|
+
description: "Public action space",
|
|
566
|
+
capacity: 1,
|
|
567
|
+
exclusive: true,
|
|
568
|
+
},
|
|
569
|
+
];
|
|
570
|
+
|
|
571
|
+
const occupants: SlotOccupant[] = [
|
|
572
|
+
{ pieceId: "w1", playerId: "player-1", slotId: "shared-1" },
|
|
573
|
+
];
|
|
574
|
+
|
|
575
|
+
return (
|
|
576
|
+
<Container title="Personal Action Spaces">
|
|
577
|
+
<SlotSystem
|
|
578
|
+
slots={personalSlots}
|
|
579
|
+
occupants={occupants}
|
|
580
|
+
layout="grid"
|
|
581
|
+
minSlotWidth={280}
|
|
582
|
+
renderSlot={(slot, slotOccupants) => {
|
|
583
|
+
const isOwnerRestricted =
|
|
584
|
+
slot.owner && slot.owner !== currentPlayerId;
|
|
585
|
+
const isAvailable =
|
|
586
|
+
!isOwnerRestricted && slotOccupants.length < slot.capacity;
|
|
587
|
+
return (
|
|
588
|
+
<DefaultSlotItem
|
|
589
|
+
name={slot.name}
|
|
590
|
+
description={slot.description}
|
|
591
|
+
capacity={slot.capacity}
|
|
592
|
+
occupantCount={slotOccupants.length}
|
|
593
|
+
isExclusive={slot.exclusive}
|
|
594
|
+
isAvailable={isAvailable}
|
|
595
|
+
className={isOwnerRestricted ? "opacity-50" : ""}
|
|
596
|
+
renderOccupants={() => (
|
|
597
|
+
<div className="flex gap-1">
|
|
598
|
+
{slotOccupants.map((o) => (
|
|
599
|
+
<DefaultSlotOccupant
|
|
600
|
+
key={o.pieceId}
|
|
601
|
+
color={playerColors[o.playerId]}
|
|
602
|
+
/>
|
|
603
|
+
))}
|
|
604
|
+
{Array(slot.capacity - slotOccupants.length)
|
|
605
|
+
.fill(null)
|
|
606
|
+
.map((_, i) => (
|
|
607
|
+
<DefaultEmptySlot key={`empty-${i}`} />
|
|
608
|
+
))}
|
|
609
|
+
</div>
|
|
610
|
+
)}
|
|
611
|
+
/>
|
|
612
|
+
);
|
|
613
|
+
}}
|
|
614
|
+
/>
|
|
615
|
+
<div className="mt-4 text-sm text-slate-400">
|
|
616
|
+
As Player 2, you can see Player 1's home space is grayed out (not
|
|
617
|
+
available)
|
|
618
|
+
</div>
|
|
619
|
+
</Container>
|
|
620
|
+
);
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
// Large worker placement board with many slots - responsive stacking
|
|
624
|
+
function LargeBoardDemo() {
|
|
625
|
+
// Extended slots for a larger game
|
|
626
|
+
const extendedSlots: SlotDefinition[] = [
|
|
627
|
+
...agricolaSlots,
|
|
628
|
+
{
|
|
629
|
+
id: "sheep-market",
|
|
630
|
+
name: "Sheep Market",
|
|
631
|
+
description: "Buy sheep for your farm",
|
|
632
|
+
capacity: 2,
|
|
633
|
+
exclusive: false,
|
|
634
|
+
group: "Animals",
|
|
635
|
+
cost: { food: 1 },
|
|
636
|
+
reward: { sheep: 2 },
|
|
637
|
+
},
|
|
638
|
+
{
|
|
639
|
+
id: "cattle-market",
|
|
640
|
+
name: "Cattle Market",
|
|
641
|
+
description: "Buy cattle for your farm",
|
|
642
|
+
capacity: 2,
|
|
643
|
+
exclusive: false,
|
|
644
|
+
group: "Animals",
|
|
645
|
+
cost: { food: 2 },
|
|
646
|
+
reward: { cattle: 1 },
|
|
647
|
+
},
|
|
648
|
+
{
|
|
649
|
+
id: "pig-market",
|
|
650
|
+
name: "Pig Market",
|
|
651
|
+
description: "Buy pigs for your farm",
|
|
652
|
+
capacity: 2,
|
|
653
|
+
exclusive: false,
|
|
654
|
+
group: "Animals",
|
|
655
|
+
cost: { food: 1 },
|
|
656
|
+
reward: { pig: 1 },
|
|
657
|
+
},
|
|
658
|
+
{
|
|
659
|
+
id: "occupation",
|
|
660
|
+
name: "Play Occupation",
|
|
661
|
+
description: "Play an occupation card",
|
|
662
|
+
capacity: 1,
|
|
663
|
+
exclusive: true,
|
|
664
|
+
group: "Cards",
|
|
665
|
+
},
|
|
666
|
+
{
|
|
667
|
+
id: "improvement",
|
|
668
|
+
name: "Play Improvement",
|
|
669
|
+
description: "Play a minor improvement",
|
|
670
|
+
capacity: 1,
|
|
671
|
+
exclusive: true,
|
|
672
|
+
group: "Cards",
|
|
673
|
+
},
|
|
674
|
+
];
|
|
675
|
+
|
|
676
|
+
const occupants: SlotOccupant[] = [
|
|
677
|
+
{ pieceId: "w1", playerId: "player-1", slotId: "take-wood" },
|
|
678
|
+
{ pieceId: "w2", playerId: "player-2", slotId: "sheep-market" },
|
|
679
|
+
{ pieceId: "w3", playerId: "player-3", slotId: "occupation" },
|
|
680
|
+
];
|
|
681
|
+
|
|
682
|
+
return (
|
|
683
|
+
<Container title="Large Board with Many Slots (Responsive)">
|
|
684
|
+
<p className="text-slate-400 text-sm mb-4">
|
|
685
|
+
17 action spaces - slots stack responsively on smaller screens.
|
|
686
|
+
</p>
|
|
687
|
+
<SlotSystem
|
|
688
|
+
slots={extendedSlots}
|
|
689
|
+
occupants={occupants}
|
|
690
|
+
layout="grouped"
|
|
691
|
+
renderSlot={(slot, slotOccupants) => (
|
|
692
|
+
<DefaultSlotItem
|
|
693
|
+
name={slot.name}
|
|
694
|
+
description={slot.description}
|
|
695
|
+
capacity={slot.capacity}
|
|
696
|
+
occupantCount={slotOccupants.length}
|
|
697
|
+
isExclusive={slot.exclusive}
|
|
698
|
+
isAvailable={slotOccupants.length < slot.capacity}
|
|
699
|
+
costLabel={formatResources(slot.cost, "-")}
|
|
700
|
+
rewardLabel={formatResources(slot.reward, "+")}
|
|
701
|
+
renderOccupants={() => (
|
|
702
|
+
<div className="flex gap-1">
|
|
703
|
+
{slotOccupants.map((o) => (
|
|
704
|
+
<DefaultSlotOccupant
|
|
705
|
+
key={o.pieceId}
|
|
706
|
+
color={playerColors[o.playerId]}
|
|
707
|
+
/>
|
|
708
|
+
))}
|
|
709
|
+
{Array(slot.capacity - slotOccupants.length)
|
|
710
|
+
.fill(null)
|
|
711
|
+
.map((_, i) => (
|
|
712
|
+
<DefaultEmptySlot key={`empty-${i}`} />
|
|
713
|
+
))}
|
|
714
|
+
</div>
|
|
715
|
+
)}
|
|
716
|
+
/>
|
|
717
|
+
)}
|
|
718
|
+
/>
|
|
719
|
+
</Container>
|
|
720
|
+
);
|
|
721
|
+
}
|
|
722
|
+
|
|
723
|
+
// Narrow container demo - shows stacking behavior
|
|
724
|
+
function NarrowContainerDemo() {
|
|
725
|
+
const occupants: SlotOccupant[] = [
|
|
726
|
+
{ pieceId: "w1", playerId: "player-1", slotId: "plow-field" },
|
|
727
|
+
];
|
|
728
|
+
|
|
729
|
+
return (
|
|
730
|
+
<Container title="Narrow Container (Stacking Demo)">
|
|
731
|
+
<p className="text-slate-400 text-sm mb-4">
|
|
732
|
+
In a narrow container, slots stack vertically.
|
|
733
|
+
</p>
|
|
734
|
+
<div className="max-w-sm mx-auto">
|
|
735
|
+
<SlotSystem
|
|
736
|
+
slots={agricolaSlots.slice(0, 4)}
|
|
737
|
+
occupants={occupants}
|
|
738
|
+
layout="grid"
|
|
739
|
+
minSlotWidth={250}
|
|
740
|
+
renderSlot={(slot, slotOccupants) => (
|
|
741
|
+
<DefaultSlotItem
|
|
742
|
+
name={slot.name}
|
|
743
|
+
description={slot.description}
|
|
744
|
+
capacity={slot.capacity}
|
|
745
|
+
occupantCount={slotOccupants.length}
|
|
746
|
+
isExclusive={slot.exclusive}
|
|
747
|
+
isAvailable={slotOccupants.length < slot.capacity}
|
|
748
|
+
costLabel={formatResources(slot.cost, "-")}
|
|
749
|
+
rewardLabel={formatResources(slot.reward, "+")}
|
|
750
|
+
renderOccupants={() => (
|
|
751
|
+
<div className="flex gap-1">
|
|
752
|
+
{slotOccupants.map((o) => (
|
|
753
|
+
<DefaultSlotOccupant
|
|
754
|
+
key={o.pieceId}
|
|
755
|
+
color={playerColors[o.playerId]}
|
|
756
|
+
/>
|
|
757
|
+
))}
|
|
758
|
+
{Array(slot.capacity - slotOccupants.length)
|
|
759
|
+
.fill(null)
|
|
760
|
+
.map((_, i) => (
|
|
761
|
+
<DefaultEmptySlot key={`empty-${i}`} />
|
|
762
|
+
))}
|
|
763
|
+
</div>
|
|
764
|
+
)}
|
|
765
|
+
/>
|
|
766
|
+
)}
|
|
767
|
+
renderOccupant={(occupant) => (
|
|
768
|
+
<DefaultSlotOccupant color={playerColors[occupant.playerId]} />
|
|
769
|
+
)}
|
|
770
|
+
/>
|
|
771
|
+
</div>
|
|
772
|
+
</Container>
|
|
773
|
+
);
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
export default {
|
|
777
|
+
interactive: <InteractiveDemo />,
|
|
778
|
+
grid: <GridLayoutDemo />,
|
|
779
|
+
list: <ListLayoutDemo />,
|
|
780
|
+
multiCapacity: <MultiCapacityDemo />,
|
|
781
|
+
personal: <PersonalSlotsDemo />,
|
|
782
|
+
largeBoard: <LargeBoardDemo />,
|
|
783
|
+
narrowContainer: <NarrowContainerDemo />,
|
|
784
|
+
|
|
785
|
+
default: (
|
|
786
|
+
<Container title="Basic Slot System">
|
|
787
|
+
<SlotSystem
|
|
788
|
+
slots={agricolaSlots.slice(0, 8)}
|
|
789
|
+
occupants={[
|
|
790
|
+
{ pieceId: "w1", playerId: "player-1", slotId: "take-wood" },
|
|
791
|
+
{ pieceId: "w2", playerId: "player-2", slotId: "plow-field" },
|
|
792
|
+
]}
|
|
793
|
+
layout="grid"
|
|
794
|
+
renderSlot={(slot, slotOccupants) => (
|
|
795
|
+
<DefaultSlotItem
|
|
796
|
+
name={slot.name}
|
|
797
|
+
description={slot.description}
|
|
798
|
+
capacity={slot.capacity}
|
|
799
|
+
occupantCount={slotOccupants.length}
|
|
800
|
+
isExclusive={slot.exclusive}
|
|
801
|
+
isAvailable={slotOccupants.length < slot.capacity}
|
|
802
|
+
costLabel={formatResources(slot.cost, "-")}
|
|
803
|
+
rewardLabel={formatResources(slot.reward, "+")}
|
|
804
|
+
renderOccupants={() => (
|
|
805
|
+
<div className="flex gap-1">
|
|
806
|
+
{slotOccupants.map((o) => (
|
|
807
|
+
<DefaultSlotOccupant
|
|
808
|
+
key={o.pieceId}
|
|
809
|
+
color={playerColors[o.playerId]}
|
|
810
|
+
/>
|
|
811
|
+
))}
|
|
812
|
+
{Array(slot.capacity - slotOccupants.length)
|
|
813
|
+
.fill(null)
|
|
814
|
+
.map((_, i) => (
|
|
815
|
+
<DefaultEmptySlot key={`empty-${i}`} />
|
|
816
|
+
))}
|
|
817
|
+
</div>
|
|
818
|
+
)}
|
|
819
|
+
/>
|
|
820
|
+
)}
|
|
821
|
+
/>
|
|
822
|
+
</Container>
|
|
823
|
+
),
|
|
824
|
+
};
|