@ankhorage/zora 21.0.23 → 21.1.1
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/CHANGELOG.md +17 -0
- package/README.md +6 -2
- package/dist/features/authoring/allowedChildren.d.ts +5 -2
- package/dist/features/authoring/allowedChildren.d.ts.map +1 -1
- package/dist/features/authoring/allowedChildren.js +13 -2
- package/dist/features/authoring/allowedChildren.js.map +1 -1
- package/dist/features/authoring/componentMeta.d.ts.map +1 -1
- package/dist/features/authoring/componentMeta.js +21 -0
- package/dist/features/authoring/componentMeta.js.map +1 -1
- package/dist/features/authoring/constants.d.ts +3 -0
- package/dist/features/authoring/constants.d.ts.map +1 -1
- package/dist/features/authoring/constants.js +3 -0
- package/dist/features/authoring/constants.js.map +1 -1
- package/dist/features/card/cardMeta.d.ts +1 -1
- package/dist/features/card/cardMeta.d.ts.map +1 -1
- package/dist/features/card/cardMeta.js +7 -2
- package/dist/features/card/cardMeta.js.map +1 -1
- package/dist/features/chess/adapters/inbound/ChessBoard.d.ts +5 -0
- package/dist/features/chess/adapters/inbound/ChessBoard.d.ts.map +1 -0
- package/dist/features/chess/adapters/inbound/ChessBoard.js +119 -0
- package/dist/features/chess/adapters/inbound/ChessBoard.js.map +1 -0
- package/dist/features/chess/adapters/inbound/OpeningBook.d.ts +5 -0
- package/dist/features/chess/adapters/inbound/OpeningBook.d.ts.map +1 -0
- package/dist/features/chess/adapters/inbound/OpeningBook.js +94 -0
- package/dist/features/chess/adapters/inbound/OpeningBook.js.map +1 -0
- package/dist/features/chess/meta.d.ts +219 -0
- package/dist/features/chess/meta.d.ts.map +1 -0
- package/dist/features/chess/meta.js +165 -0
- package/dist/features/chess/meta.js.map +1 -0
- package/dist/features/chess/public.d.ts +12 -0
- package/dist/features/chess/public.d.ts.map +1 -0
- package/dist/features/chess/public.js +10 -0
- package/dist/features/chess/public.js.map +1 -0
- package/dist/features/chess/utils/chessSquares.d.ts +4 -0
- package/dist/features/chess/utils/chessSquares.d.ts.map +1 -0
- package/dist/features/chess/utils/chessSquares.js +3 -0
- package/dist/features/chess/utils/chessSquares.js.map +1 -0
- package/dist/features/chess/utils/createBoardSquares.d.ts +4 -0
- package/dist/features/chess/utils/createBoardSquares.d.ts.map +1 -0
- package/dist/features/chess/utils/createBoardSquares.js +9 -0
- package/dist/features/chess/utils/createBoardSquares.js.map +1 -0
- package/dist/features/chess/utils/createChessBoardColorScheme.d.ts +35 -0
- package/dist/features/chess/utils/createChessBoardColorScheme.d.ts.map +1 -0
- package/dist/features/chess/utils/createChessBoardColorScheme.js +26 -0
- package/dist/features/chess/utils/createChessBoardColorScheme.js.map +1 -0
- package/dist/features/chess/utils/createOpeningBookColorScheme.d.ts +11 -0
- package/dist/features/chess/utils/createOpeningBookColorScheme.d.ts.map +1 -0
- package/dist/features/chess/utils/createOpeningBookColorScheme.js +21 -0
- package/dist/features/chess/utils/createOpeningBookColorScheme.js.map +1 -0
- package/dist/features/chess/utils/getSquareFile.d.ts +4 -0
- package/dist/features/chess/utils/getSquareFile.d.ts.map +1 -0
- package/dist/features/chess/utils/getSquareFile.js +5 -0
- package/dist/features/chess/utils/getSquareFile.js.map +1 -0
- package/dist/features/chess/utils/getSquareRank.d.ts +4 -0
- package/dist/features/chess/utils/getSquareRank.d.ts.map +1 -0
- package/dist/features/chess/utils/getSquareRank.js +5 -0
- package/dist/features/chess/utils/getSquareRank.js.map +1 -0
- package/dist/features/chess/utils/isLightSquare.d.ts +4 -0
- package/dist/features/chess/utils/isLightSquare.d.ts.map +1 -0
- package/dist/features/chess/utils/isLightSquare.js +6 -0
- package/dist/features/chess/utils/isLightSquare.js.map +1 -0
- package/dist/features/game/adapters/inbound/Game.d.ts +5 -0
- package/dist/features/game/adapters/inbound/Game.d.ts.map +1 -0
- package/dist/features/game/adapters/inbound/Game.js +24 -0
- package/dist/features/game/adapters/inbound/Game.js.map +1 -0
- package/dist/features/game/adapters/inbound/GameEntity.d.ts +5 -0
- package/dist/features/game/adapters/inbound/GameEntity.d.ts.map +1 -0
- package/dist/features/game/adapters/inbound/GameEntity.js +29 -0
- package/dist/features/game/adapters/inbound/GameEntity.js.map +1 -0
- package/dist/features/game/adapters/inbound/GameField.d.ts +4 -0
- package/dist/features/game/adapters/inbound/GameField.d.ts.map +1 -0
- package/dist/features/game/adapters/inbound/GameField.js +32 -0
- package/dist/features/game/adapters/inbound/GameField.js.map +1 -0
- package/dist/features/game/adapters/inbound/GameInputZone.d.ts +4 -0
- package/dist/features/game/adapters/inbound/GameInputZone.d.ts.map +1 -0
- package/dist/features/game/adapters/inbound/GameInputZone.js +50 -0
- package/dist/features/game/adapters/inbound/GameInputZone.js.map +1 -0
- package/dist/features/game/adapters/inbound/GameMeasurementProbe.d.ts +4 -0
- package/dist/features/game/adapters/inbound/GameMeasurementProbe.d.ts.map +1 -0
- package/dist/features/game/adapters/inbound/GameMeasurementProbe.js +54 -0
- package/dist/features/game/adapters/inbound/GameMeasurementProbe.js.map +1 -0
- package/dist/features/game/adapters/inbound/GameOverlay.d.ts +4 -0
- package/dist/features/game/adapters/inbound/GameOverlay.d.ts.map +1 -0
- package/dist/features/game/adapters/inbound/GameOverlay.js +39 -0
- package/dist/features/game/adapters/inbound/GameOverlay.js.map +1 -0
- package/dist/features/game/adapters/inbound/createGameKeyboardEvent.d.ts +16 -0
- package/dist/features/game/adapters/inbound/createGameKeyboardEvent.d.ts.map +1 -0
- package/dist/features/game/adapters/inbound/createGameKeyboardEvent.js +16 -0
- package/dist/features/game/adapters/inbound/createGameKeyboardEvent.js.map +1 -0
- package/dist/features/game/adapters/inbound/createGameMeasurementEvent.d.ts +14 -0
- package/dist/features/game/adapters/inbound/createGameMeasurementEvent.d.ts.map +1 -0
- package/dist/features/game/adapters/inbound/createGameMeasurementEvent.js +25 -0
- package/dist/features/game/adapters/inbound/createGameMeasurementEvent.js.map +1 -0
- package/dist/features/game/adapters/inbound/createGamePointerEvent.d.ts +17 -0
- package/dist/features/game/adapters/inbound/createGamePointerEvent.d.ts.map +1 -0
- package/dist/features/game/adapters/inbound/createGamePointerEvent.js +20 -0
- package/dist/features/game/adapters/inbound/createGamePointerEvent.js.map +1 -0
- package/dist/features/game/adapters/inbound/measureGameEntity.d.ts +5 -0
- package/dist/features/game/adapters/inbound/measureGameEntity.d.ts.map +1 -0
- package/dist/features/game/adapters/inbound/measureGameEntity.js +22 -0
- package/dist/features/game/adapters/inbound/measureGameEntity.js.map +1 -0
- package/dist/features/game/adapters/inbound/useGameInputZoneResponder.d.ts +15 -0
- package/dist/features/game/adapters/inbound/useGameInputZoneResponder.d.ts.map +1 -0
- package/dist/features/game/adapters/inbound/useGameInputZoneResponder.js +67 -0
- package/dist/features/game/adapters/inbound/useGameInputZoneResponder.js.map +1 -0
- package/dist/features/game/composition/GameRuntimeContext.d.ts +5 -0
- package/dist/features/game/composition/GameRuntimeContext.d.ts.map +1 -0
- package/dist/features/game/composition/GameRuntimeContext.js +4 -0
- package/dist/features/game/composition/GameRuntimeContext.js.map +1 -0
- package/dist/features/game/composition/createGameBindingContext.d.ts +4 -0
- package/dist/features/game/composition/createGameBindingContext.d.ts.map +1 -0
- package/dist/features/game/composition/createGameBindingContext.js +10 -0
- package/dist/features/game/composition/createGameBindingContext.js.map +1 -0
- package/dist/features/game/composition/createGameMeasurementRegistry.d.ts +4 -0
- package/dist/features/game/composition/createGameMeasurementRegistry.d.ts.map +1 -0
- package/dist/features/game/composition/createGameMeasurementRegistry.js +15 -0
- package/dist/features/game/composition/createGameMeasurementRegistry.js.map +1 -0
- package/dist/features/game/composition/useGameRuntime.d.ts +5 -0
- package/dist/features/game/composition/useGameRuntime.d.ts.map +1 -0
- package/dist/features/game/composition/useGameRuntime.js +117 -0
- package/dist/features/game/composition/useGameRuntime.js.map +1 -0
- package/dist/features/game/composition/useGameScheduledEffects.d.ts +17 -0
- package/dist/features/game/composition/useGameScheduledEffects.d.ts.map +1 -0
- package/dist/features/game/composition/useGameScheduledEffects.js +40 -0
- package/dist/features/game/composition/useGameScheduledEffects.js.map +1 -0
- package/dist/features/game/meta/gameEntityMeta.d.ts +403 -0
- package/dist/features/game/meta/gameEntityMeta.d.ts.map +1 -0
- package/dist/features/game/meta/gameEntityMeta.js +224 -0
- package/dist/features/game/meta/gameEntityMeta.js.map +1 -0
- package/dist/features/game/meta/gameFieldMeta.d.ts +61 -0
- package/dist/features/game/meta/gameFieldMeta.d.ts.map +1 -0
- package/dist/features/game/meta/gameFieldMeta.js +48 -0
- package/dist/features/game/meta/gameFieldMeta.js.map +1 -0
- package/dist/features/game/meta/gameInputZoneMeta.d.ts +163 -0
- package/dist/features/game/meta/gameInputZoneMeta.d.ts.map +1 -0
- package/dist/features/game/meta/gameInputZoneMeta.js +138 -0
- package/dist/features/game/meta/gameInputZoneMeta.js.map +1 -0
- package/dist/features/game/meta/gameMeasurementProbeMeta.d.ts +112 -0
- package/dist/features/game/meta/gameMeasurementProbeMeta.d.ts.map +1 -0
- package/dist/features/game/meta/gameMeasurementProbeMeta.js +70 -0
- package/dist/features/game/meta/gameMeasurementProbeMeta.js.map +1 -0
- package/dist/features/game/meta/gameMeta.d.ts +130 -0
- package/dist/features/game/meta/gameMeta.d.ts.map +1 -0
- package/dist/features/game/meta/gameMeta.js +113 -0
- package/dist/features/game/meta/gameMeta.js.map +1 -0
- package/dist/features/game/meta/gameOverlayMeta.d.ts +55 -0
- package/dist/features/game/meta/gameOverlayMeta.d.ts.map +1 -0
- package/dist/features/game/meta/gameOverlayMeta.js +65 -0
- package/dist/features/game/meta/gameOverlayMeta.js.map +1 -0
- package/dist/features/game/public.d.ts +8 -0
- package/dist/features/game/public.d.ts.map +1 -0
- package/dist/features/game/public.js +7 -0
- package/dist/features/game/public.js.map +1 -0
- package/dist/features/game/utils/clampGamePercentage.d.ts +3 -0
- package/dist/features/game/utils/clampGamePercentage.d.ts.map +1 -0
- package/dist/features/game/utils/clampGamePercentage.js +5 -0
- package/dist/features/game/utils/clampGamePercentage.js.map +1 -0
- package/dist/features/game/utils/resolveGameEntityMotionPlan.d.ts +15 -0
- package/dist/features/game/utils/resolveGameEntityMotionPlan.d.ts.map +1 -0
- package/dist/features/game/utils/resolveGameEntityMotionPlan.js +31 -0
- package/dist/features/game/utils/resolveGameEntityMotionPlan.js.map +1 -0
- package/dist/features/game/utils/toGamePercentage.d.ts +3 -0
- package/dist/features/game/utils/toGamePercentage.d.ts.map +1 -0
- package/dist/features/game/utils/toGamePercentage.js +6 -0
- package/dist/features/game/utils/toGamePercentage.js.map +1 -0
- package/dist/features/game/utils/useAnimatedGameEntityValue.d.ts +5 -0
- package/dist/features/game/utils/useAnimatedGameEntityValue.d.ts.map +1 -0
- package/dist/features/game/utils/useAnimatedGameEntityValue.js +33 -0
- package/dist/features/game/utils/useAnimatedGameEntityValue.js.map +1 -0
- package/dist/features/game/utils/useGameEntityAnimatedStyle.d.ts +16 -0
- package/dist/features/game/utils/useGameEntityAnimatedStyle.d.ts.map +1 -0
- package/dist/features/game/utils/useGameEntityAnimatedStyle.js +52 -0
- package/dist/features/game/utils/useGameEntityAnimatedStyle.js.map +1 -0
- package/dist/features/game/utils/useGameEntityMeasurement.d.ts +5 -0
- package/dist/features/game/utils/useGameEntityMeasurement.d.ts.map +1 -0
- package/dist/features/game/utils/useGameEntityMeasurement.js +14 -0
- package/dist/features/game/utils/useGameEntityMeasurement.js.map +1 -0
- package/dist/features/game/utils/useGameEntityMotionProgress.d.ts +5 -0
- package/dist/features/game/utils/useGameEntityMotionProgress.d.ts.map +1 -0
- package/dist/features/game/utils/useGameEntityMotionProgress.js +87 -0
- package/dist/features/game/utils/useGameEntityMotionProgress.js.map +1 -0
- package/dist/features/game/utils/useGameReducedMotion.d.ts +3 -0
- package/dist/features/game/utils/useGameReducedMotion.d.ts.map +1 -0
- package/dist/features/game/utils/useGameReducedMotion.js +13 -0
- package/dist/features/game/utils/useGameReducedMotion.js.map +1 -0
- package/dist/features/layout/gridMeta.d.ts +1 -1
- package/dist/features/layout/gridMeta.d.ts.map +1 -1
- package/dist/features/layout/gridMeta.js +7 -2
- package/dist/features/layout/gridMeta.js.map +1 -1
- package/dist/features/layout/screenMeta.d.ts +1 -1
- package/dist/features/layout/viewMeta.d.ts +1 -1
- package/dist/features/layout/viewMeta.d.ts.map +1 -1
- package/dist/features/layout/viewMeta.js +6 -2
- package/dist/features/layout/viewMeta.js.map +1 -1
- package/dist/features/registry/ZORA_COMPONENT_REGISTRY.d.ts.map +1 -1
- package/dist/features/registry/ZORA_COMPONENT_REGISTRY.js +16 -0
- package/dist/features/registry/ZORA_COMPONENT_REGISTRY.js.map +1 -1
- package/dist/features/section/screenSectionMeta.d.ts +1 -1
- package/dist/features/tabletop/adapters/inbound/CardBack.d.ts +5 -0
- package/dist/features/tabletop/adapters/inbound/CardBack.d.ts.map +1 -0
- package/dist/features/tabletop/adapters/inbound/CardBack.js +47 -0
- package/dist/features/tabletop/adapters/inbound/CardBack.js.map +1 -0
- package/dist/features/tabletop/adapters/inbound/CardHand.d.ts +5 -0
- package/dist/features/tabletop/adapters/inbound/CardHand.d.ts.map +1 -0
- package/dist/features/tabletop/adapters/inbound/CardHand.js +28 -0
- package/dist/features/tabletop/adapters/inbound/CardHand.js.map +1 -0
- package/dist/features/tabletop/adapters/inbound/PlayingCard.d.ts +5 -0
- package/dist/features/tabletop/adapters/inbound/PlayingCard.d.ts.map +1 -0
- package/dist/features/tabletop/adapters/inbound/PlayingCard.js +64 -0
- package/dist/features/tabletop/adapters/inbound/PlayingCard.js.map +1 -0
- package/dist/features/tabletop/adapters/inbound/PokerTrainingTable.d.ts +5 -0
- package/dist/features/tabletop/adapters/inbound/PokerTrainingTable.d.ts.map +1 -0
- package/dist/features/tabletop/adapters/inbound/PokerTrainingTable.js +12 -0
- package/dist/features/tabletop/adapters/inbound/PokerTrainingTable.js.map +1 -0
- package/dist/features/tabletop/adapters/inbound/TabletopTable.d.ts +5 -0
- package/dist/features/tabletop/adapters/inbound/TabletopTable.d.ts.map +1 -0
- package/dist/features/tabletop/adapters/inbound/TabletopTable.js +206 -0
- package/dist/features/tabletop/adapters/inbound/TabletopTable.js.map +1 -0
- package/dist/features/tabletop/meta.d.ts +353 -0
- package/dist/features/tabletop/meta.d.ts.map +1 -0
- package/dist/features/tabletop/meta.js +252 -0
- package/dist/features/tabletop/meta.js.map +1 -0
- package/dist/features/tabletop/public.d.ts +10 -0
- package/dist/features/tabletop/public.d.ts.map +1 -0
- package/dist/features/tabletop/public.js +9 -0
- package/dist/features/tabletop/public.js.map +1 -0
- package/dist/features/tabletop/utils/createPokerTrainingTableState.d.ts +13 -0
- package/dist/features/tabletop/utils/createPokerTrainingTableState.d.ts.map +1 -0
- package/dist/features/tabletop/utils/createPokerTrainingTableState.js +112 -0
- package/dist/features/tabletop/utils/createPokerTrainingTableState.js.map +1 -0
- package/dist/features/tabletop/utils/createTabletopColorScheme.d.ts +36 -0
- package/dist/features/tabletop/utils/createTabletopColorScheme.d.ts.map +1 -0
- package/dist/features/tabletop/utils/createTabletopColorScheme.js +144 -0
- package/dist/features/tabletop/utils/createTabletopColorScheme.js.map +1 -0
- package/dist/features/tabletop/utils/createTabletopGameSeats.d.ts +13 -0
- package/dist/features/tabletop/utils/createTabletopGameSeats.d.ts.map +1 -0
- package/dist/features/tabletop/utils/createTabletopGameSeats.js +22 -0
- package/dist/features/tabletop/utils/createTabletopGameSeats.js.map +1 -0
- package/dist/features/tabletop/utils/getPlayingCardLabel.d.ts +4 -0
- package/dist/features/tabletop/utils/getPlayingCardLabel.d.ts.map +1 -0
- package/dist/features/tabletop/utils/getPlayingCardLabel.js +6 -0
- package/dist/features/tabletop/utils/getPlayingCardLabel.js.map +1 -0
- package/dist/features/tabletop/utils/getTabletopCardDimensions.d.ts +12 -0
- package/dist/features/tabletop/utils/getTabletopCardDimensions.d.ts.map +1 -0
- package/dist/features/tabletop/utils/getTabletopCardDimensions.js +35 -0
- package/dist/features/tabletop/utils/getTabletopCardDimensions.js.map +1 -0
- package/dist/features/tabletop/utils/getTabletopSeatPosition.d.ts +9 -0
- package/dist/features/tabletop/utils/getTabletopSeatPosition.d.ts.map +1 -0
- package/dist/features/tabletop/utils/getTabletopSeatPosition.js +88 -0
- package/dist/features/tabletop/utils/getTabletopSeatPosition.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/types/chess.d.ts +83 -0
- package/dist/types/chess.d.ts.map +1 -0
- package/dist/types/chess.js +2 -0
- package/dist/types/chess.js.map +1 -0
- package/dist/types/gamePresentation.d.ts +94 -0
- package/dist/types/gamePresentation.d.ts.map +1 -0
- package/dist/types/gamePresentation.js +2 -0
- package/dist/types/gamePresentation.js.map +1 -0
- package/dist/types/gameRuntime.d.ts +29 -0
- package/dist/types/gameRuntime.d.ts.map +1 -0
- package/dist/types/gameRuntime.js +2 -0
- package/dist/types/gameRuntime.js.map +1 -0
- package/dist/types/tabletop.d.ts +129 -0
- package/dist/types/tabletop.d.ts.map +1 -0
- package/dist/types/tabletop.js +2 -0
- package/dist/types/tabletop.js.map +1 -0
- package/package.json +13 -11
- package/src/features/authoring/allowedChildren.ts +15 -2
- package/src/features/authoring/componentMeta.test.ts +93 -0
- package/src/features/authoring/componentMeta.ts +27 -0
- package/src/features/authoring/constants.ts +3 -0
- package/src/features/card/cardMeta.ts +12 -2
- package/src/features/chess/adapters/inbound/ChessBoard.tsx +169 -0
- package/src/features/chess/adapters/inbound/OpeningBook.tsx +131 -0
- package/src/features/chess/meta.ts +168 -0
- package/src/features/chess/public.test.tsx +165 -0
- package/src/features/chess/public.ts +27 -0
- package/src/features/chess/utils/chessSquares.ts +6 -0
- package/src/features/chess/utils/createBoardSquares.ts +13 -0
- package/src/features/chess/utils/createChessBoardColorScheme.ts +55 -0
- package/src/features/chess/utils/createOpeningBookColorScheme.ts +26 -0
- package/src/features/chess/utils/getSquareFile.ts +6 -0
- package/src/features/chess/utils/getSquareRank.ts +6 -0
- package/src/features/chess/utils/isLightSquare.ts +8 -0
- package/src/features/chessTabletopOwnership.test.ts +71 -0
- package/src/features/game/adapters/inbound/Game.tsx +43 -0
- package/src/features/game/adapters/inbound/GameEntity.tsx +44 -0
- package/src/features/game/adapters/inbound/GameField.tsx +52 -0
- package/src/features/game/adapters/inbound/GameInputZone.tsx +99 -0
- package/src/features/game/adapters/inbound/GameMeasurementProbe.tsx +83 -0
- package/src/features/game/adapters/inbound/GameOverlay.tsx +58 -0
- package/src/features/game/adapters/inbound/createGameKeyboardEvent.test.ts +51 -0
- package/src/features/game/adapters/inbound/createGameKeyboardEvent.ts +33 -0
- package/src/features/game/adapters/inbound/createGameMeasurementEvent.test.ts +56 -0
- package/src/features/game/adapters/inbound/createGameMeasurementEvent.ts +38 -0
- package/src/features/game/adapters/inbound/createGamePointerEvent.test.ts +56 -0
- package/src/features/game/adapters/inbound/createGamePointerEvent.ts +39 -0
- package/src/features/game/adapters/inbound/measureGameEntity.ts +28 -0
- package/src/features/game/adapters/inbound/useGameInputZoneResponder.ts +85 -0
- package/src/features/game/composition/GameRuntimeContext.ts +6 -0
- package/src/features/game/composition/createGameBindingContext.test.ts +66 -0
- package/src/features/game/composition/createGameBindingContext.ts +11 -0
- package/src/features/game/composition/createGameMeasurementRegistry.test.ts +35 -0
- package/src/features/game/composition/createGameMeasurementRegistry.ts +16 -0
- package/src/features/game/composition/useGameRuntime.test.tsx +173 -0
- package/src/features/game/composition/useGameRuntime.ts +200 -0
- package/src/features/game/composition/useGameScheduledEffects.ts +85 -0
- package/src/features/game/meta/gameEntityMeta.ts +226 -0
- package/src/features/game/meta/gameFieldMeta.ts +49 -0
- package/src/features/game/meta/gameInputZoneMeta.ts +140 -0
- package/src/features/game/meta/gameMeasurementProbeMeta.ts +72 -0
- package/src/features/game/meta/gameMeta.ts +115 -0
- package/src/features/game/meta/gameOverlayMeta.ts +66 -0
- package/src/features/game/public.test.tsx +64 -0
- package/src/features/game/public.ts +19 -0
- package/src/features/game/utils/clampGamePercentage.ts +4 -0
- package/src/features/game/utils/resolveGameEntityMotionPlan.test.ts +63 -0
- package/src/features/game/utils/resolveGameEntityMotionPlan.ts +53 -0
- package/src/features/game/utils/toGamePercentage.ts +6 -0
- package/src/features/game/utils/useAnimatedGameEntityValue.ts +41 -0
- package/src/features/game/utils/useGameEntityAnimatedStyle.ts +87 -0
- package/src/features/game/utils/useGameEntityMeasurement.ts +19 -0
- package/src/features/game/utils/useGameEntityMotionProgress.ts +114 -0
- package/src/features/game/utils/useGameReducedMotion.ts +15 -0
- package/src/features/layout/gridMeta.ts +12 -2
- package/src/features/layout/viewMeta.ts +10 -2
- package/src/features/registry/ZORA_COMPONENT_REGISTRY.ts +29 -0
- package/src/features/tabletop/adapters/inbound/CardBack.tsx +70 -0
- package/src/features/tabletop/adapters/inbound/CardHand.tsx +61 -0
- package/src/features/tabletop/adapters/inbound/PlayingCard.tsx +95 -0
- package/src/features/tabletop/adapters/inbound/PokerTrainingTable.tsx +34 -0
- package/src/features/tabletop/adapters/inbound/TabletopTable.tsx +264 -0
- package/src/features/tabletop/meta.ts +254 -0
- package/src/features/tabletop/public.test.tsx +127 -0
- package/src/features/tabletop/public.ts +32 -0
- package/src/features/tabletop/utils/createPokerTrainingTableState.ts +152 -0
- package/src/features/tabletop/utils/createTabletopColorScheme.ts +232 -0
- package/src/features/tabletop/utils/createTabletopGameSeats.ts +31 -0
- package/src/features/tabletop/utils/getPlayingCardLabel.ts +8 -0
- package/src/features/tabletop/utils/getTabletopCardDimensions.ts +45 -0
- package/src/features/tabletop/utils/getTabletopSeatPosition.ts +100 -0
- package/src/index.ts +83 -0
- package/src/types/chess.ts +95 -0
- package/src/types/gamePresentation.ts +103 -0
- package/src/types/gameRuntime.ts +34 -0
- package/src/types/tabletop.ts +131 -0
- package/web-dist/chunks/{Accordion-paha5aje.js → Accordion-1cgz6f8t.js} +2 -2
- package/web-dist/chunks/{Accordion-fjnck2tg.js → Accordion-46jsv73s.js} +6 -6
- package/web-dist/chunks/{Accordion-q7c1ryf2.js → Accordion-4aeg9thd.js} +4 -4
- package/web-dist/chunks/{Accordion-xshn7k8f.js → Accordion-4p710d7k.js} +4 -4
- package/web-dist/chunks/{Accordion-06588rzn.js → Accordion-57akecv2.js} +1 -1
- package/web-dist/chunks/Accordion-57mn1j9e.js +830 -0
- package/web-dist/chunks/{Accordion-qpwhmqzd.js → Accordion-6aa1argz.js} +13 -13
- package/web-dist/chunks/{Accordion-v6ykq9hv.js → Accordion-77j966qb.js} +10 -10
- package/web-dist/chunks/{Accordion-49gf1zb8.js → Accordion-7hn324r1.js} +90 -60
- package/web-dist/chunks/{Accordion-7ja4mtbz.js → Accordion-7zfskq1s.js} +1 -1
- package/web-dist/chunks/Accordion-86z2tvvz.js +321 -0
- package/web-dist/chunks/Accordion-8pke1r50.js +1559 -0
- package/web-dist/chunks/{Accordion-395r3wra.js → Accordion-8t3hyjre.js} +2 -2
- package/web-dist/chunks/{Accordion-s42wwh6m.js → Accordion-94y2x5br.js} +6 -6
- package/web-dist/chunks/{Accordion-jzbq36ec.js → Accordion-axewg096.js} +8 -8
- package/web-dist/chunks/{Accordion-fmxygyb6.js → Accordion-be000xf6.js} +4 -4
- package/web-dist/chunks/{Accordion-0jkm3y3w.js → Accordion-bsy1jrak.js} +1 -1
- package/web-dist/chunks/{Accordion-pkqj4g3r.js → Accordion-ctd0h4r8.js} +5 -5
- package/web-dist/chunks/{Accordion-ftjkdjqs.js → Accordion-dm99cvz1.js} +3 -3
- package/web-dist/chunks/{Accordion-h95wvyn5.js → Accordion-egkpe4d2.js} +2 -2
- package/web-dist/chunks/{Accordion-1pp37dtg.js → Accordion-ej3ggc77.js} +4 -4
- package/web-dist/chunks/{Accordion-31aeqxak.js → Accordion-eknpf4ac.js} +3 -3
- package/web-dist/chunks/{Accordion-f5swy5bs.js → Accordion-epgj2djr.js} +1 -1
- package/web-dist/chunks/{Accordion-crx58d5n.js → Accordion-er294z8s.js} +2 -2
- package/web-dist/chunks/{Accordion-8kgtg62g.js → Accordion-et2acvzj.js} +6 -6
- package/web-dist/chunks/{Accordion-cscmtcn8.js → Accordion-ew71mmkm.js} +1 -1
- package/web-dist/chunks/{Accordion-hz4xaqjf.js → Accordion-f77vravp.js} +9 -9
- package/web-dist/chunks/{Accordion-ars389m1.js → Accordion-gdxed3b8.js} +3 -3
- package/web-dist/chunks/{Accordion-f1h2f05v.js → Accordion-j3fs0yak.js} +5 -5
- package/web-dist/chunks/{Accordion-rrpej6sv.js → Accordion-ja4p3a9f.js} +7 -7
- package/web-dist/chunks/{Accordion-grfbz6f2.js → Accordion-k3bc4kad.js} +1 -1
- package/web-dist/chunks/{Accordion-4a6wj3ez.js → Accordion-kw4dssbm.js} +9 -9
- package/web-dist/chunks/{Accordion-x0j8b2by.js → Accordion-m267wpc1.js} +5 -5
- package/web-dist/chunks/{Accordion-gbba10rg.js → Accordion-mt5a3fhc.js} +6 -6
- package/web-dist/chunks/{Accordion-far6szrp.js → Accordion-nc8fk7hn.js} +5 -5
- package/web-dist/chunks/{Accordion-ch67q4t0.js → Accordion-nzqx7f8a.js} +4 -4
- package/web-dist/chunks/{Accordion-33rd76r7.js → Accordion-ppv52ctr.js} +8 -8
- package/web-dist/chunks/{Accordion-f05a7r28.js → Accordion-pssgp0pq.js} +5 -5
- package/web-dist/chunks/{Accordion-1vewf8aa.js → Accordion-st01gxy2.js} +2 -2
- package/web-dist/chunks/{Accordion-t3p4ykg7.js → Accordion-szeexyec.js} +8 -8
- package/web-dist/chunks/{Accordion-t6sdgmbz.js → Accordion-vq462y0x.js} +1 -1
- package/web-dist/chunks/{Accordion-2dws3778.js → Accordion-vr8des0w.js} +4 -4
- package/web-dist/chunks/{Accordion-tx78txec.js → Accordion-w3c6g1jx.js} +5 -5
- package/web-dist/chunks/{Accordion-0psdn97s.js → Accordion-w6n8e1ff.js} +1 -1
- package/web-dist/chunks/{Accordion-sz21xsf4.js → Accordion-wvphg9x4.js} +1 -1
- package/web-dist/chunks/{Accordion-3404tth9.js → Accordion-x30jrtfk.js} +7 -7
- package/web-dist/chunks/{Accordion-jh7nxehr.js → Accordion-x5ny2aax.js} +1 -1
- package/web-dist/chunks/{Accordion-96cqeekv.js → Accordion-ye97yam9.js} +5 -5
- package/web-dist/chunks/{Accordion-hxfa71g9.js → Accordion-yjrr96tn.js} +7 -7
- package/web-dist/chunks/{Accordion-r4c9k9y7.js → Accordion-z3s5pqdw.js} +2 -2
- package/web-dist/components/accordion/Accordion.js +12 -12
- package/web-dist/components/accordion-item/AccordionItem.js +12 -12
- package/web-dist/components/activity-indicator/ActivityIndicator.js +3 -3
- package/web-dist/components/app-bar/AppBar.js +19 -19
- package/web-dist/components/app-shell/AppShell.js +6 -6
- package/web-dist/components/avatar/Avatar.js +12 -12
- package/web-dist/components/avatar-group/AvatarGroup.js +12 -12
- package/web-dist/components/badge/Badge.js +7 -7
- package/web-dist/components/barcode-scanner-view/BarcodeScannerView.js +20 -20
- package/web-dist/components/bottom-sheet/BottomSheet.js +8 -8
- package/web-dist/components/bottom-sheet-flat-list/BottomSheetFlatList.js +8 -8
- package/web-dist/components/bottom-sheet-scroll-view/BottomSheetScrollView.js +8 -8
- package/web-dist/components/bottom-sheet-section-list/BottomSheetSectionList.js +8 -8
- package/web-dist/components/bottom-sheet-view/BottomSheetView.js +8 -8
- package/web-dist/components/bottom-sheet-virtualized-list/BottomSheetVirtualizedList.js +8 -8
- package/web-dist/components/breadcrumbs/Breadcrumbs.js +15 -15
- package/web-dist/components/button/Button.js +12 -12
- package/web-dist/components/button-group/ButtonGroup.js +12 -12
- package/web-dist/components/camera-permission-view/CameraPermissionView.js +20 -20
- package/web-dist/components/card/Card.js +19 -19
- package/web-dist/components/card-back/CardBack.d.ts +7 -0
- package/web-dist/components/card-back/CardBack.js +19 -0
- package/web-dist/components/card-back/index.d.ts +1 -0
- package/web-dist/components/card-back/index.js +2 -0
- package/web-dist/components/card-hand/CardHand.d.ts +7 -0
- package/web-dist/components/card-hand/CardHand.js +19 -0
- package/web-dist/components/card-hand/index.d.ts +1 -0
- package/web-dist/components/card-hand/index.js +2 -0
- package/web-dist/components/chat-list-item/ChatListItem.js +16 -16
- package/web-dist/components/checkbox/Checkbox.js +12 -12
- package/web-dist/components/checkbox-group/CheckboxGroup.js +12 -12
- package/web-dist/components/chess-board/ChessBoard.d.ts +4 -0
- package/web-dist/components/chess-board/ChessBoard.js +13 -0
- package/web-dist/components/chess-board/index.d.ts +1 -0
- package/web-dist/components/chess-board/index.js +2 -0
- package/web-dist/components/chip/Chip.js +13 -13
- package/web-dist/components/chip-group/ChipGroup.js +13 -13
- package/web-dist/components/collection-editor/CollectionEditor.js +19 -19
- package/web-dist/components/content-rail/ContentRail.js +13 -13
- package/web-dist/components/data-table/DataTable.js +26 -26
- package/web-dist/components/date-picker/DatePicker.js +17 -17
- package/web-dist/components/dialog/Dialog.js +12 -12
- package/web-dist/components/divider/Divider.js +6 -6
- package/web-dist/components/empty-state/EmptyState.js +20 -20
- package/web-dist/components/field/Field.js +12 -12
- package/web-dist/components/flat-list/FlatList.js +13 -13
- package/web-dist/components/forgot-password-form/ForgotPasswordForm.js +18 -18
- package/web-dist/components/form/Form.js +16 -16
- package/web-dist/components/form-actions/FormActions.js +16 -16
- package/web-dist/components/form-error/FormError.js +16 -16
- package/web-dist/components/game/Game.d.ts +8 -0
- package/web-dist/components/game/Game.js +25 -0
- package/web-dist/components/game/index.d.ts +1 -0
- package/web-dist/components/game/index.js +2 -0
- package/web-dist/components/game-entity/GameEntity.d.ts +8 -0
- package/web-dist/components/game-entity/GameEntity.js +25 -0
- package/web-dist/components/game-entity/index.d.ts +1 -0
- package/web-dist/components/game-entity/index.js +2 -0
- package/web-dist/components/game-field/GameField.d.ts +8 -0
- package/web-dist/components/game-field/GameField.js +25 -0
- package/web-dist/components/game-field/index.d.ts +1 -0
- package/web-dist/components/game-field/index.js +2 -0
- package/web-dist/components/game-input-zone/GameInputZone.d.ts +8 -0
- package/web-dist/components/game-input-zone/GameInputZone.js +25 -0
- package/web-dist/components/game-input-zone/index.d.ts +1 -0
- package/web-dist/components/game-input-zone/index.js +2 -0
- package/web-dist/components/game-measurement-probe/GameMeasurementProbe.d.ts +8 -0
- package/web-dist/components/game-measurement-probe/GameMeasurementProbe.js +25 -0
- package/web-dist/components/game-measurement-probe/index.d.ts +1 -0
- package/web-dist/components/game-measurement-probe/index.js +2 -0
- package/web-dist/components/game-overlay/GameOverlay.d.ts +8 -0
- package/web-dist/components/game-overlay/GameOverlay.js +25 -0
- package/web-dist/components/game-overlay/index.d.ts +1 -0
- package/web-dist/components/game-overlay/index.js +2 -0
- package/web-dist/components/gradient/Gradient.js +7 -7
- package/web-dist/components/gradient-renderer-provider/GradientRendererProvider.js +7 -7
- package/web-dist/components/grid/Grid.js +6 -6
- package/web-dist/components/heading/Heading.js +6 -6
- package/web-dist/components/hero/Hero.js +19 -19
- package/web-dist/components/icon/Icon.js +4 -4
- package/web-dist/components/icon-button/IconButton.js +12 -12
- package/web-dist/components/image/Image.js +10 -10
- package/web-dist/components/keyboard-avoiding-view/KeyboardAvoidingView.js +2 -2
- package/web-dist/components/list/List.js +13 -13
- package/web-dist/components/list-item/ListItem.js +13 -13
- package/web-dist/components/list-section/ListSection.js +13 -13
- package/web-dist/components/media-card/MediaCard.js +19 -19
- package/web-dist/components/message-bubble/MessageBubble.js +16 -16
- package/web-dist/components/metric-card/MetricCard.js +19 -19
- package/web-dist/components/missing-element/MissingElement.js +11 -11
- package/web-dist/components/o-auth-provider-button/OAuthProviderButton.js +18 -18
- package/web-dist/components/o-auth-provider-list/OAuthProviderList.js +18 -18
- package/web-dist/components/opening-book/OpeningBook.d.ts +4 -0
- package/web-dist/components/opening-book/OpeningBook.js +13 -0
- package/web-dist/components/opening-book/index.d.ts +1 -0
- package/web-dist/components/opening-book/index.js +2 -0
- package/web-dist/components/otp-form/OtpForm.js +18 -18
- package/web-dist/components/pagination/Pagination.js +13 -13
- package/web-dist/components/palette-item/PaletteItem.js +19 -19
- package/web-dist/components/playing-card/PlayingCard.d.ts +7 -0
- package/web-dist/components/playing-card/PlayingCard.js +19 -0
- package/web-dist/components/playing-card/index.d.ts +1 -0
- package/web-dist/components/playing-card/index.js +2 -0
- package/web-dist/components/poker-training-table/PokerTrainingTable.d.ts +7 -0
- package/web-dist/components/poker-training-table/PokerTrainingTable.js +19 -0
- package/web-dist/components/poker-training-table/index.d.ts +1 -0
- package/web-dist/components/poker-training-table/index.js +2 -0
- package/web-dist/components/popover-menu/PopoverMenu.js +14 -14
- package/web-dist/components/post-card/PostCard.js +19 -19
- package/web-dist/components/product-card/ProductCard.js +19 -19
- package/web-dist/components/progress/Progress.js +10 -10
- package/web-dist/components/progress-ring/ProgressRing.js +10 -10
- package/web-dist/components/radio/Radio.js +14 -14
- package/web-dist/components/radio-group/RadioGroup.js +14 -14
- package/web-dist/components/rating/Rating.js +9 -9
- package/web-dist/components/reader-surface/ReaderSurface.js +21 -21
- package/web-dist/components/scan-overlay/ScanOverlay.js +20 -20
- package/web-dist/components/screen/Screen.js +6 -6
- package/web-dist/components/screen-section/ScreenSection.js +10 -10
- package/web-dist/components/scroll-view/ScrollView.js +6 -6
- package/web-dist/components/search-input/SearchInput.js +13 -13
- package/web-dist/components/section-header/SectionHeader.js +10 -10
- package/web-dist/components/section-list/SectionList.js +13 -13
- package/web-dist/components/select/Select.js +16 -16
- package/web-dist/components/selectable-item/SelectableItem.js +5 -5
- package/web-dist/components/selection-provider/SelectionProvider.js +5 -5
- package/web-dist/components/sign-in-form/SignInForm.js +18 -18
- package/web-dist/components/sign-up-form/SignUpForm.js +18 -18
- package/web-dist/components/skeleton/Skeleton.js +22 -22
- package/web-dist/components/skeleton-card/SkeletonCard.js +22 -22
- package/web-dist/components/skeleton-list/SkeletonList.js +22 -22
- package/web-dist/components/skeleton-text/SkeletonText.js +22 -22
- package/web-dist/components/surface/Surface.js +7 -7
- package/web-dist/components/switch/Switch.js +7 -7
- package/web-dist/components/tab/Tab.js +7 -7
- package/web-dist/components/tab-list/TabList.js +7 -7
- package/web-dist/components/tab-panel/TabPanel.js +7 -7
- package/web-dist/components/tabletop-table/TabletopTable.d.ts +7 -0
- package/web-dist/components/tabletop-table/TabletopTable.js +19 -0
- package/web-dist/components/tabletop-table/index.d.ts +1 -0
- package/web-dist/components/tabletop-table/index.js +2 -0
- package/web-dist/components/tabs/Tabs.js +7 -7
- package/web-dist/components/text/Text.js +6 -6
- package/web-dist/components/text-input/TextInput.js +13 -13
- package/web-dist/components/time-picker/TimePicker.js +17 -17
- package/web-dist/components/timeline/Timeline.js +11 -11
- package/web-dist/components/toast/Toast.js +9 -9
- package/web-dist/components/toast-provider/ToastProvider.js +9 -9
- package/web-dist/components/toolbar/Toolbar.js +19 -19
- package/web-dist/components/tree-item/TreeItem.js +16 -16
- package/web-dist/components/uploader/Uploader.js +22 -22
- package/web-dist/components/view/View.js +6 -6
- package/web-dist/manifest.json +1648 -1377
- package/web-dist/runtime/ZoraProvider.js +8 -8
|
@@ -0,0 +1,830 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import {
|
|
3
|
+
require_cjs,
|
|
4
|
+
parseHexColor,
|
|
5
|
+
getReadableForeground
|
|
6
|
+
} from "./Accordion-7hn324r1.js";
|
|
7
|
+
import {
|
|
8
|
+
withZoraThemeScope
|
|
9
|
+
} from "./Accordion-k3bc4kad.js";
|
|
10
|
+
import {
|
|
11
|
+
useZoraTheme2
|
|
12
|
+
} from "./Accordion-7zfskq1s.js";
|
|
13
|
+
import {
|
|
14
|
+
__toESM
|
|
15
|
+
} from "./Accordion-9qvmwkxe.js";
|
|
16
|
+
|
|
17
|
+
// src/features/tabletop/adapters/inbound/CardBack.tsx
|
|
18
|
+
var import_react_native = __toESM(require_cjs(), 1);
|
|
19
|
+
import React from "react";
|
|
20
|
+
|
|
21
|
+
// src/features/tabletop/utils/createTabletopColorScheme.ts
|
|
22
|
+
var MINIMUM_READABLE_CONTRAST = 4.5;
|
|
23
|
+
function createTabletopColorScheme(theme, overrides = {}) {
|
|
24
|
+
const cardSurface = overrides.cardSurface ?? theme.semantics.neutral.surface;
|
|
25
|
+
const seatSurface = overrides.seatSurface ?? theme.semantics.neutral.surface;
|
|
26
|
+
const tableFelt = overrides.tableFelt ?? theme.semantics.action.primary.softBg;
|
|
27
|
+
const tokenSurface = overrides.tokenSurface ?? theme.semantics.warning.softBg;
|
|
28
|
+
const cardText = overrides.cardText ?? resolveReadableTextColor(cardSurface, theme.semantics.content.default, theme.semantics.content.muted);
|
|
29
|
+
const seatText = overrides.seatText ?? resolveReadableTextColor(seatSurface, theme.semantics.content.default, theme.semantics.content.muted);
|
|
30
|
+
const tableText = overrides.tableText ?? resolveReadableTextColor(tableFelt, theme.semantics.content.default, theme.semantics.content.muted);
|
|
31
|
+
const tokenText = overrides.tokenText ?? resolveReadableTextColor(tokenSurface, theme.semantics.content.default, theme.semantics.content.muted);
|
|
32
|
+
return {
|
|
33
|
+
cardBack: overrides.cardBack ?? theme.semantics.warning.base,
|
|
34
|
+
cardBackBorder: overrides.cardBackBorder ?? theme.semantics.neutral.border,
|
|
35
|
+
cardBorder: overrides.cardBorder ?? theme.semantics.neutral.border,
|
|
36
|
+
cardSurface,
|
|
37
|
+
cardText,
|
|
38
|
+
mutedText: overrides.mutedText ?? resolveReadableTextColor(cardSurface, theme.semantics.content.muted, cardText),
|
|
39
|
+
redSuitText: overrides.redSuitText ?? resolveReadableTextColor(cardSurface, theme.semantics.warning.base, cardText),
|
|
40
|
+
seatBorder: overrides.seatBorder ?? theme.semantics.neutral.divider,
|
|
41
|
+
seatMutedText: overrides.seatMutedText ?? resolveReadableTextColor(seatSurface, theme.semantics.content.muted, seatText),
|
|
42
|
+
seatSelectedBorder: overrides.seatSelectedBorder ?? theme.semantics.action.primary.base,
|
|
43
|
+
seatSurface,
|
|
44
|
+
seatText,
|
|
45
|
+
tableBorder: overrides.tableBorder ?? theme.semantics.warning.base,
|
|
46
|
+
tableFelt,
|
|
47
|
+
tableInnerBorder: overrides.tableInnerBorder ?? theme.semantics.neutral.divider,
|
|
48
|
+
tableMutedText: overrides.tableMutedText ?? resolveReadableTextColor(tableFelt, theme.semantics.content.muted, tableText),
|
|
49
|
+
tableText,
|
|
50
|
+
tokenSurface,
|
|
51
|
+
tokenText
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
function resolveReadableTextColor(background, preferred, fallback) {
|
|
55
|
+
const preferredContrast = getContrastRatio(background, preferred);
|
|
56
|
+
if (preferredContrast !== null && preferredContrast >= MINIMUM_READABLE_CONTRAST) {
|
|
57
|
+
return preferred;
|
|
58
|
+
}
|
|
59
|
+
const parsedBackground = parseHexColor2(background);
|
|
60
|
+
const normalizedBackground = parsedBackground === null ? null : parseHexColor(toHexColor(parsedBackground));
|
|
61
|
+
const strongestForeground = normalizedBackground === null ? undefined : getReadableForeground(normalizedBackground).foreground;
|
|
62
|
+
const candidates = uniqueColors([
|
|
63
|
+
preferred,
|
|
64
|
+
fallback,
|
|
65
|
+
...strongestForeground === undefined ? [] : [strongestForeground]
|
|
66
|
+
]);
|
|
67
|
+
const [readableCandidate] = candidates.map((candidate) => ({ candidate, contrast: getContrastRatio(background, candidate) })).filter((entry) => entry.contrast !== null).sort((left, right) => right.contrast - left.contrast);
|
|
68
|
+
return readableCandidate?.candidate ?? preferred;
|
|
69
|
+
}
|
|
70
|
+
function toHexColor(color) {
|
|
71
|
+
return `#${[color.red, color.green, color.blue].map((channel) => channel.toString(16).padStart(2, "0")).join("")}`;
|
|
72
|
+
}
|
|
73
|
+
function uniqueColors(colors) {
|
|
74
|
+
return [...new Set(colors)];
|
|
75
|
+
}
|
|
76
|
+
function getContrastRatio(background, foreground) {
|
|
77
|
+
const backgroundColor = parseHexColor2(background);
|
|
78
|
+
const foregroundColor = parseHexColor2(foreground);
|
|
79
|
+
if (backgroundColor === null || foregroundColor === null)
|
|
80
|
+
return null;
|
|
81
|
+
const backgroundLuminance = getRelativeLuminance(backgroundColor);
|
|
82
|
+
const foregroundLuminance = getRelativeLuminance(foregroundColor);
|
|
83
|
+
const lighter = Math.max(backgroundLuminance, foregroundLuminance);
|
|
84
|
+
const darker = Math.min(backgroundLuminance, foregroundLuminance);
|
|
85
|
+
return (lighter + 0.05) / (darker + 0.05);
|
|
86
|
+
}
|
|
87
|
+
function parseHexColor2(color) {
|
|
88
|
+
const value = color.trim();
|
|
89
|
+
const hex = value.startsWith("#") ? value.slice(1) : "";
|
|
90
|
+
if (!isSupportedHexLength(hex) || !isHexColorValue(hex))
|
|
91
|
+
return null;
|
|
92
|
+
if (hex.length === 3) {
|
|
93
|
+
const red = hex.slice(0, 1);
|
|
94
|
+
const green = hex.slice(1, 2);
|
|
95
|
+
const blue = hex.slice(2, 3);
|
|
96
|
+
return {
|
|
97
|
+
red: parseInt(red + red, 16),
|
|
98
|
+
green: parseInt(green + green, 16),
|
|
99
|
+
blue: parseInt(blue + blue, 16)
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
return {
|
|
103
|
+
red: parseInt(hex.slice(0, 2), 16),
|
|
104
|
+
green: parseInt(hex.slice(2, 4), 16),
|
|
105
|
+
blue: parseInt(hex.slice(4, 6), 16)
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
function isSupportedHexLength(hex) {
|
|
109
|
+
return hex.length === 3 || hex.length === 6 || hex.length === 8;
|
|
110
|
+
}
|
|
111
|
+
function isHexColorValue(hex) {
|
|
112
|
+
return [...hex].every((character) => isHexCharacter(character));
|
|
113
|
+
}
|
|
114
|
+
function isHexCharacter(character) {
|
|
115
|
+
const code = character.charCodeAt(0);
|
|
116
|
+
const isDigit = code >= 48 && code <= 57;
|
|
117
|
+
const isUpperHex = code >= 65 && code <= 70;
|
|
118
|
+
const isLowerHex = code >= 97 && code <= 102;
|
|
119
|
+
return isDigit || isUpperHex || isLowerHex;
|
|
120
|
+
}
|
|
121
|
+
function getRelativeLuminance(color) {
|
|
122
|
+
const red = normalizeColorChannel(color.red);
|
|
123
|
+
const green = normalizeColorChannel(color.green);
|
|
124
|
+
const blue = normalizeColorChannel(color.blue);
|
|
125
|
+
return 0.2126 * red + 0.7152 * green + 0.0722 * blue;
|
|
126
|
+
}
|
|
127
|
+
function normalizeColorChannel(value) {
|
|
128
|
+
const normalized = value / 255;
|
|
129
|
+
if (normalized <= 0.03928)
|
|
130
|
+
return normalized / 12.92;
|
|
131
|
+
return ((normalized + 0.055) / 1.055) ** 2.4;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// src/features/tabletop/utils/getTabletopCardDimensions.ts
|
|
135
|
+
var cardDimensions = {
|
|
136
|
+
large: {
|
|
137
|
+
width: 56,
|
|
138
|
+
height: 80,
|
|
139
|
+
radius: 8,
|
|
140
|
+
rankFontSize: 20,
|
|
141
|
+
suitFontSize: 16
|
|
142
|
+
},
|
|
143
|
+
medium: {
|
|
144
|
+
width: 40,
|
|
145
|
+
height: 56,
|
|
146
|
+
radius: 6,
|
|
147
|
+
rankFontSize: 15,
|
|
148
|
+
suitFontSize: 12
|
|
149
|
+
},
|
|
150
|
+
small: {
|
|
151
|
+
width: 28,
|
|
152
|
+
height: 40,
|
|
153
|
+
radius: 5,
|
|
154
|
+
rankFontSize: 11,
|
|
155
|
+
suitFontSize: 9
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
function getTabletopCardDimensions(size) {
|
|
159
|
+
switch (size) {
|
|
160
|
+
case "small":
|
|
161
|
+
return cardDimensions.small;
|
|
162
|
+
case "large":
|
|
163
|
+
return cardDimensions.large;
|
|
164
|
+
case "medium":
|
|
165
|
+
return cardDimensions.medium;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// src/features/tabletop/adapters/inbound/CardBack.tsx
|
|
170
|
+
import { jsx } from "react/jsx-runtime";
|
|
171
|
+
var CardBack2 = withZoraThemeScope(CardBackInner);
|
|
172
|
+
function CardBackInner({
|
|
173
|
+
size = "medium",
|
|
174
|
+
muted = false,
|
|
175
|
+
accessibilityLabel,
|
|
176
|
+
colorScheme,
|
|
177
|
+
testID
|
|
178
|
+
}) {
|
|
179
|
+
const { theme } = useZoraTheme2();
|
|
180
|
+
const colors = React.useMemo(() => createTabletopColorScheme(theme, colorScheme), [colorScheme, theme]);
|
|
181
|
+
const dimensions = getTabletopCardDimensions(size);
|
|
182
|
+
return /* @__PURE__ */ jsx(import_react_native.View, {
|
|
183
|
+
accessibilityLabel: accessibilityLabel ?? "Hidden card",
|
|
184
|
+
accessibilityRole: "image",
|
|
185
|
+
style: [
|
|
186
|
+
styles.card,
|
|
187
|
+
{
|
|
188
|
+
backgroundColor: colors.cardBack,
|
|
189
|
+
borderColor: colors.cardBackBorder,
|
|
190
|
+
borderRadius: dimensions.radius,
|
|
191
|
+
height: dimensions.height,
|
|
192
|
+
opacity: muted ? 0.48 : 1,
|
|
193
|
+
width: dimensions.width
|
|
194
|
+
}
|
|
195
|
+
],
|
|
196
|
+
testID,
|
|
197
|
+
children: /* @__PURE__ */ jsx(import_react_native.View, {
|
|
198
|
+
style: [
|
|
199
|
+
styles.inner,
|
|
200
|
+
{
|
|
201
|
+
borderColor: colors.cardBackBorder,
|
|
202
|
+
borderRadius: Math.max(2, dimensions.radius - 3)
|
|
203
|
+
}
|
|
204
|
+
]
|
|
205
|
+
})
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
var styles = import_react_native.StyleSheet.create({
|
|
209
|
+
card: {
|
|
210
|
+
alignItems: "center",
|
|
211
|
+
borderWidth: 1,
|
|
212
|
+
justifyContent: "center"
|
|
213
|
+
},
|
|
214
|
+
inner: {
|
|
215
|
+
borderWidth: 1,
|
|
216
|
+
height: "68%",
|
|
217
|
+
opacity: 0.48,
|
|
218
|
+
width: "68%"
|
|
219
|
+
}
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
// src/features/tabletop/adapters/inbound/PlayingCard.tsx
|
|
223
|
+
var import_react_native2 = __toESM(require_cjs(), 1);
|
|
224
|
+
import React2 from "react";
|
|
225
|
+
|
|
226
|
+
// src/features/tabletop/utils/getPlayingCardLabel.ts
|
|
227
|
+
var rankLabels = { A: "ace", J: "jack", K: "king", Q: "queen" };
|
|
228
|
+
function getPlayingCardLabel(card) {
|
|
229
|
+
return `${rankLabels[card.rank] ?? card.rank} of ${card.suit}`;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
// src/features/tabletop/adapters/inbound/PlayingCard.tsx
|
|
233
|
+
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
234
|
+
var suitMarks = { clubs: "♣", diamonds: "♦", hearts: "♥", spades: "♠" };
|
|
235
|
+
var PlayingCard2 = withZoraThemeScope(PlayingCardInner);
|
|
236
|
+
function PlayingCardInner({
|
|
237
|
+
card,
|
|
238
|
+
size = "medium",
|
|
239
|
+
selected = false,
|
|
240
|
+
muted = false,
|
|
241
|
+
accessibilityLabel,
|
|
242
|
+
colorScheme,
|
|
243
|
+
testID
|
|
244
|
+
}) {
|
|
245
|
+
const { theme } = useZoraTheme2();
|
|
246
|
+
const colors = React2.useMemo(() => createTabletopColorScheme(theme, colorScheme), [colorScheme, theme]);
|
|
247
|
+
const dimensions = getTabletopCardDimensions(size);
|
|
248
|
+
const suitColor = card.suit === "hearts" || card.suit === "diamonds" ? colors.redSuitText : colors.cardText;
|
|
249
|
+
return /* @__PURE__ */ jsxs(import_react_native2.View, {
|
|
250
|
+
accessibilityLabel: accessibilityLabel ?? getPlayingCardLabel(card),
|
|
251
|
+
accessibilityRole: "image",
|
|
252
|
+
style: [
|
|
253
|
+
styles2.card,
|
|
254
|
+
{
|
|
255
|
+
backgroundColor: colors.cardSurface,
|
|
256
|
+
borderColor: selected ? colors.seatSelectedBorder : colors.cardBorder,
|
|
257
|
+
borderRadius: dimensions.radius,
|
|
258
|
+
height: dimensions.height,
|
|
259
|
+
opacity: muted ? 0.48 : 1,
|
|
260
|
+
width: dimensions.width
|
|
261
|
+
}
|
|
262
|
+
],
|
|
263
|
+
testID,
|
|
264
|
+
children: [
|
|
265
|
+
/* @__PURE__ */ jsx2(import_react_native2.Text, {
|
|
266
|
+
selectable: false,
|
|
267
|
+
style: [
|
|
268
|
+
styles2.rank,
|
|
269
|
+
{
|
|
270
|
+
color: suitColor,
|
|
271
|
+
fontSize: dimensions.rankFontSize,
|
|
272
|
+
lineHeight: dimensions.rankFontSize + 4
|
|
273
|
+
}
|
|
274
|
+
],
|
|
275
|
+
children: card.rank
|
|
276
|
+
}),
|
|
277
|
+
/* @__PURE__ */ jsx2(import_react_native2.Text, {
|
|
278
|
+
selectable: false,
|
|
279
|
+
style: [
|
|
280
|
+
styles2.suit,
|
|
281
|
+
{
|
|
282
|
+
color: suitColor,
|
|
283
|
+
fontSize: dimensions.suitFontSize,
|
|
284
|
+
lineHeight: dimensions.suitFontSize + 3
|
|
285
|
+
}
|
|
286
|
+
],
|
|
287
|
+
children: suitMarks[card.suit]
|
|
288
|
+
})
|
|
289
|
+
]
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
var styles2 = import_react_native2.StyleSheet.create({
|
|
293
|
+
card: {
|
|
294
|
+
alignItems: "center",
|
|
295
|
+
borderWidth: 1,
|
|
296
|
+
justifyContent: "center"
|
|
297
|
+
},
|
|
298
|
+
rank: {
|
|
299
|
+
fontWeight: "800"
|
|
300
|
+
},
|
|
301
|
+
suit: {
|
|
302
|
+
fontWeight: "700",
|
|
303
|
+
marginTop: -2
|
|
304
|
+
}
|
|
305
|
+
});
|
|
306
|
+
|
|
307
|
+
// src/features/tabletop/adapters/inbound/CardHand.tsx
|
|
308
|
+
var import_react_native3 = __toESM(require_cjs(), 1);
|
|
309
|
+
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
310
|
+
var CardHand2 = withZoraThemeScope(CardHandInner);
|
|
311
|
+
function createFaceDownCards(count) {
|
|
312
|
+
return Array.from({ length: Math.max(0, count) }, (_, index) => index);
|
|
313
|
+
}
|
|
314
|
+
function CardHandInner({
|
|
315
|
+
cards = [],
|
|
316
|
+
faceDownCards = 0,
|
|
317
|
+
size = "medium",
|
|
318
|
+
muted = false,
|
|
319
|
+
colorScheme,
|
|
320
|
+
accessibilityLabel,
|
|
321
|
+
testID
|
|
322
|
+
}) {
|
|
323
|
+
const hiddenCards = createFaceDownCards(faceDownCards);
|
|
324
|
+
return /* @__PURE__ */ jsxs2(import_react_native3.View, {
|
|
325
|
+
accessibilityLabel,
|
|
326
|
+
style: styles3.hand,
|
|
327
|
+
testID,
|
|
328
|
+
children: [
|
|
329
|
+
cards.map((card, index) => /* @__PURE__ */ jsx3(PlayingCard2, {
|
|
330
|
+
card,
|
|
331
|
+
colorScheme,
|
|
332
|
+
muted,
|
|
333
|
+
size,
|
|
334
|
+
testID: testID ? `${testID}-card-${index}` : undefined
|
|
335
|
+
}, `${card.rank}-${card.suit}-${index}`)),
|
|
336
|
+
hiddenCards.map((index) => /* @__PURE__ */ jsx3(CardBack2, {
|
|
337
|
+
colorScheme,
|
|
338
|
+
muted,
|
|
339
|
+
size,
|
|
340
|
+
testID: testID ? `${testID}-hidden-${index}` : undefined
|
|
341
|
+
}, `hidden-${index}`))
|
|
342
|
+
]
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
var styles3 = import_react_native3.StyleSheet.create({
|
|
346
|
+
hand: {
|
|
347
|
+
alignItems: "center",
|
|
348
|
+
flexDirection: "row",
|
|
349
|
+
gap: 4,
|
|
350
|
+
justifyContent: "center"
|
|
351
|
+
}
|
|
352
|
+
});
|
|
353
|
+
|
|
354
|
+
// src/features/tabletop/adapters/inbound/TabletopTable.tsx
|
|
355
|
+
var import_react_native4 = __toESM(require_cjs(), 1);
|
|
356
|
+
import React3 from "react";
|
|
357
|
+
|
|
358
|
+
// src/features/tabletop/utils/getTabletopSeatPosition.ts
|
|
359
|
+
var fallbackSeatPosition = { top: "82%", left: "50%" };
|
|
360
|
+
var seatPositions = {
|
|
361
|
+
2: [fallbackSeatPosition, { top: "18%", left: "50%" }],
|
|
362
|
+
3: [fallbackSeatPosition, { top: "28%", left: "18%" }, { top: "28%", left: "82%" }],
|
|
363
|
+
4: [
|
|
364
|
+
fallbackSeatPosition,
|
|
365
|
+
{ top: "50%", left: "12%" },
|
|
366
|
+
{ top: "18%", left: "50%" },
|
|
367
|
+
{ top: "50%", left: "88%" }
|
|
368
|
+
],
|
|
369
|
+
5: [
|
|
370
|
+
{ top: "84%", left: "50%" },
|
|
371
|
+
{ top: "62%", left: "12%" },
|
|
372
|
+
{ top: "18%", left: "24%" },
|
|
373
|
+
{ top: "18%", left: "76%" },
|
|
374
|
+
{ top: "62%", left: "88%" }
|
|
375
|
+
],
|
|
376
|
+
6: [
|
|
377
|
+
{ top: "84%", left: "50%" },
|
|
378
|
+
{ top: "68%", left: "16%" },
|
|
379
|
+
{ top: "26%", left: "16%" },
|
|
380
|
+
{ top: "16%", left: "50%" },
|
|
381
|
+
{ top: "26%", left: "84%" },
|
|
382
|
+
{ top: "68%", left: "84%" }
|
|
383
|
+
],
|
|
384
|
+
7: [
|
|
385
|
+
{ top: "86%", left: "50%" },
|
|
386
|
+
{ top: "70%", left: "14%" },
|
|
387
|
+
{ top: "34%", left: "10%" },
|
|
388
|
+
{ top: "14%", left: "34%" },
|
|
389
|
+
{ top: "14%", left: "66%" },
|
|
390
|
+
{ top: "34%", left: "90%" },
|
|
391
|
+
{ top: "70%", left: "86%" }
|
|
392
|
+
],
|
|
393
|
+
8: [
|
|
394
|
+
{ top: "86%", left: "50%" },
|
|
395
|
+
{ top: "72%", left: "16%" },
|
|
396
|
+
{ top: "50%", left: "8%" },
|
|
397
|
+
{ top: "20%", left: "20%" },
|
|
398
|
+
{ top: "14%", left: "50%" },
|
|
399
|
+
{ top: "20%", left: "80%" },
|
|
400
|
+
{ top: "50%", left: "92%" },
|
|
401
|
+
{ top: "72%", left: "84%" }
|
|
402
|
+
],
|
|
403
|
+
9: [
|
|
404
|
+
{ top: "88%", left: "50%" },
|
|
405
|
+
{ top: "78%", left: "12%" },
|
|
406
|
+
{ top: "50%", left: "4%" },
|
|
407
|
+
{ top: "18%", left: "10%" },
|
|
408
|
+
{ top: "8%", left: "28%" },
|
|
409
|
+
{ top: "8%", left: "50%" },
|
|
410
|
+
{ top: "8%", left: "72%" },
|
|
411
|
+
{ top: "18%", left: "90%" },
|
|
412
|
+
{ top: "50%", left: "96%" }
|
|
413
|
+
],
|
|
414
|
+
10: [
|
|
415
|
+
{ top: "88%", left: "50%" },
|
|
416
|
+
{ top: "80%", left: "20%" },
|
|
417
|
+
{ top: "58%", left: "6%" },
|
|
418
|
+
{ top: "30%", left: "8%" },
|
|
419
|
+
{ top: "10%", left: "30%" },
|
|
420
|
+
{ top: "8%", left: "50%" },
|
|
421
|
+
{ top: "10%", left: "70%" },
|
|
422
|
+
{ top: "30%", left: "92%" },
|
|
423
|
+
{ top: "58%", left: "94%" },
|
|
424
|
+
{ top: "80%", left: "80%" }
|
|
425
|
+
]
|
|
426
|
+
};
|
|
427
|
+
function normalizeTabletopSeatCount(count) {
|
|
428
|
+
const rounded = Math.round(count);
|
|
429
|
+
if (rounded <= 2)
|
|
430
|
+
return 2;
|
|
431
|
+
if (rounded >= 10)
|
|
432
|
+
return 10;
|
|
433
|
+
return rounded;
|
|
434
|
+
}
|
|
435
|
+
function getTabletopSeatPositions(count) {
|
|
436
|
+
return seatPositions[normalizeTabletopSeatCount(count)];
|
|
437
|
+
}
|
|
438
|
+
function getTabletopSeatPosition(index, count) {
|
|
439
|
+
const positions = getTabletopSeatPositions(count);
|
|
440
|
+
const position = positions[index % positions.length];
|
|
441
|
+
return position ?? fallbackSeatPosition;
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
// src/features/tabletop/adapters/inbound/TabletopTable.tsx
|
|
445
|
+
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
446
|
+
var TabletopTable2 = withZoraThemeScope(TabletopTableInner);
|
|
447
|
+
function createSeatAccessibilityLabel(seat) {
|
|
448
|
+
if (seat.accessibilityLabel !== undefined)
|
|
449
|
+
return seat.accessibilityLabel;
|
|
450
|
+
if (typeof seat.label !== "string")
|
|
451
|
+
return;
|
|
452
|
+
const parts = [seat.label];
|
|
453
|
+
if (typeof seat.sublabel === "string")
|
|
454
|
+
parts.push(seat.sublabel);
|
|
455
|
+
if (typeof seat.tokenLabel === "string")
|
|
456
|
+
parts.push(seat.tokenLabel);
|
|
457
|
+
if (seat.selected)
|
|
458
|
+
parts.push("selected");
|
|
459
|
+
if (seat.muted)
|
|
460
|
+
parts.push("muted");
|
|
461
|
+
return parts.join(", ");
|
|
462
|
+
}
|
|
463
|
+
function TabletopTableInner({
|
|
464
|
+
seats,
|
|
465
|
+
centerCards = [],
|
|
466
|
+
centerLabel,
|
|
467
|
+
centerSublabel,
|
|
468
|
+
shape = "oval",
|
|
469
|
+
seatCount,
|
|
470
|
+
cardSize = "small",
|
|
471
|
+
disabled = false,
|
|
472
|
+
colorScheme,
|
|
473
|
+
accessibilityLabel,
|
|
474
|
+
testID
|
|
475
|
+
}) {
|
|
476
|
+
const { theme } = useZoraTheme2();
|
|
477
|
+
const colors = React3.useMemo(() => createTabletopColorScheme(theme, colorScheme), [colorScheme, theme]);
|
|
478
|
+
const resolvedSeatCount = seatCount ?? seats.length;
|
|
479
|
+
return /* @__PURE__ */ jsxs3(import_react_native4.View, {
|
|
480
|
+
accessibilityLabel,
|
|
481
|
+
style: [
|
|
482
|
+
styles4.root,
|
|
483
|
+
{ aspectRatio: shape === "circle" ? 1 : 1.6, opacity: disabled ? 0.56 : 1 }
|
|
484
|
+
],
|
|
485
|
+
testID,
|
|
486
|
+
children: [
|
|
487
|
+
/* @__PURE__ */ jsxs3(import_react_native4.View, {
|
|
488
|
+
style: [
|
|
489
|
+
styles4.surface,
|
|
490
|
+
shape === "circle" ? styles4.circleSurface : styles4.ovalSurface,
|
|
491
|
+
shape === "rounded" ? styles4.roundedSurface : null,
|
|
492
|
+
{
|
|
493
|
+
backgroundColor: colors.tableFelt,
|
|
494
|
+
borderColor: colors.tableBorder
|
|
495
|
+
}
|
|
496
|
+
],
|
|
497
|
+
children: [
|
|
498
|
+
/* @__PURE__ */ jsx4(import_react_native4.View, {
|
|
499
|
+
pointerEvents: "none",
|
|
500
|
+
style: [
|
|
501
|
+
styles4.innerSurface,
|
|
502
|
+
shape === "circle" ? styles4.circleSurface : styles4.ovalSurface,
|
|
503
|
+
shape === "rounded" ? styles4.roundedSurface : null,
|
|
504
|
+
{ borderColor: colors.tableInnerBorder }
|
|
505
|
+
]
|
|
506
|
+
}),
|
|
507
|
+
/* @__PURE__ */ jsxs3(import_react_native4.View, {
|
|
508
|
+
style: styles4.centerContent,
|
|
509
|
+
children: [
|
|
510
|
+
centerCards.length > 0 ? /* @__PURE__ */ jsx4(CardHand2, {
|
|
511
|
+
cards: centerCards,
|
|
512
|
+
colorScheme,
|
|
513
|
+
size: cardSize
|
|
514
|
+
}) : null,
|
|
515
|
+
centerLabel !== undefined ? /* @__PURE__ */ jsx4(import_react_native4.View, {
|
|
516
|
+
style: [styles4.centerLabel, { backgroundColor: colors.seatSurface }],
|
|
517
|
+
children: /* @__PURE__ */ jsx4(import_react_native4.Text, {
|
|
518
|
+
style: [styles4.centerLabelText, { color: colors.seatText }],
|
|
519
|
+
children: centerLabel
|
|
520
|
+
})
|
|
521
|
+
}) : null,
|
|
522
|
+
centerSublabel !== undefined ? /* @__PURE__ */ jsx4(import_react_native4.Text, {
|
|
523
|
+
style: [styles4.centerSublabel, { color: colors.tableMutedText }],
|
|
524
|
+
children: centerSublabel
|
|
525
|
+
}) : null
|
|
526
|
+
]
|
|
527
|
+
})
|
|
528
|
+
]
|
|
529
|
+
}),
|
|
530
|
+
seats.map((seat, index) => {
|
|
531
|
+
const position = getTabletopSeatPosition(index, resolvedSeatCount);
|
|
532
|
+
const hasCards = seat.cards !== undefined || seat.faceDownCards !== undefined;
|
|
533
|
+
const seatCardSize = seat.selected && cardSize === "small" ? "medium" : cardSize;
|
|
534
|
+
return /* @__PURE__ */ jsxs3(import_react_native4.View, {
|
|
535
|
+
accessibilityLabel: createSeatAccessibilityLabel(seat),
|
|
536
|
+
accessibilityRole: "summary",
|
|
537
|
+
style: [
|
|
538
|
+
styles4.seatSlot,
|
|
539
|
+
{
|
|
540
|
+
left: position.left,
|
|
541
|
+
opacity: seat.muted ? 0.48 : 1,
|
|
542
|
+
top: position.top
|
|
543
|
+
}
|
|
544
|
+
],
|
|
545
|
+
testID: testID ? `${testID}-seat-${seat.id}` : undefined,
|
|
546
|
+
children: [
|
|
547
|
+
/* @__PURE__ */ jsxs3(import_react_native4.View, {
|
|
548
|
+
style: [
|
|
549
|
+
styles4.seatPanel,
|
|
550
|
+
seat.selected ? styles4.selectedSeatPanel : null,
|
|
551
|
+
{
|
|
552
|
+
borderColor: seat.selected ? colors.seatSelectedBorder : colors.seatBorder,
|
|
553
|
+
backgroundColor: colors.seatSurface
|
|
554
|
+
}
|
|
555
|
+
],
|
|
556
|
+
children: [
|
|
557
|
+
hasCards ? /* @__PURE__ */ jsx4(CardHand2, {
|
|
558
|
+
cards: seat.cards,
|
|
559
|
+
colorScheme,
|
|
560
|
+
faceDownCards: seat.faceDownCards,
|
|
561
|
+
muted: seat.muted ?? seat.disabled,
|
|
562
|
+
size: seatCardSize
|
|
563
|
+
}) : null,
|
|
564
|
+
/* @__PURE__ */ jsxs3(import_react_native4.View, {
|
|
565
|
+
style: styles4.seatTextGroup,
|
|
566
|
+
children: [
|
|
567
|
+
/* @__PURE__ */ jsx4(import_react_native4.Text, {
|
|
568
|
+
style: [styles4.seatLabel, { color: colors.seatText }],
|
|
569
|
+
children: seat.label
|
|
570
|
+
}),
|
|
571
|
+
seat.sublabel !== undefined ? /* @__PURE__ */ jsx4(import_react_native4.Text, {
|
|
572
|
+
style: [styles4.seatSublabel, { color: colors.seatMutedText }],
|
|
573
|
+
children: seat.sublabel
|
|
574
|
+
}) : null
|
|
575
|
+
]
|
|
576
|
+
})
|
|
577
|
+
]
|
|
578
|
+
}),
|
|
579
|
+
seat.tokenLabel !== undefined ? /* @__PURE__ */ jsx4(import_react_native4.View, {
|
|
580
|
+
style: [
|
|
581
|
+
styles4.token,
|
|
582
|
+
{
|
|
583
|
+
backgroundColor: colors.tokenSurface,
|
|
584
|
+
borderColor: seat.selected ? colors.seatSelectedBorder : colors.tableInnerBorder
|
|
585
|
+
}
|
|
586
|
+
],
|
|
587
|
+
children: /* @__PURE__ */ jsx4(import_react_native4.Text, {
|
|
588
|
+
style: [styles4.tokenText, { color: colors.tokenText }],
|
|
589
|
+
children: seat.tokenLabel
|
|
590
|
+
})
|
|
591
|
+
}) : null
|
|
592
|
+
]
|
|
593
|
+
}, seat.id);
|
|
594
|
+
})
|
|
595
|
+
]
|
|
596
|
+
});
|
|
597
|
+
}
|
|
598
|
+
var styles4 = import_react_native4.StyleSheet.create({
|
|
599
|
+
centerContent: {
|
|
600
|
+
alignItems: "center",
|
|
601
|
+
gap: 6,
|
|
602
|
+
left: 0,
|
|
603
|
+
position: "absolute",
|
|
604
|
+
right: 0,
|
|
605
|
+
top: "35%"
|
|
606
|
+
},
|
|
607
|
+
centerLabel: {
|
|
608
|
+
borderRadius: 999,
|
|
609
|
+
paddingHorizontal: 10,
|
|
610
|
+
paddingVertical: 4
|
|
611
|
+
},
|
|
612
|
+
centerLabelText: {
|
|
613
|
+
fontSize: 12,
|
|
614
|
+
fontWeight: "800"
|
|
615
|
+
},
|
|
616
|
+
centerSublabel: {
|
|
617
|
+
fontSize: 11,
|
|
618
|
+
fontWeight: "700"
|
|
619
|
+
},
|
|
620
|
+
circleSurface: {
|
|
621
|
+
borderRadius: 999
|
|
622
|
+
},
|
|
623
|
+
innerSurface: {
|
|
624
|
+
borderWidth: 1,
|
|
625
|
+
bottom: 10,
|
|
626
|
+
left: 10,
|
|
627
|
+
opacity: 0.44,
|
|
628
|
+
position: "absolute",
|
|
629
|
+
right: 10,
|
|
630
|
+
top: 10
|
|
631
|
+
},
|
|
632
|
+
ovalSurface: {
|
|
633
|
+
borderRadius: 999
|
|
634
|
+
},
|
|
635
|
+
root: {
|
|
636
|
+
maxWidth: 760,
|
|
637
|
+
position: "relative",
|
|
638
|
+
width: "100%"
|
|
639
|
+
},
|
|
640
|
+
roundedSurface: {
|
|
641
|
+
borderRadius: 28
|
|
642
|
+
},
|
|
643
|
+
seatLabel: {
|
|
644
|
+
fontSize: 11,
|
|
645
|
+
fontWeight: "800"
|
|
646
|
+
},
|
|
647
|
+
seatPanel: {
|
|
648
|
+
alignItems: "center",
|
|
649
|
+
borderRadius: 12,
|
|
650
|
+
borderWidth: 1,
|
|
651
|
+
gap: 4,
|
|
652
|
+
minWidth: 68,
|
|
653
|
+
paddingHorizontal: 7,
|
|
654
|
+
paddingVertical: 6
|
|
655
|
+
},
|
|
656
|
+
seatSlot: {
|
|
657
|
+
alignItems: "center",
|
|
658
|
+
gap: 4,
|
|
659
|
+
minWidth: 78,
|
|
660
|
+
position: "absolute",
|
|
661
|
+
transform: [{ translateX: -39 }, { translateY: -34 }]
|
|
662
|
+
},
|
|
663
|
+
seatSublabel: {
|
|
664
|
+
fontSize: 10,
|
|
665
|
+
fontWeight: "700"
|
|
666
|
+
},
|
|
667
|
+
seatTextGroup: {
|
|
668
|
+
alignItems: "center",
|
|
669
|
+
gap: 1
|
|
670
|
+
},
|
|
671
|
+
selectedSeatPanel: {
|
|
672
|
+
borderWidth: 2,
|
|
673
|
+
paddingHorizontal: 9,
|
|
674
|
+
paddingVertical: 7
|
|
675
|
+
},
|
|
676
|
+
surface: {
|
|
677
|
+
borderWidth: 8,
|
|
678
|
+
bottom: 28,
|
|
679
|
+
left: 24,
|
|
680
|
+
position: "absolute",
|
|
681
|
+
right: 24,
|
|
682
|
+
top: 24
|
|
683
|
+
},
|
|
684
|
+
token: {
|
|
685
|
+
borderRadius: 999,
|
|
686
|
+
borderWidth: 1,
|
|
687
|
+
paddingHorizontal: 7,
|
|
688
|
+
paddingVertical: 2
|
|
689
|
+
},
|
|
690
|
+
tokenText: {
|
|
691
|
+
fontSize: 10,
|
|
692
|
+
fontWeight: "800"
|
|
693
|
+
}
|
|
694
|
+
});
|
|
695
|
+
|
|
696
|
+
// src/features/tabletop/adapters/inbound/PokerTrainingTable.tsx
|
|
697
|
+
import React4 from "react";
|
|
698
|
+
|
|
699
|
+
// src/features/tabletop/utils/createTabletopGameSeats.ts
|
|
700
|
+
function createTabletopGameSeats({
|
|
701
|
+
seats,
|
|
702
|
+
participants,
|
|
703
|
+
missingParticipantState = { disabled: true, muted: true }
|
|
704
|
+
}) {
|
|
705
|
+
const participantsBySeat = new Map(participants.map((participant) => [participant.seatId, participant]));
|
|
706
|
+
return seats.map((seat) => {
|
|
707
|
+
const participant = participantsBySeat.get(seat.id);
|
|
708
|
+
return {
|
|
709
|
+
id: seat.id,
|
|
710
|
+
...seat.defaultState,
|
|
711
|
+
...participant === undefined ? missingParticipantState : participant.state
|
|
712
|
+
};
|
|
713
|
+
});
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
// src/features/tabletop/utils/createPokerTrainingTableState.ts
|
|
717
|
+
function createPokerTrainingTableState(task, { defaultStackBigBlinds = 100 } = {}) {
|
|
718
|
+
const tableSize = task.tableSize ?? "9max";
|
|
719
|
+
const positions = tableSize === "6max" ? sixMaxPokerPositions : nineMaxPokerPositions;
|
|
720
|
+
const bigBlind = task.blinds?.big;
|
|
721
|
+
const heroPosition = task.heroPosition ?? task.players?.find((player) => player.isHero)?.position;
|
|
722
|
+
const orderedPositions = rotatePokerPositions(positions, heroPosition);
|
|
723
|
+
const defaultStack = `${formatAmount(defaultStackBigBlinds)} BB`;
|
|
724
|
+
const participants = (task.players ?? []).map((player) => createPokerParticipantState(player, task, bigBlind));
|
|
725
|
+
const seats = createTabletopGameSeats({
|
|
726
|
+
seats: orderedPositions.map((position) => ({
|
|
727
|
+
id: position,
|
|
728
|
+
defaultState: {
|
|
729
|
+
label: position,
|
|
730
|
+
tokenLabel: position === "BTN" ? "D" : undefined
|
|
731
|
+
}
|
|
732
|
+
})),
|
|
733
|
+
participants,
|
|
734
|
+
missingParticipantState: {
|
|
735
|
+
disabled: true,
|
|
736
|
+
muted: true,
|
|
737
|
+
sublabel: `${defaultStack} · Folded`
|
|
738
|
+
}
|
|
739
|
+
});
|
|
740
|
+
return {
|
|
741
|
+
seatCount: positions.length,
|
|
742
|
+
seats,
|
|
743
|
+
centerCards: task.communityCards ?? [],
|
|
744
|
+
centerLabel: task.pot === undefined ? undefined : `Pot ${formatAmount(task.pot)}`,
|
|
745
|
+
centerSublabel: task.blinds === undefined ? undefined : `Blinds ${formatAmount(task.blinds.small)} / ${formatAmount(task.blinds.big)}`,
|
|
746
|
+
accessibilityLabel: createPokerAccessibilityLabel(tableSize, heroPosition, task)
|
|
747
|
+
};
|
|
748
|
+
}
|
|
749
|
+
var sixMaxPokerPositions = ["BTN", "SB", "BB", "UTG", "HJ", "CO"];
|
|
750
|
+
var nineMaxPokerPositions = [
|
|
751
|
+
"BTN",
|
|
752
|
+
"SB",
|
|
753
|
+
"BB",
|
|
754
|
+
"UTG",
|
|
755
|
+
"UTG+1",
|
|
756
|
+
"UTG+2",
|
|
757
|
+
"MP",
|
|
758
|
+
"HJ",
|
|
759
|
+
"CO"
|
|
760
|
+
];
|
|
761
|
+
function rotatePokerPositions(positions, heroPosition) {
|
|
762
|
+
const heroIndex = positions.findIndex((position) => position === heroPosition);
|
|
763
|
+
if (heroIndex <= 0)
|
|
764
|
+
return positions;
|
|
765
|
+
return [...positions.slice(heroIndex), ...positions.slice(0, heroIndex)];
|
|
766
|
+
}
|
|
767
|
+
function createPokerParticipantState(player, task, bigBlind) {
|
|
768
|
+
const isHero = player.isHero === true || player.position === task.heroPosition;
|
|
769
|
+
const cards = player.cards ?? (isHero ? task.heroCards : undefined);
|
|
770
|
+
const folded = player.folded === true;
|
|
771
|
+
return {
|
|
772
|
+
seatId: player.position,
|
|
773
|
+
state: {
|
|
774
|
+
cards,
|
|
775
|
+
disabled: folded,
|
|
776
|
+
faceDownCards: cards === undefined && !folded && !isHero ? 2 : undefined,
|
|
777
|
+
muted: folded,
|
|
778
|
+
selected: isHero,
|
|
779
|
+
sublabel: formatPlayerSublabel(player, bigBlind)
|
|
780
|
+
}
|
|
781
|
+
};
|
|
782
|
+
}
|
|
783
|
+
function formatPlayerSublabel(player, bigBlind) {
|
|
784
|
+
const stack = player.stack === undefined ? undefined : formatChipStack(player.stack, bigBlind);
|
|
785
|
+
const bet = player.bet === undefined ? undefined : `Bet ${formatChipStack(player.bet, bigBlind)}`;
|
|
786
|
+
const parts = [stack, bet, player.folded === true ? "Folded" : undefined].filter((part) => part !== undefined);
|
|
787
|
+
return parts.length === 0 ? undefined : parts.join(" · ");
|
|
788
|
+
}
|
|
789
|
+
function formatChipStack(amount, bigBlind) {
|
|
790
|
+
if (bigBlind !== undefined && bigBlind > 0) {
|
|
791
|
+
return `${formatAmount(amount / bigBlind)} BB`;
|
|
792
|
+
}
|
|
793
|
+
return `${formatAmount(amount)} chips`;
|
|
794
|
+
}
|
|
795
|
+
function formatAmount(amount) {
|
|
796
|
+
return new Intl.NumberFormat("en-US", { maximumFractionDigits: 2 }).format(amount);
|
|
797
|
+
}
|
|
798
|
+
function createPokerAccessibilityLabel(tableSize, heroPosition, task) {
|
|
799
|
+
const parts = [`${tableSize === "6max" ? "Six" : "Nine"}-player poker table`];
|
|
800
|
+
if (heroPosition !== undefined)
|
|
801
|
+
parts.push(`Hero ${heroPosition}`);
|
|
802
|
+
if (task.pot !== undefined)
|
|
803
|
+
parts.push(`Pot ${formatAmount(task.pot)}`);
|
|
804
|
+
if (task.blinds !== undefined) {
|
|
805
|
+
parts.push(`Blinds ${formatAmount(task.blinds.small)} / ${formatAmount(task.blinds.big)}`);
|
|
806
|
+
}
|
|
807
|
+
return `${parts.join(". ")}.`;
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
// src/features/tabletop/adapters/inbound/PokerTrainingTable.tsx
|
|
811
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
812
|
+
var PokerTrainingTable2 = withZoraThemeScope(PokerTrainingTableInner);
|
|
813
|
+
function PokerTrainingTableInner({
|
|
814
|
+
task = {},
|
|
815
|
+
defaultStackBigBlinds = 100,
|
|
816
|
+
accessibilityLabel,
|
|
817
|
+
...tableProps
|
|
818
|
+
}) {
|
|
819
|
+
const state = React4.useMemo(() => createPokerTrainingTableState(task, { defaultStackBigBlinds }), [defaultStackBigBlinds, task]);
|
|
820
|
+
return /* @__PURE__ */ jsx5(TabletopTable2, {
|
|
821
|
+
...tableProps,
|
|
822
|
+
accessibilityLabel: accessibilityLabel ?? state.accessibilityLabel,
|
|
823
|
+
centerCards: state.centerCards,
|
|
824
|
+
centerLabel: state.centerLabel,
|
|
825
|
+
centerSublabel: state.centerSublabel,
|
|
826
|
+
seatCount: state.seatCount,
|
|
827
|
+
seats: state.seats
|
|
828
|
+
});
|
|
829
|
+
}
|
|
830
|
+
export { CardBack2, PlayingCard2, CardHand2, TabletopTable2, PokerTrainingTable2 };
|