react-native-games 0.6.0 → 0.8.0
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/README.md +148 -23
- package/lib/module/games/balloon-blaster/BalloonBlaster.js +5 -8
- package/lib/module/games/balloon-blaster/BalloonBlaster.js.map +1 -1
- package/lib/module/games/candy-crush/CandyCrush.js +121 -0
- package/lib/module/games/candy-crush/CandyCrush.js.map +1 -0
- package/lib/module/games/candy-crush/CandyCrushConstants.js +125 -0
- package/lib/module/games/candy-crush/CandyCrushConstants.js.map +1 -0
- package/lib/module/games/candy-crush/CandyCrushService.js +370 -0
- package/lib/module/games/candy-crush/CandyCrushService.js.map +1 -0
- package/lib/module/games/candy-crush/CandyCrushStore.js +305 -0
- package/lib/module/games/candy-crush/CandyCrushStore.js.map +1 -0
- package/lib/module/games/candy-crush/components/CandyItem.js +191 -0
- package/lib/module/games/candy-crush/components/CandyItem.js.map +1 -0
- package/lib/module/games/candy-crush/components/GameBackground.js +85 -0
- package/lib/module/games/candy-crush/components/GameBackground.js.map +1 -0
- package/lib/module/games/candy-crush/components/GameGrid.js +314 -0
- package/lib/module/games/candy-crush/components/GameGrid.js.map +1 -0
- package/lib/module/games/candy-crush/components/ScoreBoard.js +112 -0
- package/lib/module/games/candy-crush/components/ScoreBoard.js.map +1 -0
- package/lib/module/games/candy-crush/components/index.js +7 -0
- package/lib/module/games/candy-crush/components/index.js.map +1 -0
- package/lib/module/games/candy-crush/index.js +6 -0
- package/lib/module/games/candy-crush/index.js.map +1 -0
- package/lib/module/games/color-sort/ColorSort.js +130 -0
- package/lib/module/games/color-sort/ColorSort.js.map +1 -0
- package/lib/module/games/color-sort/ColorSortConstants.js +68 -0
- package/lib/module/games/color-sort/ColorSortConstants.js.map +1 -0
- package/lib/module/games/color-sort/ColorSortService.js +255 -0
- package/lib/module/games/color-sort/ColorSortService.js.map +1 -0
- package/lib/module/games/color-sort/ColorSortStore.js +258 -0
- package/lib/module/games/color-sort/ColorSortStore.js.map +1 -0
- package/lib/module/games/color-sort/components/ColorContainer.js +140 -0
- package/lib/module/games/color-sort/components/ColorContainer.js.map +1 -0
- package/lib/module/games/color-sort/components/GameBackground.js +135 -0
- package/lib/module/games/color-sort/components/GameBackground.js.map +1 -0
- package/lib/module/games/color-sort/components/ScoreBoard.js +78 -0
- package/lib/module/games/color-sort/components/ScoreBoard.js.map +1 -0
- package/lib/module/games/color-sort/components/index.js +6 -0
- package/lib/module/games/color-sort/components/index.js.map +1 -0
- package/lib/module/games/dino-jump/DinoJump.js +209 -0
- package/lib/module/games/dino-jump/DinoJump.js.map +1 -0
- package/lib/module/games/dino-jump/DinoJumpConstants.js +179 -0
- package/lib/module/games/dino-jump/DinoJumpConstants.js.map +1 -0
- package/lib/module/games/dino-jump/DinoJumpService.js +268 -0
- package/lib/module/games/dino-jump/DinoJumpService.js.map +1 -0
- package/lib/module/games/dino-jump/DinoJumpStore.js +387 -0
- package/lib/module/games/dino-jump/DinoJumpStore.js.map +1 -0
- package/lib/module/games/dino-jump/components/DinoSprite.js +409 -0
- package/lib/module/games/dino-jump/components/DinoSprite.js.map +1 -0
- package/lib/module/games/dino-jump/components/GameArea.js +68 -0
- package/lib/module/games/dino-jump/components/GameArea.js.map +1 -0
- package/lib/module/games/dino-jump/components/GameBackground.js +421 -0
- package/lib/module/games/dino-jump/components/GameBackground.js.map +1 -0
- package/lib/module/games/dino-jump/components/ObstacleSprite.js +306 -0
- package/lib/module/games/dino-jump/components/ObstacleSprite.js.map +1 -0
- package/lib/module/games/dino-jump/components/ScoreBoard.js +107 -0
- package/lib/module/games/dino-jump/components/ScoreBoard.js.map +1 -0
- package/lib/module/games/dino-jump/components/StarSprite.js +45 -0
- package/lib/module/games/dino-jump/components/StarSprite.js.map +1 -0
- package/lib/module/games/dino-jump/components/index.js +9 -0
- package/lib/module/games/dino-jump/components/index.js.map +1 -0
- package/lib/module/games/flappy-bird/FlappyBird.js +131 -0
- package/lib/module/games/flappy-bird/FlappyBird.js.map +1 -0
- package/lib/module/games/flappy-bird/FlappyBirdConstants.js +90 -0
- package/lib/module/games/flappy-bird/FlappyBirdConstants.js.map +1 -0
- package/lib/module/games/flappy-bird/FlappyBirdStore.js +276 -0
- package/lib/module/games/flappy-bird/FlappyBirdStore.js.map +1 -0
- package/lib/module/games/flappy-bird/components/Bird.js +87 -0
- package/lib/module/games/flappy-bird/components/Bird.js.map +1 -0
- package/lib/module/games/flappy-bird/components/GameArea.js +86 -0
- package/lib/module/games/flappy-bird/components/GameArea.js.map +1 -0
- package/lib/module/games/flappy-bird/components/GameBackground.js +112 -0
- package/lib/module/games/flappy-bird/components/GameBackground.js.map +1 -0
- package/lib/module/games/flappy-bird/components/Pipes.js +175 -0
- package/lib/module/games/flappy-bird/components/Pipes.js.map +1 -0
- package/lib/module/games/flappy-bird/components/ScoreBoard.js +72 -0
- package/lib/module/games/flappy-bird/components/ScoreBoard.js.map +1 -0
- package/lib/module/games/flappy-bird/components/index.js +8 -0
- package/lib/module/games/flappy-bird/components/index.js.map +1 -0
- package/lib/module/games/fruit-merger/FruitMerger.js +112 -0
- package/lib/module/games/fruit-merger/FruitMerger.js.map +1 -0
- package/lib/module/games/fruit-merger/FruitMergerConstants.js +119 -0
- package/lib/module/games/fruit-merger/FruitMergerConstants.js.map +1 -0
- package/lib/module/games/fruit-merger/FruitMergerService.js +13 -0
- package/lib/module/games/fruit-merger/FruitMergerService.js.map +1 -0
- package/lib/module/games/fruit-merger/FruitMergerStore.js +318 -0
- package/lib/module/games/fruit-merger/FruitMergerStore.js.map +1 -0
- package/lib/module/games/fruit-merger/components/FruitItem.js +102 -0
- package/lib/module/games/fruit-merger/components/FruitItem.js.map +1 -0
- package/lib/module/games/fruit-merger/components/GameArea.js +123 -0
- package/lib/module/games/fruit-merger/components/GameArea.js.map +1 -0
- package/lib/module/games/fruit-merger/components/GameBackground.js +477 -0
- package/lib/module/games/fruit-merger/components/GameBackground.js.map +1 -0
- package/lib/module/games/fruit-merger/components/ScoreBoard.js +66 -0
- package/lib/module/games/fruit-merger/components/ScoreBoard.js.map +1 -0
- package/lib/module/games/fruit-merger/components/index.js +7 -0
- package/lib/module/games/fruit-merger/components/index.js.map +1 -0
- package/lib/module/games/fruit-ninja/FruitNinja.js +6 -9
- package/lib/module/games/fruit-ninja/FruitNinja.js.map +1 -1
- package/lib/module/games/game-2048/Game2048.js +120 -0
- package/lib/module/games/game-2048/Game2048.js.map +1 -0
- package/lib/module/games/game-2048/Game2048Constants.js +263 -0
- package/lib/module/games/game-2048/Game2048Constants.js.map +1 -0
- package/lib/module/games/game-2048/Game2048Service.js +457 -0
- package/lib/module/games/game-2048/Game2048Service.js.map +1 -0
- package/lib/module/games/game-2048/Game2048Store.js +238 -0
- package/lib/module/games/game-2048/Game2048Store.js.map +1 -0
- package/lib/module/games/game-2048/components/GameBackground.js +247 -0
- package/lib/module/games/game-2048/components/GameBackground.js.map +1 -0
- package/lib/module/games/game-2048/components/GameGrid.js +139 -0
- package/lib/module/games/game-2048/components/GameGrid.js.map +1 -0
- package/lib/module/games/game-2048/components/GameTile.js +72 -0
- package/lib/module/games/game-2048/components/GameTile.js.map +1 -0
- package/lib/module/games/game-2048/components/ScoreBoard.js +70 -0
- package/lib/module/games/game-2048/components/ScoreBoard.js.map +1 -0
- package/lib/module/games/game-2048/components/index.js +7 -0
- package/lib/module/games/game-2048/components/index.js.map +1 -0
- package/lib/module/games/maze-runner/MazeRunner.js +33 -31
- package/lib/module/games/maze-runner/MazeRunner.js.map +1 -1
- package/lib/module/games/popit-fidget/PopitFidget.js +34 -32
- package/lib/module/games/popit-fidget/PopitFidget.js.map +1 -1
- package/lib/module/games/sliding-numbers/SlidingNumbers.js +161 -0
- package/lib/module/games/sliding-numbers/SlidingNumbers.js.map +1 -0
- package/lib/module/games/sliding-numbers/SlidingNumbersConstants.js +207 -0
- package/lib/module/games/sliding-numbers/SlidingNumbersConstants.js.map +1 -0
- package/lib/module/games/sliding-numbers/SlidingNumbersService.js +248 -0
- package/lib/module/games/sliding-numbers/SlidingNumbersService.js.map +1 -0
- package/lib/module/games/sliding-numbers/SlidingNumbersStore.js +275 -0
- package/lib/module/games/sliding-numbers/SlidingNumbersStore.js.map +1 -0
- package/lib/module/games/sliding-numbers/components/GameBackground.js +259 -0
- package/lib/module/games/sliding-numbers/components/GameBackground.js.map +1 -0
- package/lib/module/games/sliding-numbers/components/NumbersGrid.js +174 -0
- package/lib/module/games/sliding-numbers/components/NumbersGrid.js.map +1 -0
- package/lib/module/games/sliding-numbers/components/NumbersTile.js +116 -0
- package/lib/module/games/sliding-numbers/components/NumbersTile.js.map +1 -0
- package/lib/module/games/sliding-numbers/components/ScoreBoard.js +66 -0
- package/lib/module/games/sliding-numbers/components/ScoreBoard.js.map +1 -0
- package/lib/module/games/sliding-numbers/components/index.js +7 -0
- package/lib/module/games/sliding-numbers/components/index.js.map +1 -0
- package/lib/module/games/snake/Snake.js +192 -0
- package/lib/module/games/snake/Snake.js.map +1 -0
- package/lib/module/games/snake/SnakeConstants.js +138 -0
- package/lib/module/games/snake/SnakeConstants.js.map +1 -0
- package/lib/module/games/snake/SnakeService.js +148 -0
- package/lib/module/games/snake/SnakeService.js.map +1 -0
- package/lib/module/games/snake/SnakeStore.js +184 -0
- package/lib/module/games/snake/SnakeStore.js.map +1 -0
- package/lib/module/games/snake/components/GameBackground.js +221 -0
- package/lib/module/games/snake/components/GameBackground.js.map +1 -0
- package/lib/module/games/snake/components/GameGrid.js +153 -0
- package/lib/module/games/snake/components/GameGrid.js.map +1 -0
- package/lib/module/games/snake/components/ScoreBoard.js +57 -0
- package/lib/module/games/snake/components/ScoreBoard.js.map +1 -0
- package/lib/module/games/snake/components/index.js +6 -0
- package/lib/module/games/snake/components/index.js.map +1 -0
- package/lib/module/games/snake/index.js +6 -0
- package/lib/module/games/snake/index.js.map +1 -0
- package/lib/module/games/space-fighter/SpaceFighter.js +7 -10
- package/lib/module/games/space-fighter/SpaceFighter.js.map +1 -1
- package/lib/module/games/whack-a-mole/WhackAMole.js +6 -6
- package/lib/module/games/whack-a-mole/WhackAMole.js.map +1 -1
- package/lib/module/games/whack-a-mole/components/GameBackground.js +7 -8
- package/lib/module/games/whack-a-mole/components/GameBackground.js.map +1 -1
- package/lib/module/index.js +8 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/services/GamesConstants.js +58 -2
- package/lib/module/services/GamesConstants.js.map +1 -1
- package/lib/module/services/GamesService.js +40 -0
- package/lib/module/services/GamesService.js.map +1 -1
- package/lib/module/services/SoundsService.js +132 -1
- package/lib/module/services/SoundsService.js.map +1 -1
- package/lib/module/shared/helpers/GameOverModal.js +6 -3
- package/lib/module/shared/helpers/GameOverModal.js.map +1 -1
- package/lib/module/shared/helpers/GameSettingsModal.js +3 -3
- package/lib/module/shared/helpers/GameSettingsModal.js.map +1 -1
- package/lib/module/shared/helpers/ParticleBlast.js +3 -2
- package/lib/module/shared/helpers/ParticleBlast.js.map +1 -1
- package/lib/typescript/src/games/balloon-blaster/BalloonBlaster.d.ts.map +1 -1
- package/lib/typescript/src/games/candy-crush/CandyCrush.d.ts +4 -0
- package/lib/typescript/src/games/candy-crush/CandyCrush.d.ts.map +1 -0
- package/lib/typescript/src/games/candy-crush/CandyCrushConstants.d.ts +104 -0
- package/lib/typescript/src/games/candy-crush/CandyCrushConstants.d.ts.map +1 -0
- package/lib/typescript/src/games/candy-crush/CandyCrushService.d.ts +40 -0
- package/lib/typescript/src/games/candy-crush/CandyCrushService.d.ts.map +1 -0
- package/lib/typescript/src/games/candy-crush/CandyCrushStore.d.ts +48 -0
- package/lib/typescript/src/games/candy-crush/CandyCrushStore.d.ts.map +1 -0
- package/lib/typescript/src/games/candy-crush/components/CandyItem.d.ts +13 -0
- package/lib/typescript/src/games/candy-crush/components/CandyItem.d.ts.map +1 -0
- package/lib/typescript/src/games/candy-crush/components/GameBackground.d.ts +5 -0
- package/lib/typescript/src/games/candy-crush/components/GameBackground.d.ts.map +1 -0
- package/lib/typescript/src/games/candy-crush/components/GameGrid.d.ts +3 -0
- package/lib/typescript/src/games/candy-crush/components/GameGrid.d.ts.map +1 -0
- package/lib/typescript/src/games/candy-crush/components/ScoreBoard.d.ts +3 -0
- package/lib/typescript/src/games/candy-crush/components/ScoreBoard.d.ts.map +1 -0
- package/lib/typescript/src/games/candy-crush/components/index.d.ts +5 -0
- package/lib/typescript/src/games/candy-crush/components/index.d.ts.map +1 -0
- package/lib/typescript/src/games/candy-crush/index.d.ts +4 -0
- package/lib/typescript/src/games/candy-crush/index.d.ts.map +1 -0
- package/lib/typescript/src/games/color-sort/ColorSort.d.ts +4 -0
- package/lib/typescript/src/games/color-sort/ColorSort.d.ts.map +1 -0
- package/lib/typescript/src/games/color-sort/ColorSortConstants.d.ts +52 -0
- package/lib/typescript/src/games/color-sort/ColorSortConstants.d.ts.map +1 -0
- package/lib/typescript/src/games/color-sort/ColorSortService.d.ts +66 -0
- package/lib/typescript/src/games/color-sort/ColorSortService.d.ts.map +1 -0
- package/lib/typescript/src/games/color-sort/ColorSortStore.d.ts +48 -0
- package/lib/typescript/src/games/color-sort/ColorSortStore.d.ts.map +1 -0
- package/lib/typescript/src/games/color-sort/components/ColorContainer.d.ts +11 -0
- package/lib/typescript/src/games/color-sort/components/ColorContainer.d.ts.map +1 -0
- package/lib/typescript/src/games/color-sort/components/GameBackground.d.ts +7 -0
- package/lib/typescript/src/games/color-sort/components/GameBackground.d.ts.map +1 -0
- package/lib/typescript/src/games/color-sort/components/ScoreBoard.d.ts +3 -0
- package/lib/typescript/src/games/color-sort/components/ScoreBoard.d.ts.map +1 -0
- package/lib/typescript/src/games/color-sort/components/index.d.ts +4 -0
- package/lib/typescript/src/games/color-sort/components/index.d.ts.map +1 -0
- package/lib/typescript/src/games/dino-jump/DinoJump.d.ts +4 -0
- package/lib/typescript/src/games/dino-jump/DinoJump.d.ts.map +1 -0
- package/lib/typescript/src/games/dino-jump/DinoJumpConstants.d.ts +95 -0
- package/lib/typescript/src/games/dino-jump/DinoJumpConstants.d.ts.map +1 -0
- package/lib/typescript/src/games/dino-jump/DinoJumpService.d.ts +40 -0
- package/lib/typescript/src/games/dino-jump/DinoJumpService.d.ts.map +1 -0
- package/lib/typescript/src/games/dino-jump/DinoJumpStore.d.ts +103 -0
- package/lib/typescript/src/games/dino-jump/DinoJumpStore.d.ts.map +1 -0
- package/lib/typescript/src/games/dino-jump/components/DinoSprite.d.ts +3 -0
- package/lib/typescript/src/games/dino-jump/components/DinoSprite.d.ts.map +1 -0
- package/lib/typescript/src/games/dino-jump/components/GameArea.d.ts +8 -0
- package/lib/typescript/src/games/dino-jump/components/GameArea.d.ts.map +1 -0
- package/lib/typescript/src/games/dino-jump/components/GameBackground.d.ts +7 -0
- package/lib/typescript/src/games/dino-jump/components/GameBackground.d.ts.map +1 -0
- package/lib/typescript/src/games/dino-jump/components/ObstacleSprite.d.ts +3 -0
- package/lib/typescript/src/games/dino-jump/components/ObstacleSprite.d.ts.map +1 -0
- package/lib/typescript/src/games/dino-jump/components/ScoreBoard.d.ts +3 -0
- package/lib/typescript/src/games/dino-jump/components/ScoreBoard.d.ts.map +1 -0
- package/lib/typescript/src/games/dino-jump/components/StarSprite.d.ts +3 -0
- package/lib/typescript/src/games/dino-jump/components/StarSprite.d.ts.map +1 -0
- package/lib/typescript/src/games/dino-jump/components/index.d.ts +7 -0
- package/lib/typescript/src/games/dino-jump/components/index.d.ts.map +1 -0
- package/lib/typescript/src/games/flappy-bird/FlappyBird.d.ts +4 -0
- package/lib/typescript/src/games/flappy-bird/FlappyBird.d.ts.map +1 -0
- package/lib/typescript/src/games/flappy-bird/FlappyBirdConstants.d.ts +83 -0
- package/lib/typescript/src/games/flappy-bird/FlappyBirdConstants.d.ts.map +1 -0
- package/lib/typescript/src/games/flappy-bird/FlappyBirdStore.d.ts +53 -0
- package/lib/typescript/src/games/flappy-bird/FlappyBirdStore.d.ts.map +1 -0
- package/lib/typescript/src/games/flappy-bird/components/Bird.d.ts +8 -0
- package/lib/typescript/src/games/flappy-bird/components/Bird.d.ts.map +1 -0
- package/lib/typescript/src/games/flappy-bird/components/GameArea.d.ts +8 -0
- package/lib/typescript/src/games/flappy-bird/components/GameArea.d.ts.map +1 -0
- package/lib/typescript/src/games/flappy-bird/components/GameBackground.d.ts +7 -0
- package/lib/typescript/src/games/flappy-bird/components/GameBackground.d.ts.map +1 -0
- package/lib/typescript/src/games/flappy-bird/components/Pipes.d.ts +8 -0
- package/lib/typescript/src/games/flappy-bird/components/Pipes.d.ts.map +1 -0
- package/lib/typescript/src/games/flappy-bird/components/ScoreBoard.d.ts +3 -0
- package/lib/typescript/src/games/flappy-bird/components/ScoreBoard.d.ts.map +1 -0
- package/lib/typescript/src/games/flappy-bird/components/index.d.ts +6 -0
- package/lib/typescript/src/games/flappy-bird/components/index.d.ts.map +1 -0
- package/lib/typescript/src/games/fruit-merger/FruitMerger.d.ts +4 -0
- package/lib/typescript/src/games/fruit-merger/FruitMerger.d.ts.map +1 -0
- package/lib/typescript/src/games/fruit-merger/FruitMergerConstants.d.ts +115 -0
- package/lib/typescript/src/games/fruit-merger/FruitMergerConstants.d.ts.map +1 -0
- package/lib/typescript/src/games/fruit-merger/FruitMergerService.d.ts +5 -0
- package/lib/typescript/src/games/fruit-merger/FruitMergerService.d.ts.map +1 -0
- package/lib/typescript/src/games/fruit-merger/FruitMergerStore.d.ts +43 -0
- package/lib/typescript/src/games/fruit-merger/FruitMergerStore.d.ts.map +1 -0
- package/lib/typescript/src/games/fruit-merger/components/FruitItem.d.ts +10 -0
- package/lib/typescript/src/games/fruit-merger/components/FruitItem.d.ts.map +1 -0
- package/lib/typescript/src/games/fruit-merger/components/GameArea.d.ts +8 -0
- package/lib/typescript/src/games/fruit-merger/components/GameArea.d.ts.map +1 -0
- package/lib/typescript/src/games/fruit-merger/components/GameBackground.d.ts +7 -0
- package/lib/typescript/src/games/fruit-merger/components/GameBackground.d.ts.map +1 -0
- package/lib/typescript/src/games/fruit-merger/components/ScoreBoard.d.ts +3 -0
- package/lib/typescript/src/games/fruit-merger/components/ScoreBoard.d.ts.map +1 -0
- package/lib/typescript/src/games/fruit-merger/components/index.d.ts +5 -0
- package/lib/typescript/src/games/fruit-merger/components/index.d.ts.map +1 -0
- package/lib/typescript/src/games/fruit-ninja/FruitNinja.d.ts.map +1 -1
- package/lib/typescript/src/games/game-2048/Game2048.d.ts +4 -0
- package/lib/typescript/src/games/game-2048/Game2048.d.ts.map +1 -0
- package/lib/typescript/src/games/game-2048/Game2048Constants.d.ts +163 -0
- package/lib/typescript/src/games/game-2048/Game2048Constants.d.ts.map +1 -0
- package/lib/typescript/src/games/game-2048/Game2048Service.d.ts +113 -0
- package/lib/typescript/src/games/game-2048/Game2048Service.d.ts.map +1 -0
- package/lib/typescript/src/games/game-2048/Game2048Store.d.ts +48 -0
- package/lib/typescript/src/games/game-2048/Game2048Store.d.ts.map +1 -0
- package/lib/typescript/src/games/game-2048/components/GameBackground.d.ts +7 -0
- package/lib/typescript/src/games/game-2048/components/GameBackground.d.ts.map +1 -0
- package/lib/typescript/src/games/game-2048/components/GameGrid.d.ts +7 -0
- package/lib/typescript/src/games/game-2048/components/GameGrid.d.ts.map +1 -0
- package/lib/typescript/src/games/game-2048/components/GameTile.d.ts +13 -0
- package/lib/typescript/src/games/game-2048/components/GameTile.d.ts.map +1 -0
- package/lib/typescript/src/games/game-2048/components/ScoreBoard.d.ts +3 -0
- package/lib/typescript/src/games/game-2048/components/ScoreBoard.d.ts.map +1 -0
- package/lib/typescript/src/games/game-2048/components/index.d.ts +5 -0
- package/lib/typescript/src/games/game-2048/components/index.d.ts.map +1 -0
- package/lib/typescript/src/games/maze-runner/MazeRunner.d.ts.map +1 -1
- package/lib/typescript/src/games/popit-fidget/PopitFidget.d.ts.map +1 -1
- package/lib/typescript/src/games/sliding-numbers/SlidingNumbers.d.ts +4 -0
- package/lib/typescript/src/games/sliding-numbers/SlidingNumbers.d.ts.map +1 -0
- package/lib/typescript/src/games/sliding-numbers/SlidingNumbersConstants.d.ts +108 -0
- package/lib/typescript/src/games/sliding-numbers/SlidingNumbersConstants.d.ts.map +1 -0
- package/lib/typescript/src/games/sliding-numbers/SlidingNumbersService.d.ts +34 -0
- package/lib/typescript/src/games/sliding-numbers/SlidingNumbersService.d.ts.map +1 -0
- package/lib/typescript/src/games/sliding-numbers/SlidingNumbersStore.d.ts +56 -0
- package/lib/typescript/src/games/sliding-numbers/SlidingNumbersStore.d.ts.map +1 -0
- package/lib/typescript/src/games/sliding-numbers/components/GameBackground.d.ts +7 -0
- package/lib/typescript/src/games/sliding-numbers/components/GameBackground.d.ts.map +1 -0
- package/lib/typescript/src/games/sliding-numbers/components/NumbersGrid.d.ts +7 -0
- package/lib/typescript/src/games/sliding-numbers/components/NumbersGrid.d.ts.map +1 -0
- package/lib/typescript/src/games/sliding-numbers/components/NumbersTile.d.ts +11 -0
- package/lib/typescript/src/games/sliding-numbers/components/NumbersTile.d.ts.map +1 -0
- package/lib/typescript/src/games/sliding-numbers/components/ScoreBoard.d.ts +3 -0
- package/lib/typescript/src/games/sliding-numbers/components/ScoreBoard.d.ts.map +1 -0
- package/lib/typescript/src/games/sliding-numbers/components/index.d.ts +5 -0
- package/lib/typescript/src/games/sliding-numbers/components/index.d.ts.map +1 -0
- package/lib/typescript/src/games/snake/Snake.d.ts +4 -0
- package/lib/typescript/src/games/snake/Snake.d.ts.map +1 -0
- package/lib/typescript/src/games/snake/SnakeConstants.d.ts +93 -0
- package/lib/typescript/src/games/snake/SnakeConstants.d.ts.map +1 -0
- package/lib/typescript/src/games/snake/SnakeService.d.ts +30 -0
- package/lib/typescript/src/games/snake/SnakeService.d.ts.map +1 -0
- package/lib/typescript/src/games/snake/SnakeStore.d.ts +43 -0
- package/lib/typescript/src/games/snake/SnakeStore.d.ts.map +1 -0
- package/lib/typescript/src/games/snake/components/GameBackground.d.ts +5 -0
- package/lib/typescript/src/games/snake/components/GameBackground.d.ts.map +1 -0
- package/lib/typescript/src/games/snake/components/GameGrid.d.ts +3 -0
- package/lib/typescript/src/games/snake/components/GameGrid.d.ts.map +1 -0
- package/lib/typescript/src/games/snake/components/ScoreBoard.d.ts +3 -0
- package/lib/typescript/src/games/snake/components/ScoreBoard.d.ts.map +1 -0
- package/lib/typescript/src/games/snake/components/index.d.ts +4 -0
- package/lib/typescript/src/games/snake/components/index.d.ts.map +1 -0
- package/lib/typescript/src/games/snake/index.d.ts +4 -0
- package/lib/typescript/src/games/snake/index.d.ts.map +1 -0
- package/lib/typescript/src/games/space-fighter/SpaceFighter.d.ts.map +1 -1
- package/lib/typescript/src/games/whack-a-mole/WhackAMole.d.ts.map +1 -1
- package/lib/typescript/src/games/whack-a-mole/components/GameBackground.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +8 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/services/GamesConstants.d.ts +156 -0
- package/lib/typescript/src/services/GamesConstants.d.ts.map +1 -1
- package/lib/typescript/src/services/GamesService.d.ts +10 -2
- package/lib/typescript/src/services/GamesService.d.ts.map +1 -1
- package/lib/typescript/src/services/SoundsService.d.ts +103 -0
- package/lib/typescript/src/services/SoundsService.d.ts.map +1 -1
- package/lib/typescript/src/shared/helpers/GameOverModal.d.ts +2 -0
- package/lib/typescript/src/shared/helpers/GameOverModal.d.ts.map +1 -1
- package/lib/typescript/src/shared/helpers/ParticleBlast.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { create } from 'zustand';
|
|
4
|
+
import { subscribeWithSelector } from 'zustand/middleware';
|
|
5
|
+
import { immerMiddleware } from "../../services/GamesService.js";
|
|
6
|
+
import { PIECE_COLORS } from "./ColorSortConstants.js";
|
|
7
|
+
import { playSound, GAME_SOUNDS } from "../../services/SoundsService.js";
|
|
8
|
+
import { playHaptic, HapticType } from "../../services/HapticsService.js";
|
|
9
|
+
// Helper function to shuffle array
|
|
10
|
+
const shuffleArray = array => {
|
|
11
|
+
const shuffled = [...array];
|
|
12
|
+
for (let i = shuffled.length - 1; i > 0; i--) {
|
|
13
|
+
const j = Math.floor(Math.random() * (i + 1));
|
|
14
|
+
const temp = shuffled[i];
|
|
15
|
+
shuffled[i] = shuffled[j];
|
|
16
|
+
shuffled[j] = temp;
|
|
17
|
+
}
|
|
18
|
+
return shuffled;
|
|
19
|
+
};
|
|
20
|
+
export const useColorSortStore = create()(subscribeWithSelector(immerMiddleware((set, get) => ({
|
|
21
|
+
isPlaying: false,
|
|
22
|
+
isGameOver: false,
|
|
23
|
+
isPaused: false,
|
|
24
|
+
containers: [],
|
|
25
|
+
selectedContainerId: null,
|
|
26
|
+
time: 0,
|
|
27
|
+
timerInterval: null,
|
|
28
|
+
initializeGame: difficulty => {
|
|
29
|
+
let numColors;
|
|
30
|
+
let piecesPerColor;
|
|
31
|
+
let numContainers;
|
|
32
|
+
let maxCapacity;
|
|
33
|
+
switch (difficulty) {
|
|
34
|
+
case 'easy':
|
|
35
|
+
numColors = 3;
|
|
36
|
+
piecesPerColor = 3;
|
|
37
|
+
maxCapacity = 4;
|
|
38
|
+
numContainers = 4;
|
|
39
|
+
break;
|
|
40
|
+
case 'medium':
|
|
41
|
+
numColors = 4;
|
|
42
|
+
piecesPerColor = 3;
|
|
43
|
+
maxCapacity = 4;
|
|
44
|
+
numContainers = 5;
|
|
45
|
+
break;
|
|
46
|
+
case 'hard':
|
|
47
|
+
numColors = 5;
|
|
48
|
+
piecesPerColor = 4;
|
|
49
|
+
maxCapacity = 5;
|
|
50
|
+
numContainers = 6;
|
|
51
|
+
break;
|
|
52
|
+
default:
|
|
53
|
+
numColors = 4;
|
|
54
|
+
piecesPerColor = 3;
|
|
55
|
+
maxCapacity = 4;
|
|
56
|
+
numContainers = 5;
|
|
57
|
+
}
|
|
58
|
+
const selectedColors = PIECE_COLORS.slice(0, numColors);
|
|
59
|
+
let allPieces = [];
|
|
60
|
+
selectedColors.forEach((color, colorIndex) => {
|
|
61
|
+
for (let i = 0; i < piecesPerColor; i++) {
|
|
62
|
+
allPieces.push({
|
|
63
|
+
id: `piece-${colorIndex}-${i}`,
|
|
64
|
+
color
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
allPieces = shuffleArray(allPieces);
|
|
69
|
+
const containers = [];
|
|
70
|
+
for (let i = 0; i < numContainers; i++) {
|
|
71
|
+
const container = {
|
|
72
|
+
id: `container-${i}`,
|
|
73
|
+
pieces: i < numColors ? allPieces.splice(0, piecesPerColor) : [],
|
|
74
|
+
maxCapacity,
|
|
75
|
+
x: 0,
|
|
76
|
+
y: 0
|
|
77
|
+
};
|
|
78
|
+
containers.push(container);
|
|
79
|
+
}
|
|
80
|
+
set(state => {
|
|
81
|
+
state.containers = containers;
|
|
82
|
+
state.selectedContainerId = null;
|
|
83
|
+
state.time = 0;
|
|
84
|
+
state.isGameOver = false;
|
|
85
|
+
});
|
|
86
|
+
},
|
|
87
|
+
startGame: () => {
|
|
88
|
+
const state = get();
|
|
89
|
+
if (state.timerInterval) {
|
|
90
|
+
clearInterval(state.timerInterval);
|
|
91
|
+
}
|
|
92
|
+
const interval = setInterval(() => {
|
|
93
|
+
get().incrementTime();
|
|
94
|
+
}, 1000);
|
|
95
|
+
set(draftState => {
|
|
96
|
+
draftState.isPlaying = true;
|
|
97
|
+
draftState.isGameOver = false;
|
|
98
|
+
draftState.isPaused = false;
|
|
99
|
+
draftState.time = 0;
|
|
100
|
+
draftState.timerInterval = interval;
|
|
101
|
+
});
|
|
102
|
+
},
|
|
103
|
+
stopGame: () => {
|
|
104
|
+
const state = get();
|
|
105
|
+
if (state.timerInterval) {
|
|
106
|
+
clearInterval(state.timerInterval);
|
|
107
|
+
}
|
|
108
|
+
set(draftState => {
|
|
109
|
+
draftState.isPlaying = false;
|
|
110
|
+
draftState.isGameOver = true;
|
|
111
|
+
draftState.timerInterval = null;
|
|
112
|
+
});
|
|
113
|
+
},
|
|
114
|
+
resetGame: () => {
|
|
115
|
+
const state = get();
|
|
116
|
+
if (state.timerInterval) {
|
|
117
|
+
clearInterval(state.timerInterval);
|
|
118
|
+
}
|
|
119
|
+
set(draftState => {
|
|
120
|
+
draftState.isPlaying = false;
|
|
121
|
+
draftState.isGameOver = false;
|
|
122
|
+
draftState.isPaused = false;
|
|
123
|
+
draftState.selectedContainerId = null;
|
|
124
|
+
draftState.time = 0;
|
|
125
|
+
draftState.timerInterval = null;
|
|
126
|
+
});
|
|
127
|
+
},
|
|
128
|
+
pauseGame: () => {
|
|
129
|
+
const state = get();
|
|
130
|
+
if (state.timerInterval) {
|
|
131
|
+
clearInterval(state.timerInterval);
|
|
132
|
+
}
|
|
133
|
+
set(draftState => {
|
|
134
|
+
draftState.isPaused = true;
|
|
135
|
+
draftState.timerInterval = null;
|
|
136
|
+
});
|
|
137
|
+
},
|
|
138
|
+
resumeGame: () => {
|
|
139
|
+
// Resume timer
|
|
140
|
+
const interval = setInterval(() => {
|
|
141
|
+
get().incrementTime();
|
|
142
|
+
}, 1000);
|
|
143
|
+
set(draftState => {
|
|
144
|
+
draftState.isPaused = false;
|
|
145
|
+
draftState.timerInterval = interval;
|
|
146
|
+
});
|
|
147
|
+
},
|
|
148
|
+
selectContainer: (containerId, settings) => {
|
|
149
|
+
const state = get();
|
|
150
|
+
const container = state.containers.find(c => c.id === containerId);
|
|
151
|
+
if (!container) return;
|
|
152
|
+
|
|
153
|
+
// If no container is selected yet
|
|
154
|
+
if (state.selectedContainerId === null) {
|
|
155
|
+
if (container.pieces.length === 0) {
|
|
156
|
+
playSound(GAME_SOUNDS.COLOR_SORT.MISS, settings.enableSounds);
|
|
157
|
+
playHaptic(HapticType.LIGHT, settings.enableHaptics);
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
// First selection - select this container
|
|
161
|
+
set(draftState => {
|
|
162
|
+
draftState.selectedContainerId = containerId;
|
|
163
|
+
});
|
|
164
|
+
playSound(GAME_SOUNDS.COLOR_SORT.MATCH, settings.enableSounds);
|
|
165
|
+
playHaptic(HapticType.LIGHT, settings.enableHaptics);
|
|
166
|
+
} else if (state.selectedContainerId === containerId) {
|
|
167
|
+
set(draftState => {
|
|
168
|
+
draftState.selectedContainerId = null;
|
|
169
|
+
});
|
|
170
|
+
playSound(GAME_SOUNDS.COLOR_SORT.MISS, settings.enableSounds);
|
|
171
|
+
playHaptic(HapticType.LIGHT, settings.enableHaptics);
|
|
172
|
+
} else {
|
|
173
|
+
// Second selection - try to move piece (can be empty container)
|
|
174
|
+
get().movePiece(state.selectedContainerId, containerId, settings);
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
canMovePiece: (fromContainerId, toContainerId) => {
|
|
178
|
+
const state = get();
|
|
179
|
+
const fromContainer = state.containers.find(c => c.id === fromContainerId);
|
|
180
|
+
const toContainer = state.containers.find(c => c.id === toContainerId);
|
|
181
|
+
if (!fromContainer || !toContainer) return false;
|
|
182
|
+
if (fromContainer.pieces.length === 0) return false;
|
|
183
|
+
if (toContainer.pieces.length >= toContainer.maxCapacity) return false;
|
|
184
|
+
|
|
185
|
+
// Can move to any container that has space (no color restriction)
|
|
186
|
+
return true;
|
|
187
|
+
},
|
|
188
|
+
movePiece: (fromContainerId, toContainerId, settings) => {
|
|
189
|
+
const canMove = get().canMovePiece(fromContainerId, toContainerId);
|
|
190
|
+
if (!canMove) {
|
|
191
|
+
// Invalid move
|
|
192
|
+
set(state => {
|
|
193
|
+
state.selectedContainerId = null;
|
|
194
|
+
});
|
|
195
|
+
playSound(GAME_SOUNDS.COLOR_SORT.MISS, settings.enableSounds);
|
|
196
|
+
playHaptic(HapticType.LIGHT, settings.enableHaptics);
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
// Valid move - move the piece
|
|
201
|
+
set(state => {
|
|
202
|
+
const fromContainer = state.containers.find(c => c.id === fromContainerId);
|
|
203
|
+
const toContainer = state.containers.find(c => c.id === toContainerId);
|
|
204
|
+
if (fromContainer && toContainer && fromContainer.pieces.length > 0) {
|
|
205
|
+
const piece = fromContainer.pieces.pop();
|
|
206
|
+
if (piece) {
|
|
207
|
+
toContainer.pieces.push(piece);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
state.selectedContainerId = null;
|
|
211
|
+
});
|
|
212
|
+
playSound(GAME_SOUNDS.COLOR_SORT.MATCH, settings.enableSounds);
|
|
213
|
+
playHaptic(HapticType.MEDIUM, settings.enableHaptics);
|
|
214
|
+
|
|
215
|
+
// Check win condition
|
|
216
|
+
if (get().checkWinCondition()) {
|
|
217
|
+
playSound(GAME_SOUNDS.COLOR_SORT.COMPLETE, settings.enableSounds);
|
|
218
|
+
playHaptic(HapticType.SUCCESS, settings.enableHaptics);
|
|
219
|
+
get().stopGame();
|
|
220
|
+
}
|
|
221
|
+
},
|
|
222
|
+
checkWinCondition: () => {
|
|
223
|
+
const state = get();
|
|
224
|
+
|
|
225
|
+
// Win if all non-empty containers have all pieces of the same color
|
|
226
|
+
let sortedContainers = 0;
|
|
227
|
+
const colorCounts = new Map();
|
|
228
|
+
for (const container of state.containers) {
|
|
229
|
+
if (container.pieces.length === 0) continue; // Empty containers are OK
|
|
230
|
+
|
|
231
|
+
// Check if all pieces in this container are the same color
|
|
232
|
+
const firstColor = container.pieces[0]?.color;
|
|
233
|
+
const allSameColor = container.pieces.every(piece => piece.color === firstColor);
|
|
234
|
+
if (!allSameColor) return false; // Mixed colors = not solved
|
|
235
|
+
|
|
236
|
+
// This container is sorted (all same color)
|
|
237
|
+
sortedContainers++;
|
|
238
|
+
colorCounts.set(firstColor, (colorCounts.get(firstColor) || 0) + 1);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
// Win if each color appears in exactly one container (all colors sorted)
|
|
242
|
+
return sortedContainers > 0 && colorCounts.size === sortedContainers;
|
|
243
|
+
},
|
|
244
|
+
incrementTime: () => {
|
|
245
|
+
set(state => {
|
|
246
|
+
state.time += 1;
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
}))));
|
|
250
|
+
|
|
251
|
+
// Selectors
|
|
252
|
+
export const useIsPlaying = () => useColorSortStore(state => state.isPlaying);
|
|
253
|
+
export const useIsGameOver = () => useColorSortStore(state => state.isGameOver);
|
|
254
|
+
export const useIsPaused = () => useColorSortStore(state => state.isPaused);
|
|
255
|
+
export const useTime = () => useColorSortStore(state => state.time);
|
|
256
|
+
export const useContainers = () => useColorSortStore(state => state.containers);
|
|
257
|
+
export const useSelectedContainerId = () => useColorSortStore(state => state.selectedContainerId);
|
|
258
|
+
//# sourceMappingURL=ColorSortStore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["create","subscribeWithSelector","immerMiddleware","PIECE_COLORS","playSound","GAME_SOUNDS","playHaptic","HapticType","shuffleArray","array","shuffled","i","length","j","Math","floor","random","temp","useColorSortStore","set","get","isPlaying","isGameOver","isPaused","containers","selectedContainerId","time","timerInterval","initializeGame","difficulty","numColors","piecesPerColor","numContainers","maxCapacity","selectedColors","slice","allPieces","forEach","color","colorIndex","push","id","container","pieces","splice","x","y","state","startGame","clearInterval","interval","setInterval","incrementTime","draftState","stopGame","resetGame","pauseGame","resumeGame","selectContainer","containerId","settings","find","c","COLOR_SORT","MISS","enableSounds","LIGHT","enableHaptics","MATCH","movePiece","canMovePiece","fromContainerId","toContainerId","fromContainer","toContainer","canMove","piece","pop","MEDIUM","checkWinCondition","COMPLETE","SUCCESS","sortedContainers","colorCounts","Map","firstColor","allSameColor","every","size","useIsPlaying","useIsGameOver","useIsPaused","useTime","useContainers","useSelectedContainerId"],"sourceRoot":"../../../../src","sources":["games/color-sort/ColorSortStore.ts"],"mappings":";;AAAA,SAASA,MAAM,QAAQ,SAAS;AAChC,SAASC,qBAAqB,QAAQ,oBAAoB;AAC1D,SAASC,eAAe,QAA2B,gCAA6B;AAChF,SAASC,YAAY,QAAQ,yBAAsB;AACnD,SAASC,SAAS,EAAEC,WAAW,QAAQ,iCAA8B;AACrE,SAASC,UAAU,EAAEC,UAAU,QAAQ,kCAA+B;AAqCtE;AACA,MAAMC,YAAY,GA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CAACkE,UAAU,EAAE,CAACF,WAAW,CAAC/D,GAAG,CAACiE,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACrE;;IAEA;IACA,OAAOH,gBAAgB,GAAG,CAAC,IAAIC,WAAW,CAACK,IAAI,KAAKN,gBAAgB;EACtE,CAAC;EAED9B,aAAa,EAAEA,CAAA,KAAM;IACnBjC,GAAG,CAAE4B,KAAqB,IAAK;MAC7BA,KAAK,CAACrB,IAAI,IAAI,CAAC;IACjB,CAAC,CAAC;EACJ;AACF,CAAC,CAAC,CACJ,CACF,CAAC;;AAED;AACA,OAAO,MAAM+D,YAAY,GAAGA,CAAA,KAAMvE,iBAAiB,CAAE6B,KAAK,IAAKA,KAAK,CAAC1B,SAAS,CAAC;AAC/E,OAAO,MAAMqE,aAAa,GAAGA,CAAA,KAAMxE,iBAAiB,CAAE6B,KAAK,IAAKA,KAAK,CAACzB,UAAU,CAAC;AACjF,OAAO,MAAMqE,WAAW,GAAGA,CAAA,KAAMzE,iBAAiB,CAAE6B,KAAK,IAAKA,KAAK,CAACxB,QAAQ,CAAC;AAC7E,OAAO,MAAMqE,OAAO,GAAGA,CAAA,KAAM1E,iBAAiB,CAAE6B,KAAK,IAAKA,KAAK,CAACrB,IAAI,CAAC;AACrE,OAAO,MAAMmE,aAAa,GAAGA,CAAA,KAAM3E,iBAAiB,CAAE6B,KAAK,IAAKA,KAAK,CAACvB,UAAU,CAAC;AACjF,OAAO,MAAMsE,sBAAsB,GAAGA,CAAA,KAAM5E,iBAAiB,CAAE6B,KAAK,IAAKA,KAAK,CAACtB,mBAAmB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React, { useMemo } from 'react';
|
|
4
|
+
import { TouchableOpacity, View, StyleSheet } from 'react-native';
|
|
5
|
+
import Animated, { useAnimatedStyle, withTiming } from 'react-native-reanimated';
|
|
6
|
+
import { COLOR_SORT_COLORS, COLOR_SORT_GAME_CONFIG } from "../ColorSortConstants.js";
|
|
7
|
+
import { getPieceHeight } from "../ColorSortService.js";
|
|
8
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
|
+
const AnimatedPiece = /*#__PURE__*/React.memo(({
|
|
10
|
+
piece,
|
|
11
|
+
isTopPiece,
|
|
12
|
+
isSelected,
|
|
13
|
+
marginTop,
|
|
14
|
+
size,
|
|
15
|
+
height
|
|
16
|
+
}) => {
|
|
17
|
+
const pieceAnimatedStyle = useAnimatedStyle(() => ({
|
|
18
|
+
transform: [{
|
|
19
|
+
translateY: withTiming(isSelected && isTopPiece ? -15 : 0, {
|
|
20
|
+
duration: 200
|
|
21
|
+
})
|
|
22
|
+
}]
|
|
23
|
+
}), [isSelected, isTopPiece]);
|
|
24
|
+
return /*#__PURE__*/_jsx(Animated.View, {
|
|
25
|
+
style: [{
|
|
26
|
+
marginTop
|
|
27
|
+
}, isTopPiece && pieceAnimatedStyle],
|
|
28
|
+
children: /*#__PURE__*/_jsxs(View, {
|
|
29
|
+
style: [styles.piece, {
|
|
30
|
+
backgroundColor: piece.color,
|
|
31
|
+
width: size,
|
|
32
|
+
height
|
|
33
|
+
}],
|
|
34
|
+
children: [/*#__PURE__*/_jsx(View, {
|
|
35
|
+
style: styles.pieceShine
|
|
36
|
+
}), /*#__PURE__*/_jsx(View, {
|
|
37
|
+
style: styles.pieceDepth
|
|
38
|
+
})]
|
|
39
|
+
})
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
AnimatedPiece.displayName = 'AnimatedPiece';
|
|
43
|
+
export const ColorContainer = /*#__PURE__*/React.memo(({
|
|
44
|
+
container,
|
|
45
|
+
isSelected,
|
|
46
|
+
onPress,
|
|
47
|
+
difficulty
|
|
48
|
+
}) => {
|
|
49
|
+
const {
|
|
50
|
+
PIECE_SIZE,
|
|
51
|
+
PIECE_SPACING
|
|
52
|
+
} = COLOR_SORT_GAME_CONFIG;
|
|
53
|
+
const pieceHeight = useMemo(() => getPieceHeight(difficulty, PIECE_SIZE), [difficulty, PIECE_SIZE]);
|
|
54
|
+
|
|
55
|
+
// Memoize container style to prevent recreation
|
|
56
|
+
const containerStyle = useMemo(() => [styles.container, {
|
|
57
|
+
borderWidth: isSelected ? 3 : 2,
|
|
58
|
+
borderColor: isSelected ? COLOR_SORT_COLORS.BUTTON_PRIMARY : COLOR_SORT_COLORS.BASE_DARK
|
|
59
|
+
}], [isSelected]);
|
|
60
|
+
return /*#__PURE__*/_jsx(TouchableOpacity, {
|
|
61
|
+
onPress: onPress,
|
|
62
|
+
activeOpacity: 0.7,
|
|
63
|
+
children: /*#__PURE__*/_jsx(View, {
|
|
64
|
+
style: containerStyle,
|
|
65
|
+
children: /*#__PURE__*/_jsx(View, {
|
|
66
|
+
style: styles.pieceStack,
|
|
67
|
+
children: [...container.pieces].reverse().map((piece, index) => /*#__PURE__*/_jsx(AnimatedPiece, {
|
|
68
|
+
piece: piece,
|
|
69
|
+
isTopPiece: index === 0,
|
|
70
|
+
isSelected: isSelected,
|
|
71
|
+
marginTop: index === 0 ? 0 : PIECE_SPACING,
|
|
72
|
+
size: 70,
|
|
73
|
+
height: pieceHeight
|
|
74
|
+
}, piece.id))
|
|
75
|
+
})
|
|
76
|
+
})
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
ColorContainer.displayName = 'ColorContainer';
|
|
80
|
+
const styles = StyleSheet.create({
|
|
81
|
+
container: {
|
|
82
|
+
alignItems: 'center',
|
|
83
|
+
justifyContent: 'flex-end',
|
|
84
|
+
width: 80,
|
|
85
|
+
height: 225,
|
|
86
|
+
borderRadius: 15,
|
|
87
|
+
backgroundColor: 'rgba(192, 192, 192, 0.6)',
|
|
88
|
+
paddingHorizontal: 5,
|
|
89
|
+
paddingTop: 10,
|
|
90
|
+
paddingBottom: 5,
|
|
91
|
+
shadowColor: '#000',
|
|
92
|
+
shadowOffset: {
|
|
93
|
+
width: 0,
|
|
94
|
+
height: 4
|
|
95
|
+
},
|
|
96
|
+
shadowOpacity: 0.3,
|
|
97
|
+
shadowRadius: 5,
|
|
98
|
+
elevation: 5
|
|
99
|
+
},
|
|
100
|
+
pieceStack: {
|
|
101
|
+
alignItems: 'center',
|
|
102
|
+
justifyContent: 'flex-end',
|
|
103
|
+
flex: 1
|
|
104
|
+
},
|
|
105
|
+
piece: {
|
|
106
|
+
borderRadius: 10,
|
|
107
|
+
borderLeftWidth: 2,
|
|
108
|
+
borderRightWidth: 2,
|
|
109
|
+
borderBottomWidth: 2,
|
|
110
|
+
borderTopWidth: 0,
|
|
111
|
+
borderColor: 'rgba(0, 0, 0, 0.3)',
|
|
112
|
+
overflow: 'hidden',
|
|
113
|
+
shadowColor: '#000',
|
|
114
|
+
shadowOffset: {
|
|
115
|
+
width: 0,
|
|
116
|
+
height: 3
|
|
117
|
+
},
|
|
118
|
+
shadowOpacity: 0.4,
|
|
119
|
+
shadowRadius: 4,
|
|
120
|
+
elevation: 5
|
|
121
|
+
},
|
|
122
|
+
pieceShine: {
|
|
123
|
+
position: 'absolute',
|
|
124
|
+
top: 2,
|
|
125
|
+
left: 2,
|
|
126
|
+
right: '50%',
|
|
127
|
+
height: '30%',
|
|
128
|
+
backgroundColor: 'rgba(255, 255, 255, 0.3)',
|
|
129
|
+
borderRadius: 6
|
|
130
|
+
},
|
|
131
|
+
pieceDepth: {
|
|
132
|
+
position: 'absolute',
|
|
133
|
+
bottom: 0,
|
|
134
|
+
left: 0,
|
|
135
|
+
right: 0,
|
|
136
|
+
height: 4,
|
|
137
|
+
backgroundColor: 'rgba(0, 0, 0, 0.2)'
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
//# sourceMappingURL=ColorContainer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","useMemo","TouchableOpacity","View","StyleSheet","Animated","useAnimatedStyle","withTiming","COLOR_SORT_COLORS","COLOR_SORT_GAME_CONFIG","getPieceHeight","jsx","_jsx","jsxs","_jsxs","AnimatedPiece","memo","piece","isTopPiece","isSelected","marginTop","size","height","pieceAnimatedStyle","transform","translateY","duration","style","children","styles","backgroundColor","color","width","pieceShine","pieceDepth","displayName","ColorContainer","container","onPress","difficulty","PIECE_SIZE","PIECE_SPACING","pieceHeight","containerStyle","borderWidth","borderColor","BUTTON_PRIMARY","BASE_DARK","activeOpacity","pieceStack","pieces","reverse","map","index","id","create","alignItems","justifyContent","borderRadius","paddingHorizontal","paddingTop","paddingBottom","shadowColor","shadowOffset","shadowOpacity","shadowRadius","elevation","flex","borderLeftWidth","borderRightWidth","borderBottomWidth","borderTopWidth","overflow","position","top","left","right","bottom"],"sourceRoot":"../../../../../src","sources":["games/color-sort/components/ColorContainer.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,OAAO,QAAQ,OAAO;AACtC,SAASC,gBAAgB,EAAEC,IAAI,EAAEC,UAAU,QAAQ,cAAc;AACjE,OAAOC,QAAQ,IAAIC,gBAAgB,EAAEC,UAAU,QAAQ,yBAAyB;AAEhF,SAASC,iBAAiB,EAAEC,sBAAsB,QAAQ,0BAAuB;AACjF,SAASC,cAAc,QAAQ,wBAAqB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AASrD,MAAMC,aAOJ,gBAAGf,KAAK,CAACgB,IAAI,CAAC,CAAC;EAAEC,KAAK;EAAEC,UAAU;EAAEC,UAAU;EAAEC,SAAS;EAAEC,IAAI;EAAEC;AAAO,CAAC,KAAK;EAC9E,MAAMC,kBAAkB,GAAGjB,gBAAgB,CAAC,OAAO;IACjDkB,SAAS,EAAE,CAAC;MACVC,UAAU,EAAElB,UAAU,CACpBY,UAAU,IAAID,UAAU,GAAG,CAAC,EAAE,GAAG,CAAC,EAClC;QAAEQ,QAAQ,EAAE;MAAI,CAClB;IACF,CAAC;EACH,CAAC,CAAC,EAAE,CAACP,UAAU,EAAED,UAAU,CAAC,CAAC;EAE7B,oBACEN,IAAA,CAACP,QAAQ,CAACF,IAAI;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;IACLyC,YAAY,EAAE,EAAE;IAChBU,eAAe,EAAE,CAAC;IAClBC,gBAAgB,EAAE,CAAC;IACnBC,iBAAiB,EAAE,CAAC;IACpBC,cAAc,EAAE,CAAC;IACjB1B,WAAW,EAAE,oBAAoB;IACjC2B,QAAQ,EAAE,QAAQ;IAClBV,WAAW,EAAE,MAAM;IACnBC,YAAY,EAAE;MAAE/B,KAAK,EAAE,CAAC;MAAEV,MAAM,EAAE;IAAE,CAAC;IACrC0C,aAAa,EAAE,GAAG;IAClBC,YAAY,EAAE,CAAC;IACfC,SAAS,EAAE;EACb,CAAC;EACDjC,UAAU,EAAE;IACVwC,QAAQ,EAAE,UAAU;IACpBC,GAAG,EAAE,CAAC;IACNC,IAAI,EAAE,CAAC;IACPC,KAAK,EAAE,KAAK;IACZtD,MAAM,EAAE,KAAK;IACbQ,eAAe,EAAE,0BAA0B;IAC3C4B,YAAY,EAAE;EAChB,CAAC;EACDxB,UAAU,EAAE;IACVuC,QAAQ,EAAE,UAAU;IACpBI,MAAM,EAAE,CAAC;IACTF,IAAI,EAAE,CAAC;IACPC,KAAK,EAAE,CAAC;IACRtD,MAAM,EAAE,CAAC;IACTQ,eAAe,EAAE;EACnB;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React, { useMemo } from 'react';
|
|
4
|
+
import { View, Dimensions } from 'react-native';
|
|
5
|
+
import { Canvas, LinearGradient, Rect, vec, Circle, RoundedRect } from '@shopify/react-native-skia';
|
|
6
|
+
import { generateFloatingBlocks, getDecorativeBlocks, getDecorativeCircles, getGradientColors } from "../ColorSortService.js";
|
|
7
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
|
+
const {
|
|
9
|
+
width,
|
|
10
|
+
height
|
|
11
|
+
} = Dimensions.get('window');
|
|
12
|
+
export const GameBackground = /*#__PURE__*/React.memo(({
|
|
13
|
+
children
|
|
14
|
+
}) => {
|
|
15
|
+
const floatingBlocks = useMemo(() => generateFloatingBlocks(), []);
|
|
16
|
+
const decorativeBlocks = useMemo(() => getDecorativeBlocks(), []);
|
|
17
|
+
const decorativeCircles = useMemo(() => getDecorativeCircles(), []);
|
|
18
|
+
const gradients = useMemo(() => getGradientColors(), []);
|
|
19
|
+
const renderFloatingBlocks = useMemo(() => {
|
|
20
|
+
return floatingBlocks.map(block => {
|
|
21
|
+
if (block.type === 'square') {
|
|
22
|
+
return /*#__PURE__*/_jsx(RoundedRect, {
|
|
23
|
+
x: block.x,
|
|
24
|
+
y: block.y,
|
|
25
|
+
width: block.size,
|
|
26
|
+
height: block.size,
|
|
27
|
+
r: block.size * 0.2,
|
|
28
|
+
color: block.color
|
|
29
|
+
}, block.key);
|
|
30
|
+
} else if (block.type === 'rect') {
|
|
31
|
+
return /*#__PURE__*/_jsx(RoundedRect, {
|
|
32
|
+
x: block.x,
|
|
33
|
+
y: block.y,
|
|
34
|
+
width: block.size * 0.6,
|
|
35
|
+
height: block.size,
|
|
36
|
+
r: block.size * 0.15,
|
|
37
|
+
color: block.color
|
|
38
|
+
}, block.key);
|
|
39
|
+
} else if (block.type === 'wide') {
|
|
40
|
+
return /*#__PURE__*/_jsx(RoundedRect, {
|
|
41
|
+
x: block.x,
|
|
42
|
+
y: block.y,
|
|
43
|
+
width: block.size * 1.2,
|
|
44
|
+
height: block.size * 0.8,
|
|
45
|
+
r: block.size * 0.1,
|
|
46
|
+
color: block.color
|
|
47
|
+
}, block.key);
|
|
48
|
+
} else {
|
|
49
|
+
return /*#__PURE__*/_jsx(Circle, {
|
|
50
|
+
cx: block.x + block.size / 2,
|
|
51
|
+
cy: block.y + block.size / 2,
|
|
52
|
+
r: block.size / 2,
|
|
53
|
+
color: block.color
|
|
54
|
+
}, block.key);
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
}, [floatingBlocks]);
|
|
58
|
+
return /*#__PURE__*/_jsxs(View, {
|
|
59
|
+
style: {
|
|
60
|
+
flex: 1
|
|
61
|
+
},
|
|
62
|
+
children: [/*#__PURE__*/_jsxs(Canvas, {
|
|
63
|
+
style: {
|
|
64
|
+
position: 'absolute',
|
|
65
|
+
top: 0,
|
|
66
|
+
left: 0,
|
|
67
|
+
right: 0,
|
|
68
|
+
bottom: 0,
|
|
69
|
+
width,
|
|
70
|
+
height
|
|
71
|
+
},
|
|
72
|
+
children: [/*#__PURE__*/_jsx(Rect, {
|
|
73
|
+
x: 0,
|
|
74
|
+
y: 0,
|
|
75
|
+
width: width,
|
|
76
|
+
height: height,
|
|
77
|
+
children: /*#__PURE__*/_jsx(LinearGradient, {
|
|
78
|
+
start: vec(0, 0),
|
|
79
|
+
end: vec(width, height),
|
|
80
|
+
colors: gradients.main
|
|
81
|
+
})
|
|
82
|
+
}), /*#__PURE__*/_jsx(Rect, {
|
|
83
|
+
x: 0,
|
|
84
|
+
y: 0,
|
|
85
|
+
width: width,
|
|
86
|
+
height: height,
|
|
87
|
+
children: /*#__PURE__*/_jsx(LinearGradient, {
|
|
88
|
+
start: vec(0, 0),
|
|
89
|
+
end: vec(width / 2, height / 2),
|
|
90
|
+
colors: gradients.overlay
|
|
91
|
+
})
|
|
92
|
+
}), /*#__PURE__*/_jsx(Rect, {
|
|
93
|
+
x: 0,
|
|
94
|
+
y: 0,
|
|
95
|
+
width: width,
|
|
96
|
+
height: height,
|
|
97
|
+
children: /*#__PURE__*/_jsx(LinearGradient, {
|
|
98
|
+
start: vec(width, 0),
|
|
99
|
+
end: vec(0, height),
|
|
100
|
+
colors: gradients.diagonal
|
|
101
|
+
})
|
|
102
|
+
}), renderFloatingBlocks, decorativeBlocks.map(block => /*#__PURE__*/_jsx(RoundedRect, {
|
|
103
|
+
x: block.x,
|
|
104
|
+
y: block.y,
|
|
105
|
+
width: block.size,
|
|
106
|
+
height: block.size,
|
|
107
|
+
r: block.r,
|
|
108
|
+
color: block.color
|
|
109
|
+
}, block.key)), decorativeCircles.map(circle => /*#__PURE__*/_jsx(Circle, {
|
|
110
|
+
cx: circle.cx,
|
|
111
|
+
cy: circle.cy,
|
|
112
|
+
r: circle.r,
|
|
113
|
+
color: circle.color
|
|
114
|
+
}, circle.key)), Array.from({
|
|
115
|
+
length: Math.floor(width / 60)
|
|
116
|
+
}, (_, i) => /*#__PURE__*/_jsx(Rect, {
|
|
117
|
+
x: i * 60,
|
|
118
|
+
y: 0,
|
|
119
|
+
width: 1,
|
|
120
|
+
height: height,
|
|
121
|
+
color: "rgba(255, 255, 255, 0.05)"
|
|
122
|
+
}, `grid-v-${i}`)), Array.from({
|
|
123
|
+
length: Math.floor(height / 60)
|
|
124
|
+
}, (_, i) => /*#__PURE__*/_jsx(Rect, {
|
|
125
|
+
x: 0,
|
|
126
|
+
y: i * 60,
|
|
127
|
+
width: width,
|
|
128
|
+
height: 1,
|
|
129
|
+
color: "rgba(255, 255, 255, 0.05)"
|
|
130
|
+
}, `grid-h-${i}`))]
|
|
131
|
+
}), children]
|
|
132
|
+
});
|
|
133
|
+
});
|
|
134
|
+
GameBackground.displayName = 'GameBackground';
|
|
135
|
+
//# sourceMappingURL=GameBackground.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","useMemo","View","Dimensions","Canvas","LinearGradient","Rect","vec","Circle","RoundedRect","generateFloatingBlocks","getDecorativeBlocks","getDecorativeCircles","getGradientColors","jsx","_jsx","jsxs","_jsxs","width","height","get","GameBackground","memo","children","floatingBlocks","decorativeBlocks","decorativeCircles","gradients","renderFloatingBlocks","map","block","type","x","y","size","r","color","key","cx","cy","style","flex","position","top","left","right","bottom","start","end","colors","main","overlay","diagonal","circle","Array","from","length","Math","floor","_","i","displayName"],"sourceRoot":"../../../../../src","sources":["games/color-sort/components/GameBackground.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,OAAO,QAAQ,OAAO;AACtC,SAASC,IAAI,EAAEC,UAAU,QAAQ,cAAc;AAC/C,SACEC,MAAM,EACNC,cAAc,EACdC,IA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EAAG;QACV1C,KAAK,EAAEA,KAAM;QACbC,MAAM,EAAE,CAAE;QACViB,KAAK,EAAC;MAA2B,GAL5B,UAAUwB,CAAC,EAMjB,CACF,CAAC;IAAA,CAEI,CAAC,EAGRrC,QAAQ;EAAA,CACL,CAAC;AAEX,CAAC,CAAC;AAEFF,cAAc,CAACwC,WAAW,GAAG,gBAAgB","ignoreList":[]}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React, { useMemo } from 'react';
|
|
4
|
+
import { View, Text, StyleSheet } from 'react-native';
|
|
5
|
+
import { useTime } from "../ColorSortStore.js";
|
|
6
|
+
import { COLOR_SORT_COLORS } from "../ColorSortConstants.js";
|
|
7
|
+
import { formatTime } from "../ColorSortService.js";
|
|
8
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
|
+
export const ScoreBoard = /*#__PURE__*/React.memo(() => {
|
|
10
|
+
const time = useTime();
|
|
11
|
+
const formattedTime = useMemo(() => formatTime(time), [time]);
|
|
12
|
+
return /*#__PURE__*/_jsx(View, {
|
|
13
|
+
style: styles.scoreboardContainer,
|
|
14
|
+
children: /*#__PURE__*/_jsx(View, {
|
|
15
|
+
style: styles.scoreBoard,
|
|
16
|
+
children: /*#__PURE__*/_jsxs(View, {
|
|
17
|
+
style: styles.scoreItem,
|
|
18
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
19
|
+
style: styles.scoreLabel,
|
|
20
|
+
children: "TIME"
|
|
21
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
22
|
+
style: styles.scoreValue,
|
|
23
|
+
children: formattedTime
|
|
24
|
+
})]
|
|
25
|
+
})
|
|
26
|
+
})
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
const styles = StyleSheet.create({
|
|
30
|
+
scoreboardContainer: {
|
|
31
|
+
position: 'absolute',
|
|
32
|
+
top: 20,
|
|
33
|
+
left: 20,
|
|
34
|
+
right: 20,
|
|
35
|
+
zIndex: 10,
|
|
36
|
+
pointerEvents: 'none'
|
|
37
|
+
},
|
|
38
|
+
scoreBoard: {
|
|
39
|
+
backgroundColor: 'rgba(255, 107, 53, 0.4)',
|
|
40
|
+
borderRadius: 12,
|
|
41
|
+
padding: 15,
|
|
42
|
+
flexDirection: 'row',
|
|
43
|
+
justifyContent: 'space-around',
|
|
44
|
+
alignItems: 'center',
|
|
45
|
+
borderWidth: 2,
|
|
46
|
+
borderColor: COLOR_SORT_COLORS.BUTTON_PRIMARY
|
|
47
|
+
},
|
|
48
|
+
scoreItem: {
|
|
49
|
+
alignItems: 'center',
|
|
50
|
+
flex: 1
|
|
51
|
+
},
|
|
52
|
+
scoreLabel: {
|
|
53
|
+
fontSize: 12,
|
|
54
|
+
fontWeight: '700',
|
|
55
|
+
color: COLOR_SORT_COLORS.SCORE_TEXT,
|
|
56
|
+
marginBottom: 4,
|
|
57
|
+
letterSpacing: 1,
|
|
58
|
+
textShadowColor: 'rgba(0, 0, 0, 0.5)',
|
|
59
|
+
textShadowOffset: {
|
|
60
|
+
width: 1,
|
|
61
|
+
height: 1
|
|
62
|
+
},
|
|
63
|
+
textShadowRadius: 2
|
|
64
|
+
},
|
|
65
|
+
scoreValue: {
|
|
66
|
+
fontSize: 24,
|
|
67
|
+
fontWeight: '900',
|
|
68
|
+
color: COLOR_SORT_COLORS.SCORE_TEXT,
|
|
69
|
+
textShadowColor: 'rgba(0, 0, 0, 0.8)',
|
|
70
|
+
textShadowOffset: {
|
|
71
|
+
width: 1,
|
|
72
|
+
height: 1
|
|
73
|
+
},
|
|
74
|
+
textShadowRadius: 2
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
ScoreBoard.displayName = 'ScoreBoard';
|
|
78
|
+
//# sourceMappingURL=ScoreBoard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","useMemo","View","Text","StyleSheet","useTime","COLOR_SORT_COLORS","formatTime","jsx","_jsx","jsxs","_jsxs","ScoreBoard","memo","time","formattedTime","style","styles","scoreboardContainer","children","scoreBoard","scoreItem","scoreLabel","scoreValue","create","position","top","left","right","zIndex","pointerEvents","backgroundColor","borderRadius","padding","flexDirection","justifyContent","alignItems","borderWidth","borderColor","BUTTON_PRIMARY","flex","fontSize","fontWeight","color","SCORE_TEXT","marginBottom","letterSpacing","textShadowColor","textShadowOffset","width","height","textShadowRadius","displayName"],"sourceRoot":"../../../../../src","sources":["games/color-sort/components/ScoreBoard.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,OAAO,QAAQ,OAAO;AACtC,SAASC,IAAI,EAAEC,IAAI,EAAEC,UAAU,QAAQ,cAAc;AACrD,SAASC,OAAO,QAAQ,sBAAmB;AAC3C,SAASC,iBAAiB,QAAQ,0BAAuB;AACzD,SAASC,UAAU,QAAQ,wBAAqB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAEjD,OAAO,MAAMC,UAAoB,gBAAGZ,KAAK,CAACa,IAAI,CAAC,MAAM;EACnD,MAAMC,IAAI,GAAGT,OAAO,CAAC,CAAC;EACtB,MAAMU,aAAa,GAAGd,OAAO,CAAC,MAAMM,UAAU,CAACO,IAAI,CAAC,EAAE,CAACA,IAAI,CAAC,CAAC;EAE7D,oBACEL,IAAA,CAACP,IAAI;IAACc,KAAK,EAAEC,MAAM,CAACC,mBAAoB;IAAAC,QAAA,eACtCV,IAAA,CAACP,IAAI;MAACc,KAAK,EAAEC,MAAM,CAACG,UAAW;MAAAD,QAAA,eAC7BR,KAAA,CAACT,IAAI;QAACc,KAAK,EAAEC,MAAM,CAACI,SAAU;QAAAF,QAAA,gBAC5BV,IAAA,CAACN,IAAI;UAACa,KAAK,EAAEC,MAAM,CAACK,UAAW;UAAAH,QAAA,EAAC;QAAI,CAAM,CAAC,eAC3CV,IAAA,CAACN,IAAI;UAACa,KAAK,EAAEC,MAAM,CAACM,UAAW;UAAAJ,QAAA,EAAEJ;QA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[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../../../src","sources":["games/color-sort/components/index.ts"],"mappings":";;AAAA,cAAc,qBAAkB;AAChC,cAAc,iBAAc;AAC5B,cAAc,qBAAkB","ignoreList":[]}
|