@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,22 @@
|
|
|
1
|
+
import type { InteractionDescriptor } from "../types/plugin-state.js";
|
|
2
|
+
/**
|
|
3
|
+
* Structured inbox view of the controlling seat's available interactions.
|
|
4
|
+
* Interactions are grouped into UI behavior buckets. Prompt-kind interactions
|
|
5
|
+
* (authored via `promptInput(...)`) surface at `bySurface.inbox`.
|
|
6
|
+
*/
|
|
7
|
+
export interface SeatInbox {
|
|
8
|
+
/** Interactions grouped by derived UI bucket id. */
|
|
9
|
+
bySurface: Record<string, readonly InteractionDescriptor[]>;
|
|
10
|
+
/** Prompt-kind interactions addressed to the controlling seat. */
|
|
11
|
+
prompts: readonly InteractionDescriptor[];
|
|
12
|
+
/** Flat list of all available interactions (ungrouped). */
|
|
13
|
+
all: readonly InteractionDescriptor[];
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Returns the controlling seat's available interactions grouped by UI bucket.
|
|
17
|
+
* Prompt-kind interactions (authored via `promptInput(...)`) appear both in
|
|
18
|
+
* `bySurface.inbox` and in `prompts`. Backed by authoritative descriptors
|
|
19
|
+
* from the trusted bundle — clients MUST NOT recompute availability.
|
|
20
|
+
*/
|
|
21
|
+
export declare function useSeatInbox(): SeatInbox;
|
|
22
|
+
//# sourceMappingURL=useSeatInbox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSeatInbox.d.ts","sourceRoot":"","sources":["../../src/hooks/useSeatInbox.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAMtE;;;;GAIG;AACH,MAAM,WAAW,SAAS;IACxB,oDAAoD;IACpD,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,qBAAqB,EAAE,CAAC,CAAC;IAC5D,kEAAkE;IAClE,OAAO,EAAE,SAAS,qBAAqB,EAAE,CAAC;IAC1C,2DAA2D;IAC3D,GAAG,EAAE,SAAS,qBAAqB,EAAE,CAAC;CACvC;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,IAAI,SAAS,CAoBxC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { usePluginState } from "../context/PluginStateContext.js";
|
|
2
|
+
import { eligibleTargetsByBoardKind, hasBoardTargetInput, } from "../utils/interaction-inputs.js";
|
|
3
|
+
/**
|
|
4
|
+
* Returns the controlling seat's available interactions grouped by UI bucket.
|
|
5
|
+
* Prompt-kind interactions (authored via `promptInput(...)`) appear both in
|
|
6
|
+
* `bySurface.inbox` and in `prompts`. Backed by authoritative descriptors
|
|
7
|
+
* from the trusted bundle — clients MUST NOT recompute availability.
|
|
8
|
+
*/
|
|
9
|
+
export function useSeatInbox() {
|
|
10
|
+
const interactions = usePluginState((s) => s.gameplay.availableInteractions ?? []);
|
|
11
|
+
const bySurface = {};
|
|
12
|
+
const prompts = [];
|
|
13
|
+
for (const descriptor of interactions) {
|
|
14
|
+
const surface = bucketForDescriptor(descriptor);
|
|
15
|
+
(bySurface[surface] ?? (bySurface[surface] = [])).push(descriptor);
|
|
16
|
+
if (descriptor.kind === "prompt") {
|
|
17
|
+
prompts.push(descriptor);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return {
|
|
21
|
+
bySurface,
|
|
22
|
+
prompts,
|
|
23
|
+
all: interactions,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
function bucketForDescriptor(descriptor) {
|
|
27
|
+
if (descriptor.kind === "prompt")
|
|
28
|
+
return "inbox";
|
|
29
|
+
if (descriptor.zoneId)
|
|
30
|
+
return "hand";
|
|
31
|
+
if (hasBoardTargetInput(descriptor)) {
|
|
32
|
+
const byKind = eligibleTargetsByBoardKind(descriptor);
|
|
33
|
+
if (byKind.vertex)
|
|
34
|
+
return "board-vertex";
|
|
35
|
+
if (byKind.edge)
|
|
36
|
+
return "board-edge";
|
|
37
|
+
if (byKind.tile)
|
|
38
|
+
return "board-tile";
|
|
39
|
+
if (byKind.space)
|
|
40
|
+
return "board-space";
|
|
41
|
+
}
|
|
42
|
+
return "panel";
|
|
43
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { SimultaneousPhaseSnapshot } from "../types/plugin-state.js";
|
|
2
|
+
/**
|
|
3
|
+
* Returns visibility-safe progress metadata for the active simultaneous-player
|
|
4
|
+
* phase, or null when no simultaneous submission barrier is active.
|
|
5
|
+
*/
|
|
6
|
+
export declare function useSimultaneousPhase(): SimultaneousPhaseSnapshot | null;
|
|
7
|
+
//# sourceMappingURL=useSimultaneousPhase.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSimultaneousPhase.d.ts","sourceRoot":"","sources":["../../src/hooks/useSimultaneousPhase.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAE1E;;;GAGG;AACH,wBAAgB,oBAAoB,IAAI,yBAAyB,GAAG,IAAI,CAEvE"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { usePluginState } from "../context/PluginStateContext.js";
|
|
2
|
+
/**
|
|
3
|
+
* Returns visibility-safe progress metadata for the active simultaneous-player
|
|
4
|
+
* phase, or null when no simultaneous submission barrier is active.
|
|
5
|
+
*/
|
|
6
|
+
export function useSimultaneousPhase() {
|
|
7
|
+
return usePluginState((state) => state.gameplay.simultaneousPhase ?? null);
|
|
8
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { AnySquareBoardInput, BoardSpaceIdOf, NormalizedSquareBoard, NormalizedSquareCellOf } from "../types/tiled-board.js";
|
|
2
|
+
type NeighborMode = "orthogonal" | "diagonal" | "all";
|
|
3
|
+
type DistanceMetric = "manhattan" | "chebyshev";
|
|
4
|
+
export declare function useSquareBoard<const TBoard extends AnySquareBoardInput>(board: TBoard): {
|
|
5
|
+
board: NormalizedSquareBoard<TBoard>;
|
|
6
|
+
getCell: (cellId: BoardSpaceIdOf<TBoard>) => NormalizedSquareCellOf<TBoard> | undefined;
|
|
7
|
+
getCellAt: (row: number, col: number) => NormalizedSquareCellOf<TBoard> | undefined;
|
|
8
|
+
getNeighbors: (cellId: BoardSpaceIdOf<TBoard>, mode?: NeighborMode) => NormalizedSquareCellOf<TBoard>[];
|
|
9
|
+
getDistance: (fromCellId: BoardSpaceIdOf<TBoard>, toCellId: BoardSpaceIdOf<TBoard>, metric?: DistanceMetric) => number;
|
|
10
|
+
layout: TBoard extends import("../index.js").AnyHexBoardInput ? "hex" : "square";
|
|
11
|
+
getSpace: (spaceId: BoardSpaceIdOf<TBoard>) => (TBoard extends import("../index.js").AnyHexBoardInput ? import("../index.js").NormalizedHexTileOf<TBoard> : TBoard extends AnySquareBoardInput ? NormalizedSquareCellOf<TBoard> : never) | undefined;
|
|
12
|
+
getEdge: (edgeId: import("../index.js").BoardEdgeIdOf<TBoard>) => (TBoard extends import("../index.js").AnyHexBoardInput ? import("../index.js").NormalizedHexEdgeOf<TBoard> : TBoard extends AnySquareBoardInput ? import("../index.js").NormalizedSquareEdgeOf<TBoard> : never) | undefined;
|
|
13
|
+
getVertex: (vertexId: import("../index.js").BoardVertexIdOf<TBoard>) => (TBoard extends import("../index.js").AnyHexBoardInput ? import("../index.js").NormalizedHexVertexOf<TBoard> : TBoard extends AnySquareBoardInput ? import("../index.js").NormalizedSquareVertexOf<TBoard> : never) | undefined;
|
|
14
|
+
getAdjacentSpaces: (spaceId: BoardSpaceIdOf<TBoard>) => (TBoard extends import("../index.js").AnyHexBoardInput ? import("../index.js").NormalizedHexTileOf<TBoard> : TBoard extends AnySquareBoardInput ? NormalizedSquareCellOf<TBoard> : never)[];
|
|
15
|
+
getSpaceEdges: (spaceId: BoardSpaceIdOf<TBoard>) => (TBoard extends import("../index.js").AnyHexBoardInput ? import("../index.js").NormalizedHexEdgeOf<TBoard> : TBoard extends AnySquareBoardInput ? import("../index.js").NormalizedSquareEdgeOf<TBoard> : never)[];
|
|
16
|
+
getSpaceVertices: (spaceId: BoardSpaceIdOf<TBoard>) => (TBoard extends import("../index.js").AnyHexBoardInput ? import("../index.js").NormalizedHexVertexOf<TBoard> : TBoard extends AnySquareBoardInput ? import("../index.js").NormalizedSquareVertexOf<TBoard> : never)[];
|
|
17
|
+
getIncidentEdges: (vertexId: import("../index.js").BoardVertexIdOf<TBoard>) => (TBoard extends import("../index.js").AnyHexBoardInput ? import("../index.js").NormalizedHexEdgeOf<TBoard> : TBoard extends AnySquareBoardInput ? import("../index.js").NormalizedSquareEdgeOf<TBoard> : never)[];
|
|
18
|
+
getIncidentVertices: (edgeId: import("../index.js").BoardEdgeIdOf<TBoard>) => (TBoard extends import("../index.js").AnyHexBoardInput ? import("../index.js").NormalizedHexVertexOf<TBoard> : TBoard extends AnySquareBoardInput ? import("../index.js").NormalizedSquareVertexOf<TBoard> : never)[];
|
|
19
|
+
};
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=useSquareBoard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSquareBoard.d.ts","sourceRoot":"","sources":["../../src/hooks/useSquareBoard.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,mBAAmB,EACnB,cAAc,EACd,qBAAqB,EACrB,sBAAsB,EACvB,MAAM,yBAAyB,CAAC;AAIjC,KAAK,YAAY,GAAG,YAAY,GAAG,UAAU,GAAG,KAAK,CAAC;AACtD,KAAK,cAAc,GAAG,WAAW,GAAG,WAAW,CAAC;AAEhD,wBAAgB,cAAc,CAAC,KAAK,CAAC,MAAM,SAAS,mBAAmB,EACrE,KAAK,EAAE,MAAM;;sBAmBF,cAAc,CAAC,MAAM,CAAC,KAEzB,sBAAsB,CAAC,MAAM,CAAC,GAC9B,SAAS;qBAMT,MAAM,OAAO,MAAM,KAEnB,sBAAsB,CAAC,MAAM,CAAC,GAC9B,SAAS;2BAMN,cAAc,CAAC,MAAM,CAAC,SAAQ,YAAY;8BA8CrC,cAAc,CAAC,MAAM,CAAC,YACxB,cAAc,CAAC,MAAM,CAAC,WACxB,cAAc;;;;;;;;;;EAwB3B"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { useCallback, useMemo } from "react";
|
|
2
|
+
import { normalizeSquareBoardInput } from "../types/tiled-board.js";
|
|
3
|
+
import { useBoardTopology } from "./useBoardTopology.js";
|
|
4
|
+
export function useSquareBoard(board) {
|
|
5
|
+
const normalizedBoard = useMemo(() => normalizeSquareBoardInput(board), [board]);
|
|
6
|
+
const topology = useBoardTopology(board);
|
|
7
|
+
const cellByCoordinate = useMemo(() => new Map(normalizedBoard.cells.map((cell) => [`${cell.row},${cell.col}`, cell])), [normalizedBoard.cells]);
|
|
8
|
+
const getCell = useCallback((cellId) => {
|
|
9
|
+
return topology.getSpace(cellId);
|
|
10
|
+
}, [topology]);
|
|
11
|
+
const getCellAt = useCallback((row, col) => {
|
|
12
|
+
return cellByCoordinate.get(`${row},${col}`);
|
|
13
|
+
}, [cellByCoordinate]);
|
|
14
|
+
const getNeighbors = useCallback((cellId, mode = "orthogonal") => {
|
|
15
|
+
const cell = getCell(cellId);
|
|
16
|
+
if (!cell) {
|
|
17
|
+
return [];
|
|
18
|
+
}
|
|
19
|
+
const offsets = mode === "diagonal"
|
|
20
|
+
? [
|
|
21
|
+
[-1, -1],
|
|
22
|
+
[-1, 1],
|
|
23
|
+
[1, -1],
|
|
24
|
+
[1, 1],
|
|
25
|
+
]
|
|
26
|
+
: mode === "all"
|
|
27
|
+
? [
|
|
28
|
+
[-1, 0],
|
|
29
|
+
[0, 1],
|
|
30
|
+
[1, 0],
|
|
31
|
+
[0, -1],
|
|
32
|
+
[-1, -1],
|
|
33
|
+
[-1, 1],
|
|
34
|
+
[1, -1],
|
|
35
|
+
[1, 1],
|
|
36
|
+
]
|
|
37
|
+
: [
|
|
38
|
+
[-1, 0],
|
|
39
|
+
[0, 1],
|
|
40
|
+
[1, 0],
|
|
41
|
+
[0, -1],
|
|
42
|
+
];
|
|
43
|
+
return offsets
|
|
44
|
+
.map(([rowOffset, colOffset]) => getCellAt(cell.row + rowOffset, cell.col + colOffset))
|
|
45
|
+
.filter((candidate) => candidate !== undefined);
|
|
46
|
+
}, [getCell, getCellAt]);
|
|
47
|
+
const getDistance = useCallback((fromCellId, toCellId, metric = "manhattan") => {
|
|
48
|
+
const fromCell = getCell(fromCellId);
|
|
49
|
+
const toCell = getCell(toCellId);
|
|
50
|
+
if (!fromCell || !toCell) {
|
|
51
|
+
return Number.POSITIVE_INFINITY;
|
|
52
|
+
}
|
|
53
|
+
const rowDistance = Math.abs(fromCell.row - toCell.row);
|
|
54
|
+
const colDistance = Math.abs(fromCell.col - toCell.col);
|
|
55
|
+
return metric === "chebyshev"
|
|
56
|
+
? Math.max(rowDistance, colDistance)
|
|
57
|
+
: rowDistance + colDistance;
|
|
58
|
+
}, [getCell]);
|
|
59
|
+
return {
|
|
60
|
+
...topology,
|
|
61
|
+
board: normalizedBoard,
|
|
62
|
+
getCell,
|
|
63
|
+
getCellAt,
|
|
64
|
+
getNeighbors,
|
|
65
|
+
getDistance,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useSquareGrid hook - Utilities for square grid operations
|
|
3
|
+
*
|
|
4
|
+
* Provides basic grid utilities and neighbor finding.
|
|
5
|
+
* Game-specific logic (pathfinding, movement rules) should be implemented by the parent.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```tsx
|
|
9
|
+
* const gridApi = useSquareGrid({ rows: 8, cols: 8, pieces });
|
|
10
|
+
*
|
|
11
|
+
* // Get neighbors
|
|
12
|
+
* const neighbors = gridApi.getNeighbors(3, 4);
|
|
13
|
+
*
|
|
14
|
+
* // Get piece at position
|
|
15
|
+
* const piece = gridApi.getPieceAt(0, 0);
|
|
16
|
+
*
|
|
17
|
+
* // Calculate distance
|
|
18
|
+
* const dist = gridApi.getDistance(0, 0, 7, 7);
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export interface GridPieceData {
|
|
22
|
+
/** Unique piece identifier */
|
|
23
|
+
id: string;
|
|
24
|
+
/** Row position (0-based) */
|
|
25
|
+
row: number;
|
|
26
|
+
/** Column position (0-based) */
|
|
27
|
+
col: number;
|
|
28
|
+
/** Piece type */
|
|
29
|
+
type: string;
|
|
30
|
+
/** Owner player ID */
|
|
31
|
+
owner?: string;
|
|
32
|
+
/** Additional data */
|
|
33
|
+
data?: Record<string, unknown>;
|
|
34
|
+
}
|
|
35
|
+
export interface CellData {
|
|
36
|
+
/** Row index */
|
|
37
|
+
row: number;
|
|
38
|
+
/** Column index */
|
|
39
|
+
col: number;
|
|
40
|
+
/** Whether the cell is blocked */
|
|
41
|
+
blocked?: boolean;
|
|
42
|
+
/** Cell type */
|
|
43
|
+
type?: string;
|
|
44
|
+
/** Additional data */
|
|
45
|
+
data?: Record<string, unknown>;
|
|
46
|
+
}
|
|
47
|
+
export type DistanceType = "manhattan" | "chebyshev" | "euclidean";
|
|
48
|
+
export type NeighborType = "orthogonal" | "diagonal" | "all";
|
|
49
|
+
export interface UseSquareGridOptions {
|
|
50
|
+
/** Number of rows */
|
|
51
|
+
rows: number;
|
|
52
|
+
/** Number of columns */
|
|
53
|
+
cols: number;
|
|
54
|
+
/** Pieces on the grid */
|
|
55
|
+
pieces?: GridPieceData[];
|
|
56
|
+
/** Blocked cells */
|
|
57
|
+
blockedCells?: Array<{
|
|
58
|
+
row: number;
|
|
59
|
+
col: number;
|
|
60
|
+
}>;
|
|
61
|
+
/** Neighbor type for movement */
|
|
62
|
+
neighborType?: NeighborType;
|
|
63
|
+
}
|
|
64
|
+
export interface UseSquareGridReturn {
|
|
65
|
+
/** Get piece at a position */
|
|
66
|
+
getPieceAt: (row: number, col: number) => GridPieceData | undefined;
|
|
67
|
+
/** Get pieces by owner */
|
|
68
|
+
getPiecesByOwner: (owner: string) => GridPieceData[];
|
|
69
|
+
/** Get neighboring cells */
|
|
70
|
+
getNeighbors: (row: number, col: number, type?: NeighborType) => Array<{
|
|
71
|
+
row: number;
|
|
72
|
+
col: number;
|
|
73
|
+
}>;
|
|
74
|
+
/** Calculate distance between two cells */
|
|
75
|
+
getDistance: (r1: number, c1: number, r2: number, c2: number, type?: DistanceType) => number;
|
|
76
|
+
/** Check if a cell is valid (within bounds) */
|
|
77
|
+
isValidCell: (row: number, col: number) => boolean;
|
|
78
|
+
/** Check if a cell is blocked */
|
|
79
|
+
isBlocked: (row: number, col: number) => boolean;
|
|
80
|
+
/** Check if a cell is occupied by a piece */
|
|
81
|
+
isOccupied: (row: number, col: number) => boolean;
|
|
82
|
+
/** Get cells in a rectangle area */
|
|
83
|
+
getCellsInRect: (topRow: number, leftCol: number, bottomRow: number, rightCol: number) => Array<{
|
|
84
|
+
row: number;
|
|
85
|
+
col: number;
|
|
86
|
+
}>;
|
|
87
|
+
/** Convert row/col to algebraic notation */
|
|
88
|
+
toAlgebraic: (row: number, col: number) => string;
|
|
89
|
+
/** Convert algebraic notation to row/col */
|
|
90
|
+
fromAlgebraic: (notation: string) => {
|
|
91
|
+
row: number;
|
|
92
|
+
col: number;
|
|
93
|
+
} | null;
|
|
94
|
+
}
|
|
95
|
+
export declare function useSquareGrid(options: UseSquareGridOptions): UseSquareGridReturn;
|
|
96
|
+
//# sourceMappingURL=useSquareGrid.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSquareGrid.d.ts","sourceRoot":"","sources":["../../src/hooks/useSquareGrid.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAQH,MAAM,WAAW,aAAa;IAC5B,8BAA8B;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,6BAA6B;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,gCAAgC;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,iBAAiB;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,sBAAsB;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sBAAsB;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC;AAED,MAAM,WAAW,QAAQ;IACvB,gBAAgB;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,mBAAmB;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,kCAAkC;IAClC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,gBAAgB;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,sBAAsB;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC;AAED,MAAM,MAAM,YAAY,GAAG,WAAW,GAAG,WAAW,GAAG,WAAW,CAAC;AACnE,MAAM,MAAM,YAAY,GAAG,YAAY,GAAG,UAAU,GAAG,KAAK,CAAC;AAE7D,MAAM,WAAW,oBAAoB;IACnC,qBAAqB;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,wBAAwB;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,yBAAyB;IACzB,MAAM,CAAC,EAAE,aAAa,EAAE,CAAC;IACzB,oBAAoB;IACpB,YAAY,CAAC,EAAE,KAAK,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,EA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IAC5C,WAAW,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,KAAK,MAAM,CAAC;IAElD,4CAA4C;IAC5C,aAAa,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;CAC1E;AA0BD,wBAAgB,aAAa,CAC3B,OAAO,EAAE,oBAAoB,GAC5B,mBAAmB,CAuLrB"}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useSquareGrid hook - Utilities for square grid operations
|
|
3
|
+
*
|
|
4
|
+
* Provides basic grid utilities and neighbor finding.
|
|
5
|
+
* Game-specific logic (pathfinding, movement rules) should be implemented by the parent.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```tsx
|
|
9
|
+
* const gridApi = useSquareGrid({ rows: 8, cols: 8, pieces });
|
|
10
|
+
*
|
|
11
|
+
* // Get neighbors
|
|
12
|
+
* const neighbors = gridApi.getNeighbors(3, 4);
|
|
13
|
+
*
|
|
14
|
+
* // Get piece at position
|
|
15
|
+
* const piece = gridApi.getPieceAt(0, 0);
|
|
16
|
+
*
|
|
17
|
+
* // Calculate distance
|
|
18
|
+
* const dist = gridApi.getDistance(0, 0, 7, 7);
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
import { useMemo, useCallback } from "react";
|
|
22
|
+
// ============================================================================
|
|
23
|
+
// Direction vectors
|
|
24
|
+
// ============================================================================
|
|
25
|
+
const ORTHOGONAL_DIRS = [
|
|
26
|
+
{ dr: -1, dc: 0 }, // up
|
|
27
|
+
{ dr: 1, dc: 0 }, // down
|
|
28
|
+
{ dr: 0, dc: -1 }, // left
|
|
29
|
+
{ dr: 0, dc: 1 }, // right
|
|
30
|
+
];
|
|
31
|
+
const DIAGONAL_DIRS = [
|
|
32
|
+
{ dr: -1, dc: -1 }, // up-left
|
|
33
|
+
{ dr: -1, dc: 1 }, // up-right
|
|
34
|
+
{ dr: 1, dc: -1 }, // down-left
|
|
35
|
+
{ dr: 1, dc: 1 }, // down-right
|
|
36
|
+
];
|
|
37
|
+
const ALL_DIRS = [...ORTHOGONAL_DIRS, ...DIAGONAL_DIRS];
|
|
38
|
+
// ============================================================================
|
|
39
|
+
// Hook Implementation
|
|
40
|
+
// ============================================================================
|
|
41
|
+
export function useSquareGrid(options) {
|
|
42
|
+
const { rows, cols, pieces = [], blockedCells = [], neighborType = "orthogonal", } = options;
|
|
43
|
+
// Create lookup maps
|
|
44
|
+
const pieceMap = useMemo(() => {
|
|
45
|
+
const map = new Map();
|
|
46
|
+
pieces.forEach((p) => {
|
|
47
|
+
map.set(`${p.row},${p.col}`, p);
|
|
48
|
+
});
|
|
49
|
+
return map;
|
|
50
|
+
}, [pieces]);
|
|
51
|
+
const blockedSet = useMemo(() => {
|
|
52
|
+
return new Set(blockedCells.map((c) => `${c.row},${c.col}`));
|
|
53
|
+
}, [blockedCells]);
|
|
54
|
+
// Get piece at position
|
|
55
|
+
const getPieceAt = useCallback((row, col) => {
|
|
56
|
+
return pieceMap.get(`${row},${col}`);
|
|
57
|
+
}, [pieceMap]);
|
|
58
|
+
// Get pieces by owner
|
|
59
|
+
const getPiecesByOwner = useCallback((owner) => {
|
|
60
|
+
return pieces.filter((p) => p.owner === owner);
|
|
61
|
+
}, [pieces]);
|
|
62
|
+
// Check if cell is valid
|
|
63
|
+
const isValidCell = useCallback((row, col) => {
|
|
64
|
+
return row >= 0 && row < rows && col >= 0 && col < cols;
|
|
65
|
+
}, [rows, cols]);
|
|
66
|
+
// Check if cell is blocked
|
|
67
|
+
const isBlocked = useCallback((row, col) => {
|
|
68
|
+
return blockedSet.has(`${row},${col}`);
|
|
69
|
+
}, [blockedSet]);
|
|
70
|
+
// Check if cell is occupied
|
|
71
|
+
const isOccupied = useCallback((row, col) => {
|
|
72
|
+
return pieceMap.has(`${row},${col}`);
|
|
73
|
+
}, [pieceMap]);
|
|
74
|
+
// Get neighboring cells
|
|
75
|
+
const getNeighbors = useCallback((row, col, type = neighborType) => {
|
|
76
|
+
const dirs = type === "orthogonal"
|
|
77
|
+
? ORTHOGONAL_DIRS
|
|
78
|
+
: type === "diagonal"
|
|
79
|
+
? DIAGONAL_DIRS
|
|
80
|
+
: ALL_DIRS;
|
|
81
|
+
const neighbors = [];
|
|
82
|
+
for (const { dr, dc } of dirs) {
|
|
83
|
+
const newRow = row + dr;
|
|
84
|
+
const newCol = col + dc;
|
|
85
|
+
if (isValidCell(newRow, newCol)) {
|
|
86
|
+
neighbors.push({ row: newRow, col: newCol });
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return neighbors;
|
|
90
|
+
}, [neighborType, isValidCell]);
|
|
91
|
+
// Calculate distance
|
|
92
|
+
const getDistance = useCallback((r1, c1, r2, c2, type = "manhattan") => {
|
|
93
|
+
const dr = Math.abs(r2 - r1);
|
|
94
|
+
const dc = Math.abs(c2 - c1);
|
|
95
|
+
switch (type) {
|
|
96
|
+
case "manhattan":
|
|
97
|
+
return dr + dc;
|
|
98
|
+
case "chebyshev":
|
|
99
|
+
return Math.max(dr, dc);
|
|
100
|
+
case "euclidean":
|
|
101
|
+
return Math.sqrt(dr * dr + dc * dc);
|
|
102
|
+
default:
|
|
103
|
+
return dr + dc;
|
|
104
|
+
}
|
|
105
|
+
}, []);
|
|
106
|
+
// Get cells in rectangle
|
|
107
|
+
const getCellsInRect = useCallback((topRow, leftCol, bottomRow, rightCol) => {
|
|
108
|
+
const cells = [];
|
|
109
|
+
const minRow = Math.max(0, Math.min(topRow, bottomRow));
|
|
110
|
+
const maxRow = Math.min(rows - 1, Math.max(topRow, bottomRow));
|
|
111
|
+
const minCol = Math.max(0, Math.min(leftCol, rightCol));
|
|
112
|
+
const maxCol = Math.min(cols - 1, Math.max(leftCol, rightCol));
|
|
113
|
+
for (let r = minRow; r <= maxRow; r++) {
|
|
114
|
+
for (let c = minCol; c <= maxCol; c++) {
|
|
115
|
+
cells.push({ row: r, col: c });
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return cells;
|
|
119
|
+
}, [rows, cols]);
|
|
120
|
+
// Convert to algebraic notation
|
|
121
|
+
const toAlgebraic = useCallback((row, col) => {
|
|
122
|
+
const file = String.fromCharCode(97 + col);
|
|
123
|
+
const rank = rows - row;
|
|
124
|
+
return `${file}${rank}`;
|
|
125
|
+
}, [rows]);
|
|
126
|
+
// Convert from algebraic notation
|
|
127
|
+
const fromAlgebraic = useCallback((notation) => {
|
|
128
|
+
if (notation.length < 2)
|
|
129
|
+
return null;
|
|
130
|
+
const file = notation.charCodeAt(0) - 97;
|
|
131
|
+
const rank = parseInt(notation.slice(1), 10);
|
|
132
|
+
if (isNaN(rank))
|
|
133
|
+
return null;
|
|
134
|
+
const row = rows - rank;
|
|
135
|
+
const col = file;
|
|
136
|
+
if (!isValidCell(row, col))
|
|
137
|
+
return null;
|
|
138
|
+
return { row, col };
|
|
139
|
+
}, [rows, isValidCell]);
|
|
140
|
+
return {
|
|
141
|
+
getPieceAt,
|
|
142
|
+
getPiecesByOwner,
|
|
143
|
+
getNeighbors,
|
|
144
|
+
getDistance,
|
|
145
|
+
isValidCell,
|
|
146
|
+
isBlocked,
|
|
147
|
+
isOccupied,
|
|
148
|
+
getCellsInRect,
|
|
149
|
+
toAlgebraic,
|
|
150
|
+
fromAlgebraic,
|
|
151
|
+
};
|
|
152
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export * from "./reducer.js";
|
|
2
|
+
export { createDreamboardUI, type BoardTargetKey, type CardKey, type DreamboardUI, type DreamboardUIRegister, type InteractionInputKey, type InteractionKey, type PhaseKey, type PromptOptionKey, type PromptKey, type RegisteredUI, type TypedBoard, type TypedInteraction, type TypedPhase, type TypedPlayerRoster, type TypedPrompt, type TypedPromptInbox, type TypedZone, type UIContract, type UIContractBucket, type ZoneKey, } from "./ui-contract.js";
|
|
3
|
+
export * from "./primitives/index.js";
|
|
4
|
+
export { BoardInteractionConflictError, useBoardInteractions, type BoardInteractionsContext, type BoardInteractionsOptions, type BoardTargetLayerFactory, type BoardTargetLayerOptions, } from "./hooks/useBoardInteractions.js";
|
|
5
|
+
export { useBoardTopology } from "./hooks/useBoardTopology.js";
|
|
6
|
+
export { useCards } from "./hooks/useCards.js";
|
|
7
|
+
export { useHexBoard } from "./hooks/useHexBoard.js";
|
|
8
|
+
export { useSquareBoard } from "./hooks/useSquareBoard.js";
|
|
9
|
+
export { useHandLayout } from "./hooks/useHandLayout.js";
|
|
10
|
+
export { useInteractionByKey } from "./hooks/useInteractionByKey.js";
|
|
11
|
+
export { useIsMobile } from "./hooks/useIsMobile.js";
|
|
12
|
+
export { usePanZoom, calculateViewBox } from "./hooks/usePanZoom.js";
|
|
13
|
+
export { usePluginRuntime } from "./hooks/usePluginRuntime.js";
|
|
14
|
+
export { toTrackBoardData } from "./helpers/track-board.js";
|
|
15
|
+
export { PluginStateProvider, usePluginActions, usePluginState, } from "./context/PluginStateContext.js";
|
|
16
|
+
export { RuntimeContext, RuntimeProvider, useRuntimeContext, } from "./context/RuntimeContext.js";
|
|
17
|
+
export { type ClientParamSchema, type ClientParamSchemaMap, } from "./context/ClientParamSchemaContext.js";
|
|
18
|
+
export { ThemeProvider, arcadeTheme, buttonStyle, chipStyle, cssVar, cssVarOr, deriveBoardTheme, getThemePreset, intentForVariant, mergeTheme, motionDuration, playerColor, resolveTheme, studioTheme, surfaceStyle, tabletopTheme, themeToCssVars, useBoardTheme, useTheme, useThemeCssVars, type BoardTheme, type ButtonSize, type ButtonVariant, type ColorRamp, type ComponentTokens, type Elevation, type FoundationColor, type IntentColor, type Motion, type PlayerColor, type Radius, type SemanticColor, type Space, type Theme, type ThemeContextValue, type ThemeMeta, type ThemeOverride, type ThemePresetId, type ThemeProviderProps, type Typography, } from "./theme/index.js";
|
|
19
|
+
export { normalizeHexBoardInput, normalizeSquareBoardInput, } from "./types/tiled-board.js";
|
|
20
|
+
export { InteractionField, InteractionForm, defaultFormInputs, hasDefaultInteractionFormFields, } from "./components/InteractionForm.js";
|
|
21
|
+
export type { InteractionFieldProps, InteractionFieldRenderMap, InteractionFieldRenderProps, InteractionFormProps, } from "./components/InteractionForm.js";
|
|
22
|
+
export * from "./components/index.js";
|
|
23
|
+
export type * from "./hooks/useHandLayout.js";
|
|
24
|
+
export type * from "./hooks/usePanZoom.js";
|
|
25
|
+
export type * from "./hooks/usePluginRuntime.js";
|
|
26
|
+
export type { PluginStateSnapshot } from "./types/plugin-state.js";
|
|
27
|
+
export type * from "./types/player-state.js";
|
|
28
|
+
export type * from "./types/runtime-api.js";
|
|
29
|
+
export type { AnyHexBoardInput, AnySquareBoardInput, BoardEdgeIdOf, BoardSpaceIdOf, BoardVertexIdOf, AuthoredHexBoardInput, AuthoredSquareBoardInput, GeneratedHexBoardInput, GeneratedHexSpaceStateLike, GeneratedSquareBoardInput, GeneratedSquareSpaceStateLike, GeneratedTiledEdgeStateLike, GeneratedTiledVertexStateLike, HexBoardInput, NormalizedHexBoard, NormalizedHexEdgeOf, NormalizedHexTileOf, NormalizedHexVertexOf, NormalizedSquareBoard, NormalizedSquareCellOf, NormalizedSquareEdgeOf, NormalizedSquarePieceOf, NormalizedSquareVertexOf, SquareBoardInput, } from "./types/tiled-board.js";
|
|
30
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,OAAO,EACL,kBAAkB,EAClB,KAAK,cAAc,EACnB,KAAK,OAAO,EACZ,KAAK,YAAY,EACjB,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACnB,KAAK,QAAQ,EACb,KAAK,eAAe,EACpB,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,KAAK,UAAU,EACf,KAAK,gBAAg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ACnB,mBAAmB,EACnB,qBAAqB,EACrB,qBAAqB,EACrB,sBAAsB,EACtB,sBAAsB,EACtB,uBAAuB,EACvB,wBAAwB,EACxB,gBAAgB,GACjB,MAAM,wBAAwB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export * from "./reducer.js";
|
|
2
|
+
export { createDreamboardUI, } from "./ui-contract.js";
|
|
3
|
+
export * from "./primitives/index.js";
|
|
4
|
+
export { BoardInteractionConflictError, useBoardInteractions, } from "./hooks/useBoardInteractions.js";
|
|
5
|
+
export { useBoardTopology } from "./hooks/useBoardTopology.js";
|
|
6
|
+
export { useCards } from "./hooks/useCards.js";
|
|
7
|
+
export { useHexBoard } from "./hooks/useHexBoard.js";
|
|
8
|
+
export { useSquareBoard } from "./hooks/useSquareBoard.js";
|
|
9
|
+
export { useHandLayout } from "./hooks/useHandLayout.js";
|
|
10
|
+
export { useInteractionByKey } from "./hooks/useInteractionByKey.js";
|
|
11
|
+
export { useIsMobile } from "./hooks/useIsMobile.js";
|
|
12
|
+
export { usePanZoom, calculateViewBox } from "./hooks/usePanZoom.js";
|
|
13
|
+
export { usePluginRuntime } from "./hooks/usePluginRuntime.js";
|
|
14
|
+
export { toTrackBoardData } from "./helpers/track-board.js";
|
|
15
|
+
export { PluginStateProvider, usePluginActions, usePluginState, } from "./context/PluginStateContext.js";
|
|
16
|
+
export { RuntimeContext, RuntimeProvider, useRuntimeContext, } from "./context/RuntimeContext.js";
|
|
17
|
+
export { ThemeProvider, arcadeTheme, buttonStyle, chipStyle, cssVar, cssVarOr, deriveBoardTheme, getThemePreset, intentForVariant, mergeTheme, motionDuration, playerColor, resolveTheme, studioTheme, surfaceStyle, tabletopTheme, themeToCssVars, useBoardTheme, useTheme, useThemeCssVars, } from "./theme/index.js";
|
|
18
|
+
export { normalizeHexBoardInput, normalizeSquareBoardInput, } from "./types/tiled-board.js";
|
|
19
|
+
export { InteractionField, InteractionForm, defaultFormInputs, hasDefaultInteractionFormFields, } from "./components/InteractionForm.js";
|
|
20
|
+
export * from "./components/index.js";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface AlertProps extends React.ComponentProps<"div"> {
|
|
3
|
+
variant?: "default" | "destructive";
|
|
4
|
+
}
|
|
5
|
+
export declare function Alert({ className, variant, ...props }: AlertProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare function AlertTitle({ className, ...props }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare function AlertDescription({ className, ...props }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
//# sourceMappingURL=alert.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alert.d.ts","sourceRoot":"","sources":["../../../src/internal/ui/alert.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,MAAM,WAAW,UAAW,SAAQ,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC;IAC7D,OAAO,CAAC,EAAE,SAAS,GAAG,aAAa,CAAC;CACrC;AAED,wBAAgB,KAAK,CAAC,EACpB,SAAS,EACT,OAAmB,EACnB,GAAG,KAAK,EACT,EAAE,UAAU,2CAaZ;AAED,wBAAgB,UAAU,CAAC,EACzB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,2CAQ7B;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,2CAQ7B"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "./utils.js";
|
|
3
|
+
export function Alert({ className, variant = "default", ...props }) {
|
|
4
|
+
return (_jsx("div", { "data-slot": "alert", role: "alert", className: cn("relative grid w-full grid-cols-[0_1fr] items-start gap-y-0.5 rounded-lg border px-4 py-3 text-sm has-[>svg]:grid-cols-[1rem_1fr] has-[>svg]:gap-x-3 [&>svg]:translate-y-0.5", variant === "destructive" && "border-red-300 text-red-800", className), ...props }));
|
|
5
|
+
}
|
|
6
|
+
export function AlertTitle({ className, ...props }) {
|
|
7
|
+
return (_jsx("div", { "data-slot": "alert-title", className: cn("col-start-2 font-medium tracking-tight", className), ...props }));
|
|
8
|
+
}
|
|
9
|
+
export function AlertDescription({ className, ...props }) {
|
|
10
|
+
return (_jsx("div", { "data-slot": "alert-description", className: cn("col-start-2 text-sm opacity-90", className), ...props }));
|
|
11
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export type ButtonVariant = "default" | "destructive" | "outline" | "secondary" | "ghost" | "link";
|
|
3
|
+
export type ButtonSize = "default" | "sm" | "lg" | "icon";
|
|
4
|
+
export interface ButtonProps extends React.ComponentProps<"button"> {
|
|
5
|
+
variant?: ButtonVariant;
|
|
6
|
+
size?: ButtonSize;
|
|
7
|
+
asChild?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare function Button({ className, variant, size, asChild, ...props }: ButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
//# sourceMappingURL=button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../src/internal/ui/button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,MAAM,MAAM,aAAa,GACrB,SAAS,GACT,aAAa,GACb,SAAS,GACT,WAAW,GACX,OAAO,GACP,MAAM,CAAC;AAEX,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,IAAI,GAAG,IAAI,GAAG,MAAM,CAAC;AAE1D,MAAM,WAAW,WAAY,SAAQ,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC;IACjE,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAkBD,wBAAgB,MAAM,CAAC,EACrB,SAAS,EACT,OAAmB,EACnB,IAAgB,EAChB,OAAe,EACf,GAAG,KAAK,EACT,EAAE,WAAW,2CAeb"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
3
|
+
import { cn } from "./utils.js";
|
|
4
|
+
const variantClass = {
|
|
5
|
+
default: "border-slate-900 bg-white text-slate-950 hover:bg-slate-100",
|
|
6
|
+
destructive: "border-red-900 bg-red-600 text-white hover:bg-red-700",
|
|
7
|
+
outline: "border-slate-900 bg-transparent hover:bg-slate-100",
|
|
8
|
+
secondary: "border-slate-700 bg-slate-100 text-slate-950 hover:bg-slate-200",
|
|
9
|
+
ghost: "border-transparent bg-transparent hover:bg-slate-100",
|
|
10
|
+
link: "border-transparent bg-transparent text-blue-700 underline-offset-4 hover:underline",
|
|
11
|
+
};
|
|
12
|
+
const sizeClass = {
|
|
13
|
+
default: "h-10 px-4 py-2",
|
|
14
|
+
sm: "h-9 px-3",
|
|
15
|
+
lg: "h-11 px-8",
|
|
16
|
+
icon: "size-10",
|
|
17
|
+
};
|
|
18
|
+
export function Button({ className, variant = "default", size = "default", asChild = false, ...props }) {
|
|
19
|
+
const Comp = asChild ? Slot : "button";
|
|
20
|
+
return (_jsx(Comp, { "data-slot": "button", className: cn("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md border text-sm font-medium transition-colors outline-none disabled:pointer-events-none disabled:opacity-50", "focus-visible:ring-2 focus-visible:ring-slate-400 focus-visible:ring-offset-2", variantClass[variant], sizeClass[size], className), ...props }));
|
|
21
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
3
|
+
export declare function Dialog(props: React.ComponentProps<typeof DialogPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export declare function DialogTrigger(props: React.ComponentProps<typeof DialogPrimitive.Trigger>): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export declare function DialogPortal(props: React.ComponentProps<typeof DialogPrimitive.Portal>): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare function DialogClose(props: React.ComponentProps<typeof DialogPrimitive.Close>): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare function DialogOverlay({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Overlay>): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare function DialogContent({ className, children, showCloseButton, overlayClassName, ...props }: React.ComponentProps<typeof DialogPrimitive.Content> & {
|
|
9
|
+
showCloseButton?: boolean;
|
|
10
|
+
overlayClassName?: string;
|
|
11
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export declare function DialogHeader({ className, ...props }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export declare function DialogFooter({ className, ...props }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export declare function DialogTitle({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Title>): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export declare function DialogDescription({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Description>): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
//# sourceMappingURL=dialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dialog.d.ts","sourceRoot":"","sources":["../../../src/internal/ui/dialog.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAC;AAI1D,wBAAgB,MAAM,CACpB,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,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@@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
4
|
+
import { XIcon } from "lucide-react";
|
|
5
|
+
import { cn } from "./utils.js";
|
|
6
|
+
export function Dialog(props) {
|
|
7
|
+
return _jsx(DialogPrimitive.Root, { "data-slot": "dialog", ...props });
|
|
8
|
+
}
|
|
9
|
+
export function DialogTrigger(props) {
|
|
10
|
+
return _jsx(DialogPrimitive.Trigger, { "data-slot": "dialog-trigger", ...props });
|
|
11
|
+
}
|
|
12
|
+
export function DialogPortal(props) {
|
|
13
|
+
return _jsx(DialogPrimitive.Portal, { "data-slot": "dialog-portal", ...props });
|
|
14
|
+
}
|
|
15
|
+
export function DialogClose(props) {
|
|
16
|
+
return _jsx(DialogPrimitive.Close, { "data-slot": "dialog-close", ...props });
|
|
17
|
+
}
|
|
18
|
+
export function DialogOverlay({ className, ...props }) {
|
|
19
|
+
return (_jsx(DialogPrimitive.Overlay, { "data-slot": "dialog-overlay", className: cn("fixed inset-0 z-50 bg-black/50", className), ...props }));
|
|
20
|
+
}
|
|
21
|
+
export function DialogContent({ className, children, showCloseButton = true, overlayClassName, ...props }) {
|
|
22
|
+
return (_jsxs(DialogPortal, { children: [_jsx(DialogOverlay, { className: overlayClassName }), _jsxs(DialogPrimitive.Content, { "data-slot": "dialog-content", className: cn("fixed left-1/2 top-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-lg border bg-white p-6 shadow-lg sm:max-w-lg", className), ...props, children: [children, showCloseButton ? (_jsxs(DialogPrimitive.Close, { "data-slot": "dialog-close", className: "absolute right-4 top-4 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-slate-400", children: [_jsx(XIcon, { "aria-hidden": "true", className: "size-4" }), _jsx("span", { className: "sr-only", children: "Close" })] })) : null] })] }));
|
|
23
|
+
}
|
|
24
|
+
export function DialogHeader({ className, ...props }) {
|
|
25
|
+
return (_jsx("div", { "data-slot": "dialog-header", className: cn("flex flex-col gap-2 text-center sm:text-left", className), ...props }));
|
|
26
|
+
}
|
|
27
|
+
export function DialogFooter({ className, ...props }) {
|
|
28
|
+
return (_jsx("div", { "data-slot": "dialog-footer", className: cn("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end", className), ...props }));
|
|
29
|
+
}
|
|
30
|
+
export function DialogTitle({ className, ...props }) {
|
|
31
|
+
return (_jsx(DialogPrimitive.Title, { "data-slot": "dialog-title", className: cn("text-lg font-semibold leading-none", className), ...props }));
|
|
32
|
+
}
|
|
33
|
+
export function DialogDescription({ className, ...props }) {
|
|
34
|
+
return (_jsx(DialogPrimitive.Description, { "data-slot": "dialog-description", className: cn("text-sm text-slate-600", className), ...props }));
|
|
35
|
+
}
|