@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 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-state.d.ts","sourceRoot":"","sources":["../../src/types/plugin-state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAE9D;;;;;;GAMG;AAEH,KAAK,UAAU,GAAG,MAAM,CAAC;AAEzB,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,QAAQ,CAAC;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,SAAS,EAAE,OAAO,CAAC;CACpB;AAMD;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,4CAA4C;IAC5C,KAAK,EAAE,cAAc,EAAE,CA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C,CAAC;CACvE;AAED;;;GAGG;AACH,MAAM,WAAW,mBAAmB,CAClC,IAAI,GAAG,OAAO,EACd,SAAS,SAAS,MAAM,GAAG,MAAM,EACjC,SAAS,SAAS,MAAM,GAAG,MAAM,EACjC,eAAe,SAAS,MAAM,GAAG,MAAM;IAEvC,6EAA6E;IAC7E,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;IAClB,8EAA8E;IAC9E,QAAQ,EAAE,gBAAgB,CAAC,SAAS,EAAE,SAAS,EAAE,eAAe,CAAC,CAAC;IAClE,iEAAiE;IACjE,KAAK,EAAE,UAAU,GAAG,IAAI,CAAC;IACzB,gFAAgF;IAChF,aAAa,EAAE,YAAY,EAAE,CAAC;IAC9B,wEAAwE;IACxE,OAAO,EAAE,kBAAkB,CAAC;IAC5B,+EAA+E;IAC/E,OAAO,EAAE,YAAY,GAAG,IAAI,CAAC;IAC7B,oDAAoD;IACpD,MAAM,EAAE,MAAM,CAAC;CAChB;AAMD;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,YAAY,CAAC;IACnB,0CAA0C;IAC1C,MAAM,EAAE,MAAM,CAAC;IACf,8BAA8B;IAC9B,KAAK,EAAE,mBAAmB,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,WAAW,CAAC;IAClB,+CAA+C;IAC/C,MAAM,EAAE,MAAM,CAAC;CAChB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { GameView, PhaseName } from "@dreamboard/ui-contract";
|
|
2
|
+
import type { GameplayPromptOption, GameplaySnapshot as BaseGameplaySnapshot, PluginStateSnapshot as BasePluginStateSnapshot } from "./plugin-state.js";
|
|
3
|
+
type StageName = string;
|
|
4
|
+
type InteractionId = string;
|
|
5
|
+
export type GameplaySnapshot = BaseGameplaySnapshot<PhaseName, StageName, InteractionId>;
|
|
6
|
+
export type PluginStateSnapshot = Omit<BasePluginStateSnapshot<GameView, PhaseName, StageName, InteractionId>, "gameplay"> & {
|
|
7
|
+
gameplay: GameplaySnapshot;
|
|
8
|
+
};
|
|
9
|
+
export type { GameplayPromptOption };
|
|
10
|
+
//# sourceMappingURL=reducer-state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reducer-state.d.ts","sourceRoot":"","sources":["../../src/types/reducer-state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,KAAK,EACV,oBAAoB,EACpB,gBAAgB,IAAI,oBAAoB,EACxC,mBAAmB,IAAI,uBAAuB,EAC/C,MAAM,mBAAmB,CAAC;AAE3B,KAAK,SAAS,GAAG,MAAM,CAAC;AACxB,KAAK,aAAa,GAAG,MAAM,CAAC;AAE5B,MAAM,MAAM,gBAAgB,GAAG,oBAAoB,CACjD,SAAS,EACT,SAAS,EACT,aAAa,CACd,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,IAAI,CACpC,uBAAuB,CAAC,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,aAAa,CAAC,EACtE,UAAU,CACX,GAAG;IACF,QAAQ,EAAE,gBAAgB,CAAC;CAC5B,CAAC;AAEF,YAAY,EAAE,oBAAoB,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import type { PlayerId } from "@dreamboard/manifest-contract";
|
|
2
|
+
/**
|
|
3
|
+
* Result of validating a player action
|
|
4
|
+
*/
|
|
5
|
+
export interface ValidationResult {
|
|
6
|
+
/** Whether the action is valid */
|
|
7
|
+
valid: boolean;
|
|
8
|
+
/** Machine-readable error code if validation failed */
|
|
9
|
+
errorCode?: string;
|
|
10
|
+
/** Human-readable error message if validation failed */
|
|
11
|
+
message?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Structured authoritative submission failure returned by runtime submit APIs.
|
|
15
|
+
*/
|
|
16
|
+
export interface SubmissionError extends Error {
|
|
17
|
+
/** Machine-readable error code when available */
|
|
18
|
+
errorCode?: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Plugin session state
|
|
22
|
+
*/
|
|
23
|
+
export interface PluginSessionState {
|
|
24
|
+
/** Session initialization status */
|
|
25
|
+
status: "loading" | "ready";
|
|
26
|
+
/** Current session ID (null if not initialized) */
|
|
27
|
+
sessionId: string | null;
|
|
28
|
+
/** Player IDs that this user can control (immutable after game starts) */
|
|
29
|
+
controllablePlayerIds: PlayerId[];
|
|
30
|
+
/** The currently selected player ID that the user is controlling */
|
|
31
|
+
controllingPlayerId: PlayerId | null;
|
|
32
|
+
/** User ID of the controller (null if not initialized) */
|
|
33
|
+
userId: string | null;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* RuntimeAPI provides the interface between plugin code and the game runtime.
|
|
37
|
+
* This API is exposed to plugin iframes for subscribing to game events and submitting actions.
|
|
38
|
+
*/
|
|
39
|
+
export interface RuntimeAPI {
|
|
40
|
+
/**
|
|
41
|
+
* Validate a player interaction before submitting it. `params` is typed
|
|
42
|
+
* as `unknown` because a `promptInput` collector can declare a scalar
|
|
43
|
+
* response schema (`z.enum([...])`, `z.string()`, `z.number()`, ...)
|
|
44
|
+
* while ordinary collectors pass an object.
|
|
45
|
+
*
|
|
46
|
+
* @param playerId - ID of the player performing the interaction
|
|
47
|
+
* @param interactionId - Identifier of the interaction
|
|
48
|
+
* @param params - Interaction-specific payload
|
|
49
|
+
* @returns Promise that resolves with validation result
|
|
50
|
+
*/
|
|
51
|
+
validateInteraction: (playerId: PlayerId, interactionId: string, params: unknown) => Promise<ValidationResult>;
|
|
52
|
+
/**
|
|
53
|
+
* Submit a player interaction to the game server. `submitInteraction`
|
|
54
|
+
* is the single submission verb for every interaction kind — authors
|
|
55
|
+
* do not split between "action" and "prompt response" calls.
|
|
56
|
+
*
|
|
57
|
+
* @param playerId - ID of the player performing the interaction
|
|
58
|
+
* @param interactionId - Identifier of the interaction
|
|
59
|
+
* @param params - Interaction-specific payload (see
|
|
60
|
+
* {@link validateInteraction} for the `unknown` typing rationale)
|
|
61
|
+
* @throws SubmissionError if submission is rejected by the authority.
|
|
62
|
+
*/
|
|
63
|
+
submitInteraction: (playerId: PlayerId, interactionId: string, params: unknown) => Promise<void>;
|
|
64
|
+
/**
|
|
65
|
+
* Get the current plugin session state.
|
|
66
|
+
* Returns initialization status and session/player IDs.
|
|
67
|
+
*
|
|
68
|
+
* @returns Current plugin session state
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* ```typescript
|
|
72
|
+
* const { status, sessionId, playerId } = runtime.getSessionState();
|
|
73
|
+
* if (status === "ready") {
|
|
74
|
+
* console.log('Connected to session:', sessionId);
|
|
75
|
+
* }
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
|
+
getSessionState: () => PluginSessionState;
|
|
79
|
+
/**
|
|
80
|
+
* Disconnect from the runtime and clean up all listeners.
|
|
81
|
+
* Should be called when the plugin is unmounting.
|
|
82
|
+
*/
|
|
83
|
+
disconnect: () => void;
|
|
84
|
+
/**
|
|
85
|
+
* Request to switch to a different player.
|
|
86
|
+
* Only works if the user controls multiple seats.
|
|
87
|
+
* The parent window will handle the switch and update the session state.
|
|
88
|
+
*
|
|
89
|
+
* @param playerId - ID of the player to switch to
|
|
90
|
+
*
|
|
91
|
+
* @example
|
|
92
|
+
* ```typescript
|
|
93
|
+
* // Switch to player-2
|
|
94
|
+
* runtime.switchPlayer?.('player-2');
|
|
95
|
+
* ```
|
|
96
|
+
*/
|
|
97
|
+
switchPlayer?: (playerId: PlayerId) => void;
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=runtime-api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-api.d.ts","sourceRoot":"","sources":["../../src/types/runtime-api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AE,QAAQ,KAAK,IAAI,CAAC;CAC7C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import type { BoardId, EdgeTypeId, PlayerId, SpaceTypeId, VertexTypeId } from "@dreamboard/manifest-contract";
|
|
2
|
+
import type { HexBoardState, HexEdgeState, HexTileState, HexVertexState, SquareBoardState, SquareCellState, SquareEdgeState, SquarePieceState, SquareVertexState } from "./player-state.js";
|
|
3
|
+
type RuntimeFields = Record<string, unknown>;
|
|
4
|
+
export interface GeneratedTiledEdgeStateLike<SpaceIdValue extends string = string, EdgeIdValue extends string = string, Fields = RuntimeFields> {
|
|
5
|
+
id: EdgeIdValue;
|
|
6
|
+
spaceIds: readonly SpaceIdValue[];
|
|
7
|
+
typeId?: EdgeTypeId | null;
|
|
8
|
+
label?: string | null;
|
|
9
|
+
ownerId?: PlayerId | null;
|
|
10
|
+
fields?: Fields;
|
|
11
|
+
}
|
|
12
|
+
export interface GeneratedTiledVertexStateLike<SpaceIdValue extends string = string, VertexIdValue extends string = string, Fields = RuntimeFields> {
|
|
13
|
+
id: VertexIdValue;
|
|
14
|
+
spaceIds: readonly SpaceIdValue[];
|
|
15
|
+
typeId?: VertexTypeId | null;
|
|
16
|
+
label?: string | null;
|
|
17
|
+
ownerId?: PlayerId | null;
|
|
18
|
+
fields?: Fields;
|
|
19
|
+
}
|
|
20
|
+
export interface GeneratedHexSpaceStateLike<SpaceIdValue extends string = string, Fields = RuntimeFields> {
|
|
21
|
+
id: SpaceIdValue;
|
|
22
|
+
q: number;
|
|
23
|
+
r: number;
|
|
24
|
+
typeId?: SpaceTypeId | null;
|
|
25
|
+
label?: string | null;
|
|
26
|
+
ownerId?: PlayerId | null;
|
|
27
|
+
fields?: Fields;
|
|
28
|
+
}
|
|
29
|
+
export interface GeneratedSquareSpaceStateLike<SpaceIdValue extends string = string, Fields = RuntimeFields> {
|
|
30
|
+
id: SpaceIdValue;
|
|
31
|
+
row: number;
|
|
32
|
+
col: number;
|
|
33
|
+
typeId?: SpaceTypeId | null;
|
|
34
|
+
label?: string | null;
|
|
35
|
+
ownerId?: PlayerId | null;
|
|
36
|
+
fields?: Fields;
|
|
37
|
+
}
|
|
38
|
+
export interface GeneratedHexBoardInput<BoardIdValue extends string = BoardId, SpaceIdValue extends string = string, EdgeIdValue extends string = string, VertexIdValue extends string = string, SpaceFields = RuntimeFields, EdgeFields = RuntimeFields, VertexFields = RuntimeFields> {
|
|
39
|
+
id: BoardIdValue;
|
|
40
|
+
layout?: "hex";
|
|
41
|
+
orientation?: "pointy-top" | "flat-top";
|
|
42
|
+
spaces: Readonly<Record<SpaceIdValue, GeneratedHexSpaceStateLike<SpaceIdValue, SpaceFields>>>;
|
|
43
|
+
edges: ReadonlyArray<HexEdgeState<BoardIdValue, SpaceIdValue, EdgeIdValue, EdgeFields> | GeneratedTiledEdgeStateLike<SpaceIdValue, EdgeIdValue, EdgeFields>>;
|
|
44
|
+
vertices: ReadonlyArray<HexVertexState<BoardIdValue, SpaceIdValue, VertexIdValue, VertexFields> | GeneratedTiledVertexStateLike<SpaceIdValue, VertexIdValue, VertexFields>>;
|
|
45
|
+
}
|
|
46
|
+
export interface AuthoredHexBoardInput<BoardIdValue extends string = BoardId, SpaceIdValue extends string = string, EdgeIdValue extends string = string, VertexIdValue extends string = string, SpaceFields = RuntimeFields, EdgeFields = RuntimeFields, VertexFields = RuntimeFields, SpaceView = unknown> {
|
|
47
|
+
id: BoardIdValue;
|
|
48
|
+
layout?: "hex";
|
|
49
|
+
orientation?: "pointy-top" | "flat-top";
|
|
50
|
+
tiles: ReadonlyArray<HexTileState<BoardIdValue, SpaceIdValue, SpaceFields, SpaceView>>;
|
|
51
|
+
edges: ReadonlyArray<HexEdgeState<BoardIdValue, SpaceIdValue, EdgeIdValue, EdgeFields> | GeneratedTiledEdgeStateLike<SpaceIdValue, EdgeIdValue, EdgeFields>>;
|
|
52
|
+
vertices: ReadonlyArray<HexVertexState<BoardIdValue, SpaceIdValue, VertexIdValue, VertexFields> | GeneratedTiledVertexStateLike<SpaceIdValue, VertexIdValue, VertexFields>>;
|
|
53
|
+
}
|
|
54
|
+
export type HexBoardInput<BoardIdValue extends string = BoardId, SpaceIdValue extends string = string, EdgeIdValue extends string = string, VertexIdValue extends string = string, SpaceFields = RuntimeFields, EdgeFields = RuntimeFields, VertexFields = RuntimeFields> = AuthoredHexBoardInput<BoardIdValue, SpaceIdValue, EdgeIdValue, VertexIdValue, SpaceFields, EdgeFields, VertexFields> | GeneratedHexBoardInput<BoardIdValue, SpaceIdValue, EdgeIdValue, VertexIdValue, SpaceFields, EdgeFields, VertexFields>;
|
|
55
|
+
export interface GeneratedSquareBoardInput<BoardIdValue extends string = BoardId, SpaceIdValue extends string = string, EdgeIdValue extends string = string, VertexIdValue extends string = string, PieceIdValue extends string = string, SpaceFields = RuntimeFields, EdgeFields = RuntimeFields, VertexFields = RuntimeFields, PieceFields = RuntimeFields> {
|
|
56
|
+
id: BoardIdValue;
|
|
57
|
+
layout?: "square";
|
|
58
|
+
spaces: Readonly<Record<SpaceIdValue, GeneratedSquareSpaceStateLike<SpaceIdValue, SpaceFields>>>;
|
|
59
|
+
edges: ReadonlyArray<SquareEdgeState<SpaceIdValue, EdgeIdValue, EdgeFields> | GeneratedTiledEdgeStateLike<SpaceIdValue, EdgeIdValue, EdgeFields>>;
|
|
60
|
+
vertices: ReadonlyArray<SquareVertexState<SpaceIdValue, VertexIdValue, VertexFields> | GeneratedTiledVertexStateLike<SpaceIdValue, VertexIdValue, VertexFields>>;
|
|
61
|
+
pieces?: ReadonlyArray<SquarePieceState<PieceIdValue, PieceFields>>;
|
|
62
|
+
}
|
|
63
|
+
export interface AuthoredSquareBoardInput<BoardIdValue extends string = BoardId, SpaceIdValue extends string = string, EdgeIdValue extends string = string, VertexIdValue extends string = string, PieceIdValue extends string = string, SpaceFields = RuntimeFields, EdgeFields = RuntimeFields, VertexFields = RuntimeFields, PieceFields = RuntimeFields> {
|
|
64
|
+
id: BoardIdValue;
|
|
65
|
+
layout?: "square";
|
|
66
|
+
rows: number;
|
|
67
|
+
cols: number;
|
|
68
|
+
cells: ReadonlyArray<SquareCellState<SpaceIdValue, SpaceFields>>;
|
|
69
|
+
edges: ReadonlyArray<SquareEdgeState<SpaceIdValue, EdgeIdValue, EdgeFields> | GeneratedTiledEdgeStateLike<SpaceIdValue, EdgeIdValue, EdgeFields>>;
|
|
70
|
+
vertices: ReadonlyArray<SquareVertexState<SpaceIdValue, VertexIdValue, VertexFields> | GeneratedTiledVertexStateLike<SpaceIdValue, VertexIdValue, VertexFields>>;
|
|
71
|
+
pieces: ReadonlyArray<SquarePieceState<PieceIdValue, PieceFields>>;
|
|
72
|
+
}
|
|
73
|
+
export type SquareBoardInput<BoardIdValue extends string = BoardId, SpaceIdValue extends string = string, EdgeIdValue extends string = string, VertexIdValue extends string = string, PieceIdValue extends string = string, SpaceFields = RuntimeFields, EdgeFields = RuntimeFields, VertexFields = RuntimeFields, PieceFields = RuntimeFields> = AuthoredSquareBoardInput<BoardIdValue, SpaceIdValue, EdgeIdValue, VertexIdValue, PieceIdValue, SpaceFields, EdgeFields, VertexFields, PieceFields> | GeneratedSquareBoardInput<BoardIdValue, SpaceIdValue, EdgeIdValue, VertexIdValue, PieceIdValue, SpaceFields, EdgeFields, VertexFields, PieceFields>;
|
|
74
|
+
export type AnyHexBoardInput = HexBoardInput<string, string, string, string, RuntimeFields, RuntimeFields, RuntimeFields>;
|
|
75
|
+
export type AnySquareBoardInput = SquareBoardInput<string, string, string, string, string, RuntimeFields, RuntimeFields, RuntimeFields, RuntimeFields>;
|
|
76
|
+
export type BoardIdOf<TBoard> = TBoard extends {
|
|
77
|
+
id: infer Id extends string;
|
|
78
|
+
} ? Id : string;
|
|
79
|
+
type SpaceRecordValueOf<TBoard> = TBoard extends {
|
|
80
|
+
spaces: Readonly<Record<string, infer Space>>;
|
|
81
|
+
} ? Space : never;
|
|
82
|
+
type TileValueOf<TBoard> = TBoard extends {
|
|
83
|
+
tiles: ReadonlyArray<infer Tile>;
|
|
84
|
+
} ? Tile : never;
|
|
85
|
+
type CellValueOf<TBoard> = TBoard extends {
|
|
86
|
+
cells: ReadonlyArray<infer Cell>;
|
|
87
|
+
} ? Cell : never;
|
|
88
|
+
type EdgeValueOf<TBoard> = TBoard extends {
|
|
89
|
+
edges: ReadonlyArray<infer Edge>;
|
|
90
|
+
} ? Edge : never;
|
|
91
|
+
type VertexValueOf<TBoard> = TBoard extends {
|
|
92
|
+
vertices: ReadonlyArray<infer Vertex>;
|
|
93
|
+
} ? Vertex : never;
|
|
94
|
+
type PieceValueOf<TBoard> = TBoard extends {
|
|
95
|
+
pieces?: ReadonlyArray<infer Piece>;
|
|
96
|
+
} ? Piece : never;
|
|
97
|
+
export type BoardSpaceIdOf<TBoard> = SpaceRecordValueOf<TBoard> extends {
|
|
98
|
+
id: infer Id extends string;
|
|
99
|
+
} ? Id : TileValueOf<TBoard> extends {
|
|
100
|
+
id: infer Id extends string;
|
|
101
|
+
} ? Id : CellValueOf<TBoard> extends {
|
|
102
|
+
id: infer Id extends string;
|
|
103
|
+
} ? Id : never;
|
|
104
|
+
export type BoardEdgeIdOf<TBoard> = EdgeValueOf<TBoard> extends {
|
|
105
|
+
id: infer Id extends string;
|
|
106
|
+
} ? Id : never;
|
|
107
|
+
export type BoardVertexIdOf<TBoard> = VertexValueOf<TBoard> extends {
|
|
108
|
+
id: infer Id extends string;
|
|
109
|
+
} ? Id : never;
|
|
110
|
+
type HexTilePropertiesOf<TBoard> = SpaceRecordValueOf<TBoard> extends {
|
|
111
|
+
fields?: infer Fields;
|
|
112
|
+
} ? Fields : TileValueOf<TBoard> extends {
|
|
113
|
+
properties?: infer Properties;
|
|
114
|
+
} ? Properties : RuntimeFields;
|
|
115
|
+
type HexTileViewOf<TBoard> = TileValueOf<TBoard> extends {
|
|
116
|
+
view: infer View;
|
|
117
|
+
} ? View : TileValueOf<TBoard> extends {
|
|
118
|
+
view?: infer View;
|
|
119
|
+
} ? View | undefined : unknown;
|
|
120
|
+
type HexEdgePropertiesOf<TBoard> = EdgeValueOf<TBoard> extends {
|
|
121
|
+
fields?: infer Fields;
|
|
122
|
+
} ? Fields : EdgeValueOf<TBoard> extends {
|
|
123
|
+
properties?: infer Properties;
|
|
124
|
+
} ? Properties : RuntimeFields;
|
|
125
|
+
type HexVertexPropertiesOf<TBoard> = VertexValueOf<TBoard> extends {
|
|
126
|
+
fields?: infer Fields;
|
|
127
|
+
} ? Fields : VertexValueOf<TBoard> extends {
|
|
128
|
+
properties?: infer Properties;
|
|
129
|
+
} ? Properties : RuntimeFields;
|
|
130
|
+
type SquareCellPropertiesOf<TBoard> = SpaceRecordValueOf<TBoard> extends {
|
|
131
|
+
fields?: infer Fields;
|
|
132
|
+
} ? Fields : CellValueOf<TBoard> extends {
|
|
133
|
+
properties?: infer Properties;
|
|
134
|
+
} ? Properties : RuntimeFields;
|
|
135
|
+
type SquareEdgePropertiesOf<TBoard> = EdgeValueOf<TBoard> extends {
|
|
136
|
+
fields?: infer Fields;
|
|
137
|
+
} ? Fields : EdgeValueOf<TBoard> extends {
|
|
138
|
+
properties?: infer Properties;
|
|
139
|
+
} ? Properties : RuntimeFields;
|
|
140
|
+
type SquareVertexPropertiesOf<TBoard> = VertexValueOf<TBoard> extends {
|
|
141
|
+
fields?: infer Fields;
|
|
142
|
+
} ? Fields : VertexValueOf<TBoard> extends {
|
|
143
|
+
properties?: infer Properties;
|
|
144
|
+
} ? Properties : RuntimeFields;
|
|
145
|
+
type SquarePiecePropertiesOf<TBoard> = PieceValueOf<TBoard> extends {
|
|
146
|
+
properties?: infer Properties;
|
|
147
|
+
} ? Properties : RuntimeFields;
|
|
148
|
+
/**
|
|
149
|
+
* Normalized hex tile shape for a given board input.
|
|
150
|
+
*
|
|
151
|
+
* `view` is always present (required) on the result so consumers can
|
|
152
|
+
* read overlay fields without a null-check. For boards that do not
|
|
153
|
+
* statically declare a `view` shape (the generic case), `view` falls
|
|
154
|
+
* back to `unknown`, which still admits any value.
|
|
155
|
+
*
|
|
156
|
+
* The runtime normalizer injects `view: undefined` for inputs that
|
|
157
|
+
* do not author a `view` field, keeping the runtime contract aligned
|
|
158
|
+
* with this static shape.
|
|
159
|
+
*/
|
|
160
|
+
export type NormalizedHexTileOf<TBoard extends AnyHexBoardInput> = Omit<HexTileState<BoardIdOf<TBoard>, BoardSpaceIdOf<TBoard>, HexTilePropertiesOf<TBoard>, HexTileViewOf<TBoard>>, "view"> & {
|
|
161
|
+
view: HexTileViewOf<TBoard>;
|
|
162
|
+
};
|
|
163
|
+
export type NormalizedHexEdgeOf<TBoard extends AnyHexBoardInput> = HexEdgeState<BoardIdOf<TBoard>, BoardSpaceIdOf<TBoard>, BoardEdgeIdOf<TBoard>, HexEdgePropertiesOf<TBoard>>;
|
|
164
|
+
export type NormalizedHexVertexOf<TBoard extends AnyHexBoardInput> = HexVertexState<BoardIdOf<TBoard>, BoardSpaceIdOf<TBoard>, BoardVertexIdOf<TBoard>, HexVertexPropertiesOf<TBoard>>;
|
|
165
|
+
export type NormalizedSquareCellOf<TBoard extends AnySquareBoardInput> = SquareCellState<BoardSpaceIdOf<TBoard>, SquareCellPropertiesOf<TBoard>>;
|
|
166
|
+
export type NormalizedSquareEdgeOf<TBoard extends AnySquareBoardInput> = SquareEdgeState<BoardSpaceIdOf<TBoard>, BoardEdgeIdOf<TBoard>, SquareEdgePropertiesOf<TBoard>>;
|
|
167
|
+
export type NormalizedSquareVertexOf<TBoard extends AnySquareBoardInput> = SquareVertexState<BoardSpaceIdOf<TBoard>, BoardVertexIdOf<TBoard>, SquareVertexPropertiesOf<TBoard>>;
|
|
168
|
+
export type NormalizedSquarePieceOf<TBoard extends AnySquareBoardInput> = SquarePieceState<PieceValueOf<TBoard> extends {
|
|
169
|
+
id: infer PieceIdValue extends string;
|
|
170
|
+
} ? PieceIdValue : string, SquarePiecePropertiesOf<TBoard>>;
|
|
171
|
+
export type NormalizedHexBoard<TBoard extends AnyHexBoardInput> = Omit<Pick<HexBoardState<BoardIdOf<TBoard>, BoardSpaceIdOf<TBoard>, BoardEdgeIdOf<TBoard>, BoardVertexIdOf<TBoard>, HexTilePropertiesOf<TBoard>, HexEdgePropertiesOf<TBoard>, HexVertexPropertiesOf<TBoard>>, "id" | "tiles" | "edges" | "vertices">, "tiles"> & {
|
|
172
|
+
tiles: ReadonlyArray<NormalizedHexTileOf<TBoard>>;
|
|
173
|
+
orientation?: "pointy-top" | "flat-top";
|
|
174
|
+
};
|
|
175
|
+
export type NormalizedSquareBoard<TBoard extends AnySquareBoardInput> = Pick<SquareBoardState<BoardIdOf<TBoard>, BoardSpaceIdOf<TBoard>, BoardEdgeIdOf<TBoard>, BoardVertexIdOf<TBoard>, PieceValueOf<TBoard> extends {
|
|
176
|
+
id: infer PieceIdValue extends string;
|
|
177
|
+
} ? PieceIdValue : string, SquareCellPropertiesOf<TBoard>, SquareEdgePropertiesOf<TBoard>, SquareVertexPropertiesOf<TBoard>, SquarePiecePropertiesOf<TBoard>>, "id" | "rows" | "cols" | "cells" | "edges" | "vertices" | "pieces">;
|
|
178
|
+
export declare function isGeneratedHexBoardInput<TBoard extends AnyHexBoardInput | AnySquareBoardInput>(board: TBoard): board is Extract<TBoard, {
|
|
179
|
+
spaces: Readonly<Record<string, unknown>>;
|
|
180
|
+
}>;
|
|
181
|
+
export declare function isGeneratedSquareBoardInput<TBoard extends AnyHexBoardInput | AnySquareBoardInput>(board: TBoard): board is Extract<TBoard, {
|
|
182
|
+
spaces: Readonly<Record<string, unknown>>;
|
|
183
|
+
}>;
|
|
184
|
+
export declare function normalizeHexBoardInput<TBoard extends AnyHexBoardInput>(board: TBoard): NormalizedHexBoard<TBoard>;
|
|
185
|
+
export declare function normalizeSquareBoardInput<TBoard extends AnySquareBoardInput>(board: TBoard): NormalizedSquareBoard<TBoard>;
|
|
186
|
+
export {};
|
|
187
|
+
//# sourceMappingURL=tiled-board.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+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AM,CAAA;CAAE,GAClE,YAAY,GACZ,MAAM,EACV,sBAAsB,CAAC,MAAM,CAAC,EAC9B,sBAAsB,CAAC,MAAM,CAAC,EAC9B,wBAAwB,CAAC,MAAM,CAAC,EAChC,uBAAuB,CAAC,MAAM,CAAC,CAChC,EACD,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,GAAG,UAAU,GAAG,QAAQ,CACnE,CAAC;AAiBF,wBAAgB,wBAAwB,CACtC,MAAM,SAAS,gBAAgB,GAAG,mBAAmB,EAErD,KAAK,EAAE,MAAM,GACZ,KAAK,IAAI,OAAO,CAAC,MAAM,EAAE;IAAE,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAA;CAAE,CAAC,CAkBzE;AAED,wBAAgB,2BAA2B,CACzC,MAAM,SAAS,gBAAgB,GAAG,mBAAmB,EAErD,KAAK,EAAE,MAAM,GACZ,KAAK,IAAI,OAAO,CAAC,MAAM,EAAE;IAAE,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAA;CAAE,CAAC,CAkBzE;AAkJD,wBAAgB,sBAAsB,CAAC,MAAM,SAAS,gBAAgB,EACpE,KAAK,EAAE,MAAM,GACZ,kBAAkB,CAAC,MAAM,CAAC,CAuC5B;AAED,wBAAgB,yBAAyB,CAAC,MAAM,SAAS,mBAAmB,EAC1E,KAAK,EAAE,MAAM,GACZ,qBAAqB,CAAC,MAAM,CAAC,CA4D/B"}
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
function isRecord(value) {
|
|
2
|
+
return typeof value === "object" && value !== null;
|
|
3
|
+
}
|
|
4
|
+
function firstValue(record) {
|
|
5
|
+
const [first] = Object.values(record);
|
|
6
|
+
return first;
|
|
7
|
+
}
|
|
8
|
+
function normalizeOptional(value) {
|
|
9
|
+
return (value ?? undefined);
|
|
10
|
+
}
|
|
11
|
+
export function isGeneratedHexBoardInput(board) {
|
|
12
|
+
if (!isRecord(board) || !("spaces" in board) || !isRecord(board.spaces)) {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
if ("tiles" in board || "cells" in board) {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
if (board.layout === "hex") {
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
21
|
+
const firstSpace = firstValue(board.spaces);
|
|
22
|
+
return (isRecord(firstSpace) &&
|
|
23
|
+
typeof firstSpace.q === "number" &&
|
|
24
|
+
typeof firstSpace.r === "number");
|
|
25
|
+
}
|
|
26
|
+
export function isGeneratedSquareBoardInput(board) {
|
|
27
|
+
if (!isRecord(board) || !("spaces" in board) || !isRecord(board.spaces)) {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
if ("tiles" in board || "cells" in board) {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
if (board.layout === "square") {
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
const firstSpace = firstValue(board.spaces);
|
|
37
|
+
return (isRecord(firstSpace) &&
|
|
38
|
+
typeof firstSpace.row === "number" &&
|
|
39
|
+
typeof firstSpace.col === "number");
|
|
40
|
+
}
|
|
41
|
+
function normalizeHexTile(tile) {
|
|
42
|
+
return {
|
|
43
|
+
id: tile.id,
|
|
44
|
+
q: tile.q,
|
|
45
|
+
r: tile.r,
|
|
46
|
+
typeId: normalizeOptional(tile.typeId),
|
|
47
|
+
label: normalizeOptional(tile.label),
|
|
48
|
+
owner: normalizeOptional(tile.ownerId),
|
|
49
|
+
properties: (tile.fields ?? undefined),
|
|
50
|
+
view: undefined,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
function normalizeHexEdge(edge) {
|
|
54
|
+
if ("hex1" in edge && "hex2" in edge) {
|
|
55
|
+
return {
|
|
56
|
+
...edge,
|
|
57
|
+
label: normalizeOptional(edge.label),
|
|
58
|
+
owner: normalizeOptional(edge.owner),
|
|
59
|
+
typeId: normalizeOptional(edge.typeId),
|
|
60
|
+
properties: edge.properties,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
const [hex1 = "", hex2 = ""] = edge.spaceIds;
|
|
64
|
+
return {
|
|
65
|
+
id: edge.id,
|
|
66
|
+
hex1: hex1,
|
|
67
|
+
hex2: hex2,
|
|
68
|
+
typeId: normalizeOptional(edge.typeId),
|
|
69
|
+
label: normalizeOptional(edge.label),
|
|
70
|
+
owner: normalizeOptional(edge.ownerId),
|
|
71
|
+
properties: (edge.fields ?? undefined),
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
function normalizeHexVertex(vertex) {
|
|
75
|
+
if ("hexes" in vertex) {
|
|
76
|
+
return {
|
|
77
|
+
...vertex,
|
|
78
|
+
label: normalizeOptional(vertex.label),
|
|
79
|
+
owner: normalizeOptional(vertex.owner),
|
|
80
|
+
typeId: normalizeOptional(vertex.typeId),
|
|
81
|
+
properties: vertex.properties,
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
return {
|
|
85
|
+
id: vertex.id,
|
|
86
|
+
hexes: vertex.spaceIds,
|
|
87
|
+
typeId: normalizeOptional(vertex.typeId),
|
|
88
|
+
label: normalizeOptional(vertex.label),
|
|
89
|
+
owner: normalizeOptional(vertex.ownerId),
|
|
90
|
+
properties: (vertex.fields ?? undefined),
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
function normalizeSquareCell(cell) {
|
|
94
|
+
return {
|
|
95
|
+
id: cell.id,
|
|
96
|
+
row: cell.row,
|
|
97
|
+
col: cell.col,
|
|
98
|
+
typeId: normalizeOptional(cell.typeId),
|
|
99
|
+
label: normalizeOptional(cell.label),
|
|
100
|
+
owner: normalizeOptional(cell.ownerId),
|
|
101
|
+
properties: (cell.fields ?? undefined),
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
function normalizeSquareEdge(edge) {
|
|
105
|
+
if ("ownerId" in edge || "fields" in edge) {
|
|
106
|
+
return {
|
|
107
|
+
id: edge.id,
|
|
108
|
+
spaceIds: edge.spaceIds,
|
|
109
|
+
typeId: normalizeOptional(edge.typeId),
|
|
110
|
+
label: normalizeOptional(edge.label),
|
|
111
|
+
owner: normalizeOptional(edge.ownerId),
|
|
112
|
+
properties: (edge.fields ?? undefined),
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
return {
|
|
116
|
+
id: edge.id,
|
|
117
|
+
spaceIds: edge.spaceIds,
|
|
118
|
+
typeId: normalizeOptional(edge.typeId),
|
|
119
|
+
label: normalizeOptional(edge.label),
|
|
120
|
+
owner: normalizeOptional(edge.owner),
|
|
121
|
+
properties: edge
|
|
122
|
+
.properties,
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
function normalizeSquareVertex(vertex) {
|
|
126
|
+
if ("ownerId" in vertex || "fields" in vertex) {
|
|
127
|
+
return {
|
|
128
|
+
id: vertex.id,
|
|
129
|
+
spaceIds: vertex.spaceIds,
|
|
130
|
+
typeId: normalizeOptional(vertex.typeId),
|
|
131
|
+
label: normalizeOptional(vertex.label),
|
|
132
|
+
owner: normalizeOptional(vertex.ownerId),
|
|
133
|
+
properties: (vertex.fields ??
|
|
134
|
+
undefined),
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
return {
|
|
138
|
+
id: vertex.id,
|
|
139
|
+
spaceIds: vertex.spaceIds,
|
|
140
|
+
typeId: normalizeOptional(vertex.typeId),
|
|
141
|
+
label: normalizeOptional(vertex.label),
|
|
142
|
+
owner: normalizeOptional(vertex.owner),
|
|
143
|
+
properties: vertex
|
|
144
|
+
.properties,
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
function isAuthoredHexBoardInput(board) {
|
|
148
|
+
return "tiles" in board;
|
|
149
|
+
}
|
|
150
|
+
function isAuthoredSquareBoardInput(board) {
|
|
151
|
+
return "cells" in board;
|
|
152
|
+
}
|
|
153
|
+
export function normalizeHexBoardInput(board) {
|
|
154
|
+
if (isGeneratedHexBoardInput(board)) {
|
|
155
|
+
return {
|
|
156
|
+
id: board.id,
|
|
157
|
+
orientation: board.orientation,
|
|
158
|
+
tiles: Object.values(board.spaces).map((tile) => normalizeHexTile(tile)),
|
|
159
|
+
edges: board.edges.map((edge) => normalizeHexEdge(edge)),
|
|
160
|
+
vertices: board.vertices.map((vertex) => normalizeHexVertex(vertex)),
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
if (!isAuthoredHexBoardInput(board)) {
|
|
164
|
+
throw new Error("Expected authored hex board input.");
|
|
165
|
+
}
|
|
166
|
+
const authoredBoard = board;
|
|
167
|
+
return {
|
|
168
|
+
id: authoredBoard.id,
|
|
169
|
+
orientation: authoredBoard.orientation,
|
|
170
|
+
tiles: authoredBoard.tiles.map((tile) => ({
|
|
171
|
+
...tile,
|
|
172
|
+
label: normalizeOptional(tile.label),
|
|
173
|
+
owner: normalizeOptional(tile.owner),
|
|
174
|
+
typeId: normalizeOptional(tile.typeId),
|
|
175
|
+
properties: tile.properties,
|
|
176
|
+
view: tile.view,
|
|
177
|
+
})),
|
|
178
|
+
edges: authoredBoard.edges.map((edge) => normalizeHexEdge(edge)),
|
|
179
|
+
vertices: authoredBoard.vertices.map((vertex) => normalizeHexVertex(vertex)),
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
export function normalizeSquareBoardInput(board) {
|
|
183
|
+
if (isGeneratedSquareBoardInput(board)) {
|
|
184
|
+
const cells = Object.values(board.spaces).map((cell) => normalizeSquareCell(cell));
|
|
185
|
+
const rows = cells.length === 0 ? 0 : Math.max(...cells.map((cell) => cell.row)) + 1;
|
|
186
|
+
const cols = cells.length === 0 ? 0 : Math.max(...cells.map((cell) => cell.col)) + 1;
|
|
187
|
+
return {
|
|
188
|
+
id: board.id,
|
|
189
|
+
rows,
|
|
190
|
+
cols,
|
|
191
|
+
cells,
|
|
192
|
+
edges: board.edges.map((edge) => normalizeSquareEdge(edge)),
|
|
193
|
+
vertices: board.vertices.map((vertex) => normalizeSquareVertex(vertex)),
|
|
194
|
+
pieces: (board.pieces ?? []).map((piece) => ({
|
|
195
|
+
...piece,
|
|
196
|
+
owner: normalizeOptional(piece.owner),
|
|
197
|
+
typeId: piece.typeId,
|
|
198
|
+
properties: piece.properties,
|
|
199
|
+
})),
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
if (!isAuthoredSquareBoardInput(board)) {
|
|
203
|
+
throw new Error("Expected authored square board input.");
|
|
204
|
+
}
|
|
205
|
+
const authoredBoard = board;
|
|
206
|
+
return {
|
|
207
|
+
id: authoredBoard.id,
|
|
208
|
+
rows: authoredBoard.rows,
|
|
209
|
+
cols: authoredBoard.cols,
|
|
210
|
+
cells: authoredBoard.cells.map((cell) => ({
|
|
211
|
+
...cell,
|
|
212
|
+
label: normalizeOptional(cell.label),
|
|
213
|
+
owner: normalizeOptional(cell.owner),
|
|
214
|
+
typeId: normalizeOptional(cell.typeId),
|
|
215
|
+
properties: cell.properties,
|
|
216
|
+
})),
|
|
217
|
+
edges: authoredBoard.edges.map((edge) => normalizeSquareEdge(edge)),
|
|
218
|
+
vertices: authoredBoard.vertices.map((vertex) => normalizeSquareVertex(vertex)),
|
|
219
|
+
pieces: (authoredBoard.pieces ?? []).map((piece) => ({
|
|
220
|
+
...piece,
|
|
221
|
+
owner: normalizeOptional(piece.owner),
|
|
222
|
+
typeId: piece.typeId,
|
|
223
|
+
properties: piece.properties,
|
|
224
|
+
})),
|
|
225
|
+
};
|
|
226
|
+
}
|