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.tsPure Three.js die mesh creation independent of React (501 lines)chamber-meshes.tsPure Three.js chamber boundary mesh creation (368 lines)face-data.tsFace positioning and UV data for all dice types (249 lines)index.tsVisuals module exportsindex.htmlVanilla 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.tschamber-meshes.tsface-data.ts
E2E test suite
6 files changed
dice-roll.spec.tsE2E dice roll tests verifying end-to-end roll flowcanvas-render.spec.tsCanvas rendering verification testsinteraction.spec.tsUser interaction E2E testsphysics-parity.spec.tsPhysics parity tests between pre-sim and playbackTestHarness.tsxTest harness React component for E2E scenariosplaywright.config.tsPlaywright 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.tsphysics-parity.spec.tsplaywright.config.ts
Component refactoring
6 files changed
die-visuals.tsxSimplified to delegate heavy mesh work to the vanilla visuals layerPlaybackDie.tsxSimplified playback with improved state managementChamber.tsxRefactored with centralized physics constants and improved boundary calculationDiceArena.tsxImproved state machine transitions and error recoveryDiceScene.tsxFixed effect dependencies and pre-simulation trigger logicuseRapierInit.tsNew 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.tsdie-visuals.tsx
Physics and simulation fixes
3 files changed
pre-simulate.tsFixed boundary half-extent calculation and pre-sim effect dependenciesplayback.tsImproved playback state transitionsdefaults.tsRefined 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.tsdefaults.ts
Test coverage expansion
8 files changed
die-visuals.test.tsDie visuals component testsuseRapierInit.test.tsRapier init hook testsDiceLighting.test.tsxLighting component testsdie-meshes.test.tsVanilla die mesh tests (628 lines)chamber-meshes.test.tsVanilla chamber mesh tests (211 lines)vanilla-integration.test.tsVanilla integration tests (306 lines)quat-math.test.tsQuaternion math utility testspublic-api.test.tsPublic 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.tsvanilla-integration.test.ts
Legacy code removal
2 files changed
mesh-factory.tsRemoved legacy mesh factory replaced by vanilla visuals layernumbers-overlay.tsRemoved legacy numbers overlay replaced by face-data module