dice-core 2026-03-03
Extract vanilla visuals layer, add E2E test suite, and multi-round code review fixes
63 files · 4,952+ · 2,670-

Vanilla visuals extraction

5 files changed
  • die-meshes.ts Pure Three.js die mesh creation independent of React (501 lines)
  • chamber-meshes.ts Pure Three.js chamber boundary mesh creation (368 lines)
  • face-data.ts Face positioning and UV data for all dice types (249 lines)
  • index.ts Visuals module exports
  • index.html Vanilla HTML example using dice-core without React (229 lines)
  • Extracted a pure Three.js visuals layer (die-meshes, chamber-meshes, face-data) that can be used independently of React, enabling vanilla JavaScript integration decouple architectural
    3 files
    • die-meshes.ts
    • chamber-meshes.ts
    • face-data.ts

E2E test suite

6 files changed
  • dice-roll.spec.ts E2E dice roll tests verifying end-to-end roll flow
  • canvas-render.spec.ts Canvas rendering verification tests
  • interaction.spec.ts User interaction E2E tests
  • physics-parity.spec.ts Physics parity tests between pre-sim and playback
  • TestHarness.tsx Test harness React component for E2E scenarios
  • playwright.config.ts Playwright configuration
  • Added a complete Playwright E2E test suite covering dice rolls, canvas rendering, user interactions, and physics parity with a dedicated test harness qualify architectural
    3 files
    • dice-roll.spec.ts
    • physics-parity.spec.ts
    • playwright.config.ts

Component refactoring

6 files changed
  • die-visuals.tsx Simplified to delegate heavy mesh work to the vanilla visuals layer
  • PlaybackDie.tsx Simplified playback with improved state management
  • Chamber.tsx Refactored with centralized physics constants and improved boundary calculation
  • DiceArena.tsx Improved state machine transitions and error recovery
  • DiceScene.tsx Fixed effect dependencies and pre-simulation trigger logic
  • useRapierInit.ts New hook for Rapier initialization with retry and error handling
  • Extracted Rapier initialization into a dedicated useRapierInit hook and simplified components by delegating visual work to the vanilla layer streamline behavioral
    2 files
    • useRapierInit.ts
    • die-visuals.tsx

Physics and simulation fixes

3 files changed
  • pre-simulate.ts Fixed boundary half-extent calculation and pre-sim effect dependencies
  • playback.ts Improved playback state transitions
  • defaults.ts Refined physics defaults, removed dice-configs dependency
  • Fixed boundary half-extent calculations affecting arena containment, improved tap consistency for mobile interaction, and corrected pre-simulation effect dependencies harden behavioral
    2 files
    • pre-simulate.ts
    • defaults.ts

Test coverage expansion

8 files changed
  • die-visuals.test.ts Die visuals component tests
  • useRapierInit.test.ts Rapier init hook tests
  • DiceLighting.test.tsx Lighting component tests
  • die-meshes.test.ts Vanilla die mesh tests (628 lines)
  • chamber-meshes.test.ts Vanilla chamber mesh tests (211 lines)
  • vanilla-integration.test.ts Vanilla integration tests (306 lines)
  • quat-math.test.ts Quaternion math utility tests
  • public-api.test.ts Public API surface tests
  • Added extensive test coverage for the vanilla visuals layer, useRapierInit hook, die-visuals component, quaternion math, and public API surface qualify behavioral
    2 files
    • die-meshes.test.ts
    • vanilla-integration.test.ts

Legacy code removal

2 files changed
  • mesh-factory.ts Removed legacy mesh factory replaced by vanilla visuals layer
  • numbers-overlay.ts Removed legacy numbers overlay replaced by face-data module
  • Removed legacy mesh-factory and numbers-overlay modules that were superseded by the new vanilla visuals layer deprecate internal
    2 files
    • mesh-factory.ts
    • numbers-overlay.ts