@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,66 @@
|
|
|
1
|
+
import type { GameSession } from '@ankhorage/game';
|
|
2
|
+
import { resolveRuntimeBindingValueSync } from '@ankhorage/runtime/bindings';
|
|
3
|
+
import { describe, expect, test } from 'bun:test';
|
|
4
|
+
|
|
5
|
+
import { createGameBindingContext } from './createGameBindingContext';
|
|
6
|
+
|
|
7
|
+
const session: GameSession = {
|
|
8
|
+
definitionId: 'binding-demo',
|
|
9
|
+
stageId: 'main',
|
|
10
|
+
phase: 'playing',
|
|
11
|
+
state: { health: 80, progress: 0.5 },
|
|
12
|
+
entities: {
|
|
13
|
+
player: {
|
|
14
|
+
id: 'player',
|
|
15
|
+
templateId: 'actor',
|
|
16
|
+
state: { x: 42, y: 73, label: 'Player' },
|
|
17
|
+
},
|
|
18
|
+
shot: {
|
|
19
|
+
id: 'shot',
|
|
20
|
+
templateId: 'projectile',
|
|
21
|
+
state: { x: 50, y: 60, label: 'A' },
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
scheduled: [],
|
|
25
|
+
elapsedMs: 120,
|
|
26
|
+
sequence: 4,
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
describe('createGameBindingContext', () => {
|
|
30
|
+
test('resolves ordinary Runtime context bindings from the local Game session', () => {
|
|
31
|
+
const context = createGameBindingContext(session);
|
|
32
|
+
|
|
33
|
+
expect(
|
|
34
|
+
resolveRuntimeBindingValueSync(
|
|
35
|
+
{ source: { kind: 'context', path: 'game.session.entities.player.state.x' } },
|
|
36
|
+
{ context },
|
|
37
|
+
),
|
|
38
|
+
).toBe(42);
|
|
39
|
+
expect(
|
|
40
|
+
resolveRuntimeBindingValueSync(
|
|
41
|
+
{ source: { kind: 'context', path: 'game.session.state.health' } },
|
|
42
|
+
{ context },
|
|
43
|
+
),
|
|
44
|
+
).toBe(80);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
test('exposes current entities as a repeatable array with stable ids', () => {
|
|
48
|
+
const context = createGameBindingContext(session);
|
|
49
|
+
const entities = resolveRuntimeBindingValueSync(
|
|
50
|
+
{ source: { kind: 'context', path: 'game.entities' } },
|
|
51
|
+
{ context },
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
expect(Array.isArray(entities)).toBe(true);
|
|
55
|
+
expect(entities).toEqual(Object.values(session.entities));
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
test('owns only the local game namespace', () => {
|
|
59
|
+
expect(createGameBindingContext(session)).toEqual({
|
|
60
|
+
game: {
|
|
61
|
+
entities: Object.values(session.entities),
|
|
62
|
+
session,
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { GameSession } from '@ankhorage/game';
|
|
2
|
+
|
|
3
|
+
/*** Create the canonical Runtime context namespace for one local game session. */
|
|
4
|
+
export function createGameBindingContext(session: GameSession): Record<string, unknown> {
|
|
5
|
+
return {
|
|
6
|
+
game: {
|
|
7
|
+
entities: Object.values(session.entities),
|
|
8
|
+
session,
|
|
9
|
+
},
|
|
10
|
+
};
|
|
11
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { describe, expect, test } from 'bun:test';
|
|
2
|
+
|
|
3
|
+
import type { GameMeasurementBounds } from '../../../types/gameRuntime';
|
|
4
|
+
import { createGameMeasurementRegistry } from './createGameMeasurementRegistry';
|
|
5
|
+
|
|
6
|
+
const bounds: GameMeasurementBounds = {
|
|
7
|
+
left: 10,
|
|
8
|
+
right: 30,
|
|
9
|
+
top: 20,
|
|
10
|
+
bottom: 50,
|
|
11
|
+
width: 20,
|
|
12
|
+
height: 30,
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
describe('createGameMeasurementRegistry', () => {
|
|
16
|
+
test('registers, reads, and unregisters one local measurement source', async () => {
|
|
17
|
+
const registry = createGameMeasurementRegistry();
|
|
18
|
+
const unregister = registry.registerMeasurement('player', () => Promise.resolve(bounds));
|
|
19
|
+
|
|
20
|
+
expect(await registry.measure('player')).toEqual(bounds);
|
|
21
|
+
unregister();
|
|
22
|
+
expect(await registry.measure('player')).toBeUndefined();
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
test('does not let an older cleanup delete a newer registration with the same id', async () => {
|
|
26
|
+
const registry = createGameMeasurementRegistry();
|
|
27
|
+
const firstCleanup = registry.registerMeasurement('actor', () => Promise.resolve(bounds));
|
|
28
|
+
const newerBounds = { ...bounds, left: 40, right: 60 };
|
|
29
|
+
registry.registerMeasurement('actor', () => Promise.resolve(newerBounds));
|
|
30
|
+
|
|
31
|
+
firstCleanup();
|
|
32
|
+
|
|
33
|
+
expect(await registry.measure('actor')).toEqual(newerBounds);
|
|
34
|
+
});
|
|
35
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { GameMeasurementReader, GameMeasurementRegistry } from '../../../types/gameRuntime';
|
|
2
|
+
|
|
3
|
+
/*** Create one isolated measurement registry for an embeddable Game instance. */
|
|
4
|
+
export function createGameMeasurementRegistry(): GameMeasurementRegistry {
|
|
5
|
+
const readers = new Map<string, GameMeasurementReader>();
|
|
6
|
+
|
|
7
|
+
return {
|
|
8
|
+
registerMeasurement: (id, reader) => {
|
|
9
|
+
readers.set(id, reader);
|
|
10
|
+
return () => {
|
|
11
|
+
if (readers.get(id) === reader) readers.delete(id);
|
|
12
|
+
};
|
|
13
|
+
},
|
|
14
|
+
measure: (id) => readers.get(id)?.() ?? Promise.resolve(undefined),
|
|
15
|
+
};
|
|
16
|
+
}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import type { GameDefinition, GameEvent, GameOutput } from '@ankhorage/game';
|
|
2
|
+
import { describe, expect, test } from 'bun:test';
|
|
3
|
+
import { Window } from 'happy-dom';
|
|
4
|
+
import React, { act } from 'react';
|
|
5
|
+
import { createRoot } from 'react-dom/client';
|
|
6
|
+
|
|
7
|
+
import type { GameRuntimeValue } from '../../../types/gameRuntime';
|
|
8
|
+
import { useGameRuntime } from './useGameRuntime';
|
|
9
|
+
|
|
10
|
+
interface RuntimeHarnessProps {
|
|
11
|
+
readonly autoAdvanceTime: boolean;
|
|
12
|
+
readonly definition: GameDefinition;
|
|
13
|
+
readonly dispatchRef: { current: GameRuntimeValue['dispatch'] | undefined };
|
|
14
|
+
readonly onOutput: (output: GameOutput) => void;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function RuntimeHarness({
|
|
18
|
+
autoAdvanceTime,
|
|
19
|
+
definition,
|
|
20
|
+
dispatchRef,
|
|
21
|
+
onOutput,
|
|
22
|
+
}: RuntimeHarnessProps) {
|
|
23
|
+
const runtime = useGameRuntime({ autoAdvanceTime, definition, onOutput });
|
|
24
|
+
|
|
25
|
+
React.useEffect(() => {
|
|
26
|
+
dispatchRef.current = runtime.dispatch;
|
|
27
|
+
return () => {
|
|
28
|
+
dispatchRef.current = undefined;
|
|
29
|
+
};
|
|
30
|
+
}, [dispatchRef, runtime.dispatch]);
|
|
31
|
+
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const batchedOutputDefinition: GameDefinition = {
|
|
36
|
+
id: 'batched-output-test',
|
|
37
|
+
stages: [{ id: 'main' }],
|
|
38
|
+
rules: [
|
|
39
|
+
{
|
|
40
|
+
id: 'emit-first',
|
|
41
|
+
event: 'emit.first',
|
|
42
|
+
effects: [{ kind: 'emit', type: 'first' }],
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
id: 'emit-second',
|
|
46
|
+
event: 'emit.second',
|
|
47
|
+
effects: [{ kind: 'emit', type: 'second' }],
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const pausedScheduleDefinition: GameDefinition = {
|
|
53
|
+
id: 'paused-schedule-test',
|
|
54
|
+
stages: [{ id: 'main' }],
|
|
55
|
+
rules: [
|
|
56
|
+
{
|
|
57
|
+
id: 'schedule-output',
|
|
58
|
+
event: 'schedule.output',
|
|
59
|
+
effects: [
|
|
60
|
+
{
|
|
61
|
+
kind: 'schedule',
|
|
62
|
+
delayMs: { kind: 'literal', value: 500 },
|
|
63
|
+
effects: [{ kind: 'emit', type: 'scheduled' }],
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
id: 'noop',
|
|
69
|
+
event: 'noop',
|
|
70
|
+
effects: [],
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
describe('useGameRuntime', () => {
|
|
76
|
+
test('delivers outputs from every state update in one React batch', () => {
|
|
77
|
+
const browser = new Window();
|
|
78
|
+
const restoreGlobals = installBrowserGlobals(browser);
|
|
79
|
+
const host = document.createElement('div');
|
|
80
|
+
document.body.appendChild(host);
|
|
81
|
+
const root = createRoot(host);
|
|
82
|
+
const outputs: GameOutput[] = [];
|
|
83
|
+
const dispatchRef: { current: ((event: GameEvent) => void) | undefined } = {
|
|
84
|
+
current: undefined,
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
try {
|
|
88
|
+
act(() =>
|
|
89
|
+
root.render(
|
|
90
|
+
<RuntimeHarness
|
|
91
|
+
autoAdvanceTime
|
|
92
|
+
definition={batchedOutputDefinition}
|
|
93
|
+
dispatchRef={dispatchRef}
|
|
94
|
+
onOutput={(output) => outputs.push(output)}
|
|
95
|
+
/>,
|
|
96
|
+
),
|
|
97
|
+
);
|
|
98
|
+
|
|
99
|
+
act(() => {
|
|
100
|
+
dispatchRef.current?.({ type: 'emit.first' });
|
|
101
|
+
dispatchRef.current?.({ type: 'emit.second' });
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
expect(outputs.map((output) => output.type)).toEqual(['first', 'second']);
|
|
105
|
+
} finally {
|
|
106
|
+
act(() => root.unmount());
|
|
107
|
+
browser.close();
|
|
108
|
+
restoreGlobals();
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
test('does not advance scheduled effects across time spent paused', () => {
|
|
113
|
+
const browser = new Window();
|
|
114
|
+
const restoreGlobals = installBrowserGlobals(browser);
|
|
115
|
+
const originalNow = Date.now;
|
|
116
|
+
const host = document.createElement('div');
|
|
117
|
+
document.body.appendChild(host);
|
|
118
|
+
const root = createRoot(host);
|
|
119
|
+
const outputs: GameOutput[] = [];
|
|
120
|
+
const dispatchRef: { current: ((event: GameEvent) => void) | undefined } = {
|
|
121
|
+
current: undefined,
|
|
122
|
+
};
|
|
123
|
+
let now = 100;
|
|
124
|
+
Date.now = () => now;
|
|
125
|
+
|
|
126
|
+
const render = (autoAdvanceTime: boolean) => (
|
|
127
|
+
<RuntimeHarness
|
|
128
|
+
autoAdvanceTime={autoAdvanceTime}
|
|
129
|
+
definition={pausedScheduleDefinition}
|
|
130
|
+
dispatchRef={dispatchRef}
|
|
131
|
+
onOutput={(output) => outputs.push(output)}
|
|
132
|
+
/>
|
|
133
|
+
);
|
|
134
|
+
|
|
135
|
+
try {
|
|
136
|
+
act(() => root.render(render(false)));
|
|
137
|
+
act(() => dispatchRef.current?.({ type: 'schedule.output' }));
|
|
138
|
+
|
|
139
|
+
now = 10_000;
|
|
140
|
+
act(() => root.render(render(true)));
|
|
141
|
+
act(() => dispatchRef.current?.({ type: 'noop' }));
|
|
142
|
+
|
|
143
|
+
expect(outputs).toEqual([]);
|
|
144
|
+
} finally {
|
|
145
|
+
Date.now = originalNow;
|
|
146
|
+
act(() => root.unmount());
|
|
147
|
+
browser.close();
|
|
148
|
+
restoreGlobals();
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
function installBrowserGlobals(browser: Window): () => void {
|
|
154
|
+
const keys = ['window', 'document', 'Node', 'navigator', 'IS_REACT_ACT_ENVIRONMENT'] as const;
|
|
155
|
+
const previous = keys.map(
|
|
156
|
+
(key) => [key, Object.getOwnPropertyDescriptor(globalThis, key)] as const,
|
|
157
|
+
);
|
|
158
|
+
|
|
159
|
+
Object.assign(globalThis, {
|
|
160
|
+
window: browser,
|
|
161
|
+
document: browser.document,
|
|
162
|
+
Node: browser.Node,
|
|
163
|
+
navigator: browser.navigator,
|
|
164
|
+
IS_REACT_ACT_ENVIRONMENT: true,
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
return () => {
|
|
168
|
+
for (const [key, descriptor] of previous) {
|
|
169
|
+
if (descriptor) Object.defineProperty(globalThis, key, descriptor);
|
|
170
|
+
else Reflect.deleteProperty(globalThis, key);
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
}
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import {
|
|
2
|
+
advanceGameTime,
|
|
3
|
+
applyGameEvent,
|
|
4
|
+
createGameSession,
|
|
5
|
+
type GameInput,
|
|
6
|
+
type GameOutput,
|
|
7
|
+
} from '@ankhorage/game';
|
|
8
|
+
import React from 'react';
|
|
9
|
+
|
|
10
|
+
import type { GameProps } from '../../../types/gamePresentation';
|
|
11
|
+
import type { GameRuntimeState, GameRuntimeValue } from '../../../types/gameRuntime';
|
|
12
|
+
import { useGameScheduledEffects } from './useGameScheduledEffects';
|
|
13
|
+
|
|
14
|
+
const EMPTY_GAME_INPUT: GameInput = {};
|
|
15
|
+
|
|
16
|
+
/*** Own one local transient Game session while delegating all domain transitions to @ankhorage/game. */
|
|
17
|
+
export function useGameRuntime(props: GameProps): GameRuntimeValue {
|
|
18
|
+
const { definition, input = EMPTY_GAME_INPUT, seed = 0, resetKey = '' } = props;
|
|
19
|
+
const definitionRef = useLatestValue(definition);
|
|
20
|
+
const inputRef = useLatestValue(input);
|
|
21
|
+
const outputRef = useLatestValue(props.onOutput);
|
|
22
|
+
const autoAdvanceTime = props.autoAdvanceTime ?? true;
|
|
23
|
+
const clockRef = React.useRef(0);
|
|
24
|
+
const runtimeKey = createRuntimeKey(definition.id, resetKey, seed);
|
|
25
|
+
const [runtime, setRuntime] = React.useState<GameRuntimeState>(() =>
|
|
26
|
+
createRuntimeState(definition, input, seed, runtimeKey, 0),
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
useGameRuntimeReset({
|
|
30
|
+
clockRef,
|
|
31
|
+
definitionRef,
|
|
32
|
+
inputRef,
|
|
33
|
+
runtimeKey,
|
|
34
|
+
seed,
|
|
35
|
+
setRuntime,
|
|
36
|
+
});
|
|
37
|
+
useGameAutoAdvanceClock(autoAdvanceTime, clockRef);
|
|
38
|
+
useGameOutputEmitter(runtime, outputRef, setRuntime);
|
|
39
|
+
|
|
40
|
+
const dispatch = React.useCallback<GameRuntimeValue['dispatch']>(
|
|
41
|
+
(event) => {
|
|
42
|
+
const now = Date.now();
|
|
43
|
+
setRuntime((current) =>
|
|
44
|
+
applyRuntimeEvent({
|
|
45
|
+
autoAdvanceTime,
|
|
46
|
+
current,
|
|
47
|
+
definition: definitionRef.current,
|
|
48
|
+
elapsedMs: Math.max(0, now - clockRef.current),
|
|
49
|
+
event,
|
|
50
|
+
input: inputRef.current,
|
|
51
|
+
runtimeKey,
|
|
52
|
+
seed,
|
|
53
|
+
}),
|
|
54
|
+
);
|
|
55
|
+
clockRef.current = now;
|
|
56
|
+
},
|
|
57
|
+
[autoAdvanceTime, definitionRef, inputRef, runtimeKey, seed],
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
useGameScheduledEffects({
|
|
61
|
+
clockRef,
|
|
62
|
+
definitionRef,
|
|
63
|
+
enabled: autoAdvanceTime,
|
|
64
|
+
inputRef,
|
|
65
|
+
runtimeKey,
|
|
66
|
+
scheduled: runtime.session.scheduled,
|
|
67
|
+
setRuntime,
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
return React.useMemo(() => ({ session: runtime.session, dispatch }), [dispatch, runtime.session]);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
interface GameRuntimeResetArgs {
|
|
74
|
+
readonly clockRef: React.RefObject<number>;
|
|
75
|
+
readonly definitionRef: React.RefObject<GameProps['definition']>;
|
|
76
|
+
readonly inputRef: React.RefObject<GameInput>;
|
|
77
|
+
readonly runtimeKey: string;
|
|
78
|
+
readonly seed: number;
|
|
79
|
+
readonly setRuntime: React.Dispatch<React.SetStateAction<GameRuntimeState>>;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/*** Reset the transient session only when its explicit serializable runtime identity changes. */
|
|
83
|
+
function useGameRuntimeReset({
|
|
84
|
+
clockRef,
|
|
85
|
+
definitionRef,
|
|
86
|
+
inputRef,
|
|
87
|
+
runtimeKey,
|
|
88
|
+
seed,
|
|
89
|
+
setRuntime,
|
|
90
|
+
}: GameRuntimeResetArgs): void {
|
|
91
|
+
React.useEffect(() => {
|
|
92
|
+
clockRef.current = Date.now();
|
|
93
|
+
setRuntime((current) =>
|
|
94
|
+
current.key === runtimeKey
|
|
95
|
+
? current
|
|
96
|
+
: createRuntimeState(
|
|
97
|
+
definitionRef.current,
|
|
98
|
+
inputRef.current,
|
|
99
|
+
seed,
|
|
100
|
+
runtimeKey,
|
|
101
|
+
current.revision + 1,
|
|
102
|
+
),
|
|
103
|
+
);
|
|
104
|
+
}, [clockRef, definitionRef, inputRef, runtimeKey, seed, setRuntime]);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/*** Rebase elapsed-time tracking when automatic game-time advancement resumes. */
|
|
108
|
+
function useGameAutoAdvanceClock(enabled: boolean, clockRef: React.RefObject<number>): void {
|
|
109
|
+
const previousEnabledRef = React.useRef(enabled);
|
|
110
|
+
|
|
111
|
+
React.useEffect(() => {
|
|
112
|
+
if (enabled && !previousEnabledRef.current) {
|
|
113
|
+
clockRef.current = Date.now();
|
|
114
|
+
}
|
|
115
|
+
previousEnabledRef.current = enabled;
|
|
116
|
+
}, [clockRef, enabled]);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/*** Emit each committed runtime output once and clear the delivered queue. */
|
|
120
|
+
function useGameOutputEmitter(
|
|
121
|
+
runtime: GameRuntimeState,
|
|
122
|
+
outputRef: React.RefObject<GameProps['onOutput']>,
|
|
123
|
+
setRuntime: React.Dispatch<React.SetStateAction<GameRuntimeState>>,
|
|
124
|
+
): void {
|
|
125
|
+
React.useEffect(() => {
|
|
126
|
+
if (runtime.outputs.length === 0) return;
|
|
127
|
+
|
|
128
|
+
setRuntime((current) =>
|
|
129
|
+
current.revision === runtime.revision ? { ...current, outputs: [] } : current,
|
|
130
|
+
);
|
|
131
|
+
emitGameOutputs(runtime.outputs, outputRef.current);
|
|
132
|
+
}, [outputRef, runtime.outputs, runtime.revision, setRuntime]);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
interface ApplyRuntimeEventArgs {
|
|
136
|
+
readonly autoAdvanceTime: boolean;
|
|
137
|
+
readonly current: GameRuntimeState;
|
|
138
|
+
readonly definition: GameProps['definition'];
|
|
139
|
+
readonly elapsedMs: number;
|
|
140
|
+
readonly event: Parameters<typeof applyGameEvent>[2];
|
|
141
|
+
readonly input: GameInput;
|
|
142
|
+
readonly runtimeKey: string;
|
|
143
|
+
readonly seed: number;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/*** Apply elapsed time and one explicit game event against the matching local session. */
|
|
147
|
+
function applyRuntimeEvent(args: ApplyRuntimeEventArgs): GameRuntimeState {
|
|
148
|
+
const base =
|
|
149
|
+
args.current.key === args.runtimeKey
|
|
150
|
+
? args.current
|
|
151
|
+
: createRuntimeState(
|
|
152
|
+
args.definition,
|
|
153
|
+
args.input,
|
|
154
|
+
args.seed,
|
|
155
|
+
args.runtimeKey,
|
|
156
|
+
args.current.revision,
|
|
157
|
+
);
|
|
158
|
+
const timed = args.autoAdvanceTime
|
|
159
|
+
? advanceGameTime(args.definition, base.session, args.elapsedMs, args.input)
|
|
160
|
+
: { session: base.session, outputs: [] };
|
|
161
|
+
const result = applyGameEvent(args.definition, timed.session, args.event, args.input);
|
|
162
|
+
return {
|
|
163
|
+
key: args.runtimeKey,
|
|
164
|
+
session: result.session,
|
|
165
|
+
outputs: [...base.outputs, ...timed.outputs, ...result.outputs],
|
|
166
|
+
revision: args.current.revision + 1,
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/*** Create one transient runtime state through the published Game owner API. */
|
|
171
|
+
function createRuntimeState(
|
|
172
|
+
definition: GameProps['definition'],
|
|
173
|
+
input: GameInput,
|
|
174
|
+
seed: number,
|
|
175
|
+
key: string,
|
|
176
|
+
revision: number,
|
|
177
|
+
): GameRuntimeState {
|
|
178
|
+
const result = createGameSession(definition, { input, seed });
|
|
179
|
+
return { key, session: result.session, outputs: result.outputs, revision };
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/*** Create one runtime identity from serializable definition/session initialization inputs. */
|
|
183
|
+
function createRuntimeKey(definitionId: string, resetKey: string, seed: number): string {
|
|
184
|
+
return `${definitionId}:${resetKey}:${seed}`;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/*** Emit runtime outputs through the ZORA event callback boundary. */
|
|
188
|
+
function emitGameOutputs(outputs: readonly GameOutput[], onOutput: GameProps['onOutput']): void {
|
|
189
|
+
if (onOutput === undefined) return;
|
|
190
|
+
outputs.forEach((output) => onOutput(output));
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/*** Keep a stable ref object updated with the latest adapter input. */
|
|
194
|
+
function useLatestValue<TValue>(value: TValue): React.RefObject<TValue> {
|
|
195
|
+
const ref = React.useRef(value);
|
|
196
|
+
React.useEffect(() => {
|
|
197
|
+
ref.current = value;
|
|
198
|
+
}, [value]);
|
|
199
|
+
return ref;
|
|
200
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { advanceGameTime, type GameDefinition, type GameInput } from '@ankhorage/game';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
|
+
import type { GameRuntimeState } from '../../../types/gameRuntime';
|
|
5
|
+
|
|
6
|
+
type SetGameRuntime = React.Dispatch<React.SetStateAction<GameRuntimeState>>;
|
|
7
|
+
|
|
8
|
+
/*** Advance the nearest scheduled game effects through one platform timer. */
|
|
9
|
+
export function useGameScheduledEffects({
|
|
10
|
+
clockRef,
|
|
11
|
+
definitionRef,
|
|
12
|
+
enabled,
|
|
13
|
+
inputRef,
|
|
14
|
+
runtimeKey,
|
|
15
|
+
scheduled,
|
|
16
|
+
setRuntime,
|
|
17
|
+
}: UseGameScheduledEffectsArgs): void {
|
|
18
|
+
React.useEffect(() => {
|
|
19
|
+
if (!enabled || scheduled.length === 0) return undefined;
|
|
20
|
+
const delayMs = resolveNextScheduledDelay(scheduled);
|
|
21
|
+
|
|
22
|
+
const timer = setTimeout(() => {
|
|
23
|
+
const now = Date.now();
|
|
24
|
+
const elapsedMs = Math.max(0, now - clockRef.current);
|
|
25
|
+
clockRef.current = now;
|
|
26
|
+
setRuntime((current) =>
|
|
27
|
+
advanceScheduledRuntime({
|
|
28
|
+
current,
|
|
29
|
+
definition: definitionRef.current,
|
|
30
|
+
elapsedMs,
|
|
31
|
+
input: inputRef.current,
|
|
32
|
+
runtimeKey,
|
|
33
|
+
}),
|
|
34
|
+
);
|
|
35
|
+
}, delayMs);
|
|
36
|
+
|
|
37
|
+
return () => clearTimeout(timer);
|
|
38
|
+
}, [clockRef, definitionRef, enabled, inputRef, runtimeKey, scheduled, setRuntime]);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
interface UseGameScheduledEffectsArgs {
|
|
42
|
+
readonly clockRef: React.RefObject<number>;
|
|
43
|
+
readonly definitionRef: React.RefObject<GameDefinition>;
|
|
44
|
+
readonly enabled: boolean;
|
|
45
|
+
readonly inputRef: React.RefObject<GameInput>;
|
|
46
|
+
readonly runtimeKey: string;
|
|
47
|
+
readonly scheduled: GameRuntimeState['session']['scheduled'];
|
|
48
|
+
readonly setRuntime: SetGameRuntime;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
interface AdvanceScheduledRuntimeArgs {
|
|
52
|
+
readonly current: GameRuntimeState;
|
|
53
|
+
readonly definition: GameDefinition;
|
|
54
|
+
readonly elapsedMs: number;
|
|
55
|
+
readonly input: GameInput;
|
|
56
|
+
readonly runtimeKey: string;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/*** Advance one matching runtime state while preserving sessions that have already reset. */
|
|
60
|
+
function advanceScheduledRuntime({
|
|
61
|
+
current,
|
|
62
|
+
definition,
|
|
63
|
+
elapsedMs,
|
|
64
|
+
input,
|
|
65
|
+
runtimeKey,
|
|
66
|
+
}: AdvanceScheduledRuntimeArgs): GameRuntimeState {
|
|
67
|
+
if (current.key !== runtimeKey) return current;
|
|
68
|
+
const result = advanceGameTime(definition, current.session, elapsedMs, input);
|
|
69
|
+
return {
|
|
70
|
+
key: runtimeKey,
|
|
71
|
+
session: result.session,
|
|
72
|
+
outputs: [...current.outputs, ...result.outputs],
|
|
73
|
+
revision: current.revision + 1,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/*** Resolve the nearest scheduled game consequence without owning domain timing rules. */
|
|
78
|
+
function resolveNextScheduledDelay(
|
|
79
|
+
scheduledEffects: GameRuntimeState['session']['scheduled'],
|
|
80
|
+
): number {
|
|
81
|
+
return scheduledEffects.reduce(
|
|
82
|
+
(nearest, scheduled) => Math.min(nearest, scheduled.remainingMs),
|
|
83
|
+
Number.POSITIVE_INFINITY,
|
|
84
|
+
);
|
|
85
|
+
}
|