dice-core 2026-03-02
Centralize physics constants, extract D4 overlay, and address code review P1/P2 findings
45 files · 3,429+ · 2,135-

Physics constant centralization

3 files changed
  • defaults.ts Centralized all physics constants (restitution, friction, mass, gravity) into the config layer
  • pre-simulate.ts Updated to reference centralized physics constants instead of inline values
  • spawn-configs.ts Refactored spawn logic to use centralized config
  • Centralized all physics constants into the config defaults module, eliminating scattered inline values across simulation and component code decouple architectural
    2 files
    • defaults.ts
    • pre-simulate.ts

Component architecture improvements

8 files changed
  • die-visuals.tsx Renamed from .ts to .tsx, extracted D4 overlay component, expanded with glow and material utilities
  • DiceScene.tsx Fixed promise leak, improved effect dependency management
  • DiceArena.tsx Refined state machine transitions and error handling
  • DiceRoller.tsx Improved prop forwarding and lifecycle management
  • Die.tsx Simplified die component with extracted visuals
  • PlaybackDie.tsx Simplified playback component
  • Chamber.tsx Refined chamber with centralized physics constants
  • ErrorBoundary.tsx Improved error boundary with better state management
  • Extracted D4 overlay into its own component within die-visuals.tsx and simplified Die/PlaybackDie by delegating visual concerns streamline architectural
    3 files
    • die-visuals.tsx
    • Die.tsx
    • PlaybackDie.tsx
  • Fixed a promise leak in DiceScene where pre-simulation results could be applied after abort harden behavioral
    1 file
    • DiceScene.tsx

Dice notation parser consolidation

3 files changed
  • notation-parser.test.ts Consolidated all notation parser tests into a single comprehensive suite (952+ lines)
  • modifiers.test.ts New modifier test suite (308 lines)
  • modifiers.ts New modifiers module for roll modifications
  • Consolidated scattered notation parser tests into a single comprehensive suite and added a dedicated modifiers module with full test coverage streamline behavioral
    2 files
    • notation-parser.test.ts
    • modifiers.ts

Seeded RNG improvements

1 file changed
  • seeded-rng.ts Improved RNG with better seed handling and edge case protection
  • Hardened the seeded RNG with improved seed handling and edge case protections harden behavioral
    1 file
    • seeded-rng.ts

CI and testing

6 files changed
  • ci.yml Added CI workflow for automated linting, testing, and building
  • DiceScene.test.tsx Expanded DiceScene tests (345+ lines)
  • DiceArena.test.tsx Expanded DiceArena tests
  • ErrorBoundary.test.tsx New ErrorBoundary test suite
  • rapier-init.test.ts New Rapier initialization tests
  • pre-simulate-worker.test.ts New pre-simulate worker tests
  • Added CI workflow and significantly expanded test coverage with new suites for DiceScene, ErrorBoundary, Rapier init, and pre-simulate worker qualify behavioral
    2 files
    • ci.yml
    • DiceScene.test.tsx

Type system refinement

3 files changed
  • config.ts Refined config types with better optional handling and documentation
  • dice.ts Added new dice type definitions
  • index.ts Updated public API surface
  • Refined TypeScript types for configuration and dice, improving optional field handling and removing dead state types specify internal
    3 files
    • config.ts
    • dice.ts
    • index.ts